From a054e7747c3edef94163cf95de7b8d26e21e21da Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 19 Apr 2011 09:34:33 +0000 Subject: [PATCH] Updated template engine git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20742 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../TemplateEngine/TemplateEngine.tpl | 4 +- .../TemplateEngine/class_TemplateEngine.inc | 1 + .../class_newConfigManagement.inc | 37 +++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateEngine.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateEngine.tpl index 8767de994..9372b25eb 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateEngine.tpl +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateEngine.tpl @@ -1,4 +1,6 @@ -

Module name

+

{$typeData.description}

+ +
{$template} diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc index f5eb611b4..fd9617c60 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc @@ -121,6 +121,7 @@ class TemplateEngine { $smarty = get_smarty(); $smarty->assign("type", $this->itemType); + $smarty->assign("typeData", $this->data[$this->itemType]); // Tell smarty the HTML-content for each widget and the name that should be // displayed. diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 2c0383e33..5cf92797a 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -616,9 +616,40 @@ class newConfigManagement extends plugin $item = $this->currentObject; $type = $this->TemplateEngine->getItemType(); if($this->cfgItemMap[$type] == 'root'){ - echo "{$type} Cannot be saved yet"; - $this->listing->clearDialogObject(); - return; + + // We've to create a new distribution + if($type == 'Distribution'){ + $name = $values['name']; + $itype = $values['installation_type']; + $imethod = $values['installation_method']; + $mirror = $values['mirror']; + + $rpc = $this->config->getRpcHandle(); + $res = $rpc->createDistribution($name, $itype, array('mirror'=>$mirror, 'install_method' => $imethod)); + + print_a(array($name, $itype, array('mirror'=>$mirror, 'install_method' => $imethod))); + + if(!$rpc->success()){ + msg_dialog::display(_("Error"), sprintf(_("Failed to save distributions: %s"), $rpc->get_error()),ERROR_DIALOG); + return(NULL); + }else{ + + // We've successfully added the item, now add it to the tree. + $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],array(), '-' ); + + // Finally - close the dialog. + $this->listing->clearDialogObject(); + } + + + $this->listing->clearDialogObject(); + + }else{ + + echo "{$type} Cannot be saved yet"; + $this->listing->clearDialogObject(); + return; + } } // Save a CONFIG-ITEM object. -- 2.30.2