From: hickert Date: Tue, 17 May 2011 11:28:11 +0000 (+0000) Subject: Updated Device Config X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ed789d87c70204f07de7f35a66ce41716d59c13f;p=gosa.git Updated Device Config git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20844 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc index 253532be6..4e981fb1d 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_DeviceConfig.inc @@ -21,15 +21,15 @@ class DeviceConfig extends plugin public $initialized = FALSE; + /*! \brief Initialize the plugin and its widgets. - * Finally call init() to load values from the backend. */ function __construct(&$config, $dn, $parent) { plugin::plugin($config, $dn); + // Get the account information from the generic class. $this->is_account = $this->initially_was_account = FALSE; - $this->_device = &$parent; $this->deviceUUID = $parent->deviceUUID; @@ -66,11 +66,14 @@ class DeviceConfig extends plugin $this->parameterList->setAcl('rwcdm'); } + function check() { } - + + /*! \brief Generates the HTML output for the plugin + */ function execute() { @@ -92,7 +95,6 @@ class DeviceConfig extends plugin } } - // Log account access if($this->is_account && !$this->view_logged){ $this->view_logged = TRUE; @@ -125,13 +127,21 @@ class DeviceConfig extends plugin } } + /*************** + Create the HTML content with its lists + ***************/ + // 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){ + + // skip already assigned elements if(in_array($name, $this->usedElements)) continue; + + // Create the list elements. $data[$name] = $element; $desc = (isset($element['description'])) ? $element['description'] : ''; $lData[$name] = array('data' => array($name, $desc)); @@ -142,6 +152,8 @@ class DeviceConfig extends plugin // Build list of assigned Elements $data = $lData = array();; foreach($this->usedElements as $name){ + + // check if the assgined element is still available, if not mark it in red. if(isset($this->assignableElements[$name])){ $element = $this->assignableElements[$name]; $data[$name] = $element; @@ -150,7 +162,6 @@ class DeviceConfig extends plugin $element = NULL; $data[$name] = $element; $desc = ""._("Unknown config item").""; - } $lData[$name] = array('data' => array($name, $desc)); } @@ -160,23 +171,27 @@ class DeviceConfig extends plugin $data = $lData = array();; foreach($this->usedElements as $name){ + // Skip parameters for not existent items. if(!isset($this->assignableElements[$name]['parameter'])) continue; + // Build up the parameter list using the 'TemplateWidget_string' class. $parameter = $this->assignableElements[$name]['parameter']; foreach($parameter as $param => $desc){ $data[$param] = NULL; $value = (isset($this->parameterValues[$param])) ? $this->parameterValues[$param] : ""; + // Create template widget on demand. if(!isset($this->parameterWidgets[$param])){ $this->parameterWidgets[$param] = new TemplateWidget_string($this->config, $param, $value, $desc, '', FALSE, 'string', $param); } $w = $this->parameterWidgets[$param]; - $lData[$param] = array('data' => array($w->getDisplayName(), $w->render())); + $lData[$param] = array('data' => array($w->getDisplayName(),$desc, $w->render())); } } $this->parameterList->setListData($data, $lData); + // Build up smarty template. $smarty = get_smarty(); $smarty->assign("error", FALSE); $smarty->assign("assignableElementsList", $this->assignableElementsList->render()); @@ -186,9 +201,11 @@ class DeviceConfig extends plugin } + /*! \brief Act on posted values. + * And keep track of posted values. + */ function save_object() { - // Get posted parameter values foreach($this->parameterWidgets as $name => $w){ $w->save_object(); @@ -213,9 +230,10 @@ class DeviceConfig extends plugin } + /*! \brief Save changes back to the GOsa-ng server. + */ function save() { - // Collect paramter list. $params = array(); foreach($this->usedElements as $name){ @@ -243,6 +261,8 @@ class DeviceConfig extends plugin } + /*! \brief Removes the account from the device. + */ function remove_from_parent() { // Save changes back to server. @@ -259,8 +279,8 @@ class DeviceConfig extends plugin static function plInfo() { return (array( - "plShortName" => _("Device"), - "plDescription" => _("Registered device"), + "plShortName" => _("Device config"), + "plDescription" => _("Device config"), "plSelfModify" => FALSE, "plDepends" => array(), "plPriority" => 1,