Code

Updated Config Mangement to enabled Template editing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 May 2011 12:35:55 +0000 (12:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 May 2011 12:35:55 +0000 (12:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20859 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc
gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.json
gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl

index 4168b36434133fed389f7c0f9ff8463b16850429..31f3df8f0416cb491b09a53c589767b0f8760985 100644 (file)
@@ -727,8 +727,6 @@ class newConfigManagement extends plugin
             }
             if(in_array($values['name'],$usedNames)){
                 $msgs[] = msgPool::duplicated(_("Name"));
-            #}elseif(preg_match("/[^a-z0-9\.]/i",$values['name'])){
-            #    $msgs[] = msgPool::invalid(_("Name"), $values['name'], '/[a-z0-9\.]/');
             }
         }
 
@@ -840,6 +838,29 @@ class newConfigManagement extends plugin
                         $this->listing->clearDialogObject();
                     }
                 }
+            }elseif($type == "Template"){
+
+                    // Initiate the rpc request.
+                    $rpc = $this->config->getRpcHandle();
+                    $res = $rpc->installSetTemplate($values['name'], $values);
+                    if(!$rpc->success()){
+                        msg_dialog::display(_("Error"), sprintf(_("Failed to save template: %s"), $rpc->get_error()),ERROR_DIALOG);
+                        return(NULL);
+                    }else{
+                        
+                        // We've successfully added/saved the item, now add it to the tree.
+                        if(!$item){
+                            $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],$values, '-' );
+                            $this->listing->clearDialogObject();
+                        }else{
+
+                            // Update the model and clear the dialogs 
+                            $path = $item['path'];
+                            $this->dataModel->setItemValues($path, $values);
+                            $this->listing->clearDialogObject();
+                        }
+                    }
+                
             }else{
                 echo "{$type} Cannot be saved yet";
                 $this->listing->clearDialogObject();
index 3156d45ce600d6c6f4cb18b8f1fd224b93782970..423df6e218b961a7ffbac976949a62b9ed0234d8 100644 (file)
@@ -92,7 +92,7 @@
                     "name": {
                         "description": "Name",
                         "default": "",
-                        "syntax": "/^[a-z0-9\-\.]*$/i",
+                        "syntax": "/^[a-z0-9\\-\\.]*$/i",
                         "value": "",
                         "required": true,
                         "type": "string",
                         "value": "",
                         "syntax": "/^[a-z0-9\\-]*$/i",
                         "required": true,
+                        "initiallyEditableOnly": true,
                         "type": "string",
                         "display": "Name"
                     },
index e2d8cd532d95f3bdcd8ed0645d6c2a614de8094e..e2c513404fe75073cbcd40d5d506d9ab70eeb742 100644 (file)
@@ -28,7 +28,7 @@
         </td>
         <td class="left-border">
         </td><td>
-            <table>
+            <table width="100%">
                 <tr>
                     <td>{$architecturesName}</td>
                     <td>{$architectures}</td>