Code

Updated ACL category
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_divListSudo.inc
index baed8f8ee8bc07dabe3be441967d3da819030ec1..a47b6f629424b478c16676c93df01b82732ac081 100644 (file)
  */
 class divListSudo extends MultiSelectWindow
 {
-
-  /* Current base */
-  private $departments        = array();
-
   /* Regex */
   public $Regex              = "*";
   public $UserRegex          = "*";
@@ -99,7 +95,8 @@ class divListSudo extends MultiSelectWindow
        which are shown in the listbox on top of the listbox
      */
     $base  = sudo::get_sudoers_ou($this->config);
-    $acl   = $this->ui->get_category_permissions($base,"sudo"); 
+    $acl    = $this->ui->get_permissions($base,"sudo/sudo"); 
+    $acl_all= $this->ui->get_category_permissions($base,"sudo"); 
  
     /* Add default header */
     $listhead = MultiSelectWindow::get_default_header(false);
@@ -111,42 +108,23 @@ class divListSudo extends MultiSelectWindow
 
     /* Append create options */
     if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_sudo.png' alt=''>&nbsp;"._("Role")."|new_role|\n";
-      $s.= "...|<input class='center' type='image' src='images/list_new_sudo.png' alt=''>&nbsp;"._("Default")."|new_default|\n";
+      $s.= "...|<input class='center' type='image' src='plugins/sudo/images/list_new_sudo.png' alt=''>&nbsp;"._("Role")."|new_role|\n";
+      $s.= "...|<input class='center' type='image' src='plugins/sudo/images/list_new_sudo.png' alt=''>&nbsp;"._("Default")."|new_default|\n";
     }
 
     /* Append multiple remove */
-    if(preg_match("/d/",$acl)){
+    if(preg_match("/r/",$acl)){
       $s.= "..|---|\n";
       $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Remove")."|"."del_role|\n";
     }
 
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_sudo|\n";
-#      $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
-#        "&nbsp;"._("Cut")."|"."multiple_cut_sudo|\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";
-      }
-    }
-
+    /* Add Copy & Paste header */
+    $s .= $this->parent->get_copypaste_header($this->selectedBase,$this->module);
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);   
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
   }
@@ -168,7 +146,7 @@ class divListSudo extends MultiSelectWindow
   {
     /* Prepare links */
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_sudo.png' alt='Sudo' title='%s'>";
+    $userimg  = "<img class='center' src='plugins/sudo/images/select_sudo.png' alt='Sudo' title='%s'>";
     $ui       = get_userinfo();
 
     $action_col_size = 54;
@@ -184,25 +162,16 @@ class divListSudo extends MultiSelectWindow
     
       /* Create action icons - copy & paste icons */
       $acl    = $ui->get_permissions($val['dn'],"sudo/sudo");
+      $acl_all= $this->ui->get_category_permissions($val['dn'],"sudo"); 
 
-      /* Add edit icon */
-      $actions = "";
-
-      $actions= "";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl)){
-#        $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'],"sudo","sudo",TRUE,FALSE);
 
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='".msgPool::editButton()."' name='sudo_edit_%KEY%' title='"._("Edit this entry")."'>";
 
-      if(preg_match("/(c.*w|w.*c)/",$acl)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
+      /* Add snapshot icon */
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
@@ -249,7 +218,7 @@ class divListSudo extends MultiSelectWindow
     /* Create summary string for list footer */
     $num     = count($list);
     $num_str  = _("Number of listed roles");
-    $str = "<img class='center' src='images/select_sudo.png'
+    $str = "<img class='center' src='plugins/sudo/images/select_sudo.png'
               title='".$num_str."' alt='".$num_str."'>&nbsp;".$num."&nbsp;";
     $this->set_List_Bottom_Info($str);
   }