From 8ce268ab449d1fe63baf6a6302af6d05bcf1d1aa Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 1 Apr 2007 19:11:41 +0000 Subject: Fixed #584. --- HISTORY | 1 + framework/Collections/TAttributeCollection.php | 34 ++++++++++++++++++++------ framework/I18N/TTranslate.php | 1 + 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index bd9466e9..d33f98a6 100644 --- a/HISTORY +++ b/HISTORY @@ -17,6 +17,7 @@ BUG: Ticket#560 - TActiveImageButton broken (Postback instead of Callback) (Wei) BUG: Ticket#566 - <%[ tags (localize tags) missing escaping (Qiang) BUG: Ticket#573 - NumberFormat Bug (Wei) BUG: Ticket#579 - The rating list lost its Javascript in changeset [1775] (Wei). +BUG: Ticket#584 - Parameter names in TTranslate are case-insensitive (Qiang) BUG: TXmlElement did not encode attribute and text values when being saved as a string (Qiang) BUG: SelectedIndices not return expected result for ActiveListBox (Wei) ENH: Ticket#367 - Change default extension for XLIFF files (Wei, changed to support .xlf extension). diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php index a65a4a89..edfbc35e 100644 --- a/framework/Collections/TAttributeCollection.php +++ b/framework/Collections/TAttributeCollection.php @@ -44,6 +44,8 @@ Prado::using('System.Collections.TMap'); */ class TAttributeCollection extends TMap { + private $_caseSensitive=false; + /** * Returns a property value or an event handler list by property or event name. * This method overrides the parent implementation by returning @@ -70,49 +72,65 @@ class TAttributeCollection extends TMap $this->add($name,$value); } + /** + * @return boolean whether the keys are case-sensitive. Defaults to false. + */ + public function getCaseSensitive() + { + return $this->_caseSensitive; + } + + /** + * @param boolean whether the keys are case-sensitive. + */ + public function setCaseSensitive($value) + { + $this->_caseSensitive=TPropertyValue::ensureBoolean($value); + } + /** * Returns the item with the specified key. - * This overrides the parent implementation by converting the key to lower case first. + * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. * @param mixed the key * @return mixed the element at the offset, null if no element is found at the offset */ public function itemAt($key) { - return parent::itemAt(strtolower($key)); + return parent::itemAt($this->_caseSensitive?$key:strtolower($key)); } /** * Adds an item into the map. - * This overrides the parent implementation by converting the key to lower case first. + * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. * @param mixed key * @param mixed value */ public function add($key,$value) { - parent::add(strtolower($key),$value); + parent::add($this->_caseSensitive?$key:strtolower($key),$value); } /** * Removes an item from the map by its key. - * This overrides the parent implementation by converting the key to lower case first. + * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. * @param mixed the key of the item to be removed * @return mixed the removed value, null if no such key exists. */ public function remove($key) { - return parent::remove(strtolower($key)); + return parent::remove($this->_caseSensitive?$key:strtolower($key)); } /** * Returns whether the specified is in the map. - * This overrides the parent implementation by converting the key to lower case first. + * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. * @param mixed the key * @return boolean whether the map contains an item with the specified key */ public function contains($key) { - return parent::contains(strtolower($key)); + return parent::contains($this->_caseSensitive?$key:strtolower($key)); } /** diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php index e1f2fee5..409015ed 100644 --- a/framework/I18N/TTranslate.php +++ b/framework/I18N/TTranslate.php @@ -146,6 +146,7 @@ class TTranslate extends TI18NControl else { $parameters=new TAttributeCollection; + $parameters->setCaseSensitive(true); $this->setViewState('Parameters',$parameters,null); return $parameters; } -- cgit v1.2.3