Code

Fixed upper-lowercase problem of class names used when creating a new component.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Oct 2007 08:31:28 +0000 (08:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Oct 2007 08:31:28 +0000 (08:31 +0000)
New layer menu allows creating of new systems now

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7693 594d385d-05f5-0310-b6e9-bd551577e9d8

contrib/gosa.conf
plugins/admin/systems/class_componentGeneric.inc
plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_systemManagement.inc
plugins/admin/systems/tabs_component.inc

index f4cdc3b87fbc6b61cd7e880413877038b3fb11ba..999ecd1f1a25b478a9d657e20d13a80fe29319c9 100644 (file)
        </phonetabs>
 
        <componenttabs>
-               <tab class="componentgeneric" name="Generic" />
+               <tab class="componentGeneric" name="Generic" />
                <tab class="glpiAccount" name="Inventory" />
        </componenttabs>
 
index 4306494b3bc34f7f262f642c1112a381d6e2fd5a..2511398525e093084782ba590b84ef2553830cd3 100644 (file)
@@ -23,7 +23,7 @@ class componentGeneric extends plugin
   var $netConfigDNS;
   var $view_logged  = FALSE;
 
-  function componentgeneric (&$config, $dn= NULL, $parent= NULL)
+  function componentGeneric (&$config, $dn= NULL, $parent= NULL)
   {
     plugin::plugin ($config, $dn, $parent);
 
index 71e0e942656ce5fe69226765daf13dff989c8039..353956223a8e6469c94e5a1c4a4fef3a3d412733 100644 (file)
@@ -162,13 +162,6 @@ class divListSystem extends MultiSelectWindow
     /* Must we add an additional seperator */
     $add_sep = false;
    
-    /* Get copy & paste icon */
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
-      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
-      $addsep = true;
-    }
-
     /* Add default header */
     $listhead = MultiSelectWindow::get_default_header();
 
@@ -178,80 +171,63 @@ class divListSystem extends MultiSelectWindow
       $add_sep = true;
     }
 
-    /* Assign copy & paste icons */
-    $listhead.=      $Copy_Paste;
+    /* Add base selection */
+    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle'
+      title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;";
 
     /* Handle create icons */ 
+    $l = "?plug=".$_GET['plug']."&act=";
+    $s = ".|"._("Actions")."|\n";
+    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_terminal.png'
-        name='newsystem_terminal'    alt='"._("New Terminal template")."' title='"._("New Terminal")."'>&nbsp;";
+      $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Terminal")."|".$l."newsystem_terminal|\n";
     }
-
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_workstation.png'
-        name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>&nbsp;";
-    }
-
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"server/servgeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_server.png'     
-        name='newsystem_server' alt='"._("New Server")."' title='"._("New Server")."'>&nbsp;";
+      $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Workstation")."|".$l."newsystem_workstation|\n";
     }
-
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_printer.png'    
-        name='newsystem_printer'     alt='"._("New Printer")."' title='"._("New Printer")."'>&nbsp;";
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Server")."|".$l."newsystem_server|\n";
     }
-
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_phone.png'      
-        name='newsystem_phone' alt='"._("New Phone")."' title='"._("New Phone")."'>&nbsp;";
+      $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Phone")."|".$l."newsystem_phone|\n";
     }
-
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
-      $add_sep = true;
-      $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_component.png'  
-        name='newsystem_component' alt='"._("New Component")."' title='"._("New Component")."'>&nbsp;";
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
+      $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Printer")."|".$l."newsystem_printer|\n";
     }
-
-    /* Should we add a seperator ? */
-    if($add_sep){
-      $listhead .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
+      $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Component")."|".$l."newsystem_component|\n";
     }
