Code

Added creation Posts
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 09:49:05 +0000 (09:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 09:49:05 +0000 (09:49 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15076 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/askClassName.tpl
gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/fai-list.xml

index 7975e1052ecfd62937c484bc9bb9c5d812b6cdb8..7c4329ae709e90d86f0eaa2da912c96dc4268314 100644 (file)
@@ -63,7 +63,6 @@
  </tr>
 </table>
 
-<!--
 <table summary="">
        <tr>
                <td>
@@ -78,7 +77,6 @@
                </td>
        </tr>
 </table>
--->
 <p class="seperator">&nbsp;</p>
        
 <!-- Place cursor -->
index 7a23abecd58a5092c7c17c939b68b41c732adfeb..310f203288d0044d2947cf26ba8a278947dec563 100644 (file)
@@ -85,6 +85,15 @@ class faiManagement extends management
     if($this->config->get_cfg_value("enableSnapshots") == "true"){
       $this->snapHandler = new SnapshotHandler($this->config);
     }
+
+    $this->registerAction("new_profile","newEntry");
+    $this->registerAction("new_template","newEntry");
+    $this->registerAction("new_script","newEntry");
+    $this->registerAction("new_hook","newEntry");
+    $this->registerAction("new_variable","newEntry");
+    $this->registerAction("new_package","newEntry");
+    $this->registerAction("new_partition","newEntry");
+
     $this->registerAction("editByGroup","editByGroup");
     $this->registerAction("createBranch","createBranch");
     $this->registerAction("createFreeze","createFreeze");
@@ -96,6 +105,86 @@ class faiManagement extends management
   }
 
 
+  function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    /****************
+      Create a new object
+     ****************/
+
+    $types = array( 
+        "new_partition"     =>  "FAIpartitionTable",
+        "new_script"        =>  "FAIscript",
+        "new_hook"          =>  "FAIhook",
+        "new_variable"      =>  "FAIvariable",
+        "new_template"      =>  "FAItemplate",
+        "new_package"       =>  "FAIpackageList");
+    $types_i18n = array( 
+        "new_partition"     =>  _("partition table"),
+        "new_script"        =>  _("script"),
+        "new_hook"          =>  _("hook"),
+        "new_variable"      =>  _("variable"),
+        "new_template"      =>  _("template"),
+        "new_package"       =>  _("package list"));
+
+    if(isset($types[$action])){
+      $type_acl_mapping = array(
+          "FAIpartitionTable"  => "faiPartitionTable",
+          "FAIpackageList"     => "faiPackage",
+          "FAIscript"          => "faiScript",
+          "FAIvariable"        => "faiVariable",
+          "FAIhook"            => "faiHook",
+          "FAIprofile"         => "faiProfile",
+          "FAItemplate"        => "faiTemplate");
+
+      $acl = $this->ui->get_permissions($this->acl_base,"fai/".$type_acl_mapping[$types[$action]]);
+      if(preg_match("/c/",$acl)){
+        $this->dialogObject = new askClassName($this->config,$this->dn,$this->ui,$types[$action]);
+        $this->dialogObject->parent = &$this;
+      }else{
+        msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), $types_i18n[$action]),      ERROR_DIALOG);
+      }
+    }
+    if($action == "new_profile"){
+      $this->dn = "new" ;
+
+      $acl = $this->ui->get_permissions($this->acl_base,"fai/faiProfile");
+      if(preg_match("/c/",$acl)){
+        $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
+        $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+        $this->dialog->set_acl_base($this->base);
+        $this->dialog->parent = &$this;
+
+        $this->is_dialog = false;
+      }else{
+        msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), _("profile")), ERROR_DIALOG);
+      }
+    }
+  }
+
+
+  function newClassNameSelected()
+  {
+    $this->dialogObject->save_object();
+    if(count($this->dialogObject->check())!=0){
+      foreach($this->dialogObject->check() as $msg){
+        msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+      }
+    }elseif(isset($this->dialogObject->objectClass)){
+      $this->dn = "new" ;
+      $a_setup= $this->get_type(array("objectClass"=>array($this->dialogObject->objectClass)));
+      $name = $this->dialogObject->save();
+
+      if(class_exists($a_setup[0])){
+        $this->tabObject = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+        $this->tabObject->set_acl_base($this->base);
+        $this->tabObject->by_object[$a_setup[1]]->cn = $name;
+        $this->tabObject->parent = &$this;
+      }
+    }
+  }
+
+
+
   function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
   {
     $headpage = $this->getHeadpage();
@@ -262,6 +351,14 @@ class faiManagement extends management
   function detectPostActions()
   {
     $action = management::detectPostActions();
+    if(isset($_POST['new_profile'])) $action['action'] = "new_profile";
+    if(isset($_POST['new_template'])) $action['action'] = "new_template";
+    if(isset($_POST['new_script'])) $action['action'] = "new_script";
+    if(isset($_POST['new_hook'])) $action['action'] = "new_hook";
+    if(isset($_POST['new_variable'])) $action['action'] = "new_variable";
+    if(isset($_POST['new_package'])) $action['action'] = "new_package";
+    if(isset($_POST['new_partition'])) $action['action'] = "new_partition";
+
     if(isset($_POST['faiGroupHandle_cancel'])) $action['action'] = "cancel";
     if(isset($_POST['CancelBranchName'])) $action['action'] = "cancel";
     if(isset($_POST['delete_branch_confirm'])) $action['action'] = "removeBranchConfirmed";
index 23d2e8aad13387be8364d9250ea127ee86386fa9..d7b7503208c5915b8137ff7d1228c78b0f3b1514 100644 (file)
@@ -8,7 +8,7 @@
     <multiSelect>true</multiSelect>
     <template>fai-list.tpl</template>
     <module>fai</module>
-    <label>List of fai stuff!!!!!</label>
+    <label>List of deployment classes and products</label>
     <defaultSortColumn>1</defaultSortColumn>
 
     <objectType>
      <label>Create</label>
 
      <action>
-      <name>new</name>
+      <name>new_profile</name>
       <type>entry</type>
-      <image>plugins/rolemanagement/images/new.png</image>
-      <label>Role</label>
+      <image>plugins/fai/images/fai_profile.png</image>
+      <label>Profile</label>
      </action>
-    </action>
-
-    <action>
-      <type>separator</type>
-    </action>
-
-    <action>
-      <name>edit</name>
+     <action>
+      <name>new_template</name>
       <type>entry</type>
-      <image>images/lists/edit.png</image>
-      <label>Edit</label>
-    </action>
-
-    <action>
-      <name>remove</name>
+      <image>plugins/fai/images/fai_template.png</image>
+      <label>Template</label>
+     </action>
+     <action>
+      <name>new_script</name>
       <type>entry</type>
-      <image>images/lists/trash.png</image>
-      <label>Remove</label>
+      <image>plugins/fai/images/fai_script.png</image>
+      <label>Script</label>
+     </action>
+     <action>
+      <name>new_hook</name>
+      <type>entry</type>
+      <image>plugins/fai/images/fai_hook.png</image>
+      <label>Hook</label>
+     </action>
+     <action>
+      <name>new_variable</name>
+      <type>entry</type>
+      <image>plugins/fai/images/fai_variable.png</image>
+      <label>Variable</label>
+     </action>
+     <action>
+      <name>new_package</name>
+      <type>entry</type>
+      <image>plugins/fai/images/fai_packages.png</image>
+      <label>Package list</label>
+     </action>
+     <action>
+      <name>new_partition</name>
+      <type>entry</type>
+      <image>plugins/fai/images/fai_partitionTable.png</image>
+      <label>Partition table</label>
+     </action>
+
     </action>
 
     <action>