From: hickert Date: Mon, 27 Sep 2010 12:44:58 +0000 (+0000) Subject: Added file upload widget X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=843fbc483a2242d778b555fbb019fc4f97712db2;p=gosa.git Added file upload widget git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19800 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 317313c33..263b88d24 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -19,11 +19,9 @@ class DeviceConfig extends plugin "dependency": { "description": "Modules that are needed to be installed for this module", "required": false, - "value": [ - - ], + "value": "0x002", "syntax": "^[a-zA-Z0-9_+\\\\./-]+(\\\\[[<=>]+[a-zA-Z0-9_+\\\\.-]+\\\\])?$", - "type": "list", + "type": "file", "display": "Module dependencies" }, "version": { @@ -31,7 +29,7 @@ class DeviceConfig extends plugin "required": true, "value": "", "syntax": "^[a-zA-Z0-9_+.-]+$", - "type": "textarea", + "type": "string", "display": "Module version" }, "name": { @@ -87,7 +85,7 @@ class DeviceConfig extends plugin $this->setCurrentItem('root'); $this->addItem('PuppetModule','test1', array( - 'dependency' => array('mozilla-2','toaster-2.0'), + 'dependency' => '', 'version' => '2.4-f', 'name' => 'Thundebird', 'description' => 'Mozilla mail client') diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_file.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_file.inc new file mode 100644 index 000000000..4c26fe32e --- /dev/null +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_file.inc @@ -0,0 +1,34 @@ +description); + if(mb_strlen($this->value) == 0){ + $ret = ""._("No file uploaded yet").""; + $ret.= "
+ postName}\" + name=\"{$this->postName}\" + type=\"file\" + size=\"20\" + maxlength=\"255\" + accept=\"*.*\"> "; + $ret.= ""; + }else{ + $ret = ""._("File uploaded").": ".mb_strlen($this->value)." "._("Bytes"); + $ret.= " "; + } + return($ret); + } + + function save_object() + { + if(isset($_POST["{$this->postName}_Upload"]) && isset($_FILES[$this->postName]['tmp_name'])){ + $this->value = file_get_contents($_FILES[$this->postName]['tmp_name']); + } + if(isset($_POST["{$this->postName}_Remove"])) $this->value =""; + } +} + +?> diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_textarea.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_textarea.inc index 26c733c47..030dd1156 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_textarea.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_textarea.inc @@ -4,7 +4,11 @@ class TemplateWidget_textarea extends TemplateWidget { function render() { - return(""); + $title = set_post($this->description); + return(""); } } diff --git a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl index 78a90826c..a5d6787a7 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl @@ -18,7 +18,7 @@ - {$dependencyName} + {$dependencyName}:
{$dependency}