-
-    /* Add base selection */
-    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle'
-      title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;";
-
-    /* Multiple options */
-    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
-        title='"._("Remove selected systems")."' alt='"._("Remove systems")."' name='remove_multiple_systems'>&nbsp;";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove all")."|".$l."remvove_multiple|\n";
 
     /* Add multiple copy & cut icons */
     if(is_object($this->parent->CopyPasteHandler)){
-      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
-        title='"._("Copy selected system")."' alt='"._("Copy systems")."' name='multiple_copy_systems'>&nbsp;";
-      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
-        title='"._("cut selected system")."' alt='"._("Cut systems")."' name='multiple_cut_systems'>&nbsp;";
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy all")."|".$l."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut all")."|".$l."multiple_cut_systems|\n";
+    }
+
+    /* Get copy & paste icon */
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
     }
-    
-    $s= ".|"._("Actions")."|\n";
-    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>&nbsp;"._("Create")."|\n";
-    $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>&nbsp;"._("Terminal")."|\n";
-    $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>&nbsp;"._("Workstation")."|\n";
-    $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>&nbsp;"._("Server")."|\n";
-    $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>&nbsp;"._("Phone")."|\n";
-    $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>&nbsp;"._("Printer")."|\n";
-    $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>&nbsp;"._("Component")."|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>&nbsp;"._("Remove all")."|\n";
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>&nbsp;"._("Copy all")."|\n";
-    $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>&nbsp;"._("Cut all")."|\n";
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
index 1685af29c2cc4282b0f8ee5f1ef61ea1aa9f303e..268e5b33e2c0ee8634f14c2908195ef260715e04 100644 (file)
@@ -104,8 +104,7 @@ class systems extends plugin
         $s_entry  = preg_replace("/^cut_/i","",$key);
       }
     }
-    
-      
+   
     /* Incoming handling  
      * If someone made a systemtype and ogroup selection 
      * Display the new requested entry type ... servtab  in case of server and so on.
@@ -125,6 +124,11 @@ class systems extends plugin
       $s_action ="edit";
       $s_entry  = $_GET['id'];
     }
+    /* Create options */
+    if(isset($_GET['act']) && preg_match("/^newsystem_/",$_GET['act'])){
+      $s_action = "newsystem";
+      $s_entry  = preg_replace("/^newsystem_/","",$_GET['act']);
+    }
 
     /* Check for exeeded sizelimit */
     if (($message= check_sizelimit()) != ""){
@@ -263,13 +267,14 @@ class systems extends plugin
         }
         $this->dn= "new";
       }
+
       $tabs = array(
           "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
           "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
           "server"      => array("CLASS"=>"SERVTABS",     "TABNAME"=>"servgeneric",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
           "printer"     => array("CLASS"=>"PRINTTABS",    "TABNAME"=>"printgeneric",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
           "phone"       => array("CLASS"=>"PHONETABS",    "TABNAME"=>"phoneGeneric",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentgeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentGeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
 
       if(isset($tabs[$sw])){
         $class    = $tabs[$sw]["CLASS"];
@@ -1173,7 +1178,7 @@ class systems extends plugin
           "TABCLASS"  =>"printtabs",    "ACL"     =>"printer"),
         "phone"       => array( "CLASS"     =>"PHONETABS",    "TABNAME" =>"phoneGeneric",    
           "TABCLASS"  =>"phonetabs",    "ACL"     =>"phone"),
-        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentgeneric",
+        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentGeneric",
           "TABCLASS"  =>"componenttabs","ACL"     =>"component"));
 
     /* Add a single entry to queue */
index 3d7d53dde965e79ac08cbf69101d50f89918cd1f..941203e24aa8ef958e81f8bfd95dfdc83aaf69ad 100644 (file)
@@ -21,7 +21,7 @@ class componenttabs extends tabs
   {
     /* Check for new 'dn', in order to propagate the
        'dn' to all plugins */
-    $baseobject= $this->by_object['componentgeneric'];
+    $baseobject= $this->by_object['componentGeneric'];
     $this->dn= "cn=$baseobject->cn,ou=netdevices,ou=systems,".$baseobject->base;
     $baseobject->dn= $this->dn;