18 require_once SQ_INCLUDE_PATH.
'/asset_attribute.inc';
50 $this->
Asset_Attribute($attributeid, (
float) $value, Array(
'decimal_places' =>
'2'));
53 $this->_edit_params[
'width'] = 5;
69 if (!parent::setEditParams($node))
return false;
70 $this->_edit_params[
'width'] = (int) $node->attributes()->width;
85 function paint($prefix, $read_only=
false)
87 $v = number_format($this->value, $this->_params[
'decimal_places'],
'.',
'');
95 if (isset($this->_params[
'range_upper'])){
96 $js_validate =
' else if (parseFloat(this.value) > parseFloat('.(float)$this->_params[
'range_upper'].
')) { this.value = this.__sq_init_value;}';
98 if (isset($this->_params[
'range_lower'])){
99 $js_validate .=
' else if (parseFloat(this.value) < parseFloat('.(float)$this->_params[
'range_lower'].
')) { this.value = this.__sq_init_value;}';
102 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
103 text_box($prefix, $v, $this->_edit_params[
'width'], 0,
false,
'onFocus="javascript: this.__sq_init_value = this.value;" onChange="javascript: if (isNaN(parseFloat(this.value))) { this.value = this.__sq_init_value; alert(js_translate(\'cannot_accept_non_digit_characters\')); } '.$js_validate.
' else {this.value = number_format(this.value, '.$this->_params[
'decimal_places'].
', \'.\', \'\'); } "');
118 if (!isset($_REQUEST[$prefix]))
return false;
119 $value = (float) $_REQUEST[$prefix];
120 if ($this->value != $value && $this->
setValue($value)) {
121 $this->processed =
true;
123 $this->processed =
false;
139 $value = trim($value);
140 $new_value = (float)$value;
146 if ((
string)$new_value != $value)
return false;
149 if(isset($this->_params[
'range_upper'])) {
150 (float)$range_upper = $this->_params[
'range_upper'];
151 if ($new_value > $range_upper) {
157 if(isset($this->_params[
'range_lower'])) {
158 (float)$range_lower = $this->_params[
'range_lower'];
159 if ($new_value < $range_lower) {