From dbd8cee77ed9df7ec018424f3b478a92213a0904 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 21 Jul 2022 13:43:29 -0700 Subject: [PATCH] Closes #4827 - Page/Menu delete perm added. --- e107_admin/cpage.php | 41 +++++++++++++++++++++------------- e107_handlers/user_handler.php | 1 + 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 1969eb105..92e89b08b 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -146,7 +146,7 @@ class page_admin_form_ui extends e_admin_form_ui $text = " ".ADMIN_EDIT_ICON.""; - if($this->getController()->getMode() === 'overview') + if($this->getController()->getMode() === 'overview' && getperms('J1')) // Page/Menu Delete Perms. { $text .= $this->submit_image('menu_delete['.$id.']', $id, 'delete', LAN_DELETE.' [ ID: '.$id.' ]', array('class' => 'action delete btn btn-default')); } @@ -389,26 +389,35 @@ class page_chapters_form_ui extends e_admin_form_ui { //$id = $this->getController()->getListModel()->get('page_id'); // return "".$curVal.""; + + if($attributes['mode'] !== 'read') + { + return; + } + $parent = $this->getController()->getListModel()->get('chapter_parent'); // $id = $this->getController()->getListModel()->get('chapter_id'); - $att['readParms'] = 'sort=1'; + $att = []; + $att['readParms']['sort'] = 1; - - if($attributes['mode'] == 'read') + if(!getperms('J1')) // Page/Menu Delete Perms. { - $text = "
"; - $text .= $this->renderValue('options',$value,$att,$id); - - if($parent != 0) - { - $link = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list"; - $text .= "".ADMIN_PAGES_ICON.""; // - } - - - $text .= "
"; - return $text; + $att['readParms']['deleteClass'] = e_UC_NOBODY; } + + $text = "
"; + + $text .= $this->renderValue('options',$value,$att,$id); + + if($parent != 0) + { + $link = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list"; + $text .= "".ADMIN_PAGES_ICON.""; // + } + + $text .= "
"; + return $text; + } } diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 168456c70..934c0161d 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -1948,6 +1948,7 @@ class e_userperms // Content "5" => array(ADLAN_42,E_16_CUST, E_32_CUST), // create/edit custom PAGES "J" => array(ADLAN_42,E_16_CUST, E_32_CUST), // create/edit custom MENUS + "J1" => array(ADLAN_42." (".LAN_DELETE.")",E_16_CUST, E_32_CUST), // Delete Pages/Menus. "H" => array(ADLAN_0,E_16_NEWS, E_32_NEWS), // Post News - All Areas except settings. "H0" => array(ADLAN_0." (".LAN_CREATE.")",E_16_NEWS, E_32_NEWS), // Create News Items