summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a421d5)
raw | patch | inline | side by side (parent: 4a421d5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Oct 2010 08:04:17 +0000 (08:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Oct 2010 08:04:17 +0000 (08:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19880 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
index 99379cd9a7368d6839282b71a18dc209789e3f91..03a2a075ab90dda4441211609df6e28d380cde80 100644 (file)
{
// Save eventually changed values
if($this->currentItem){
- foreach($this->TemplateEngine->getWidgets() as $widget){
- $this->currentItem['values'][$widget->getName()] = $widget->getValue();
+
+ // Check if everything is fine.
+ $msgs = $this->TemplateEngine->check();
+ if(count($msgs)){
+ msg_dialog::displayChecks($msgs);
+ }else{
+ foreach($this->TemplateEngine->getWidgets() as $widget){
+ $this->currentItem['values'][$widget->getName()] = $widget->getValue();
+ }
+ $this->closeDialogs();
}
}
- $this->closeDialogs();
}
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateEngine.inc
index 0723bc4fd0437fdb8905868bd215c7a081b49551..484b701f38241fb5948229ab8d4b01f62aee0ed6 100644 (file)
// Prepare the value for the widget
$value = $values[$name];
-
+ $syntax = (isset($item['syntax']))? $item['syntax']: "";
+
// Create the new widget.
$this->widgets[$name] = new $widgetClassName($this->config, $name,
$value,
$item['description'],
+ $syntax,
$item['required'],
$item['type'],
$item['display']);
$widget->save_object();
}
}
+
+
+ /*! \brief Check widget values and return a list of errors.
+ */
+ function check()
+ {
+ $msgs = array();
+ foreach($this->widgets as $widget){
+ $msgs = array_merge($msgs, $widget->check());
+ }
+ return($msgs);
+ }
}
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc
index ef4ff99d68dd32a694f65e716f8a1bd5c6dfbb99..670fbed18c22070e680251d35c09cd421fb5ac19 100644 (file)
protected $required = "";
protected $type = "";
protected $display = "";
+ protected $syntax = "";
/*! \brief Constructs the template widget and sets the default values.
* @param Config The GOsa configuration object.
* @param String The widget type.
* @param String A display name for the widget.
*/
- function __construct(&$config, $name, $value, $description,$required,$type,$display)
+ function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display)
{
$this->config = &$config;
$this->name = $name;
*/
function getDisplayName()
{
- return($this->display);
+ $must = ($this->required)?"<span class='required'>*</span>":"";
+ return($this->display.$must);
+ }
+
+
+ /*! \brief Returns the description for the widget.
+ */
+ function getDescription()
+ {
+ return($this->description);
}
{
$this->value = $value;
}
+
+
+ /*! \brief Check the value entry using the provieded syntax.
+ * @return Array Returns a list of errors
+ */
+ function check()
+ {
+ return(array());
+ }
}
?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc
index 3f1f457efafe1f77e6c76aa08ec0e86d54279f7f..0d21145d8422da581de5b5d65717667489030c96 100644 (file)
class TemplateWidget_list extends TemplateWidget
{
- function __construct(&$config, $name, $value, $description,$required,$type,$display)
+ function __construct(&$config, $name, $value, $description,$syntax,$required,$type,$display)
{
- parent:: __construct($config, $name, $value, $description,$required,$type,$display);
+ parent:: __construct($config, $name, $value, $description,$syntax,$required,$type,$display);
$this->listWidget= new sortableListing($this->value);
$this->listWidget->setEditable(false);
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_string.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_string.inc
index 1ff9520a5e47d44ca366d3db3863fae56db0dc5a..2bf3ccca030331d374800e93af72e4cf2b3957f3 100644 (file)
{
function render()
{
- return("<input type='text' name=\"{$this->postName}\" value=\"".set_post($this->value)."\">");
+ $desc = set_post($this->description);
+ $value = set_post($this->value);
+
+ $name = " name=\"{$this->postName}\" ";
+ $value = " value=\"{$value}\" ";
+ $title = (empty($this->description))?"": " title=\"{$desc}\"";
+
+ return("<input type='text' {$title} {$name} {$value }>");
}
}