Added "action" for the "delete" button (montage.php)

This commit is contained in:
IgorA100
2024-05-21 12:07:35 +03:00
committed by GitHub
parent 761291cc13
commit cb4481353b

View File

@@ -21,9 +21,9 @@ require_once('includes/MontageLayout.php');
if ( isset($_REQUEST['object']) ) {
if ( $_REQUEST['object'] == 'MontageLayout' ) {
if ($action == 'Save') {
$Layout = null;
$Layout = null;
if ($action == 'Save') {
# Name is only populated when creating a new layout
if ( $_REQUEST['Name'] != '' ) {
$Layout = new ZM\MontageLayout();
@@ -44,7 +44,35 @@ if ( isset($_REQUEST['object']) ) {
ZM\Warning('Need System permissions to edit layouts');
return;
}
} // end if save
} else if ($action == 'Delete') { // end if save
if ( isset($_REQUEST['zmMontageLayout']) ) {
$Layout = new ZM\MontageLayout($_REQUEST['zmMontageLayout']);
} else {
ZM\Warning('Name of layout to be deleted is not specified');
return;
}
if (canEdit('System')) {
if ($Layout->Id()) {
$Layout->delete();
zm_session_start();
unset($_SESSION["zmMontageLayout"]);
$_SESSION['zmMontageLayout'] = '';
session_write_close();
unset($_COOKIE['zmMontageLayout']);
zm_setcookie('zmMontageLayout', '', array('expires'=>time()-3600*24)); //!!! After this JS still sees cookies, strange !!!
$redirect = '?view=montage';
} else {
ZM\Warning('Layout Id=' . $_REQUEST['zmMontageLayout'] . ' not found for delete');
$redirect = '?view=montage';
}
} else {
ZM\Warning('Need System permissions to delete layouts');
$redirect = '?view=montage';
}
} else {// end if delete
ZM\Warning("Unsupported action $action in montage");
} // end if else
} # end if isset($_REQUEST['object'] )
} # end if isset($_REQUEST['object'] )
?>