From 6c0154fb4e292ad22667e618f598a37cc5f9d524 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 15 Jun 2006 18:18:47 +0000 Subject: Merge from 3.0 branch till 1166. --- .gitattributes | 2 +- HISTORY | 5 + buildscripts/classtree/build.php | 6 +- buildscripts/texbuilder/build.php | 12 +-- buildscripts/texbuilder/prado3_quick_start.tex | 122 ------------------------ buildscripts/texbuilder/quickstart.tex | 122 ++++++++++++++++++++++++ demos/quickstart/protected/controls/Layout.tpl | 2 +- framework/Web/Services/TPageService.php | 27 +++++- framework/Web/UI/TTemplateManager.php | 78 +++++++-------- framework/Web/UI/TThemeManager.php | 2 + framework/Web/UI/WebControls/TBaseValidator.php | 38 +++++++- framework/Web/UI/WebControls/TDataGrid.php | 4 +- framework/Web/UI/WebControls/TDataList.php | 4 +- framework/Web/UI/WebControls/TRepeater.php | 4 +- framework/Web/UI/WebControls/TTable.php | 5 - framework/Xml/TXmlDocument.php | 36 +++++++ 16 files changed, 289 insertions(+), 180 deletions(-) delete mode 100644 buildscripts/texbuilder/prado3_quick_start.tex create mode 100644 buildscripts/texbuilder/quickstart.tex diff --git a/.gitattributes b/.gitattributes index 40db22fe..e183b3dd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -24,7 +24,7 @@ buildscripts/phpbuilder/build.php -text buildscripts/setup.php -text buildscripts/texbuilder/build.php -text buildscripts/texbuilder/pages.php -text -buildscripts/texbuilder/prado3_quick_start.tex -text +buildscripts/texbuilder/quickstart.tex -text demos/blog/index.php -text demos/blog/protected/Common/BlogDataModule.php -text demos/blog/protected/Common/BlogErrorHandler.php -text diff --git a/HISTORY b/HISTORY index 9701e432..49670bd6 100644 --- a/HISTORY +++ b/HISTORY @@ -16,6 +16,11 @@ BUG: Ticket#191 - Duplicated postbacks occur when using TButton with validators BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang) CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang) CHG: Postback enabled control will always disable default client-side browser action. (Qiang) +CHG: CSS and JS files in a theme are now included in page in alphabetic order (Qiang) +ENH: Ticket#206 - Added OnValidate, OnError, OnSuccess events to validators (Qiang) +ENH: Ticket#232 - Allow <%# %> and <%= %> embedded within property values (Qiang) +ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if DataKeyField is not set. (Qiang) +ENH: Added TPageService.BasePageClass property (Qiang) Version 3.0.1 June 4, 2006 ========================== diff --git a/buildscripts/classtree/build.php b/buildscripts/classtree/build.php index ffb4eef3..bc95d1c8 100644 --- a/buildscripts/classtree/build.php +++ b/buildscripts/classtree/build.php @@ -13,7 +13,7 @@ $exclusions=array( ); $a=new ClassTreeBuilder($rootPath,$exclusions); $a->buildTree(); -$a->saveToFile('classtree.data'); +$a->saveToFile('classes.data'); class ClassTreeBuilder { @@ -174,6 +174,10 @@ class ClassTreeBuilder closedir($folder); return $files; } + + public function saveAsTagLib($fileName) + { + } } ?> \ No newline at end of file diff --git a/buildscripts/texbuilder/build.php b/buildscripts/texbuilder/build.php index cbea9859..c0577c8f 100644 --- a/buildscripts/texbuilder/build.php +++ b/buildscripts/texbuilder/build.php @@ -5,7 +5,7 @@ $pdflatexExec = "C:/Wei/miktex/texmf/MiKTeX/bin/pdflatex.exe"; $pdfTex = "$pdflatexExec -interaction=nonstopmode -max-print-line=120 %s"; -$mainTexFile = dirname(__FILE__).'/prado3_quick_start.tex'; +$mainTexFile = dirname(__FILE__).'/quickstart.tex'; //page root location $base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/'); @@ -244,14 +244,14 @@ foreach($pages as $chapter => $sections) echo " Adding $section\n"; $page = $base.'/'.$section; $current_path = $page; - + //add id to

,

