Code

Added fix for divlist department selection
[gosa.git] / include / class_acl.inc
index 8103ba16e8e4a756dfbf215a447f9113d656eeef..f3fed5371fa5cb4c5be52d753228c1f99e93d815 100644 (file)
@@ -27,7 +27,6 @@ class acl extends plugin
   var $currentIndex= 0;
   var $wasNewEntry= FALSE;
   var $ocMapping= array();
-  var $multiClass= array();
   var $savedAclContents= array();
 
 
@@ -107,11 +106,6 @@ class acl extends plugin
       /* Only feed categories */
       if (isset($acls['plCategory'])){
 
-        /* Find multi homed classes */
-        if (count($acls['plCategory']) > 1){
-          $this->multiClass[$class]= $class;
-        }
-
         /* Walk through supplied list and feed only translated categories */
         foreach($acls['plCategory'] as $idx => $data){
 
@@ -134,21 +128,13 @@ class acl extends plugin
             if (is_array($data['objectClass'])){
               foreach($data['objectClass'] as $objectClass){
                 if (in_array_ics($objectClass, $oc)){
-                  if (isset($this->multiClass[$class])){
-                    $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-                  } else {
-                    $this->myAclObjects[$class]= $acls['plDescription'];
-                  }
+                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
                   break;
                 }
               }
             } else {
               if (in_array_ics($data['objectClass'], $oc)){
-                if (isset($this->multiClass[$class])){
-                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-                } else {
-                  $this->myAclObjects[$class]= $acls['plDescription'];
-                }
+                $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
               }
             }
           }
@@ -156,6 +142,8 @@ class acl extends plugin
         }
       }
     }
+    $this->aclObjects['all']= '* '._("All categories");
+    $this->ocMapping['all']= array('0' => 'all');
 
     /* Sort categories */
     asort($this->aclObjects);
@@ -461,16 +449,14 @@ class acl extends plugin
       $smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
 
       /* Collect objects for selected category */
-      $aclObjects= array();
       foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
         if ($idx == 0){
           continue;
         }
-        if (isset($this->multiClass[$class])){
-          $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
-        } else {
-          $aclObjects[$class]= $plist[$class]['plDescription'];
-        }
+        $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
+      }
+      if ($this->aclObject == 'all'){
+        $aclObjects['all']= _("All objects in current subtree");
       }
       $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
     }
@@ -501,7 +487,15 @@ class acl extends plugin
       $currentAcl= $this->aclContents[$key];
 
       /* Object header */
-      $display.= "<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2><tr><td style='background-color:#C8C8C8;height:1.8em' colspan=$cols><b>"._("Object").": $name</b></td></tr>";
+      if($_SESSION['js']) {
+        if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/firefox/i",$_SERVER['HTTP_USER_AGENT'])) {
+          $display.= "<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2><tr><td style='background-color:#C8C8C8;height:1.8em;' colspan=".($cols-1)."><b>"._("Object").": $name</b></td><td align='right' style='background-color:#C8C8C8;height:1.8em;'><input type='button' onclick='divtoggle(\"$name\");' value='"._("Show/Hide Advanced Settings")."' /></td></tr>";
+        } else {
+          $display.= "<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2><tr><td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td></tr>";
+        }
+      } else {
+          $display.= "<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2><tr><td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td></tr>";
+      }
 
       /* Generate options */
       $spc= "&nbsp;&nbsp;";
@@ -530,6 +524,11 @@ class acl extends plugin
       $cnt= 1;
       $splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls'];
       asort($splist);
+      if($_SESSION['js']) {
+        if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/firefox/i",$_SERVER['HTTP_USER_AGENT'])) {
+          $display.= "<tr id='tr_$name' style='vertical-align:top;height:0px;'><td colspan=".$cols."><div id='$name' style='visibility:hidden;height:0px;vertical-align:top;width:100%;'><table style='width:100%;'>";
+        }
+      }
       foreach($splist as $attr => $dsc){
 
         /* Skip pl* attributes, they are internal... */
@@ -566,7 +565,13 @@ class acl extends plugin
        $display.= str_repeat("<td style='border-top:1px solid #A0A0A0; width:".(int)(100/$cols)."%'>&nbsp;</td>", $cols-$cnt); 
       }
 
-      $display.= "</table><br>";
+      if($_SESSION['js']) {
+        if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/firefox/i",$_SERVER['HTTP_USER_AGENT'])) {
+          $display.= "</table></div></td></tr>";
+        }
+      }
+
+      $display.= "</table><br />";
     }
 
     return ($display);