From 6499fb37f2ff5d8a23585dbcc43b86bbe0aab616 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 12 Sep 2006 07:31:03 +0000 Subject: [PATCH] some fixes: - class of select-widgets is now correctly geneated as attr class - killed warning generated for boxes (array passed to htmlentities) - class-vars now just set (not in the constructor, as required by php3) --- etemplate/inc/class.xul_io.inc.php | 165 +++++++++++++++-------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index 52718e0778..a969b3ff06 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -33,87 +33,86 @@ */ class xul_io { - var $widget2xul; - var $attr2xul; - var $xul2widget; - - function xul_io() - { - /** - * @var array $attr2xul how to translate attr, common to all widgets - */ - $this->attr2xul = array( - 'name' => 'id', - 'help' => 'statustext', - 'span' => 'span,class', - 'type' => '', // this is the widget-name => dont write as attr - 'disabled' => 'disabled=true', - 'readonly' => 'readonly=true', - 'size' => 'options' - ); - /** - * @var array $widget2xul how to widget-names and widget-spec. attr., not set ones are identical - */ - $this->widget2xul = array( - 'label' => array( - '.name' => 'description', - 'label' => 'value' - ), - 'text' => array( - '.name' => 'textbox', - 'size' => 'size,maxlength,validator' - ), - 'textarea' => array( - '.name' => 'textbox', - '.set' => 'multiline=true', - 'size' => 'rows,cols' - ), - 'integer' => array( - '.name' => 'textbox', - '.set' => 'type=integer', - 'size' => 'min,max,size' - ), - 'float' => array( - '.name' => 'textbox', - '.set' => 'type=float', - 'size' => 'min,max,size,precision' - ), - 'select' => array( - '.name' => 'menulist,menupopup', - ), - 'select-multi' => array( // multiselection, if size > 0 - '.name' => 'listbox', - 'size' => 'rows,options' - ), - 'template' => array( - '.name' => 'template', - 'size' => 'content' - ), - 'image' => array( - '.name' => 'image', - 'name' => 'src' - ), - 'tab' => array( - '.name' => 'tabbox,tabs,tabpanels' - ), - 'button' => array( - '.name' => 'button', - 'size' => 'image,ro_image' - ), - 'htmlarea' => array( - 'size' => 'style,plugins', - ), - ); - /** - * @var array $xul2widget how to xul-widget names to our internal ones, not set ones are identical - */ - $this->xul2widget = array( - 'menulist' => 'select', - 'listbox' => 'select', - 'menupopup' => 'select', - 'description' => 'label' - ); - } + /** + * translate attr, common to all widgets + * + * @var array + */ + var $attr2xul = array( + 'name' => 'id', + 'help' => 'statustext', + 'span' => 'span,class', + 'type' => '', // this is the widget-name => dont write as attr + 'disabled' => 'disabled=true', + 'readonly' => 'readonly=true', + 'size' => 'options' + ); + /** + * translate widget-names and widget-spec. attr., not set ones are identical + * + * @var array + */ + var $widget2xul = array( + 'label' => array( + '.name' => 'description', + 'label' => 'value' + ), + 'text' => array( + '.name' => 'textbox', + 'size' => 'size,maxlength,validator' + ), + 'textarea' => array( + '.name' => 'textbox', + '.set' => 'multiline=true', + 'size' => 'rows,cols' + ), + 'integer' => array( + '.name' => 'textbox', + '.set' => 'type=integer', + 'size' => 'min,max,size' + ), + 'float' => array( + '.name' => 'textbox', + '.set' => 'type=float', + 'size' => 'min,max,size,precision' + ), + 'select' => array( + '.name' => 'menulist,menupopup', + ), + 'select-multi' => array( // multiselection, if size > 0 + '.name' => 'listbox', + 'size' => 'rows,options' + ), + 'template' => array( + '.name' => 'template', + 'size' => 'content' + ), + 'image' => array( + '.name' => 'image', + 'name' => 'src' + ), + 'tab' => array( + '.name' => 'tabbox,tabs,tabpanels' + ), + 'button' => array( + '.name' => 'button', + 'size' => 'image,ro_image' + ), + 'htmlarea' => array( + 'size' => 'style,plugins', + ), + ); + /** + * translate xul-widget names to our internal ones, not set ones are identical + * + * @var array + */ + var $xul2widget = array( + 'menulist' => 'select', + 'listbox' => 'select', + 'menupopup' => 'select', + 'description' => 'label' + ); /** * sets an attribute in the xml object representing a widget @@ -224,7 +223,7 @@ case 'menulist': // id,options belongs to the 'menupopup' child if ($cell['span']) { - $widget->set_attribute('span',$cell['span']); + $this->set_attributes($widget,'span,class',$cell['span']); unset($cell['span']); } // fall-trought @@ -253,6 +252,8 @@ $this->add_widget($widget,$cell[$n],$embeded_too); unset($cell[$n]); } + // no sure where the data key gets set, but it gives a warning in xml serialization (empty array) + unset($cell['data']); $cell['orient'] = $orient; $cell['size'] = $options; break;