summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TDataList.php57
-rw-r--r--framework/Web/UI/WebControls/TRepeater.php6
-rw-r--r--framework/Web/UI/WebControls/TTemplateColumn.php8
3 files changed, 41 insertions, 30 deletions
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index 5c8ec700..c4da634a 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -1173,6 +1173,35 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
return null;
}
+ private function getAlternatingItemDisplay()
+ {
+ if(($classPath=$this->getAlternatingItemRenderer())==='' && ($template=$this->_alternatingItemTemplate)===null)
+ return array($this->getItemRenderer(),$this->_itemTemplate);
+ else
+ return array($classPath,$template);
+ }
+
+ private function getSelectedItemDisplay($itemIndex)
+ {
+ if(($classPath=$this->getSelectedItemRenderer())==='' && ($template=$this->_selectedItemTemplate)===null)
+ {
+ if($itemIndex%2===0)
+ return array($this->getItemRenderer(),$this->_itemTemplate);
+ else
+ return $this->getAlternatingItemDisplay();
+ }
+ else
+ return array($classPath,$template);
+ }
+
+ private function getEditItemDisplay($itemIndex)
+ {
+ if(($classPath=$this->getEditItemRenderer())==='' && ($template=$this->_editItemTemplate)===null)
+ return $this->getSelectedItemDisplay($itemIndex);
+ else
+ return array($classPath,$template);
+ }
+
/**
* Creates a datalist item instance based on the item type and index.
* @param integer zero-based item index
@@ -1190,35 +1219,13 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$template=$this->_itemTemplate;
break;
case TListItemType::AlternatingItem :
- if(($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate;
+ list($classPath,$template)=$this->getAlternatingItemDisplay();
break;
case TListItemType::SelectedItem:
- if(($classPath=$this->getSelectedItemRenderer())==='')
- {
- if(!($itemIndex%2) || ($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- }
- if(($template=$this->_selectedItemTemplate)===null)
- {
- if(!($itemIndex%2) || ($template=$this->_alternatingItemTemplate)===null)
- $template=$this->_itemTemplate;
- }
+ list($classPath,$template)=$this->getSelectedItemDisplay($itemIndex);
break;
case TListItemType::EditItem:
- if(($classPath=$this->getEditItemRenderer())==='')
- {
- if($itemIndex!==$this->getSelectedItemIndex() || ($classPath=$this->getSelectedItemRenderer())==='')
- if(!($itemIndex%2) || ($classPath=$this->getAlternatingItemRenderer())==='')
- $classPath=$this->getItemRenderer();
- }
- if(($template=$this->_editItemTemplate)===null)
- {
- if($itemIndex!==$this->getSelectedItemIndex() || ($template=$this->_selectedItemTemplate)===null)
- if(!($itemIndex%2) || ($template=$this->_alternatingItemTemplate)===null)
- $template=$this->_itemTemplate;
- }
+ list($classPath,$template)=$this->getEditItemDisplay($itemIndex);
break;
case TListItemType::Header :
$classPath=$this->getHeaderRenderer();
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index c94d559a..c35f38a8 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -523,9 +523,11 @@ class TRepeater extends TDataBoundControl implements INamingContainer
$template=$this->_itemTemplate;
break;
case TListItemType::AlternatingItem :
- if(($classPath=$this->getAlternatingItemRenderer())==='')
+ if(($classPath=$this->getAlternatingItemRenderer())==='' && ($template=$this->_alternatingItemTemplate)===null)
+ {
$classPath=$this->getItemRenderer();
- $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate;
+ $template=$this->_itemTemplate;
+ }
break;
case TListItemType::Header :
$classPath=$this->getHeaderRenderer();
diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php
index bd3a2acb..377fadfc 100644
--- a/framework/Web/UI/WebControls/TTemplateColumn.php
+++ b/framework/Web/UI/WebControls/TTemplateColumn.php
@@ -194,9 +194,11 @@ class TTemplateColumn extends TDataGridColumn
{
if($itemType===TListItemType::EditItem)
{
- $template=$this->_editItemTemplate===null?$this->_itemTemplate:$this->_editItemTemplate;
- if(($classPath=$this->getEditItemRenderer())==='')
+ if(($classPath=$this->getEditItemRenderer())==='' && ($template=$this->_editItemTemplate)===null)
+ {
$classPath=$this->getItemRenderer();
+ $template=$this->_itemTemplate;
+ }
}
else
{
@@ -236,7 +238,7 @@ class TTemplateColumn extends TDataGridColumn
else if($this->_footerTemplate!==null)
$this->_footerTemplate->instantiateIn($cell);
else
- $this->initializeHeaderCell($cell,$columnIndex);
+ $this->initializeFooterCell($cell,$columnIndex);
}
}