From 80a9c77696c20402368cea64b154e22d8bccfb01 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 17 Mar 2010 12:44:07 +0000 Subject: [PATCH] Updated ACL role handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16750 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/plugins/admin/acl/acl_role.tpl | 2 +- gosa-core/plugins/admin/acl/class_aclRole.inc | 47 +++++++++---------- gosa-core/plugins/admin/acl/tabs_acl_role.inc | 12 ++--- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/gosa-core/plugins/admin/acl/acl_role.tpl b/gosa-core/plugins/admin/acl/acl_role.tpl index 2b3d08588..41e2a57c6 100644 --- a/gosa-core/plugins/admin/acl/acl_role.tpl +++ b/gosa-core/plugins/admin/acl/acl_role.tpl @@ -1,7 +1,7 @@ {if $dialogState eq 'head'}

{t}Assigned ACL for current entry{/t}

- +
{t}Name{/t} diff --git a/gosa-core/plugins/admin/acl/class_aclRole.inc b/gosa-core/plugins/admin/acl/class_aclRole.inc index 51f19e973..a535647de 100644 --- a/gosa-core/plugins/admin/acl/class_aclRole.inc +++ b/gosa-core/plugins/admin/acl/class_aclRole.inc @@ -186,16 +186,16 @@ class aclrole extends acl foreach($_POST as $name => $post){ /* Actions... */ - if (preg_match('/^acl_edit_.*_x/', $name)){ + if (preg_match('/^acl_edit_[0-9]*$/', $name)){ $this->dialogState= 'create'; $firstedit= TRUE; $this->dialog= TRUE; - $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name); + $this->currentIndex= preg_replace('/^acl_edit_([0-9]*)$/', '\1', $name); $this->loadAclEntry(); continue; } - if (preg_match('/^cat_edit_.*_x/', $name)){ - $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name); + if (preg_match('/^cat_edit_/', $name)){ + $this->aclObject= preg_replace('/^cat_edit_(.*)$/', '\1', $name); $this->dialogState= 'edit'; foreach ($this->ocMapping[$this->aclObject] as $oc){ if (isset($this->aclContents[$oc])){ @@ -209,22 +209,25 @@ class aclrole extends acl continue; } - if (preg_match('/^acl_del_.*_x/', $name) && $this->acl_is_writeable("gosaAclEntry")){ - unset($this->gosaAclTemplate[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]); + if (preg_match('/^acl_del_[0-9]*/', $name) && $this->acl_is_writeable("gosaAclEntry")){ + unset($this->gosaAclTemplate[preg_replace('/^acl_del_([0-9]*)$/', '\1', $name)]); continue; } - if (preg_match('/^cat_del_.*_x/', $name) && $this->acl_is_writeable("gosaAclEntry")){ - $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name); + if (preg_match('/^cat_del_.*/', $name) && $this->acl_is_writeable("gosaAclEntry")){ + $idx= preg_replace('/^cat_del_(.*)$/', '\1', $name); foreach ($this->ocMapping[$idx] as $key){ - unset($this->aclContents["$idx/$key"]); + if(isset($this->aclContents[$idx])) + unset($this->aclContents[$idx]); + if(isset($this->aclContents["$idx/$key"])) + unset($this->aclContents["$idx/$key"]); } continue; } /* Sorting... */ - if (preg_match('/^sortup_.*_x/', $name) && $this->acl_is_writeable("gosaAclEntry")){ - $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name); + if (preg_match('/^sortup_[0-9]*$/', $name) && $this->acl_is_writeable("gosaAclEntry")){ + $index= preg_replace('/^sortup_([0-9]*)$/', '\1', $name); if ($index > 0){ $tmp= $this->gosaAclTemplate[$index]; $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index-1]; @@ -232,8 +235,8 @@ class aclrole extends acl } continue; } - if (preg_match('/^sortdown_.*_x/', $name) && $this->acl_is_writeable("gosaAclEntry")){ - $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name); + if (preg_match('/^sortdown_[0-9]*$/', $name) && $this->acl_is_writeable("gosaAclEntry")){ + $index= preg_replace('/^sortdown_([0-9]*)$/', '\1', $name); if ($index < count($this->gosaAclTemplate)-1){ $tmp= $this->gosaAclTemplate[$index]; $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index+1]; @@ -368,18 +371,14 @@ class aclrole extends acl $action =""; if($this->acl_is_writeable("gosaAclEntry")){ - $action.= ""; - $action.= ""; + $action.=image('images/lists/sort-up.png','sortup_'.$key,'','top'); + $action.=image('images/lists/sort-down.png','sortdown_'.$key,'','bottom'); } if($this->acl_is_readable("gosaAclEntry")){ - $action.= ""; + $action.= image('images/lists/edit.png','acl_edit_'.$key,msgPool::editButton(_("ACL"))); } if($this->acl_is_writeable("gosaAclEntry")){ - $action.= ""; + $action.= image('images/lists/trash.png','acl_del_'.$key,msgPool::delButton(_("ACL"))); } $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'"); @@ -422,12 +421,10 @@ class aclrole extends acl $action = ""; if($this->acl_is_readable("gosaAclEntry")){ - $action.= ""; + $action.= image('images/lists/edit.png','cat_edit_'.$section,_("Edit category ACL")); } if($this->acl_is_writeable("gosaAclEntry")){ - $action.= ""; + $action.= image('images/lists/trash.png','cat_del_'.$section,_("Delete category ACL")); } $field1= array("string" => $dsc, "attach" => "style='width:140px'"); diff --git a/gosa-core/plugins/admin/acl/tabs_acl_role.inc b/gosa-core/plugins/admin/acl/tabs_acl_role.inc index 06303492f..28be23385 100644 --- a/gosa-core/plugins/admin/acl/tabs_acl_role.inc +++ b/gosa-core/plugins/admin/acl/tabs_acl_role.inc @@ -63,19 +63,17 @@ class aclroletab extends tabs { $display= tabs::execute(); if($this->read_only){ - $display.= "

\n"; - $display.= " \n"; - $display.= "

"; + $display.= "
"; + $display.= " \n"; + $display.= "
"; }elseif(!$this->by_object['aclrole']->dialog){ $display.= "

\n"; - $display.= " \n"; - $display.= "  \n"; - $display.= " \n"; + $display.= " \n"; + $display.= " \n"; $display.= "

"; } return($display); } - } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2