summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5470de6)
raw | patch | inline | side by side (parent: 5470de6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 7 Apr 2011 12:30:32 +0000 (12:30 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 7 Apr 2011 12:30:32 +0000 (12:30 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20662 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc
index e02848aebafa1b3a93266e40ec03d7c3383b9c8e..7879644482067350a6c3c50295f6cef97b9a6e21 100644 (file)
$img = $images[$i++];
$items .=
"<action>".
- " <name>add_{$item}</name>".
+ " <name>new_{$item}</name>".
" <type>entry</type>".
" <image>{$img}</image>".
" <label>{$desc}</label>".
$this->registerAction("cancelItemEdit", "closeDialogs");
$this->registerAction("cancelItemAdd", "closeDialogs");
$this->registerAction("saveItemChanges", "saveItemChanges");
+
+ if($this->parent){
+ foreach($this->parent->addableContainerItems as $item){
+ $this->registerAction("new_{$item}", "newEntry");
+ }
+ }
+
}
function saveItemChanges()
// $this->parent->removeEntry($target);
}
+ function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+ {
+ $this->parent->newEntry(preg_replace("/^new_/", "", $action));
+ }
+
function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
{
$this->parent->openEntry($target);
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
index 6910f6559b4b0baabe828a7f9d3afd304e875188..5f56ac0bb7f655dafdb673fc6000bc7433a7f79e 100644 (file)
}
}
+ function newEntry($type)
+ {
+ $method = $this->cfgItemMap[$type];
+ $this->setInstallMethod($method);
+ $this->TemplateEngine->setValues($type,array());
+ $this->listing->setDialogObject($this->TemplateEngine);
+ $this->currentObject = NULL;
+ }
+
function saveItemChanges()
{
$item = $this->currentObject;
- $this->listing->clearDialogObject();
- $this->TemplateEngine->save_object();
- $values = array();
- foreach($this->TemplateEngine->getWidgets() as $w){
- $values[$w->getName()] = $w->getValue();
- }
- $release = preg_replace("/^.*\//","",$item['values']['__release']);
- $path = $item['values']['__path'];
- $method = $this->cfgItemMap[$item['type']];
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->setConfigItem($release, $path, $item['type'], $values);
- if(!$rpc->success()){
- msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
- return(NULL);
+ if($item == NULL){
+ $this->TemplateEngine->save_object();
+ $release = preg_replace("/^.*\//","",$this->selectedContainer);
+ $type = $this->TemplateEngine->getItemType();
+ $values = array();
+ foreach($this->TemplateEngine->getWidgets() as $w){
+ $values[$w->getName()] = $w->getValue();
+ }
+ $path = "/".$values['name'];
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->setConfigItem($release, $path, $type, $values);
+ if(!$rpc->success()){
+ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
+ return(NULL);
+ }else{
+ //$item['values']['itemValues'] = $values;
+ //$this->dataModel->setItemValues($item['path'], $item['values']);
+ $this->listing->clearDialogObject();
+ }
+ print_a(array($release, $path, $type, $values));
}else{
- $item['values']['itemValues'] = $values;
- $this->dataModel->setItemValues($item['path'], $item['values']);
+ $this->TemplateEngine->save_object();
+ $values = array();
+ foreach($this->TemplateEngine->getWidgets() as $w){
+ $values[$w->getName()] = $w->getValue();
+ }
+ $release = preg_replace("/^.*\//","",$item['values']['__release']);
+ $path = $item['values']['__path'];
+ $method = $this->cfgItemMap[$item['type']];
+
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->setConfigItem($release, $path, $item['type'], $values);
+ print_a(array($release, $path, $item['type'], $values));
+ if(!$rpc->success()){
+ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG);
+ return(NULL);
+ }else{
+ $item['values']['itemValues'] = $values;
+ $this->dataModel->setItemValues($item['path'], $item['values']);
+ $this->listing->clearDialogObject();
+ }
}
}
}