From: hickert Date: Wed, 6 Jan 2010 09:49:05 +0000 (+0000) Subject: Added creation Posts X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=55ed6b31348a7f762ba85a363df7a37e23ba866c;p=gosa.git Added creation Posts git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15076 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/askClassName.tpl b/gosa-plugins/fai/admin/fai/askClassName.tpl index 7975e1052..7c4329ae7 100644 --- a/gosa-plugins/fai/admin/fai/askClassName.tpl +++ b/gosa-plugins/fai/admin/fai/askClassName.tpl @@ -63,7 +63,6 @@ -

 

diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 7a23abecd..310f20328 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -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"; diff --git a/gosa-plugins/fai/admin/fai/fai-list.xml b/gosa-plugins/fai/admin/fai/fai-list.xml index 23d2e8aad..d7b750320 100644 --- a/gosa-plugins/fai/admin/fai/fai-list.xml +++ b/gosa-plugins/fai/admin/fai/fai-list.xml @@ -8,7 +8,7 @@ true fai - + 1 @@ -52,29 +52,48 @@ - new + new_profile entry - plugins/rolemanagement/images/new.png - + plugins/fai/images/fai_profile.png + - - - - separator - - - - edit + + new_template entry - images/lists/edit.png - - - - - remove + plugins/fai/images/fai_template.png + + + + new_script entry - images/lists/trash.png - + plugins/fai/images/fai_script.png + + + + new_hook + entry + plugins/fai/images/fai_hook.png + + + + new_variable + entry + plugins/fai/images/fai_variable.png + + + + new_package + entry + plugins/fai/images/fai_packages.png + + + + new_partition + entry + plugins/fai/images/fai_partitionTable.png + + +