Code

goFonQueueStrategy will be saved in correct format now
[gosa.git] / plugins / admin / systems / class_systemManagement.inc
index 723c26c100009ccaeb70d740378e4d98e1ad2abd..f757d339c0c8168d17a114b2995e1f4ebe5d99ad 100644 (file)
@@ -90,7 +90,6 @@ class systems extends plugin
       $terminalfilter['regex']= $s;
     }
 
-    $terminalfilter   = get_global("terminalfilter"); // contains Filter Settings
     $s_action     = "";                       // Contains the action to proceed
     $s_entry      = "";                       // The value for s_action
     $base_back    = "";                       // The Link for Backbutton
@@ -128,6 +127,9 @@ class systems extends plugin
         $s_entry  = preg_replace("/user_setpwd_/i","",$key);
       }elseif(preg_match("/dep_root.*/i",$key)){
         $s_action="root";
+      }elseif(preg_match("/newsystem_.*/i",$key)){
+        $s_action="newsystem";
+        $s_entry  = preg_replace("/newsystem_/i","",$key);
       }
     }
 
@@ -180,11 +182,17 @@ class systems extends plugin
     }
 
     /* Create new default terminal */
-    if (isset($_POST['create_system'])) {
+    if (isset($_POST['create_system'])||$s_action=="newsystem") {
       $this->dn= "new";
       $this->acl= array(":all");
 
-      switch ($_POST['system']){
+      if(isset($_POST['system'])){
+        $sw = $_POST['system'];
+      }else{
+        $sw = $s_entry;
+      }
+
+      switch ($sw){
         case 'terminal':
           $this->systab= new termtabs($this->config,
               $this->config->data['TABS']['TERMTABS'], $this->dn);
@@ -415,6 +423,10 @@ class systems extends plugin
           case "workstation":
             $tabtype= "worktabs";
           break;
+          
+          case "phone":
+            $tabtype= "phonetabs";
+          break;
 
           case "server":
             $tabtype= "servtabs";
@@ -429,10 +441,17 @@ class systems extends plugin
         }
 
         /* Delete request is permitted, perform LDAP action */
-        $this->systab= new $tabtype($this->config,
-            $this->config->data['TABS']['TERMTABS'], $this->dn);
-        $this->systab->set_acl(array($this->acl));
-        $this->systab->by_object['termgeneric']->remove_from_parent ();
+        if($tabtype=="phonetabs"){
+          $this->systab= new $tabtype($this->config,
+             $this->config->data['TABS']['PHONETABS'], $this->dn);
+          $this->systab->set_acl(array($this->acl));
+          $this->systab->by_object['phonegeneric']->remove_from_parent ();
+        }else{  
+          $this->systab= new $tabtype($this->config,
+             $this->config->data['TABS']['TERMTABS'], $this->dn);
+          $this->systab->set_acl(array($this->acl));
+          $this->systab->by_object['termgeneric']->remove_from_parent ();
+        }
         unset ($this->systab);
         gosa_log ("System object'".$this->dn."' has been removed");
         $this->systab= NULL;
@@ -535,7 +554,12 @@ class systems extends plugin
     " <input type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
     " <input type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."'                     name='dep_home'>&nbsp;".
     " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-    " <input type='image' align='middle' src='images/list_new_user.png' title='"._("Create new user")."' alt='"._("New user")."'                    name='user_new'>&nbsp;".
+    " <input type='image' align='middle' src='images/select_new_terminal.png'   name='newsystem_terminal'    alt='"._("New Terminal")."' title='"._("New Terminal")."'>".
+    " <input type='image' align='middle' src='images/select_new_workstation.png' name='newsystem_workstation' alt='"._("New Workstation")."' title='"._("New Workstation")."'>".
+    " <input type='image' align='middle' src='images/select_new_server.png'     name='newsystem_server'      alt='"._("New Server")."' title='"._("New Server")."'>".
+    " <input type='image' align='middle' src='images/select_new_printer.png'    name='newsystem_printer'     alt='"._("New Printer")."' title='"._("New Printer")."'>".
+    " <input type='image' align='middle' src='images/select_new_phone.png'      name='newsystem_phone'       alt='"._("New Phone")."' title='"._("New Phone")."'>".
+    " <input type='image' align='middle' src='images/select_new_component.png'  name='newsystem_component'   alt='"._("New Component")."' title='"._("New Component")."'>".
     " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
     _("Current base")."&nbsp;<select name='depselect' onChange='mainform.submit()'>$options</select>".
     " <input type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;".
@@ -543,25 +567,38 @@ class systems extends plugin
 
 
 
-    $action= "<input type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit user")."'>";
-    $action.= "<input type='image' src='images/editdelete.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete user")."'>";
+    $action= "<input type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit system")."'>";
+    $action.= "<input type='image' src='images/editdelete.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete system")."'>";
 
 
-    $divlist = new divlist();
+    $divlist = new divlist("systemstab");
     $divlist->SetHeader(array(
           array("string" => "&nbsp;"),
           array("string" => _("System")." / "._("Department")),
           array("string" => _("Actions"), "attach" => "style='border:none'" )));
 
 
