Code

Updated ACL role handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Mar 2010 12:44:07 +0000 (12:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Mar 2010 12:44:07 +0000 (12:44 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16750 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/acl/acl_role.tpl
gosa-core/plugins/admin/acl/class_aclRole.inc
gosa-core/plugins/admin/acl/tabs_acl_role.inc

index 2b3d085888f64eb297e559b0a587b62b91b1b492..41e2a57c6c0580626cfc25238be08394a2316768 100644 (file)
@@ -1,7 +1,7 @@
 {if $dialogState eq 'head'}
 
 <h1>{t}Assigned ACL for current entry{/t}</h1>
-<table>
+<table summary="{t}Assigned ACL for current entry{/t}">
 <tr>
        <td>
                {t}Name{/t}
index 51f19e973dd30bf1252848789c3c7bfa098d4ac6..a535647de84394797962f4e4d8224d389ca91650 100644 (file)
@@ -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.= "<input type='image' name='sortup_$key' alt='up' 
-            title='"._("Up")."' src='images/lists/sort-up.png' align='top'>";
-          $action.= "<input type='image' name='sortdown_$key' alt='down' 
-            title='"._("Down")."' src='images/lists/sort-down.png'>";
+          $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.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='acl_edit_$key' 
-            title='".msgPool::editButton(_("ACL"))."'>";
+          $action.= image('images/lists/edit.png','acl_edit_'.$key,msgPool::editButton(_("ACL")));
         }
         if($this->acl_is_writeable("gosaAclEntry")){
-          $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("Delete")."' name='acl_del_$key' 
-            title='".msgPool::delButton(_("ACL"))."'>";
+          $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.= "<input class='center' type='image' src='images/lists/edit.png' 
-            alt='"._("Edit")."' name='cat_edit_$section'   title='"._("Edit category ACL")."'>";
+          $action.= image('images/lists/edit.png','cat_edit_'.$section,_("Edit category ACL"));
         }
         if($this->acl_is_writeable("gosaAclEntry")){
-          $action.= "<input class='center' type='image' src='images/lists/trash.png' 
-            alt='"._("Delete")."' name='cat_del_$section' title='"._("Reset category ACL")."'>";
+          $action.= image('images/lists/trash.png','cat_del_'.$section,_("Delete category ACL"));
         }
 
         $field1= array("string" => $dsc, "attach" => "style='width:140px'");
index 06303492f19189b7ffe1986afcec5f61e102fa80..28be2338567e20491201b33fb37ac71e510fe6ae 100644 (file)
@@ -63,19 +63,17 @@ class aclroletab extends tabs
   {
     $display= tabs::execute();
     if($this->read_only){
-      $display.= "<p style=\"text-align:right\">\n";
-      $display.= "  <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
-      $display.= "</p>";
+      $display.= "<div class='plugin-actions'>";
+      $display.= "  <button type=submit name=\"edit_cancel\">".msgPool::cancelButton()."</button>\n";
+      $display.= "</div>";
     }elseif(!$this->by_object['aclrole']->dialog){
       $display.= "<p style=\"text-align:right\">\n";
-      $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
-      $display.= "  &nbsp;\n";
-      $display.= "  <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+      $display.= "  <button type=submit name=\"edit_finish\">".msgPool::okButton()."</button>\n";
+      $display.= "  <button type=submit name=\"edit_cancel\">".msgPool::cancelButton()."</button>\n";
       $display.= "</p>";
     }
     return($display);
   }
-
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>