*/
function createWidget_EditList() {
- global $br, $nbsp;
+ global $oTemplate;
switch ($this->size) {
//FIXME: not sure about these sizes... seems like we could add another on the "large" side...
$height = 5;
}
-//FIXME: $this->aExtraAttribs and $this->trailing_text probably should only be used in one place
-//FIXME: might be nice to have this in a template file instead of creating layout here
- return create_label(_("Add"), '')
- . $nbsp . addInput('add_' . $this->name, '', 38, 0, $this->aExtraAttribs) . htmlspecialchars($this->trailing_text)
- . $br . addSelect('new_' . $this->name, $this->possible_values, $this->value, FALSE, !checkForJavascript() ? $this->aExtraAttribs : array_merge(array('onchange' => 'if (typeof(window.addinput) == \'undefined\') { var f = document.forms.length; var i = 0; var pos = -1; while( pos == -1 && i < f ) { var e = document.forms[i].elements.length; var j = 0; while( pos == -1 && j < e ) { if ( document.forms[i].elements[j].type == \'text\' && document.forms[i].elements[j].name == \'add_' . $this->name . '\' ) { pos = j; } j++; } i++; } if( pos >= 0 ) { window.addinput = document.forms[i-1].elements[pos]; } } for (x = 0; x < this.length; x++) { if (this.options[x].selected) { window.addinput.value = this.options[x].value; break; } }'), $this->aExtraAttribs), TRUE, $height) . htmlspecialchars($this->trailing_text)
- . $br
- . addCheckBox('delete_' . $this->name, FALSE, SMPREF_YES, array_merge(array('id' => 'delete_' . $this->name), $this->aExtraAttribs))
- . $nbsp . create_label(_("Delete Selected"), 'delete_' . $this->name);
+//FIXME: $this->aExtraAttribs probably should only be used in one place
+ $oTemplate->assign('input_widget', addInput('add_' . $this->name, '', 38, 0, $this->aExtraAttribs));
+ $oTemplate->assign('trailing_text', $this->trailing_text);
+ $oTemplate->assign('select_widget', addSelect('new_' . $this->name, $this->possible_values, $this->value, FALSE, !checkForJavascript() ? $this->aExtraAttribs : array_merge(array('onchange' => 'if (typeof(window.addinput) == \'undefined\') { var f = document.forms.length; var i = 0; var pos = -1; while( pos == -1 && i < f ) { var e = document.forms[i].elements.length; var j = 0; while( pos == -1 && j < e ) { if ( document.forms[i].elements[j].type == \'text\' && document.forms[i].elements[j].name == \'add_' . $this->name . '\' ) { pos = j; } j++; } i++; } if( pos >= 0 ) { window.addinput = document.forms[i-1].elements[pos]; } } for (x = 0; x < this.length; x++) { if (this.options[x].selected) { window.addinput.value = this.options[x].value; break; } }'), $this->aExtraAttribs), TRUE, $height));
+ $oTemplate->assign('checkbox_widget', addCheckBox('delete_' . $this->name, FALSE, SMPREF_YES, array_merge(array('id' => 'delete_' . $this->name), $this->aExtraAttribs)));
+ $oTemplate->assign('name', $this->name);
+ return $oTemplate->fetch('edit_list_widget.tpl');
}
--- /dev/null
+<?php
+
+/**
+ * edit_list_widget.tpl
+ *
+ * Template for constructing an edit list.
+ *
+ * The following variables are available in this template:
+ *
+ * string $name The name of the edit list
+ * string $input_widget A preconstructed input text box used
+ * for adding new elements to the edit list
+ * string $select_widget A preconstructed input text box used
+ * string $checkbox_widget A preconstructed input text box used
+ * string $trailing_text Any text given by the caller to be displayed
+ * after the edit list input
+ *
+ * @copyright © 1999-2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: select.tpl 12961 2008-02-24 22:35:08Z pdontthink $
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+echo _("Add") . ' ' . $input_widget . '<br />' . $select_widget
+ . '<br />' . $checkbox_widget . ' <label for="delete_' . $name . '">'
+ . _("Delete Selected") . '</label>';