Code

Added navigation gray out if option is not available
[gosa.git] / plugins / admin / systems / class_divListSystem.inc
index 59ca111bdb2dd310a6913ba6418e5bca28a5ddc7..9d732b212e45a718e8e667442c171d40f5aeaaa3 100644 (file)
@@ -6,19 +6,23 @@ class divListSystem extends MultiSelectWindow
   /* Current base */
   var $selectedBase       = "";
   var $departments        = array();
+  var $do_iso             = FALSE;
 
   /* Regex */
   var $Regex              = "*";
   var $UserRegex          = "*";
 
-  /* CheckBoxes */
-  var $ShowServers        = true;
-  var $ShowTerminals      = true;
-  var $ShowWorkstations   = true;
-  var $ShowWinWorkstations= true;
-  var $ShowPrinters       = true;
-  var $ShowDevices        = true;
-  var $ShowPhones         = true;
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $ShowServers;
+  var $ShowTerminals;
+  var $ShowWorkstations;
+  var $ShowWinWorkstations;
+  var $ShowPrinters;
+  var $ShowDevices;
+  var $ShowPhones;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
 
   var $parent             ;
   var $ui                 ;
@@ -30,11 +34,9 @@ class divListSystem extends MultiSelectWindow
     $this->parent       = $parent;
     $this->ui           = get_userinfo();
 
-    /* Set default base */
-    if(!isset($_SESSION['CurrentMainBase'])){
-      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+    if (search_config($config->data['TABS'], "workgeneric", "ISOCMD")){
+      $this->do_iso= TRUE;
     }
-    $this->selectedBase = $_SESSION['CurrentMainBase'];
 
     /* Set list strings */
     $this->SetTitle(_("List of systems"));
@@ -53,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);
@@ -64,6 +66,10 @@ class divListSystem extends MultiSelectWindow
     $this->AddCheckBox("ShowPhones",          _("Select to see VOIP phones"),         _("Show phones") ,          true);
     $this->AddCheckBox("ShowDevices",         _("Select to see network devices"),     _("Show network devices"),  true);
 
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Ignore 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");
@@ -82,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")."'>".
@@ -115,7 +115,6 @@ class divListSystem extends MultiSelectWindow
   {
     $this->ClearElementsList();
     $this->GenHeader();
-    $this->AddDepartments($this->selectedBase);
   }
 
   function setEntries($terminals)
@@ -159,10 +158,14 @@ class divListSystem extends MultiSelectWindow
       $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]);
 
       // Generate Array to Add
+      $dsc= "";
+      if (isset($val['description'][0])){
+        $dsc= " [".$val['description'][0]."]";
+      }
       if((isset($val['is_new']))&&(!empty($val['is_new']))){
-        $display= "".$val["cn"][0]." ".$val['is_new'];
+        $display= $val["cn"][0]." ".$val['is_new'].$dsc;
       }else{
-        $display= "".$val["cn"][0]."";
+        $display= $val["cn"][0].$dsc;
       }
 
       if((in_array("gotoTerminal",$val['objectClass']))||(in_array("gotoWorkstation",$val['objectClass']))){
@@ -171,14 +174,19 @@ class divListSystem extends MultiSelectWindow
         $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='".@LDAP::fix($val['dn'])."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $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:70px;border-right:0px;text-align:right;'");
       $this->AddElement( array($field1,$field2,$field3));
     }
 
@@ -192,55 +200,7 @@ class divListSystem extends MultiSelectWindow
   function save_object()
   {
     /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-
-    $s_action ="";
-    foreach($_POST as $key => $value){
-      if(preg_match("/^dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/^dep_root.*/",$key)){
-        $s_action="root";
-      }elseif(preg_match("/^dep_home.*/i",$key)){
-        $s_action="home";
-      }
-    }
-   
-    /* Save base selection from headpage selectbox*/ 
-    if(isset($_POST['CurrentMainBase'])){
-      $this->selectedBase = $_POST['CurrentMainBase'];
-    }
-
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $ui= get_userinfo();
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
-    }
-
-    /* Open selected department 
-       this is posted by the parent class MultiSelectWindow */
-    if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
-      $s_entry = base64_decode($_GET['dep_id']);
-      $this->selectedBase = $this->config->departments[trim($s_entry)];
-    }
-
-    /* back to the roots ^^ */
-    if($s_action=="root"){
-      $this->selectedBase=($this->config->current['BASE']);
-    }
-
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-      $base_back          = convert_department_dn($base_back);
-      if(isset($this->config->departments[trim($base_back)])){
-        $this->selectedBase= $this->config->departments[trim($base_back)];
-      }else{
-        $this->selectedBase= $this->config->departments["/"];
-      }
-    }
-
-    $_SESSION['CurrentMainBase']  = $this->selectedBase;
+    MultiSelectWindow :: save_object();   
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: