From 261c29ece2ccf37e6419b9886cefd29f9dbb3c89 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 17 Mar 2006 03:16:13 +0000 Subject: Using constants as item types. --- framework/Web/UI/WebControls/TBoundColumn.php | 8 +- framework/Web/UI/WebControls/TButtonColumn.php | 2 +- framework/Web/UI/WebControls/TCheckBoxColumn.php | 10 +- framework/Web/UI/WebControls/TDataGrid.php | 91 ++++---- framework/Web/UI/WebControls/TDataGridColumn.php | 4 +- framework/Web/UI/WebControls/TDataList.php | 19 +- .../Web/UI/WebControls/TEditCommandColumn.php | 4 +- framework/Web/UI/WebControls/THyperLinkColumn.php | 8 +- framework/Web/UI/WebControls/TRepeater.php | 52 +++-- framework/Web/UI/WebControls/TTemplateColumn.php | 14 +- framework/Web/UI/WebControls/TWizard.php | 250 ++++++++++++++++----- 11 files changed, 318 insertions(+), 144 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php index 393d5c11..5975ec02 100644 --- a/framework/Web/UI/WebControls/TBoundColumn.php +++ b/framework/Web/UI/WebControls/TBoundColumn.php @@ -97,7 +97,7 @@ class TBoundColumn extends TDataGridColumn parent::initializeCell($cell,$columnIndex,$itemType); switch($itemType) { - case 'EditItem': + case TDataGrid::IT_EDITITEM: $control=$cell; if(!$this->getReadOnly()) { @@ -108,9 +108,9 @@ class TBoundColumn extends TDataGridColumn if(($dataField=$this->getDataField())!=='') $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); break; - case 'Item': - case 'AlternatingItem': - case 'SelectedItem': + case TDataGrid::IT_ITEM: + case TDataGrid::IT_ALTERNATINGITEM: + case TDataGrid::IT_SELECTEDITEM: if($this->getDataField()!=='') $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); break; diff --git a/framework/Web/UI/WebControls/TButtonColumn.php b/framework/Web/UI/WebControls/TButtonColumn.php index dc506b0a..12b38171 100644 --- a/framework/Web/UI/WebControls/TButtonColumn.php +++ b/framework/Web/UI/WebControls/TButtonColumn.php @@ -168,7 +168,7 @@ class TButtonColumn extends TDataGridColumn public function initializeCell($cell,$columnIndex,$itemType) { parent::initializeCell($cell,$columnIndex,$itemType); - if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem') + if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM || $itemType===TDataGrid::IT_EDITITEM) { if($this->getButtonType()==='LinkButton') $button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton'); diff --git a/framework/Web/UI/WebControls/TCheckBoxColumn.php b/framework/Web/UI/WebControls/TCheckBoxColumn.php index f695bcdc..4df1e695 100644 --- a/framework/Web/UI/WebControls/TCheckBoxColumn.php +++ b/framework/Web/UI/WebControls/TCheckBoxColumn.php @@ -14,6 +14,10 @@ * TDataGridColumn class file */ Prado::using('System.Web.UI.WebControls.TDataGridColumn'); +/** + * TCheckBox class file + */ +Prado::using('System.Web.UI.WebControls.TCheckBox'); /** * TCheckBoxColumn class @@ -76,10 +80,10 @@ class TCheckBoxColumn extends TDataGridColumn public function initializeCell($cell,$columnIndex,$itemType) { parent::initializeCell($cell,$columnIndex,$itemType); - if($itemType==='EditItem' || $itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem') + if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM || $itemType===TDataGrid::IT_EDITITEM) { - $checkBox=Prado::createComponent('System.Web.UI.WebControls.TCheckBox'); - if($this->getReadOnly() || $itemType!=='EditItem') + $checkBox=new TCheckBox; + if($this->getReadOnly() || $itemType!==TDataGrid::IT_EDITITEM) $checkBox->setEnabled(false); $cell->setHorizontalAlign('Center'); $cell->getControls()->add($checkBox); diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index d9924cd2..0157b643 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -134,6 +134,21 @@ Prado::using('System.Web.UI.WebControls.TTable'); */ class TDataGrid extends TBaseDataList implements INamingContainer { + /** + * datagrid item types + */ + const IT_HEADER='Header'; + const IT_FOOTER='Footer'; + const IT_ITEM='Item'; + const IT_SEPARATOR='Separator'; + const IT_ALTERNATINGITEM='AlternatingItem'; + const IT_EDITITEM='EditItem'; + const IT_SELECTEDITEM='SelectedItem'; + const IT_PAGER='Pager'; + + /** + * Command name that TDataGrid understands. + */ const CMD_SELECT='Select'; const CMD_EDIT='Edit'; const CMD_UPDATE='Update'; @@ -395,14 +410,14 @@ class TDataGrid extends TBaseDataList implements INamingContainer if($current>=0 && $current<$itemCount) { $item=$items->itemAt($current); - if($item->getItemType()!=='EditItem') - $item->setItemType($current%2?'AlternatingItem':'Item'); + if($item->getItemType()!==self::IT_EDITITEM) + $item->setItemType($current%2?self::IT_ALTERNATINGITEM:self::IT_ITEM); } if($value>=0 && $value<$itemCount) { $item=$items->itemAt($value); - if($item->getItemType()!=='EditItem') - $item->setItemType('SelectedItem'); + if($item->getItemType()!==self::IT_EDITITEM) + $item->setItemType(self::IT_SELECTEDITEM); } } } @@ -445,9 +460,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer $items=$this->getItems(); $itemCount=$items->getCount(); if($current>=0 && $current<$itemCount) - $items->itemAt($current)->setItemType($current%2?'AlternatingItem':'Item'); + $items->itemAt($current)->setItemType($current%2?self::IT_ALTERNATINGITEM:self::IT_ITEM); if($value>=0 && $value<$itemCount) - $items->itemAt($value)->setItemType('EditItem'); + $items->itemAt($value)->setItemType(self::IT_EDITITEM); } } @@ -901,7 +916,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $column->initialize(); if($allowPaging) $this->createPager(-1,-1,$columnCount,$ds); - $this->_header=$this->createItemInternal(-1,-1,'Header',false,null,$columns); + $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,false,null,$columns); $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); $index=0; @@ -909,18 +924,18 @@ class TDataGrid extends TBaseDataList implements INamingContainer foreach($ds as $data) { if($index===$editIndex) - $itemType='EditItem'; + $itemType=self::IT_EDITITEM; else if($index===$selectedIndex) - $itemType='SelectedItem'; + $itemType=self::IT_SELECTEDITEM; else if($index % 2) - $itemType='AlternatingItem'; + $itemType=self::IT_ALTERNATINGITEM; else - $itemType='Item'; + $itemType=self::IT_ITEM; $items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns)); $index++; $dsIndex++; } - $this->_footer=$this->createItemInternal(-1,-1,'Footer',false,null,$columns); + $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,false,null,$columns); if($allowPaging) $this->createPager(-1,-1,$columnCount,$ds); } @@ -963,7 +978,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $allowPaging=$ds->getAllowPaging(); if($allowPaging) $this->createPager(-1,-1,$columnCount,$ds); - $this->_header=$this->createItemInternal(-1,-1,'Header',true,null,$columns); + $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,true,null,$columns); $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); $index=0; @@ -973,18 +988,18 @@ class TDataGrid extends TBaseDataList implements INamingContainer if($keyField!=='') $keys->add($this->getDataFieldValue($data,$keyField)); if($index===$editIndex) - $itemType='EditItem'; + $itemType=self::IT_EDITITEM; else if($index===$selectedIndex) - $itemType='SelectedItem'; + $itemType=self::IT_SELECTEDITEM; else if($index % 2) - $itemType='AlternatingItem'; + $itemType=self::IT_ALTERNATINGITEM; else - $itemType='Item'; + $itemType=self::IT_ITEM; $items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$data,$columns)); $index++; $dsIndex++; } - $this->_footer=$this->createItemInternal(-1,-1,'Footer',true,null,$columns); + $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns); if($allowPaging) $this->createPager(-1,-1,$columnCount,$ds); $this->setViewState('ItemCount',$index,0); @@ -1003,7 +1018,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer /** * Creates a datagrid item instance based on the item type and index. * @param integer zero-based item index - * @param string item type, may be 'Header', 'Footer', 'Item', 'Separator', 'AlternatingItem', 'SelectedItem', 'EditItem'. + * @param string item type, may be self::IT_HEADER, self::IT_FOOTER, self::IT_ITEM, self::IT_SEPARATOR, self::IT_ALTERNATINGITEM, self::IT_SELECTEDITEM, self::IT_EDITITEM. * @return TDataGridItem created data list item */ protected function createItem($itemIndex,$dataSourceIndex,$itemType) @@ -1045,7 +1060,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $index=0; foreach($columns as $column) { - if($itemType==='Header') + if($itemType===self::IT_HEADER) $cell=new TTableHeaderCell; else $cell=new TTableCell; @@ -1057,7 +1072,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer private function createPager($itemIndex,$dataSourceIndex,$columnSpan,$pagedDataSource) { - $item=$this->createItem($itemIndex,$dataSourceIndex,'Pager'); + $item=$this->createItem($itemIndex,$dataSourceIndex,self::IT_PAGER); $this->initializePager($item,$columnSpan,$pagedDataSource); $this->onItemCreated(new TDataGridItemEventParameter($item)); $this->getControls()->add($item); @@ -1258,9 +1273,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer } else { - $column->setHeaderText('Item'); + $column->setHeaderText(self::IT_ITEM); $column->setDataField($key); - $column->setSortExpression('Item'); + $column->setSortExpression(self::IT_ITEM); $autoColumns->add($column); } } @@ -1322,31 +1337,31 @@ class TDataGrid extends TBaseDataList implements INamingContainer $itemType=$item->getItemType(); switch($itemType) { - case 'Header': + case self::IT_HEADER: if($headerStyle) $item->getStyle()->mergeWith($headerStyle); if(!$this->getShowHeader()) $item->setVisible(false); break; - case 'Footer': + case self::IT_FOOTER: if($footerStyle) $item->getStyle()->mergeWith($footerStyle); if(!$this->getShowFooter()) $item->setVisible(false); break; - case 'Separator': + case self::IT_SEPARATOR: if($separatorStyle) $item->getStyle()->mergeWith($separatorStyle); break; - case 'Item': + case self::IT_ITEM: if($itemStyle) $item->getStyle()->mergeWith($itemStyle); break; - case 'AlternatingItem': + case self::IT_ALTERNATINGITEM: if($alternatingItemStyle) $item->getStyle()->mergeWith($alternatingItemStyle); break; - case 'SelectedItem': + case self::IT_SELECTEDITEM: if($selectedItemStyle) $item->getStyle()->mergeWith($selectedItemStyle); if($index % 2==1) @@ -1360,7 +1375,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $item->getStyle()->mergeWith($alternatingItemStyle); } break; - case 'EditItem': + case self::IT_EDITITEM: if($editItemStyle) $item->getStyle()->mergeWith($editItemStyle); if($index % 2==1) @@ -1374,7 +1389,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $item->getStyle()->mergeWith($alternatingItemStyle); } break; - case 'Pager': + case self::IT_PAGER: if($pagerStyle) { $item->getStyle()->mergeWith($pagerStyle); @@ -1393,7 +1408,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer default: break; } - if($this->_columns && $itemType!=='Pager') + if($this->_columns && $itemType!==self::IT_PAGER) { $n=$this->_columns->getCount(); $cells=$item->getCells(); @@ -1405,9 +1420,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer $cell->setVisible(false); else { - if($itemType==='Header') + if($itemType===self::IT_HEADER) $style=$column->getHeaderStyle(false); - else if($itemType==='Footer') + else if($itemType===self::IT_FOOTER) $style=$column->getFooterStyle(false); else $style=$column->getItemStyle(false); @@ -1416,7 +1431,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer } } } - else if($itemType==='Pager' && $invisibleColumns>0) + else if($itemType===self::IT_PAGER && $invisibleColumns>0) { $cell=$item->getCells()->itemAt(0); $cell->setColumnSpan($cell->getColumnSpan()-$invisibleColumns); @@ -1689,7 +1704,7 @@ class TDataGridItem extends TTableRow implements INamingContainer } /** - * @return string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager' + * @return string item type. */ public function getItemType() { @@ -1697,11 +1712,11 @@ class TDataGridItem extends TTableRow implements INamingContainer } /** - * @param mixed data to be associated with the item + * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager' */ public function setItemType($value) { - $this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'); + $this->_itemType=$value; } /** diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index 6206e595..e8cc81aa 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -275,7 +275,7 @@ abstract class TDataGridColumn extends TApplicationComponent { switch($itemType) { - case 'Header': + case TDataGrid::IT_HEADER: $sortExpression=$this->getSortExpression(); $allowSorting=$sortExpression!=='' && (!$this->_owner || $this->_owner->getAllowSorting()); if($allowSorting) @@ -317,7 +317,7 @@ abstract class TDataGridColumn extends TApplicationComponent } } break; - case 'Footer': + case TDataGrid::IT_FOOTER: if(($text=$this->getFooterText())==='') $text=' '; $cell->setText($text); diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index 56e8d43c..f5f4b9fa 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -98,6 +98,15 @@ Prado::using('System.Web.UI.WebControls.TRepeatInfo'); */ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUser { + /** + * Command name that TDataList understands. + */ + const CMD_SELECT='Select'; + const CMD_EDIT='Edit'; + const CMD_UPDATE='Update'; + const CMD_DELETE='Delete'; + const CMD_CANCEL='Cancel'; + /** * @var TDataListItemCollection item list */ @@ -645,28 +654,28 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs { $this->onItemCommand($param); $command=$param->getCommandName(); - if(strcasecmp($command,'select')===0) + if(strcasecmp($command,self::CMD_SELECT)===0) { $this->setSelectedItemIndex($param->getItem()->getItemIndex()); $this->onSelectedIndexChanged(null); return true; } - else if(strcasecmp($command,'edit')===0) + else if(strcasecmp($command,self::CMD_EDIT)===0) { $this->onEditCommand($param); return true; } - else if(strcasecmp($command,'delete')===0) + else if(strcasecmp($command,self::CMD_DELETE)===0) { $this->onDeleteCommand($param); return true; } - else if(strcasecmp($command,'update')===0) + else if(strcasecmp($command,self::CMD_UPDATE)===0) { $this->onUpdateCommand($param); return true; } - else if(strcasecmp($command,'cancel')===0) + else if(strcasecmp($command,self::CMD_CANCEL)===0) { $this->onCancelCommand($param); return true; diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php index abc372a0..65e389bd 100644 --- a/framework/Web/UI/WebControls/TEditCommandColumn.php +++ b/framework/Web/UI/WebControls/TEditCommandColumn.php @@ -153,9 +153,9 @@ class TEditCommandColumn extends TDataGridColumn public function initializeCell($cell,$columnIndex,$itemType) { parent::initializeCell($cell,$columnIndex,$itemType); - if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem') + if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM) $cell->getControls()->add($this->createButton('Edit',$this->getEditText(),false,'')); - else if($itemType==='EditItem') + else if($itemType===TDataGrid::IT_EDITITEM) { $controls=$cell->getControls(); $controls->add($this->createButton('Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup())); diff --git a/framework/Web/UI/WebControls/THyperLinkColumn.php b/framework/Web/UI/WebControls/THyperLinkColumn.php index 96e905cd..9fc1e3d2 100644 --- a/framework/Web/UI/WebControls/THyperLinkColumn.php +++ b/framework/Web/UI/WebControls/THyperLinkColumn.php @@ -14,6 +14,10 @@ * TDataGridColumn class file */ Prado::using('System.Web.UI.WebControls.TDataGridColumn'); +/** + * THyperLink class file + */ +Prado::using('System.Web.UI.WebControls.THyperLink'); /** * THyperLinkColumn class @@ -165,9 +169,9 @@ class THyperLinkColumn extends TDataGridColumn public function initializeCell($cell,$columnIndex,$itemType) { parent::initializeCell($cell,$columnIndex,$itemType); - if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem') + if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM || $itemType===TDataGrid::IT_EDITITEM) { - $link=Prado::createComponent('System.Web.UI.WebControls.THyperLink'); + $link=new THyperLink; $link->setText($this->getText()); $link->setNavigateUrl($this->getNavigateUrl()); $link->setTarget($this->getTarget()); diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php index 4fa2f9ae..3d57fbd5 100644 --- a/framework/Web/UI/WebControls/TRepeater.php +++ b/framework/Web/UI/WebControls/TRepeater.php @@ -56,6 +56,16 @@ Prado::using('System.Web.UI.WebControls.TDataBoundControl'); */ class TRepeater extends TDataBoundControl implements INamingContainer { + /** + * Repeater item types + */ + const IT_HEADER='Header'; + const IT_FOOTER='Footer'; + const IT_EMPTY='Empty'; + const IT_ITEM='Item'; + const IT_SEPARATOR='Separator'; + const IT_ALTERNATINGITEM='AlternatingItem'; + /** * @var ITemplate template for repeater items */ @@ -251,7 +261,7 @@ class TRepeater extends TDataBoundControl implements INamingContainer /** * 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', 'SelectedItem', 'EditItem'. + * @param string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'. * @return TRepeaterItem created repeater item */ protected function createItem($itemIndex,$itemType) @@ -263,7 +273,7 @@ class TRepeater extends TDataBoundControl implements INamingContainer * Creates a repeater item and does databinding if needed. * This method invokes {@link createItem} to create a new repeater item. * @param integer zero-based item index. - * @param string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem', 'SelectedItem', 'EditItem'. + * @param string item type, may be 'Header', 'Footer', 'Empty', 'Item', 'Separator', 'AlternatingItem'. * @param boolean whether to do databinding for the item * @param mixed data to be associated with the item * @return TRepeaterItem the created item @@ -301,16 +311,12 @@ class TRepeater extends TDataBoundControl implements INamingContainer $template=null; switch($item->getItemType()) { - case 'Header': $template=$this->_headerTemplate; break; - case 'Footer': $template=$this->_footerTemplate; break; - case 'Empty': $template=$this->_emptyTemplate; break; - case 'Item': $template=$this->_itemTemplate; break; - case 'Separator': $template=$this->_separatorTemplate; break; - case 'AlternatingItem': $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break; - case 'SelectedItem': - case 'EditItem': - default: - break; + case self::IT_HEADER: $template=$this->_headerTemplate; break; + case self::IT_FOOTER: $template=$this->_footerTemplate; break; + case self::IT_EMPTY : $template=$this->_emptyTemplate; break; + case self::IT_ITEM : $template=$this->_itemTemplate; break; + case self::IT_SEPARATOR : $template=$this->_separatorTemplate; break; + case self::IT_ALTERNATINGITEM : $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break; } if($template!==null) $template->instantiateIn($item); @@ -374,19 +380,19 @@ class TRepeater extends TDataBoundControl implements INamingContainer $items=$this->getItems(); $hasSeparator=$this->_separatorTemplate!==null; if($this->_headerTemplate!==null) - $this->_header=$this->createItemInternal(-1,'Header',false,null); + $this->_header=$this->createItemInternal(-1,self::IT_HEADER,false,null); for($i=0;$i<$itemCount;++$i) { if($hasSeparator && $i>0) - $this->createItemInternal($i-1,'Separator',false,null); - $itemType=$i%2==0?'Item':'AlternatingItem'; + $this->createItemInternal($i-1,self::IT_SEPARATOR,false,null); + $itemType=$i%2==0?self::IT_ITEM:self::IT_ALTERNATINGITEM; $items->add($this->createItemInternal($i,$itemType,false,null)); } if($this->_footerTemplate!==null) - $this->_footer=$this->createItemInternal(-1,'Footer',false,null); + $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,false,null); } else if($this->_emptyTemplate!==null) - $this->createItemInternal(-1,'Empty',false,null); + $this->createItemInternal(-1,self::IT_EMPTY,false,null); $this->clearChildState(); } @@ -405,17 +411,17 @@ class TRepeater extends TDataBoundControl implements INamingContainer foreach($data as $dataItem) { if($itemIndex===0 && $this->_headerTemplate!==null) - $this->_header=$this->createItemInternal(-1,'Header',true,null); + $this->_header=$this->createItemInternal(-1,self::IT_HEADER,true,null); if($hasSeparator && $itemIndex>0) - $this->createItemInternal($itemIndex-1,'Separator',true,null); - $itemType=$itemIndex%2==0?'Item':'AlternatingItem'; + $this->createItemInternal($itemIndex-1,self::IT_SEPARATOR,true,null); + $itemType=$itemIndex%2==0?self::IT_ITEM:self::IT_ALTERNATINGITEM; $items->add($this->createItemInternal($itemIndex,$itemType,true,$dataItem)); $itemIndex++; } if($itemIndex>0 && $this->_footerTemplate!==null) - $this->_footer=$this->createItemInternal(-1,'Footer',true,null); + $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,true,null); if($itemIndex===0 && $this->_emptyTemplate!==null) - $this->createItemInternal(-1,'Empty',true,null); + $this->createItemInternal(-1,self::IT_EMPTY,true,null); $this->setViewState('ItemCount',$itemIndex,0); } @@ -622,7 +628,7 @@ class TRepeaterItem extends TControl implements INamingContainer public function __construct($itemIndex,$itemType) { $this->_itemIndex=$itemIndex; - $this->_itemType=TPropertyValue::ensureEnum($itemType,'Header','Footer','Empty','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'); + $this->_itemType=$itemType; } /** diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php index 08c4e2c6..f83e3290 100644 --- a/framework/Web/UI/WebControls/TTemplateColumn.php +++ b/framework/Web/UI/WebControls/TTemplateColumn.php @@ -138,18 +138,18 @@ class TTemplateColumn extends TDataGridColumn $template=null; switch($itemType) { - case 'Header': + case TDataGrid::IT_HEADER: $template=$this->_headerTemplate; break; - case 'Footer': + case TDataGrid::IT_FOOTER: $template=$this->_footerTemplate; break; - case 'Item': - case 'AlternatingItem': - case 'SelectedItem': + case TDataGrid::IT_ITEM: + case TDataGrid::IT_ALTERNATINGITEM: + case TDataGrid::IT_SELECTEDITEM: $template=$this->_itemTemplate; break; - case 'EditItem': + case TDataGrid::IT_EDITITEM: $template=$this->_editItemTemplate===null?$this->_itemTemplate:$this->_editItemTemplate; break; } @@ -159,7 +159,7 @@ class TTemplateColumn extends TDataGridColumn $cell->getControls()->clear(); $template->instantiateIn($cell); } - else if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem') + else if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM || $itemType===TDataGrid::IT_EDITITEM) $cell->setText(' '); } } diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php index 75a571a5..29d97a45 100644 --- a/framework/Web/UI/WebControls/TWizard.php +++ b/framework/Web/UI/WebControls/TWizard.php @@ -2,18 +2,10 @@ Prado::using('System.Web.UI.WebControls.TMultiView'); Prado::using('System.Web.UI.WebControls.TPanel'); - -/** - -containment relationship - -wizard