Code

Centralized copy & paste icon creation && permission checks
[gosa.git] / gosa-core / plugins / admin / groups / class_divListGroup.inc
index 631ddaf4b1bf86fcd19f99bc7106ef8bb540c826..7c42291e4ce1c156a62ffbba5e21b35aee96da34 100644 (file)
@@ -70,7 +70,7 @@ class divListGroup extends MultiSelectWindow
     }
 
     /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
+    $chk = "<input type='checkbox' id='select_all' name='select_all' title='"._("Select all")."'
                onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
 
     /* set Page header */
@@ -164,8 +164,7 @@ class divListGroup extends MultiSelectWindow
     }
   
     /* Get acls */
-    $acls   = $ui->get_permissions($this->selectedBase,"groups/group");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
+    $acl   = $ui->get_permissions($this->selectedBase,"groups/group");
 
 
     /* Add default header */
@@ -176,15 +175,13 @@ class divListGroup extends MultiSelectWindow
       " <input type='image' class='center' src='images/lists/submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
       "'>&nbsp;";
 
-
-        /* Create Layers menu */
+    /* Create Layers menu */
     $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
 
     /* Append create options */
-    if(preg_match("/c/",$acl_all)) {
+    if(preg_match("/c/",$acl)) {
+      $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Create")."|\n";
       $s.= "...|<input class='center' type='image' src='plugins/groups/images/new.png' alt=''>".
         "&nbsp;"._("Group")."|group_new|\n";
     }
@@ -208,27 +205,13 @@ class divListGroup extends MultiSelectWindow
     }
 
     /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
+    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
 
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    /* Add Copy & Paste header */
+    $s .= $this->parent->get_copypaste_header($this->selectedBase,$this->module);
+    
+    /* Add snapshot functionality */
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
 
@@ -295,31 +278,28 @@ class divListGroup extends MultiSelectWindow
     
       /* Create action icons - copy & paste icons */
       $acl = $ui->get_permissions($val['dn'],"groups/group");
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"groups");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"groups");
 
       $actions= "";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
+
+      /* Add copy & cut functionality */
+      $actions.= $this->parent->get_copypaste_action($val['dn'],"groups","group");
 
       /* Add edit icon */
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot functionality */
-      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
-
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+  
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
           src='images/lists/trash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img class='center' src='images/empty.png' alt='&nbsp;'
+          title='"._("Not allowed")."'>";
       }
 
-
       $posix=$mail=$samba=$appl=$phone=$enviro=$empty;
 
       if(isset($val['objectClass'])){