Code

Updated ACL category
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_divListSudo.inc
index 404a5a0e26313d5764b6068edaa43ab971464521..a47b6f629424b478c16676c93df01b82732ac081 100644 (file)
  */
 class divListSudo extends MultiSelectWindow
 {
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
   /* Regex */
-  var $Regex              = "*";
-  var $UserRegex          = "*";
+  public $Regex              = "*";
+  public $UserRegex          = "*";
 
   /* Subsearch checkbox */
-  var $SubSearch          = FALSE;
-  var $parent             ;
-  var $ui                 ;
+  public $SubSearch          = FALSE;
+  protected $parent             ;
+  public $ui                 ;
 
 
   /*! \brief  Initialize this class 
@@ -74,7 +69,7 @@ class divListSudo 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 */
@@ -88,7 +83,7 @@ class divListSudo extends MultiSelectWindow
     $this->AddRegex   ("Regex"    , _("Regular expression for matching role names")       , 
       "*" , true);
     $this->AddRegex   ("UserRegex", _("Regular expression for matching role member names"),
-      "*" , FALSE,"images/search_user.png");
+      "*" , FALSE,"images/lists/search-user.png");
   }
 
 
@@ -100,54 +95,36 @@ 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();
+    $listhead = MultiSelectWindow::get_default_header(false);
     
     /* Create Layers menu */
     $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+    $s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
       "&nbsp;"._("Create")."|\n";
 
     /* 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/edittrash.png' alt='' border='0' class='center'>".
+      $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/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-#      $s.= "..|<img src='images/editcut.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/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.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);
   }
@@ -169,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;
@@ -185,29 +162,20 @@ 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/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.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/edit.png' alt='".msgPool::editButton()."' name='sudo_edit_%KEY%' title='"._("Edit this entry")."'>";
+        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'
-          src='images/edittrash.png' alt='".msgPool::delButton()."' name='sudo_del_%KEY%' title='"._("Delete this entry")."'>";
+          src='images/lists/trash.png' alt='".msgPool::delButton()."' name='sudo_del_%KEY%' title='"._("Delete this entry")."'>";
       }
 
       $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
@@ -250,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);
   }