Use a template for the edit list widget
[squirrelmail.git] / functions / options.php
index f7b208bdc3c7b3b7efb2444ae28810b29c3cb843..41922b553862087ab9f1ccce070051816f8ca4d4 100644 (file)
@@ -569,7 +569,7 @@ class SquirrelOption {
      */
     function createWidget_EditList() {
 
      */
     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...
 
         switch ($this->size) {
 //FIXME: not sure about these sizes... seems like we could add another on the "large" side...
@@ -590,14 +590,13 @@ class SquirrelOption {
                 $height = 5;
         }
 
                 $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');
 
     }
 
 
     }