From 961777817a3543dbe179711b8ad1021a8128c83d Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 11 Apr 2006 19:51:01 +0000 Subject: Added Raw layout to TDataList. --- framework/Web/UI/WebControls/TRepeatInfo.php | 38 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls/TRepeatInfo.php') diff --git a/framework/Web/UI/WebControls/TRepeatInfo.php b/framework/Web/UI/WebControls/TRepeatInfo.php index 5f4fb825..10c49691 100644 --- a/framework/Web/UI/WebControls/TRepeatInfo.php +++ b/framework/Web/UI/WebControls/TRepeatInfo.php @@ -57,13 +57,16 @@ interface IRepeatInfoUser * TRepeatInfo class. * TRepeatInfo represents repeat information for controls like {@link TCheckBoxList}. * The layout of the repeated items is specified via {@link setRepeatLayout RepeatLayout}, - * which can be either 'Table' (default) or 'Flow'. + * which can be either 'Table' (default), 'Flow' or 'Raw'. * A table layout uses HTML table cells to organize the items while * a flow layout uses line breaks to organize the items. * The number of columns used to display the items is specified via * {@link setRepeatColumns RepeatColumns} property, while the {@link setRepeatDirection RepeatDirection} * governs the order of the items being rendered. * + * Note, the Raw layout does not contain any formatting tags and thus ignores + * the column and repeat direction settings. + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls @@ -169,11 +172,12 @@ class TRepeatInfo extends TComponent } /** - * @param string how the repeated items should be displayed, using table or using line breaks. Defaults to 'Table'. + * @param string how the repeated items should be displayed, using table or using line breaks. + * Valid values include 'Table', 'Flow' and 'Raw'. */ public function setRepeatLayout($value) { - $this->_repeatLayout=TPropertyValue::ensureEnum($value,array('Table','Flow')); + $this->_repeatLayout=TPropertyValue::ensureEnum($value,array('Table','Flow','Raw')); } /** @@ -192,6 +196,11 @@ class TRepeatInfo extends TComponent $control->setCaptionAlign($this->_captionAlign); } } + else if($this->_repeatLayout==='Raw') + { + $this->renderRawContents($writer,$user); + return; + } else $control=new TWebControl; $control->setID($user->getClientID()); @@ -209,6 +218,29 @@ class TRepeatInfo extends TComponent $control->renderEndTag($writer); } + /** + * Renders contents in raw format. + * @param THtmlWriter writer for the rendering purpose + * @param IRepeatInfoUser repeat information user + */ + protected function renderRawContents($writer,$user) + { + if($user->getHasHeader()) + $user->renderItem($writer,$this,'Header',-1); + + // render items + $hasSeparators=$user->getHasSeparators(); + $itemCount=$user->getItemCount(); + for($i=0;$i<$itemCount;++$i) + { + $user->renderItem($writer,$this,'Item',$i); + if($hasSeparators && $i!=$itemCount-1) + $user->renderItem($writer,$this,'Separator',$i); + } + if($user->getHasFooter()) + $user->renderItem($writer,$this,'Footer',-1); + } + /** * Renders contents in horizontal repeat direction. * @param THtmlWriter writer for the rendering purpose -- cgit v1.2.3