delete collection by id

This commit is contained in:
Piotr Filip 2022-10-19 12:15:13 +02:00 committed by Andrew Ruthven
parent abbb6e5e70
commit f29af80116

View File

@ -63,11 +63,11 @@ function handle_subaction( $subaction ) {
switch( $subaction ) {
case 'delete_collection':
dbg_error_log('admin-principal-edit',':handle_action: Deleting collection %s for principal %d', $_GET['dav_name'], $id );
dbg_error_log('admin-principal-edit',':handle_action: Deleting collection %s for principal %d', $_GET['collection_id'], $id );
if ($can_write_principal) {
if ( $session->CheckConfirmationHash('GET', 'confirm') ) {
dbg_error_log('admin-principal-edit',':handle_action: Allowed to delete collection %s for principal %d', $_GET['dav_name'], $id );
$qry = new AwlQuery('DELETE FROM collection WHERE dav_name=?;', $_GET['dav_name'] );
dbg_error_log('admin-principal-edit',':handle_action: Allowed to delete collection %s for principal %d', $_GET['collection_id'], $id );
$qry = new AwlQuery('DELETE FROM collection WHERE collection_id=?;', $_GET['collection_id'] );
if ( $qry->Exec() ) {
$c->messages[] = i18n('Collection deleted.');
return true;
@ -869,7 +869,7 @@ function principal_collection_browser() {
$browser->AddColumn( 'privs', translate('Privileges'), '', '',
"COALESCE( privileges_list(default_privileges), '[".translate('from principal')."]')" );
if ($can_write_principal) {
$delurl = $c->base_url . '/admin.php?action=edit&t=principal&id='.$id.'&dav_name=##URL:dav_name##&subaction=delete_collection';
$delurl = $c->base_url . '/admin.php?action=edit&t=principal&id='.$id.'&collection_id=##URL:collection_id##&subaction=delete_collection';
$browser->AddColumn( 'delete', translate('Action'), 'center', '', "'<a class=\"submit\" href=\"$delurl\" title=\"\">".translate('Delete')."</a>'" );
}
@ -896,7 +896,7 @@ function principal_collection_browser() {
function confirm_delete_collection($confirmation_hash) {
$html = '<table><tr><td class="error">';
$html .= sprintf('<b>%s</b> "%s" <a class="error" href="%s&%s">%s</a> %s',
translate('Deleting Collection:'), $_GET['dav_name'], $_SERVER['REQUEST_URI'],
translate('Deleting Collection:'), $_GET['collection_id'], $_SERVER['REQUEST_URI'],
$confirmation_hash,
translate('Confirm Deletion of the Collection'),
translate('All collection data will be unrecoverably deleted.') );