summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY5
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Modules.page2
-rw-r--r--framework/Web/UI/WebControls/TRepeater.php52
3 files changed, 58 insertions, 1 deletions
diff --git a/HISTORY b/HISTORY
index 0dc6d25a..3fb5995b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,12 +1,17 @@
Version 3.0RC2 April 16, 2006
=============================
+BUG: Ticket#54 - recursive reverse() definition (Wei)
+BUG: Ticket#93 - ValidationGroup not working in TImageMap for js validator (Wei)
+BUG: Ticket#97 - Invalid return type value for TSimpleDateFormatter::parse (Wei)
BUG: Ticket#118 - Variables that may not have been initialized (Qiang)
+BUG: Ticket#121 - OnClick don't fire with TImageButton and TRequiredFieldValidator (Wei)
BUG: Ticket#129 - TRadioButtonList in TWizard step does not postback correctly (Qiang)
CHG: Moved localize() into PradoBase (Qiang)
CHG: List controls now use array keys as list item values even if the array is integer-indexed (Qiang)
CHG: THttpUtility::htmlEncode and htmlDecode now do not deal with & (Qiang)
ENH: Optimized the representation and evaluation of template expressions (Qiang)
ENH: Added Raw layout to TDataList (Qiang)
+ENH: Added TRepeater.DataKeys and TRepeater.DataKeyField (Qiang)
Version 3.0RC1 April 5, 2006
============================
diff --git a/demos/quickstart/protected/pages/Fundamentals/Modules.page b/demos/quickstart/protected/pages/Fundamentals/Modules.page
index ebf4ac53..782ebb8c 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Modules.page
+++ b/demos/quickstart/protected/pages/Fundamentals/Modules.page
@@ -41,7 +41,7 @@ Error handler module is used to capture and process all error conditions in an a
PRADO is released with a few more modules besides the core ones. They include caching modules (<tt>TSqliteCache</tt> and <tt>TMemCache</tt>), user management module (<tt>TUserManager</tt>), authentication and authorization module (<tt>TAuthManager</tt>), etc.
</p>
<p>
-When <tt>TPageService</tt> is requested, it also loads modules specific for page service, including asset manager (<tt>TAssetManager</tt>), template manager (<tt>TTemplateManager</tt>), theme/skin manager (<tt>TThemeManager</tt>), and page state persister (<tt>TPageStatePersister</tt>).
+When <tt>TPageService</tt> is requested, it also loads modules specific for page service, including asset manager (<tt>TAssetManager</tt>), template manager (<tt>TTemplateManager</tt>), theme/skin manager (<tt>TThemeManager</tt>).
</p>
<p>
Custom modules and core modules are all configurable via <a href="?page=Configurations.Overview">configurations</a>.
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index 3d57fbd5..1acdc766 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -259,6 +259,35 @@ class TRepeater extends TDataBoundControl implements INamingContainer
}
/**
+ * @return string the field of the data source that provides the keys of the list items.
+ */
+ public function getDataKeyField()
+ {
+ return $this->getViewState('DataKeyField','');
+ }
+
+ /**
+ * @param string the field of the data source that provides the keys of the list items.
+ */
+ public function setDataKeyField($value)
+ {
+ $this->setViewState('DataKeyField',$value,'');
+ }
+
+ /**
+ * @return TList the keys used in the data listing control.
+ */
+ public function getDataKeys()
+ {
+ if(($dataKeys=$this->getViewState('DataKeys',null))===null)
+ {
+ $dataKeys=new TList;
+ $this->setViewState('DataKeys',$dataKeys,null);
+ }
+ return $dataKeys;
+ }
+
+ /**
* Creates a repeater item instance based on the item type and index.
* @param integer zero-based item index
* @param string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'.
@@ -405,11 +434,18 @@ class TRepeater extends TDataBoundControl implements INamingContainer
protected function performDataBinding($data)
{
$this->reset();
+
+ $keys=$this->getDataKeys();
+ $keys->clear();
+ $keyField=$this->getDataKeyField();
+
$items=$this->getItems();
$itemIndex=0;
$hasSeparator=$this->_separatorTemplate!==null;
foreach($data as $dataItem)
{
+ if($keyField!=='')
+ $keys->add($this->getDataFieldValue($dataItem,$keyField));
if($itemIndex===0 && $this->_headerTemplate!==null)
$this->_header=$this->createItemInternal(-1,self::IT_HEADER,true,null);
if($hasSeparator && $itemIndex>0)
@@ -493,6 +529,22 @@ class TRepeater extends TDataBoundControl implements INamingContainer
{
$this->raiseEvent('OnItemCommand',$this,$param);
}
+
+ /**
+ * Returns the value of the data at the specified field.
+ * If data is an array, TMap or TList, the value will be returned at the index
+ * of the specified field. If the data is a component with a property named
+ * as the field name, the property value will be returned.
+ * Otherwise, an exception will be raised.
+ * @param mixed data item
+ * @param mixed field name
+ * @return mixed data value at the specified field
+ * @throws TInvalidDataValueException if the data is invalid
+ */
+ protected function getDataFieldValue($data,$field)
+ {
+ return TDataFieldAccessor::getDataFieldValue($data,$field);
+ }
}
/**