diff --git a/module/group/control.php b/module/group/control.php index bbfbdacf5e..f606ebb6c7 100644 --- a/module/group/control.php +++ b/module/group/control.php @@ -537,6 +537,40 @@ class group extends control $this->display(); } + /** + * Sort priv packages. + * + * @param int $parentID + * @param string $type + * @access public + * @return void + */ + public function sortPrivPackages($parentID = 0, $type = '') + { + $orders = $_POST['orders']; + if(empty($orders)) return false; + if($type == 'view') + { + $orders = str_replace('View,', ',', $orders); + $orders = trim($orders, ','); + $this->loadModel('setting')->setItem("system.priv.views", $orders); + } + if($type == 'module') + { + $orders = trim($orders, ','); + $parentID = rtrim($parentID, 'View'); + $this->loadModel('setting')->setItem("system.priv.{$parentID}Modules", $orders); + } + if($type == 'package') + { + $orders = explode(',', $orders); + foreach($orders as $index => $id) + { + if(!empty($id)) $this->dao->update(TABLE_PRIVPACKAGE)->set('order')->eq(($index + 1) * 5)->where('id')->eq($id)->exec(); + } + } + } + /** * Delete a priv package. * @@ -669,40 +703,6 @@ class group extends control return print($tree); } - /** - * Sort priv packages. - * - * @param int $parentID - * @param string $type - * @access public - * @return void - */ - public function sortPrivPackages($parentID = 0, $type = '') - { - $orders = $_POST['orders']; - if(empty($orders)) return false; - if($type == 'view') - { - $orders = str_replace('View,', ',', $orders); - $orders = trim($orders, ','); - $this->loadModel('setting')->setItem("system.priv.views", $orders); - } - if($type == 'module') - { - $orders = trim($orders, ','); - $parentID = rtrim($parentID, 'View'); - $this->loadModel('setting')->setItem("system.priv.{$parentID}Modules", $orders); - } - if($type == 'package') - { - $orders = explode(',', $orders); - foreach($orders as $index => $id) - { - if(!empty($id)) $this->dao->update(TABLE_PRIVPACKAGE)->set('order')->eq(($index + 1) * 5)->where('id')->eq($id)->exec(); - } - } - } - /** * edit priv * diff --git a/module/group/js/editmanagepriv.js b/module/group/js/editmanagepriv.js index 2f118720ff..f5e68415f0 100644 --- a/module/group/js/editmanagepriv.js +++ b/module/group/js/editmanagepriv.js @@ -188,6 +188,7 @@ $(function() var relationPriv = $this.data('relationpriv'); $.get(createLink('group', 'deleteRelation', 'type=' + type + '&privID=' + privID + '&relationPriv=' + relationPriv)); $this.closest('.priv-panel').find('.panel-title .priv-count').html('(' + (privCount - 1) + ')'); + if($this.closest('ul').find('li').length == 1) $this.closest('ul').closest('li').remove(); $this.closest('li').remove(); })