Code

Centralized copy & paste icon creation && permission checks
[gosa.git] / gosa-core / plugins / admin / groups / class_divListGroup.inc
index 6c3304f2b8a8088126ec0c1f94040b9f0d9dfc4a..7c42291e4ce1c156a62ffbba5e21b35aee96da34 100644 (file)
@@ -207,29 +207,11 @@ class divListGroup extends MultiSelectWindow
     /* Add multiple copy & cut icons */
     $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
 
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/r/",$acl_all)){
-      $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-    }
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(r.*d|d.*r)/",$acl_all)){ 
-      $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-    }
-
-    /* Copy & paste icons */
-    if(is_object($this->parent->CopyPasteHandler) && $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-grey.png' alt=''>";
-      $s.="..|".$img."&nbsp;"._("Paste")."\n";
-    }
-
-    /* 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);
 
@@ -299,32 +281,17 @@ class divListGroup extends MultiSelectWindow
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"groups");
 
       $actions= "";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
-        $actions.= "<input class='center' type='image'
-          src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
-        $actions.= "<input class='center' type='image'
-          src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&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("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
+      $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")."'>";