Code

- Added ssh plugin
[gosa.git] / plugins / admin / systems / class_divListSystem.inc
index b58169262f276e3faa9c0676a3cad729f78edfcb..c98116dd11c42da09fd851b668e3b9c734e3c183 100644 (file)
@@ -6,6 +6,7 @@ class divListSystem extends MultiSelectWindow
   /* Current base */
   var $selectedBase       = "";
   var $departments        = array();
+  var $do_iso             = FALSE;
 
   /* Regex */
   var $Regex              = "*";
@@ -33,6 +34,10 @@ class divListSystem extends MultiSelectWindow
     $this->parent       = $parent;
     $this->ui           = get_userinfo();
 
+    if (search_config($config->data['TABS'], "workgeneric", "ISOCMD")){
+      $this->do_iso= TRUE;
+    }
+
     /* Set list strings */
     $this->SetTitle(_("List of systems"));
     $this->SetSummary(_("List of systems"));
@@ -50,7 +55,7 @@ class divListSystem extends MultiSelectWindow
     /* set Page header */
     $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("System / Department")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:60px;border-right:0px;'"));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:70px;border-right:0px;'"));
 
     /*                  Text        ,Value    ,Name         ,Is selected */
     $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
@@ -63,11 +68,11 @@ class divListSystem extends MultiSelectWindow
 
     /* Add SubSearch checkbox */
     $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Ignore subtrees"), false);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
 
     /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
     $this->AddRegex   ("Regex",     _("Display systems matching"),"*" , true);
-    $this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");
+    /*$this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");*/
   }
 
   function GenHeader()
@@ -83,16 +88,10 @@ class divListSystem extends MultiSelectWindow
         $options.= "<option value='$key'>$value</option>";
       }
     }
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-    " <input class='center' type='image' src='images/list_root.png' align='middle'
-        title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
-    " <input class='center' type='image' align='middle' src='images/list_back.png'
-        title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
-    " <input class='center' type='image' align='middle' src='images/list_home.png'
-        title='"._("Go to users department")."' alt='"._("Home")."'                     name='dep_home'>&nbsp;".
-    " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='".          _("Submit")."'>&nbsp;".
-    " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-    " <input class='center' type='image' align='middle' src='images/select_new_terminal.png'
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    $listhead.=" <input class='center' type='image' align='middle' src='images/select_new_terminal.png'
         name='newsystem_terminal'    alt='"._("New Terminal template")."' title='"._("New Terminal")."'>".
     " <input class='center' type='image' align='middle' src='images/select_new_workstation.png'
         name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>".
@@ -132,14 +131,20 @@ class divListSystem extends MultiSelectWindow
     $img10 = "<img class='center' src='images/save.png'               alt='L' title='"._("Ldap Server") ."'>";
 
     $empty    ="&nbsp;";
-    $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit system")."'>";
-    $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete system")."'>";
-
     // User and Template  Images
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     // Test Every Entry and generate divlist Array
     foreach($terminals as $key => $val){
+
+      $acl= get_permissions ($val['dn'], $this->ui->subtreeACL);
+      $acl= get_module_permission($acl, "terminal", $val['dn']);
+
+      $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit system")."'>";
+      if(chkacl($acl,"delete") ==""){
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete system")."'>";
+      }
+
  
       /* Generate picture list, which is currently disabled */
       if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;
@@ -169,20 +174,25 @@ class divListSystem extends MultiSelectWindow
         $display= $val["cn"][0].$dsc;
       }
 
-      if((in_array("gotoTerminal",$val['objectClass']))||(in_array("gotoWorkstation",$val['objectClass']))){
+      if(((in_array("gotoTerminal",$val['objectClass']))||(in_array("gotoWorkstation",$val['objectClass']))) && chkacl($acl,"password") == ""){
         $action2 = "<input class='center' type='image' src='images/certs.png' alt='"._("Password")."'   name='user_setpwd_%KEY%' title='"._("Set root       password")."'>";
       }else{
         $action2 = "";
       }
 
+      if($this->do_iso && in_array("gotoWorkstation",$val['objectClass'])){
+        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>".$action2;
+      }
+
+      /* Add Message generated by mangement->reload*/  
       if(isset($val['message'])){
-        $display.= "  (".$val['message']." '".$this->config->idepartments[$_SESSION['CurrentMainBase']]."'  )";
+        $display.= "  (".$val['message'].")";
       }
 
       $img    = $this->parent->convert_list($val);
       $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
       $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:70px;border-right:0px;text-align:right;'");
       $this->AddElement( array($field1,$field2,$field3));
     }