Code

Allow to save item changes again
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 12:41:19 +0000 (12:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Apr 2011 12:41:19 +0000 (12:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20657 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementListing.inc
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc

index cc59dc7cf9bcbf6c692a4df852cbdc0c5d7f5107..e02848aebafa1b3a93266e40ec03d7c3383b9c8e 100644 (file)
@@ -8,6 +8,8 @@ class ConfigManagementListing extends management
     private $containerSelector = NULL;
     private $objectTypeStr = "";
 
+    public $parent;
+
     function __construct($config, $ui, $parent)
     {
         // Set storage points - We do not have any - We just create a fake list which lists all items
@@ -172,18 +174,19 @@ class ConfigManagementListing extends management
 
         $items = "";
         $i = 0;
-        foreach($this->parent->addableContainerItems as $item){
-            $desc = $this->parent->itemConfig[$item]['description'];
-            $img = $images[$i++];
-            $items .=
-                "<action>".
-                "    <name>add_{$item}</name>".
-                "    <type>entry</type>".
-                "    <image>{$img}</image>".
-                "    <label>{$desc}</label>".
-                "</action>";
+        if($this->parent){
+            foreach($this->parent->addableContainerItems as $item){
+                $desc = $this->parent->itemConfig[$item]['description'];
+                $img = $images[$i++];
+                $items .=
+                    "<action>".
+                    "    <name>add_{$item}</name>".
+                    "    <type>entry</type>".
+                    "    <image>{$img}</image>".
+                    "    <label>{$desc}</label>".
+                    "</action>";
+            }
         }
-
         if(!empty($items)){
             $items =
 
@@ -220,7 +223,12 @@ class ConfigManagementListing extends management
 
         $this->registerAction("cancelItemEdit", "closeDialogs");
         $this->registerAction("cancelItemAdd", "closeDialogs");
-        $this->registerAction("saveItemAdd", "saveItemAdd");
+        $this->registerAction("saveItemChanges", "saveItemChanges");
+    }
+
+    function saveItemChanges()
+    {
+        $this->parent->saveItemChanges();
     }
 
     function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
@@ -245,6 +253,10 @@ class ConfigManagementListing extends management
         $this->dialog = TRUE;
 
     }
+    function clearDialogObject()
+    {
+        $this->closeDialogs();
+    }
 } 
 
 ?>
index bf29fc9e9fb2541d033195379ddf098938d0fd97..06ddce55ff5568ca276953f22328ca3c4ea0fd90 100644 (file)
@@ -16,6 +16,10 @@ class newConfigManagement extends plugin
     var $cfgTypeMap = NULL;
     var $cfgItemMap = NULL;
 
+    var $addableContainerItems = array();
+    var $currentObject = NULL;
+
+
     /*! \brief  Initialize the plugin and finally update the data model.
      */
     function __construct($config, $dn)
@@ -434,9 +438,19 @@ class newConfigManagement extends plugin
             $this->setInstallMethod($method);
             $this->TemplateEngine->setValues($item['type'],$item['values']['itemValues']);
             $this->listing->setDialogObject($this->TemplateEngine);
+            $this->currentObject = $item;
         }
     }
 
-
+    function saveItemChanges()
+    {
+        $this->listing->clearDialogObject();
+        $item = $this->currentObject;
+        $this->TemplateEngine->save_object();
+        foreach($this->TemplateEngine->getWidgets() as $w){
+            $item['values']['itemValues'][$w->getName()] = $w->getValue();
+        }
+        $this->dataModel->setItemValues($item['path'], $item['values']);
+    }
 }
 ?>