From: Simon H. <sim...@us...> - 2010-12-09 14:25:10
|
Update of /cvsroot/stack/stack-dev/lib/ui/inputTypes In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv30562/lib/ui/inputTypes Modified Files: Tag: item_state_separation Slider.php Log Message: Intermediate debugging Index: Slider.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/Slider.php,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -C2 -d -r1.2.4.2 -r1.2.4.3 *** Slider.php 9 Nov 2010 16:51:35 -0000 1.2.4.2 --- Slider.php 9 Dec 2010 14:25:00 -0000 1.2.4.3 *************** *** 24,55 **** class Slider extends AnswerInputType { ! // Attributes ! //protected $min; ! //protected $max; ! //protected $step; ! ! public function __construct($name, $width = null, $default = null, $maxLength = null, $height = null, $param = null) { - //if (!isset($width)) $width = '200'; $this->name = $name; ! $this->boxWidth = $width; ! ! if($param == NULL) ! { ! $this->parameters['slider_min'] = new Meta('required', '0'); ! $this->parameters['slider_max'] = new Meta('required', '100'); ! $this->parameters['slider_step'] = new Meta('required', '1'); ! } else $this->parameters = $param; ! ! // parent::__construct($name, $width); ! //$this->min = $param['min']; ! //$this->max = $param['max']; ! //$this->step = $param['step']; ! parent::__construct($name, $width, $default, $maxLength, $height, $param); ! } ! public function getXHTML() { $url = $GLOBALS['config']->get('weburl'); --- 24,44 ---- class Slider extends AnswerInputType { ! public function __construct($name, $width = null, $default = null, $maxLength = null, $height = null, $param = null) { $this->name = $name; ! $this->boxWidth = $width; ! parent::__construct($name, $width, $default, $maxLength, $height, $param); ! // slider values hard-wired for now ! $this->parameters['slider_min'] = new Meta('required', '0'); ! $this->parameters['slider_max'] = new Meta('required', '100'); ! $this->parameters['slider_step'] = new Meta('required', '25'); ! } ! public function getXHTML() { ! $min = $this->parameters['slider_min']->getSelection(); ! $max = $this->parameters['slider_max']->getSelection(); ! $step = $this->parameters['slider_step']->getSelection(); $url = $GLOBALS['config']->get('weburl'); *************** *** 68,76 **** $("#' . $this->name . '_slider").slider({' . (is_numeric($this->default) ? "value: {$this->default}," : '') ! . (isset($this->parameters['slider_min']) ? "min: {$this->parameters['slider_min']}," : '') ! . (isset($this->parameters['slider_max']) ? "max: {$this->parameters['slider_max']}," : '') ! . (isset($this->parameters['slider_step']) ? "step: {$this->parameters['slider_step']}," : '') ! . ' slide: function(event, ui) { ! $("#' . $this->name . '").val(ui.value) $("#' . $this->name . '_value").text(ui.value); } --- 57,63 ---- $("#' . $this->name . '_slider").slider({' . (is_numeric($this->default) ? "value: {$this->default}," : '') ! . "min: $min, max: $max, step: $step,". ! ' slide: function(event, ui) { ! $("#' . $this->name . '").val(ui.value); $("#' . $this->name . '_value").text(ui.value); } *************** *** 78,107 **** }); </script>'; ! return $slider; ! } ! ! /** ! * Modifies the default parameters of this Input type based on the authors inputs ! * If authors input is null, returns the defaults. ! * ! * @access public ! * @param array $param ! * @return array ! */ ! public function getDefaultParam($param=NULL) ! { ! if(!empty($param['slider_min'])) ! { ! $this->parameters['slider_min']->setSelection($param['slider_min']); ! } ! if(!empty($param['slider_max'])) ! { ! $this->parameters['slider_max']->setSelection($param['slider_max']); ! } ! return $this->parameters; ! } --- 65,93 ---- }); </script>'; + return $slider; + } ! /** ! * Modifies the default parameters of this Input type based on the authors inputs ! * If authors input is null, returns the defaults. ! * ! * @access public ! * @param array $param ! * @return array ! */ ! public function getDefaultParam($param=NULL) ! { ! if(!empty($param['slider_min'])) ! { ! $this->parameters['slider_min']->setSelection($param['slider_min']); ! } ! if(!empty($param['slider_max'])) ! { ! $this->parameters['slider_max']->setSelection($param['slider_max']); ! } ! return $this->parameters; ! } |