From fd019bf034ef4dbedfc305c77fed0dbd83a732c4 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Tue, 25 Apr 2006 00:27:44 +0000
Subject: Add TListControlValidator. Update client-side validators,
datepicker.js, colorpicker.js. Merge to 3.0 if necessary.
---
framework/Web/UI/WebControls/TRangeValidator.php | 41 ++----------------------
1 file changed, 3 insertions(+), 38 deletions(-)
(limited to 'framework/Web/UI/WebControls/TRangeValidator.php')
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php
index 56cc16bc..b7387522 100644
--- a/framework/Web/UI/WebControls/TRangeValidator.php
+++ b/framework/Web/UI/WebControls/TRangeValidator.php
@@ -29,7 +29,6 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator');
* operation is performed. The following value types are supported:
* - Integer A 32-bit signed integer data type.
* - Float A double-precision floating point number data type.
- * - Currency A decimal data type that can contain currency symbols.
* - Date A date data type. The date format can be specified by
* setting {@link setDateFormat DateFormat} property, which must be recognizable
* by {@link TSimpleDateFormatter}. If the property is not set,
@@ -87,13 +86,13 @@ class TRangeValidator extends TBaseValidator
}
/**
- * Sets the data type (Integer, Float, Currency, Date, String) that the values
- * being compared are converted to before the comparison is made.
+ * Sets the data type (Integer, Float, Date, String) that the values being
+ * compared are converted to before the comparison is made.
* @param string the data type
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','Currency','String'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String');
}
/**
@@ -131,8 +130,6 @@ class TRangeValidator extends TBaseValidator
return $this->isValidInteger($value);
case 'Float':
return $this->isValidFloat($value);
- case 'Currency':
- return $this->isValidCurrency($value);
case 'Date':
return $this->isValidDate($value);
default:
@@ -178,38 +175,6 @@ class TRangeValidator extends TBaseValidator
return $valid;
}
- /**
- * Determine if the value is a valid currency range,
- * @param string currency value
- * @return boolean true if within range.
- */
- protected function isValidCurrency($value)
- {
- $minValue=$this->getMinValue();
- $maxValue=$this->getMaxValue();
-
- $valid=true;
- $value = $this->getCurrencyValue($value);
- if($minValue!=='')
- $valid=$valid && ($value>= $this->getCurrencyValue($minValue));
- if($maxValue!=='')
- $valid=$valid && ($value<= $this->getCurrencyValue($minValue));
- return $valid;
- }
-
- /**
- * Parse the string into a currency value, return the float value of the currency.
- * @param string currency as string
- * @return float currency value.
- */
- protected function getCurrencyValue($value)
- {
- if(preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?/',$value,$matches))
- return floatval($matches[0]);
- else
- return 0.0;
- }
-
/**
* Determine if the date is within the specified range.
* Uses pradoParseDate and strtotime to get the date from string.
--
cgit v1.2.3