, <3> $tmp_content = set_header_id(file_get_contents($page),$j++); file_put_contents($page, $tmp_content); - + $content .= get_section_label($section); $file_content = file_get_contents($page); - $tex = + $tex = $content .= parse_html($page,$file_content); } @@ -265,7 +265,7 @@ foreach($pages as $chapter => $sections) if($argc <= 1 && $count > 1) { - echo "** Use pdflatex to compile prado3_quick_start.tex to obtain PDF version of quickstart tutorial. **\n"; + echo "** Use pdflatex to compile quickstart.tex to obtain PDF version of quickstart tutorial. **\n"; exit; } if($argv[1] == 'pdf') @@ -277,7 +277,7 @@ if($argv[1] == 'pdf') system($command); system($command); //run it twice - echo "\n\n** PDF file prado3_quick_start.pdf created **\n\n"; + echo "\n\n** PDF file quickstart.pdf created **\n\n"; } else diff --git a/buildscripts/texbuilder/prado3_quick_start.tex b/buildscripts/texbuilder/prado3_quick_start.tex deleted file mode 100644 index ee3010fe..00000000 --- a/buildscripts/texbuilder/prado3_quick_start.tex +++ /dev/null @@ -1,122 +0,0 @@ -\documentclass{book} -\usepackage[pdftex]{graphicx} -\usepackage[pdftex]{hyperref} - -\usepackage{fancyhdr} - -%---------- fonts Type 1 ----------------- -%\usepackage{times} -%\usepackage[T1]{fontenc} -%\usepackage{textcomp} - -%------------------------Page set-up----------------------------------------- - -\renewcommand{\baselinestretch}{1.25} -\setlength{\hoffset}{-1in} -\setlength{\oddsidemargin}{3.5cm} -\setlength{\evensidemargin}{3.5cm} -\setlength{\topmargin}{0cm} -\setlength{\footskip}{2cm} -\setlength{\headheight}{14pt} -\setlength{\marginparwidth}{0cm} -\setlength{\marginparsep}{0cm} -\setlength{\marginparpush}{0cm} -\setlength{\textwidth}{15cm} -\setlength{\parindent}{0cm} -\setlength{\parskip}{0.75\baselineskip} - -%------------------------------------------------------------------------------ - - -%---- change link style ---- -\hypersetup{colorlinks, linkcolor=blue, pdfstartview={FitH}} - - -% Pages and Fancyheadings stuff -%----------------------------------------------------------------------- -\cfoot{\thepage} -\fancyhead[LE,RO]{} -\fancyhead[LO]{\nouppercase{\scshape\rightmark}} -\fancyhead[RE]{\nouppercase{\scshape\leftmark}} -%----------------------------------------------------------------------- - -%----------------- TITLE -------------- - -\title{\Huge \bfseries Prado v3.0.1 Quick Start Tutorial - \thanks{Copyright 2005-2006. All Rights Reserved.} -} -\author{Qiang Xue, Wei Zhuo} -\date{\today} - - -%-------------- BEGIN DOCUMENT ------------------ - - -\begin{document} - -\maketitle - -\pagestyle{plain} -\addcontentsline{toc}{chapter}{Contents} -\pagenumbering{roman} -\tableofcontents - -\chapter*{Preface} -\addcontentsline{toc}{chapter}{Preface} -Prado quick start doc - -\chapter*{License} -\addcontentsline{toc}{chapter}{License} -PRADO is free software released under the terms of the following BSD license.\\ -Copyright 2004-2006, PradoSoft (http://www.pradosoft.com)\\ -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -\begin{enumerate} - \item Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - - \item Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -\item Neither the name of the developer nor the names of its contributors may -be used to endorse or promote products derived from this software without -specific prior written permission. -\end{enumerate} - -\begin{verbatim} -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\end{verbatim} - - -\newpage - -\pagestyle{fancyplain} -\pagenumbering{arabic} - -\include{ch1} -\include{ch2} -\include{ch3} -\include{ch4} -\include{ch5} -\include{ch6} -\include{ch7} -\include{ch8} -\include{ch9} -\include{ch10} -\include{ch11} -\include{ch12} -\include{ch13} - -\end{document} diff --git a/buildscripts/texbuilder/quickstart.tex b/buildscripts/texbuilder/quickstart.tex new file mode 100644 index 00000000..ee3010fe --- /dev/null +++ b/buildscripts/texbuilder/quickstart.tex @@ -0,0 +1,122 @@ +\documentclass{book} +\usepackage[pdftex]{graphicx} +\usepackage[pdftex]{hyperref} + +\usepackage{fancyhdr} + +%---------- fonts Type 1 ----------------- +%\usepackage{times} +%\usepackage[T1]{fontenc} +%\usepackage{textcomp} + +%------------------------Page set-up----------------------------------------- + +\renewcommand{\baselinestretch}{1.25} +\setlength{\hoffset}{-1in} +\setlength{\oddsidemargin}{3.5cm} +\setlength{\evensidemargin}{3.5cm} +\setlength{\topmargin}{0cm} +\setlength{\footskip}{2cm} +\setlength{\headheight}{14pt} +\setlength{\marginparwidth}{0cm} +\setlength{\marginparsep}{0cm} +\setlength{\marginparpush}{0cm} +\setlength{\textwidth}{15cm} +\setlength{\parindent}{0cm} +\setlength{\parskip}{0.75\baselineskip} + +%------------------------------------------------------------------------------ + + +%---- change link style ---- +\hypersetup{colorlinks, linkcolor=blue, pdfstartview={FitH}} + + +% Pages and Fancyheadings stuff +%----------------------------------------------------------------------- +\cfoot{\thepage} +\fancyhead[LE,RO]{} +\fancyhead[LO]{\nouppercase{\scshape\rightmark}} +\fancyhead[RE]{\nouppercase{\scshape\leftmark}} +%----------------------------------------------------------------------- + +%----------------- TITLE -------------- + +\title{\Huge \bfseries Prado v3.0.1 Quick Start Tutorial + \thanks{Copyright 2005-2006. All Rights Reserved.} +} +\author{Qiang Xue, Wei Zhuo} +\date{\today} + + +%-------------- BEGIN DOCUMENT ------------------ + + +\begin{document} + +\maketitle + +\pagestyle{plain} +\addcontentsline{toc}{chapter}{Contents} +\pagenumbering{roman} +\tableofcontents + +\chapter*{Preface} +\addcontentsline{toc}{chapter}{Preface} +Prado quick start doc + +\chapter*{License} +\addcontentsline{toc}{chapter}{License} +PRADO is free software released under the terms of the following BSD license.\\ +Copyright 2004-2006, PradoSoft (http://www.pradosoft.com)\\ +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +\begin{enumerate} + \item Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + + \item Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +\item Neither the name of the developer nor the names of its contributors may +be used to endorse or promote products derived from this software without +specific prior written permission. +\end{enumerate} + +\begin{verbatim} +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +\end{verbatim} + + +\newpage + +\pagestyle{fancyplain} +\pagenumbering{arabic} + +\include{ch1} +\include{ch2} +\include{ch3} +\include{ch4} +\include{ch5} +\include{ch6} +\include{ch7} +\include{ch8} +\include{ch9} +\include{ch10} +\include{ch11} +\include{ch12} +\include{ch13} + +\end{document} diff --git a/demos/quickstart/protected/controls/Layout.tpl b/demos/quickstart/protected/controls/Layout.tpl index d4a6a7e5..733bf6e1 100644 --- a/demos/quickstart/protected/controls/Layout.tpl +++ b/demos/quickstart/protected/controls/Layout.tpl @@ -19,7 +19,7 @@ Home | PradoSoft.com | -PDF Version | +PDF Version | diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 1df4ffde..5172f59c 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -95,6 +95,10 @@ class TPageService extends TService * @var string root path of pages */ private $_basePath=null; + /** + * @var string base path class in namespace format + */ + private $_basePageClass='TPage'; /** * @var string default page */ @@ -397,6 +401,25 @@ class TPageService extends TService $this->_basePath=realpath($path); } + /** + * Sets the base page class name (in namespace format). + * If a page only has a template file without page class file, + * this base page class will be instantiated. + * @param string class name + */ + public function setBasePageClass($value) + { + $this->_basePageClass=$value; + } + + /** + * @return string base page class name in namespace format. Defaults to 'TPage'. + */ + public function getBasePageClass() + { + return $this->_basePageClass; + } + /** * Runs the service. * This will create the requested page, initializes it with the property values @@ -417,9 +440,9 @@ class TPageService extends TService throw new TConfigurationException('pageservice_pageclass_unknown',$className); } else - $className='TPage'; + $className=$this->getBasePageClass(); - $this->_page=new $className(); + $this->_page=Prado::createComponent($className); $this->_page->setPagePath($this->getRequestedPagePath()); // initialize page properties with those set in configurations diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index cb05fa35..53239bd9 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -383,28 +383,6 @@ class TTemplate extends TApplicationComponent implements ITemplate * @param string property name * @param mixed property initial value */ - protected function configureControl2($control,$name,$value) - { - if(strncasecmp($name,'on',2)===0) // is an event - $this->configureEvent($control,$name,$value,$control); - else if(($pos=strrpos($name,'.'))===false) // is a simple property or custom attribute - $this->configureProperty($control,$name,$value); - else // is a subproperty - { - $subName=substr($name,$pos+1); - if(strncasecmp($subName,'on',2)===0) // is an event: XXX.YYY.OnZZZ - { - $object=$control->getSubProperty(substr($name,0,$pos)); - if(($object instanceof TControl)) - $this->configureEvent($object,$subName,$value,$control); - else - $this->configureSubProperty($control,$name,$value); - } - else - $this->configureSubProperty($control,$name,$value); - } - } - protected function configureControl($control,$name,$value) { if(strncasecmp($name,'on',2)===0) // is an event @@ -414,6 +392,7 @@ class TTemplate extends TApplicationComponent implements ITemplate else // is a subproperty $this->configureSubProperty($control,$name,$value); } + /** * Configures a property of a non-control component. * @param TComponent component to be configured @@ -632,7 +611,7 @@ class TTemplate extends TApplicationComponent implements ITemplate if($matchStart>$textStart) $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); $textStart=$matchEnd+1; - $literal=trim(THttpUtility::htmlDecode($match[5][0])); + $literal=trim($match[5][0]); if($str[2]==='=') // expression $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,$literal)); else if($str[2]==='%') // statements @@ -851,21 +830,44 @@ class TTemplate extends TApplicationComponent implements ITemplate */ protected function parseAttribute($value) { - $matches=array(); - if(!preg_match('/\\s*(<%#.*?%>|<%=.*?%>|<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>)\\s*/msS',$value,$matches) || $matches[0]!==$value) - return THttpUtility::htmlDecode($value); - $value=THttpUtility::htmlDecode($matches[1]); - if($value[2]==='#') // databind - return array(self::CONFIG_DATABIND,substr($value,3,strlen($value)-5)); - else if($value[2]==='=') // a dynamic initialization - return array(self::CONFIG_EXPRESSION,substr($value,3,strlen($value)-5)); - else if($value[2]==='~') // a URL - return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5))); - else if($value[2]==='[') - return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6))); - else if($value[2]==='$') - return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5))); - return ''; + if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0) + { + $isDataBind=false; + $textStart=0; + $expr=''; + for($i=0;$i<$n;++$i) + { + $match=$matches[0][$i]; + $token=$match[0]; + $offset=$match[1]; + $length=strlen($token); + if($token[2]==='#') + $isDataBind=true; + if($offset>$textStart) + $expr.=".'".strtr(substr($value,$textStart,$offset-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'"; + $expr.='.('.substr($token,3,$length-5).')'; + $textStart=$offset+$length; + } + $length=strlen($value); + if($length>$textStart) + $expr.=".'".substr($value,$textStart,$length-$textStart)."'"; + if($isDataBind) + return array(self::CONFIG_DATABIND,ltrim($expr,'.')); + else + return array(self::CONFIG_EXPRESSION,ltrim($expr,'.')); + } + else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>)\\s*/msS',$value,$matches) && $matches[0]===$value) + { + $value=$matches[1]; + if($value[2]==='~') // a URL + return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5))); + else if($value[2]==='[') + return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6))); + else if($value[2]==='$') + return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5))); + } + else + return $value; } protected function validateAttributes($type,$attributes) diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index fcb20a81..66bfa8be 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -305,6 +305,8 @@ class TTheme extends TApplicationComponent implements ITheme } } closedir($dir); + sort($this->_cssFiles); + sort($this->_jsFiles); if($cache!==null) $cache->set(self::THEME_CACHE_PREFIX.$themePath,array($this->_skins,$this->_cssFiles,$this->_jsFiles,time())); } diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 3fe9ee03..1194089e 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -473,10 +473,22 @@ abstract class TBaseValidator extends TLabel implements IValidator */ public function validate() { + $this->onValidate(); $this->setIsValid(true); $control=$this->getValidationTarget(); if($control && $this->getVisible(true) && $this->getEnabled()) - $this->setIsValid($this->evaluateIsValid()); + { + if($this->evaluateIsValid()) + { + $this->setIsValid(true); + $this->onSuccess(); + } + else + { + $this->setIsValid(false); + $this->onError(); + } + } return $this->getIsValid(); } @@ -503,6 +515,30 @@ abstract class TBaseValidator extends TLabel implements IValidator */ abstract protected function evaluateIsValid(); + /** + * This event is raised when the validator succeeds in validation. + */ + public function onSuccess() + { + $this->raiseEvent('OnSuccess',$this,null); + } + + /** + * This event is raised when the validator fails in validation. + */ + public function onError() + { + $this->raiseEvent('OnError',$this,null); + } + + /** + * This event is raised right before the validator starts to perform validation. + */ + public function onValidate() + { + $this->raiseEvent('OnValidate',$this,null); + } + /** * Renders the validator control. * @param THtmlWriter writer for the rendering purpose diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index d2625c0d..69798c1a 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -1047,10 +1047,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer $editIndex=$this->getEditItemIndex(); $index=0; $dsIndex=$ds->getAllowPaging()?$ds->getFirstIndexInPage():0; - foreach($ds as $data) + foreach($ds as $key=>$data) { if($keyField!=='') $keys->add($this->getDataFieldValue($data,$keyField)); + else + $keys->add($key); if($index===$editIndex) $itemType=self::IT_EDITITEM; else if($index===$selectedIndex) diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index 0bec8921..b2bd9229 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -1129,10 +1129,12 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs $hasSeparator=$this->_separatorTemplate!==null; $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); - foreach($data as $dataItem) + foreach($data as $key=>$dataItem) { if($keyField!=='') $keys->add($this->getDataFieldValue($dataItem,$keyField)); + else + $keys->add($key); if($itemIndex===0 && $this->_headerTemplate!==null) $this->_header=$this->createItemInternal(-1,'Header',true,null); if($hasSeparator && $itemIndex>0) diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php index 2070cb1a..9c1cc4ac 100644 --- a/framework/Web/UI/WebControls/TRepeater.php +++ b/framework/Web/UI/WebControls/TRepeater.php @@ -443,10 +443,12 @@ class TRepeater extends TDataBoundControl implements INamingContainer $items=$this->getItems(); $itemIndex=0; $hasSeparator=$this->_separatorTemplate!==null; - foreach($data as $dataItem) + foreach($data as $key=>$dataItem) { if($keyField!=='') $keys->add($this->getDataFieldValue($dataItem,$keyField)); + else + $keys->add($key); if($itemIndex===0 && $this->_headerTemplate!==null) $this->_header=$this->createItemInternal(-1,self::IT_HEADER,true,null); if($hasSeparator && $itemIndex>0) diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php index aaed37df..1c58c62e 100644 --- a/framework/Web/UI/WebControls/TTable.php +++ b/framework/Web/UI/WebControls/TTable.php @@ -67,11 +67,6 @@ Prado::using('System.Web.UI.WebControls.TTableRow'); */ class TTable extends TWebControl { - /** - * @var TTableRowCollection row collection - */ - private $_rows=null; - /** * @return string tag name for the table */ diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php index ab4b0b7a..0d766c68 100644 --- a/framework/Xml/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -229,6 +229,42 @@ class TXmlElement extends TComponent * You can also get the version and encoding of the XML document by * the Version and Encoding properties. * + * To construct an XML string, you may do the following: + * + * $doc=new TXmlDocument('1.0','utf-8'); + * $doc->TagName='Root'; + * + * $proc=new TXmlElement('Proc'); + * $proc->setAttribute('Name','xxxx'); + * $doc->Elements[]=$proc; + * + * $query=new TXmlElement('Query'); + * $query->setAttribute('ID','xxxx'); + * $proc->Elements[]=$query; + * + * $attr=new TXmlElement('Attr'); + * $attr->setAttribute('Name','aaa'); + * $attr->Value='1'; + * $query->Elements[]=$attr; + * + * $attr=new TXmlElement('Attr'); + * $attr->setAttribute('Name','bbb'); + * $attr->Value='1'; + * $query->Elements[]=$attr; + * + * The above code represents the following XML string: + * + * + * + * + * + * 1 + * 1 + * + * + * + * + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Xml -- cgit v1.2.3