summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ba4adb)
raw | patch | inline | side by side (parent: 2ba4adb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 20 Apr 2011 15:32:03 +0000 (15:32 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 20 Apr 2011 15:32:03 +0000 (15:32 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20760 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl
--- /dev/null
@@ -0,0 +1,12 @@
+{if $write_protect}
+ {t}The text is write protected due to its encoding. Editing may break it!{/t}
+ <br>
+ <button type='submit' name='editAnyway' {if !$enabled} disabled {/if}>{t}Edit anyway{/t}</button>
+{/if}
+<textarea {if !$enabled} disabled {/if} {if $write_protect} disabled {/if} {if !$write_protect} name="{$postName}" {/if}
+ style="width:100%;height:300px;" id="{$postName}"
+ rows="20" cols="120">{$value}</textarea>
+<div>
+ <input type="file" name="ImportFile" {if !$enabled} disabled {/if}>
+ <button type='submit' name='ImportUpload' {if !$enabled} disabled {/if}>{t}Import text{/t}</button>
+</div>
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateEngine.inc
index fd9617c609bcec2b2b29c84e6f72caaaaf84c4be..e81fe3eb24005a005e18c2319a6023696035610c 100644 (file)
{
return($this->itemType);
}
+
+ function editItem($type, $values)
+ {
+ $this->is_new = FALSE;
+ $this->setValues($type, $values);
+ }
+
+
+ function createItem($type, $values)
+ {
+ $this->is_new = TRUE;
+ $this->setValues($type, $values);
+ }
+
/*! \brief Sets the current item type we want to render
* E.g. 'KickstartTemplate' and the corresponding values.
$item['type'],
$item['display'],
$providedValues);
+
+ // Check if we've to disable this item.
+ if(isset($item['disable']) && $item['disable'] ||
+ isset($item['initiallyEditableOnly']) && $item['initiallyEditableOnly']){
+ $this->widgets[$name]->setEnabled(FALSE);
+ }
}
}
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget.inc
index 45f4fae0317ee86d6984c9513e5a5f084bc069a9..190d9c7ee937ea8c27388a73808a49206e024be1 100644 (file)
protected $display = "";
protected $syntax = "";
protected $values = "";
+ protected $enabled = TRUE;
/*! \brief Constructs the template widget and sets the default values.
* @param Config The GOsa configuration object.
}
+ /*! \brief Enabled or disabled the widget.
+ */
+ function setEnabled($bool = TRUE)
+ {
+ $this->enabled = $bool;
+ }
+
+
/*! \brief Returns the display-name for the current widget.
* @return String The display-name for the widget, this
* name will usually be rendered infront of input fields.
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc
index cd6cb1b0ff644538bd1ce24e2c59b1b7dbaec0b2..43318395e27a439bba95fc32e6cb79835f9ebcde 100644 (file)
--- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc
+++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc
function render()
{
$str = "";
- $str .= "<input type='checkbox' value='1' name='{$this->postName}' ";
+ $disabled = (!$this->enabled)? "disabled" : "";
+ $str .= "<input type='checkbox' value='1' name='{$this->postName}' {$disabled}";
if($this->value) $str .= " checked ";
$str .= ">";
return($str);
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc
index d0a306926f938b62cb50fca7e46d9d2bda034d86..e1b4ecdb41e174beb1f5802eb5610e6a6376b97f 100644 (file)
--- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc
+++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc
$str = "";
// Build up list data
- $str .= "<select size='1' name='{$this->postName}'>";
+ $disabled = (!$this->enabled)? "disabled" : "";
+ $str .= "<select size='1' name='{$this->postName}' {$disabled}>";
foreach($this->values as $name => $value){
if($name == $this->value){
$str .= "<option selected value=\"{$name}\">{$value}</option>\n";
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc
index d73f64641e4c474e134b85fe9261c5527e4f121c..197d6453a4ab19c4895c55f30fab8a8aea22a51c 100644 (file)
function render()
{
- $title = set_post($this->description);
+ $title = set_post($this->description);
+ $disabled = (!$this->enabled) ? 'disalbed' : '';
if(mb_strlen($this->value) == 0){
$ret = "<i>"._("No file uploaded yet")."</i>";
$ret.= "<br> <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\">
<input id=\"{$this->postName}\"
name=\"{$this->postName}\"
+ {$disabled}
type=\"file\"
size=\"20\"
maxlength=\"255\"
accept=\"*.*\"> ";
- $ret.= "<button name='{$this->postName}_Upload'>"._("Upload")."</button>";
+ $ret.= "<button {$disabled} name='{$this->postName}_Upload'>"._("Upload")."</button>";
}else{
$ret = "<i>"._("File uploaded").": ".mb_strlen($this->value)." "._("Bytes");
- $ret.= " <button name='{$this->postName}_Remove'>".msgPool::delButton()."</button>";
+ $ret.= " <button {$disabled} name='{$this->postName}_Remove'>".msgPool::delButton()."</button>";
}
return($ret);
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc
index 0f9809728beb0dcc3f32b310101a13c55ec9a1d4..8e227e218ae3dbec0440a0931a7301d84ca2bbc7 100644 (file)
--- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc
+++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc
$str = "";
// Build up list data
+ $this->listWidget->setDeleteable($this->enabled);
+ $disabled = (!$this->enabled)? "disabled" : "";
$data = $this->value;
foreach($this->value as $key => $name){
$lData[$key] = array('data' => array($this->values[$name]));
$this->listWidget->setListData($data, $lData);
$this->listWidget->update();
$str .= $this->listWidget->render();
- $str .= "<select size='1' name='{$this->postName}_Input'>";
+ $str .= "<select size='1' name='{$this->postName}_Input' {$disabled}>";
foreach($this->getAvailableOptions() as $name => $value){
$str .= "<option value=\"{$name}\">{$value}</option>\n";
}
$str .= "</select>";
- $str .= "<button name='{$this->postName}_Add'>".msgPool::addButton()."</button>";
+ $str .= "<button name='{$this->postName}_Add' {$disabled}>".msgPool::addButton()."</button>";
return($str);
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc
index ccac0fee9c74059746170ff045552462aed71cd3..8bf17a07f32a2d96e5479e9abfd5a778214cd74b 100644 (file)
function render()
{
$str = "";
+ $this->listWidget->setDeleteable($this->enabled);
$this->listWidget->setListData($this->value);
$this->listWidget->update();
$str .= $this->listWidget->render();
- $str .= "<input type='text' name='{$this->postName}_Input'>";
- $str .= "<button name='{$this->postName}_Add'>".msgPool::addButton()."</button>";
+ $disabled = (!$this->enabled)? "disabled" : "";
+
+ $str .= "<input type='text' name='{$this->postName}_Input' {$disabled}>";
+ $str .= "<button name='{$this->postName}_Add' {$disabled}>".msgPool::addButton()."</button>";
return($str);
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_string.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_string.inc
index 2bf3ccca030331d374800e93af72e4cf2b3957f3..99dc273b83f1350b7f4c1f2eb2cf020bcad6eb16 100644 (file)
{
$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 }>");
+
+ $disabled = (!$this->enabled)? "disabled" : "";
+ return("<input type='text' {$title} {$name} {$value} {$disabled}>");
}
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc
index 7c824f4f14991d6852f291bb5a024d10d8c67686..ce85384bb1fd79a436c7daee3d5bb8e6e6d92593 100644 (file)
--- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc
+++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc
$smarty->assign("postName", set_post($this->postName));
$smarty->assign("write_protect", set_post($this->write_protect));
$smarty->assign("value", set_post($this->value));
+ $smarty->assign("enabled", set_post($this->enabled));
return($smarty->fetch(get_template_path("TemplateWidget_textEditor.tpl", TRUE, dirname(__FILE__))));
}
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc
index 030dd1156e2331f3f7c5ae1585dc997923b5c644..8ca6ff8387d10d9f807fd2192aa65fd3fe0fae71 100644 (file)
--- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc
+++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc
function render()
{
$title = set_post($this->description);
+ $disabled = (!$this->enabled)? "disabled" : "";
return("<textarea title=\"{$title}\"
- style='width:100%'
+ style='width:100%'
+ {$disabled}
rows=4 type='text'
name=\"{$this->postName}\">".set_post($this->value)."</textarea>");
}