diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 401abe947f..0038042a58 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2019 + Portions created by the Initial Developer are Copyright (C) 2008-2020 the Initial Developer. All Rights Reserved. Contributor(s): @@ -25,7 +25,7 @@ */ //includes - include "root.php"; + require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; @@ -61,6 +61,22 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + //delete the voicemail greeting + if (permission_exists('voicemail_greeting_delete')) { + if ($_POST['action'] == 'delete' && is_uuid($voicemail_greeting_uuid)) { + //prepare + $array[0]['checked'] = 'true'; + $array[0]['uuid'] = $voicemail_greeting_uuid; + //delete + $obj = new voicemail_greetings; + $obj->voicemail_id = $voicemail_id; + $obj->delete($array); + //redirect + header("Location: voicemail_greetings.php?id=".$voicemail_id); + exit; + } + } + //validate the token $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { @@ -130,18 +146,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; //show the content - echo "
\n"; + echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - echo " "; - echo " \n"; - echo "
\n"; - echo "".$text['label-edit']."\n"; - echo "

\n"; + echo "
\n"; + echo "
".$text['label-edit']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','collapse'=>'hide-xs','link'=>'voicemail_greetings.php?id='.urlencode($voicemail_id)]); + if (permission_exists('voicemail_greeting_delete')) { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','collapse'=>'hide-xs','style'=>'margin-right: 15px;','onclick'=>"if (confirm('".$text['confirm-delete']."')) { document.getElementById('frm').submit(); } else { this.blur(); return false; }"]); + } + echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']); + echo "
\n"; + echo "
\n"; + echo "
\n"; echo "\n"; @@ -166,21 +183,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "".$text['description-info']."\n"; echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " "; + echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
"; - echo " \n"; - echo "
"; - echo "

"; + echo "

"; + + echo "\n"; + echo "\n"; + echo "\n"; echo "
"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file