Voicemail Greeting - Edit: Update buttons, action bar, etc.

This commit is contained in:
Nate 2020-03-06 12:35:58 -07:00
parent dc84840117
commit b1be78f457
1 changed files with 37 additions and 24 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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 "<form method='post' name='frm' id='frm'>\n";
echo "<form name='frm' id='frm' method='post'>\n";
echo "<table cellpadding='0' cellspacing='0' border='0' align='right'>\n";
echo "<tr>\n";
echo "<td nowrap='nowrap'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='voicemail_greetings.php?id=".urlencode($voicemail_id)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<b>".$text['label-edit']."</b>\n";
echo "<br><br>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['label-edit']."</b></div>\n";
echo " <div class='actions'>\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 " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@ -166,21 +183,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "".$text['description-info']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='voicemail_greeting_uuid' value='".$voicemail_greeting_uuid."'>\n";
echo " <input type='hidden' name='voicemail_id' value='".$voicemail_id."'>\n";
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "<br /><br />";
echo "<input type='hidden' name='voicemail_greeting_uuid' value='".escape($voicemail_greeting_uuid)."'>\n";
echo "<input type='hidden' name='voicemail_id' value='".escape($voicemail_id)."'>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>