summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-04-01 19:11:41 +0000
committerxue <>2007-04-01 19:11:41 +0000
commit8ce268ab449d1fe63baf6a6302af6d05bcf1d1aa (patch)
tree16347d48336798767ecbe428d4b9a00e29ff8ac4
parentacbeaa0255f86bf88f35a1192ec05bfc0d5ac92b (diff)
Fixed #584.
-rw-r--r--HISTORY1
-rw-r--r--framework/Collections/TAttributeCollection.php34
-rw-r--r--framework/I18N/TTranslate.php1
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
@@ -71,48 +73,64 @@ class TAttributeCollection extends TMap
}
/**
+ * @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;
}