Code

Added quick create icons
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Sep 2005 07:58:02 +0000 (07:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Sep 2005 07:58:02 +0000 (07:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1327 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/FAI/class_faiHook.inc
plugins/admin/FAI/class_faiManagement.inc
plugins/admin/FAI/class_faiScript.inc
plugins/admin/FAI/class_faiTemplate.inc
plugins/admin/FAI/class_faiVariable.inc

index 71406487dd35695a274acc0e4ab29fd46cd08ef9..e3355cda0152ad249e691252a860e571aad08d13 100644 (file)
@@ -202,10 +202,20 @@ class faiHook extends plugin
     plugin::save();
  
     $ldap = $this->config->get_ldap_link();
-  
-    /* Write FAIscript to ldap*/ 
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
+
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){     
+      /* Write FAIscript to ldap*/ 
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/ 
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error()); 
  
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
index 16307e7bacd29d1df2ce524477c8b55f63f94c5c..76bf88bf22da4584eb37700a5946d5cff5cbddad 100644 (file)
@@ -111,6 +111,14 @@ class faiManagement extends plugin
                foreach($_POST as $key => $val){
                        if(preg_match("/create_partition/i",$key)){
                                $s_action = "new_partition";
+                       }elseif(preg_match("/create_script/i",$key)){
+                               $s_action = "new_script";
+                       }elseif(preg_match("/create_hook/i",$key)){
+                               $s_action = "new_hook";
+                       }elseif(preg_match("/create_variable/i",$key)){
+                               $s_action = "new_variable";
+                       }elseif(preg_match("/create_template/i",$key)){
+                               $s_action = "new_template";
                        }elseif(preg_match("/UseNewClass/",$key)){
                                $s_action = "select_class_name_finished";
                        }elseif(preg_match("/UseSelectedClass/",$key)){
@@ -215,6 +223,26 @@ class faiManagement extends plugin
                        $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpartitionTable");
                }
 
+               /* Dialog handling */
+               if($s_action == "new_script"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIscript");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_hook"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIhook");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_variable"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIvariable");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_template"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAItemplate");
+               }
+
                if($s_action == "select_class_name_finished"){
                        $this->dialog->save_object();
                        if(count($this->dialog->check())!=0){
@@ -223,10 +251,12 @@ class faiManagement extends plugin
                                }               
                        }else{
                                $this->dn = "new" ;
+                               $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
                                $name = $this->dialog->save();
-                               $this->dialog = new tabsPartition($this->config,
-                                               $this->config->data['TABS']['FAIPARTITIONTABS'],$this->dn);
-                               $this->dialog->by_object['faiPartitionTable']->cn = $name;
+
+                               $this->dialog = new $a_setup[0]($this->config,
+                                               $this->config->data['TABS'][$a_setup[2]],$this->dn);
+                               $this->dialog->by_object[$a_setup[1]]->cn = $name;
                                $this->is_dialog = true;
                        }               
                }       
@@ -309,11 +339,20 @@ class faiManagement extends plugin
                        " <input type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
                        " <input type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
 
-                       " <input type='image' src='images/select_new_server.png' align='middle' 
-                       title='"._("New partition table")."' name='Create_partition' alt='"._("Partition")."'>&nbsp;".
+                       " <input type='image' src='images/fai_partitionTable.png' align='middle' 
+                       title='"._("New partition table")."' name='Create_partition' alt='"._("P")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_script.png' align='middle' 
+                       title='"._("New script bundle")."' name='Create_script' alt='"._("S")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_hook.png' align='middle' 
+                       title='"._("New hook bundle")."' name='Create_hook' alt='"._("H")."'>&nbsp;".
 
-                       " <input type='image' src='images/zip.png' align='middle' 
-                       title='"._("New packages")."' name='' alt='"._("Partition")."'>&nbsp;".
+                       " <input type='image' src='images/fai_variable.png' align='middle' 
+                       title='"._("New variable bundle")."' name='Create_variable' alt='"._("V")."'>&nbsp;".
+                       
+                       " <input type='image' src='images/fai_template.png' align='middle' 
+                       title='"._("New template bundle")."' name='Create_template' alt='"._("T")."'>&nbsp;".
 
                        "</div>";
 
index ff452e08795aeaf812caeece79e1c042261f543b..f0e0ac5b048db9327fad69347c542068abbd9660 100644 (file)
@@ -203,9 +203,19 @@ class faiScript extends plugin
  
     $ldap = $this->config->get_ldap_link();
   
-    /* Write FAIscript to ldap*/ 
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
  
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
index e34fa213dad08424296427369c7e32e2a6796568..1ddd0120acc93ef25394f7874b251b8e57dddc90 100644 (file)
@@ -203,9 +203,19 @@ class faiTemplate extends plugin
  
     $ldap = $this->config->get_ldap_link();
   
-    /* Write FAIscript to ldap*/ 
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
  
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
index a110e0b725af604ff6c2a9a2e61e2d33d11fb0d3..08b839c01fe4c2e7ddf481f477d0edf5566360a1 100644 (file)
@@ -203,9 +203,19 @@ class faiVariable extends plugin
  
     $ldap = $this->config->get_ldap_link();
   
-    /* Write FAIscript to ldap*/ 
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
  
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.