-    $divlist->SetSummary(_("This table displays all users, in the selected tree."));
+    $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
     $divlist->SetEntriesPerPage(20);
 
     // Defining Links
     $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
     foreach($this->departments as $key=> $val){
-      $field1 = array("string" => "<img src='images/folder.png' alt='department'>");
+
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match("/".$keys."\/.*/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>");
       $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
       $field3 = array("string" => "&nbsp;", "attach" => "style='border:none'");
       $divlist->AddEntry(array($field1,$field2,$field3));
@@ -635,6 +672,7 @@ class systems extends plugin
     $smarty->assign("terminalshead", $listhead);
     $smarty->assign("terminals", $divlist->DrawList());
     $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("infoimage", get_template_path('images/info.png'));
     $smarty->assign("launchimage", get_template_path('images/launch.png'));
@@ -657,25 +695,24 @@ class systems extends plugin
   function convert_list($input)
   {
     $temp= "";
-    $conv= array(      "D" => "select_default.png",
-        
-
-  "T" => "select_terminal.png",
-        "L" => "select_workstation.png",
-        "F" => "select_phone.png",
-        "S" => "select_server.png",
-        "NT" => "select_new_terminal.png",
-        "NL" => "select_new_workstation.png",
-        "W" => "select_winstation.png",
-        "C" => "select_component.png",
-        "P" => "select_printer.png");
+    $conv= array(      
+        "D" => array("select_default.png",_("Template")),
+        "T" => array("select_terminal.png",_("Terminal")),
+        "L" => array("select_workstation.png",_("Workstation")),
+        "F" => array("select_phone.png",_("Phone")),
+        "S" => array("select_server.png",_("Server")),
+        "NT"=> array("select_new_terminal.png",_("New Terminal")),
+        "NL"=> array("select_new_workstation.png",_("New Workstation")),
+        "W" => array("select_winstation.png",_("Winstation")),
+        "C" => array("select_component.png",_("Network Device")),
+        "P" => array("select_printer.png",_("Printer")));
 
    if((isset($input['is_new']))&&(!empty($input['is_new']))){
      $input['type']="N".$input['type'];
    }
    foreach ($conv  as $key => $value){
       if($input['type']==$key){
-        $tmp['img'] ="<img src='images/".$value."' alt='".$key."' title='%s'>";
+        $tmp['img'] ="<img src='images/".$value[0]."' alt='".$key."' title='".$value['1']."'>";
         $tmp['class']=$key;
         return $tmp;
       }
@@ -793,10 +830,34 @@ class systems extends plugin
     /* Get all gotoTerminal's */
     $this->terminals= array();
 
-    $res= get_list($this->ui->subtreeACL, "(|$termfilter$workfilter$winfilter$printfilter$phonefilter$serverfilter$netfilter)", TRUE, $base, array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), TRUE);
+    $res= get_list($this->ui->subtreeACL, "(|$termfilter)", FALSE, "ou=terminals,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE);
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$serverfilter)", FALSE, "ou=servers,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$phonefilter)", FALSE, "ou=phones,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$netfilter)", FALSE, "ou=netdevices,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$printfilter)", FALSE, "ou=printers,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$workfilter)", FALSE, "ou=workstations,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
+
+    $res= array_merge($res,
+          get_list($this->ui->subtreeACL, "(|$winfilter)", FALSE, "ou=winstations,ou=systems,".$base, 
+        array("cn", "description", "macAddress", "objectClass", "sambaDomainName"), FALSE));
 
-      
-    /* NEW LIST MANAGMENT
+/* NEW LIST MANAGMENT
      * We also need to search for the departments
      * So we are able to navigate like in konquerer
      */