Code

Updated post handling
[gosa.git] / gosa-core / plugins / generic / references / class_aclResolver.inc
index df9846ad96f2736e796099f2fedf799483ce8347..51d05a510ddd1482c628245949a72e090263725d 100644 (file)
@@ -33,7 +33,6 @@ class aclResolver
             $tmp= session::global_get('plist');
             $plist= $tmp->info;
             $map = array();
-            $map['all']= _("All categories");
             foreach($plist as $class => $plInfo){
                 if(isset($plInfo['plCategory']) && is_array($plInfo['plCategory'])){
                     foreach($plInfo['plCategory'] as $category => $desc){
@@ -129,7 +128,7 @@ class aclResolver
 
             // Autocompleter template 
             $autocompleter ="
-                <input class='filter_textfield' placeholder='"._("Search")."...' 
+                <input class='filter_textfield' placeholder='"._("Enter another user name")."...' 
                 id='aclTarget' name='aclTarget' type='text' value='' 
                 onChange=\"\$('aclTargetSubmit').focus();\">
 
@@ -146,36 +145,33 @@ class aclResolver
             // Base template - each entry start with this 
             $tpl = 
                 "\n <tr class='acl-viewer-head %s'>".
-                "\n  <td>%s</td>".
-                "\n  <td colspan=2><b>%s</b>&nbsp;-&nbsp;%s</td>".
+                "\n  <td style='width:20px'>%s</td>".
+                "\n  <td colspan=2><b>%s</b><div class='right'>%s</div></td>".
                 "\n </tr>".
-                "\n %s".
-                "\n <tr>".
-                "\n  <td colspan=3><hr></td>".
-                "\n </tr>";
+                "\n %s";
 
             // If the acl consists of a user-object-filter then this template is used.        
             $filter_tpl = 
                 "\n <tr class='%s'>".
                 "\n  <td></td>".
                 "\n  <td><b>"._("Filter")."</b></td>".
-                "\n  <td><ul><li>%s</li></ul></td>".
+                "\n  <td><ul class='acl-viewer-items'><li>%s</li></ul></td>".
                 "\n </tr>";
 
             // Used to display ACL owner of type "group"
             $gmem_tpl = 
                 "\n <tr class='%s'>".
                 "\n  <td></td>".
-                "\n  <td><b>"._("Group members")."</b></td>".
-                "\n  <td><ul>%s</ul></td>".
+                "\n  <td><b>"._("Groups")."</b></td>".
+                "\n  <td><ul class='acl-viewer-items'>%s</ul></td>".
                 "\n </tr>";
 
             // Used to display ACL owner of type "user"
             $umem_tpl = 
                 "\n <tr class='%s'>".
                 "\n  <td></td>".
-                "\n  <td><b>"._("Members")."</b></td>".
-                "\n  <td><ul>%s</ul></td>".
+                "\n  <td><b>"._("Users")."</b></td>".
+                "\n  <td><ul class='acl-viewer-items'>%s</ul></td>".
                 "\n </tr>";
 
             // Used to display the acl contents, except 'reset' and 'role'
@@ -183,15 +179,16 @@ class aclResolver
                 "\n <tr class='%s'>".
                 "\n  <td></td>".
                 "\n  <td><b>"._("Acls")."</b></td>".
-                "\n  <td><ul>%s</ul></td>".
+                "\n  <td><ul class='acl-viewer-items'>%s</ul></td>".
                 "\n </tr>";
 
 
-            $user = sprintf(_("ACL from the viewpoint of user '%s'"), "<b>".$this->validateUid."</b>");
+            $user = "<h3>".sprintf(_("List of effective ACLs for '%s'"), $this->validateUid)."</h3>";
             $str  = "<table summary='"._("Object permissions")."'>";
             $str .= " <tr><td>".$user."</td><td>".$autocompleter."</td></tr>";
             $str .= "</table>";
-            $str .= "<table summary='"._("Object permissions")."' class='acl-viewer'>";
+            $str .= "<div class='acl-viewer-container'>";
+            $str .= "<table summary='"._("Object permissions")."' cellpadding='0' cellspacing='0' class='acl-viewer'>";
             $ldap = $this->config->get_ldap_link();
             $ldap->cd($this->config->current['BASE']);
             $ui = get_userinfo();
@@ -218,14 +215,14 @@ class aclResolver
                     // Check membership 
                     $gmem = $umem = "";
                     $users = $groups = array();
-                    $gfound = $ufound = FALSE;
+                    $found = FALSE;
                     foreach($acl['members'] as $type => $name){
 
                         // Check if we're part of the members 
                         if(preg_match("/^U:/", $type)){
                             if(preg_match("/^U:".preg_quote($this->validateDn,'/')."/", $type)){
                                 $users[] = $name;
-                                $ufound = TRUE;
+                                $found = TRUE;
                                 continue;
                             }
                             $users[] = "<span>".$name."</span>";
@@ -234,7 +231,7 @@ class aclResolver
                         // Check if we're part of the group members 
                         if(preg_match("/^G/", $type)){
                             if($type == "G:*"){
-                                $gfound = TRUE;
+                                $found = TRUE;
                                 $groups[] = $name;
                                 continue;
                             }
@@ -244,19 +241,17 @@ class aclResolver
                                 if($ldap->count()){
                                     $attrs = $ldap->fetch();
                                     if(isset($attrs['memberUid']) && in_array($this->validateUid, $attrs['memberUid'])){
-                                        $gfound = TRUE;
+                                        $found = TRUE;
                                         $groups[] = $name;
+                                        continue;
                                     }
                                 }
-                                continue;
                             }
 
-                            // Group member doesn't mactch
+                            // Mark groups that doesn't match 
                             $groups[] = "<span>".$name."</span>";
                         }
                     }
-                    if(!count($groups)) $gfound = TRUE;
-                    if(!count($users)) $ufound = TRUE;
 
                     // Build up ACL definition list 
                     $defs ="";
@@ -272,10 +267,9 @@ class aclResolver
                    
                     // Display the acl block in a special color if its not matching 
                     $class="";
-                    if(!$gfound || !$ufound || !$match){
+                    if(!$found || !$match){
                         $class = "acl-viewer-blocked";
                     }                    
-
                     if(!empty($filter)) $filter =sprintf($filter_tpl,$class,$filter);
                     if(!empty($defs)) $defs = sprintf($acl_tpl,$class,$defs);
                     if(count($users))  $umem = sprintf($umem_tpl,$class,"<li>".implode($users,'</li><li>')."</li>");
@@ -284,6 +278,7 @@ class aclResolver
                 }
             }
             $str .= "</table>"; 
+            $str .= "</div>"; 
             $this->renderedList = $str;
         }
         return($this->renderedList);
@@ -291,19 +286,19 @@ class aclResolver
 
     function aclToString($acls)
     {
-        $str ="<ul>";
+        $str ="<ul class='acl-category-list'>";
         foreach($acls as $name => $acl){
             if($name == "0") $name = _("All");
-            $str .= "<li>".$name;
-            $str .= "<ul>";
+            $str .= "<li><i>".$name.":</i> ";
+            $str .= "<ul class='acl-list'>";
             if(preg_match("/s/", $acl)){
-                $str.="<li>"._("Grant permission to owner").'</li>'; 
+                $str.="<li><u>"._("Restrict changes to user's own object").'</u></li>'; 
             }
             if(preg_match("/r/", $acl)) $str.="<li>"._("read").'</li>'; 
             if(preg_match("/w/", $acl)) $str.="<li>"._("write").'</li>'; 
-            if(preg_match("/c/", $acl)) $str.="<li>"._("Create").'</li>'; 
-            if(preg_match("/d/", $acl)) $str.="<li>"._("Remove").'</li>'; 
-            if(preg_match("/m/", $acl)) $str.="<li>"._("Move").'</li>'; 
+            if(preg_match("/c/", $acl)) $str.="<li>"._("create").'</li>'; 
+            if(preg_match("/d/", $acl)) $str.="<li>"._("remove").'</li>'; 
+            if(preg_match("/m/", $acl)) $str.="<li>"._("move").'</li>'; 
             $str.= "</ul>";
         }
         return($str."</ul>");