From 6be2a6dff5ad311aac426bfe79ab98a53be15db6 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Mar 2020 11:43:02 -0700 Subject: [PATCH] Recordings - Edit: Update buttons, action bar, etc. --- app/recordings/recording_edit.php | 83 +++++++++++++++++++------------ 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index dec3daef5f..e1011317d2 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -17,23 +17,27 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2020 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('recording_add') || permission_exists('recording_edit')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//includes + require_once "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('recording_add') || permission_exists('recording_edit')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; @@ -61,6 +65,21 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //get recording uuid to edit $recording_uuid = $_POST["recording_uuid"]; + //delete the recording + if (permission_exists('recording_delete')) { + if ($_POST['action'] == 'delete' && is_uuid($recording_uuid)) { + //prepare + $array[0]['checked'] = 'true'; + $array[0]['uuid'] = $recording_uuid; + //delete + $obj = new switch_recordings; + $obj->delete($array); + //redirect + header('Location: recordings.php'); + exit; + } + } + //validate the token $token = new token; if (!$token->validate($_SERVER['PHP_SELF'])) { @@ -145,19 +164,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 "
"; - echo " "; - echo " \n"; - echo "
\n"; - - echo "".$text['title-edit']."\n"; - echo "

\n"; + echo "
\n"; + echo "
".$text['title-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;','link'=>'recordings.php']); + if (permission_exists('recording_delete')) { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'action','value'=>'delete','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']); + echo "
\n"; + echo "
\n"; + echo "
\n"; echo "\n"; @@ -194,18 +213,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo $text['description-description']."\n"; echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " "; + echo "
\n"; - echo " \n"; - echo " \n"; - echo "
"; - echo " \n"; - echo "
"; - echo "

"; + echo "

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