Code

Fixed sorting for device config parameters
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 May 2011 11:33:10 +0000 (11:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 May 2011 11:33:10 +0000 (11:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20845 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc

index 4e981fb1d8a79f51dfc1a18aeb5ad8566d8ab95f..c77adbd336a1dcaa24bc9ec9a7aa84b24fc3aba7 100644 (file)
@@ -79,19 +79,32 @@ class DeviceConfig extends plugin
 
         // Initialize to plugin
         if(!$this->initialized){
+
+            // Load config settings for the current device.
             $rpc = $this->config->getRpcHandle();
             $res = $rpc->systemGetConfigParameters($this->deviceUUID);
+            if(!$rpc->success()){
+                $smarty = get_smarty();
+                $smarty->assign("error", TRUE);
+                $smarty->assign("errorMsg", msgPool::rpcError($this->rpcErrorMessage));
+                return($display.$smarty->fetch(get_template_path('goto/Device/DeviceConfig.tpl', TRUE)));
+            }
+            
+            // Load assignable elements.
+            $assignableElements = $rpc->listAssignableElements('squeeze/1.0');
             if(!$rpc->success()){
                 $smarty = get_smarty();
                 $smarty->assign("error", TRUE);
                 $smarty->assign("errorMsg", msgPool::rpcError($this->rpcErrorMessage));
                 return($display.$smarty->fetch(get_template_path('goto/Device/DeviceConfig.tpl', TRUE)));
             }else{
+
+                // Initialization completed.
                 $this->initialized = TRUE;
                 $this->is_account = $this->initially_was_account = isset($res['item']);
-            
                 if(isset($res['var']))     $this->parameterValues = $res['var'];
                 if(isset($res['item']))      $this->usedElements = $res['item'];
+                $this->assignableElements = $assignableElements;
             }
         }
 
@@ -132,9 +145,6 @@ class DeviceConfig extends plugin
          ***************/
 
         // Fill list of assignable elements
-        $rpc = $this->config->getRpcHandle();
-        $res = $rpc->listAssignableElements('squeeze/1.0');
-        $this->assignableElements = $res;
         $data = $lData = array();;
         foreach($this->assignableElements as $name => $element){
 
@@ -148,6 +158,7 @@ class DeviceConfig extends plugin
             
         }
         $this->assignableElementsList->setListData($data, $lData);
+        $this->assignableElementsList->update();
 
         // Build list of assigned Elements
         $data = $lData = array();;
@@ -166,6 +177,7 @@ class DeviceConfig extends plugin
             $lData[$name] = array('data' => array($name, $desc));
         }
         $this->usedElementsList->setListData($data, $lData);
+        $this->usedElementsList->update();
         
         // Build up parameter list
         $data = $lData = array();;
@@ -190,6 +202,7 @@ class DeviceConfig extends plugin
             }
         }
         $this->parameterList->setListData($data, $lData);
+        $this->parameterList->update();
 
         // Build up smarty template.
         $smarty = get_smarty();