From 618293517861b69334cd470068199394120cd20a Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 30 Jun 2006 18:41:56 +0000 Subject: Merge from 3.0 branch till 1218. --- framework/Caching/TMemCache.php | 2 +- framework/Caching/TSqliteCache.php | 2 +- framework/Exceptions/TErrorHandler.php | 2 +- framework/Exceptions/messages.txt | 4 +++- framework/Web/THttpSession.php | 2 +- framework/Web/UI/TTemplateManager.php | 6 +++--- framework/Web/UI/TThemeManager.php | 10 ++++++++-- framework/Web/UI/WebControls/TDataGrid.php | 19 +++++++++++++------ 8 files changed, 31 insertions(+), 16 deletions(-) (limited to 'framework') diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php index dd229312..bd1ae189 100644 --- a/framework/Caching/TMemCache.php +++ b/framework/Caching/TMemCache.php @@ -53,7 +53,7 @@ * * TMemCache may be configured in application configuration file as follows * - * + * * * where {@link getHost Host} and {@link getPort Port} are configurable properties * of TMemCache. diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php index dc4bf13f..b94b39fe 100644 --- a/framework/Caching/TSqliteCache.php +++ b/framework/Caching/TSqliteCache.php @@ -55,7 +55,7 @@ * * TSqliteCache may be configured in application configuration file as follows * - * + * * * where {@link getDbFile DbFile} is a property specifying the location of the * SQLite DB file (in the namespace format). diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 25f421e3..e18de7ab 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -42,7 +42,7 @@ * by the application object to handle errors. * * TErrorHandler may be configured in application configuration file as follows - * + * * * @author Qiang Xue * @version $Revision: $ $Date: $ diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 38541fed..22b28a42 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -144,7 +144,9 @@ authmanager_usermanager_invalid = TAuthManager.UserManager '{0}' does not refe authmanager_usermanager_unchangeable = TAuthManager.UserManager cannot be modified after the module is initialized. authmanager_session_required = TAuthManager requires a session application module. -thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid directory. +thememanager_service_unavailable = TThemeManager requires TPageService to be available. This error often occurs when you configure TThemeManager outside of the page service configuration. +thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid path alias. Make sure you have defined this alias in configuration and it points to a valid directory. +thememanager_basepath_invalid2 = TThemeManager.BasePath '{0}' is not a valid directory. thememanager_basepath_unchangeable = TThemeManager.BasePath cannot be modified after the module is initialized. theme_baseurl_required = TThemeManager.BasePath is required. By default, a directory named 'themes' under the directory containing the application entry script is assumed. diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php index f95cb72d..4439cf57 100644 --- a/framework/Web/THttpSession.php +++ b/framework/Web/THttpSession.php @@ -376,7 +376,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar if($this->_started) throw new TInvalidOperationException('httpsession_transid_unchangeable'); else - ini_set('session.use_only_cookies',TPropertyValue::ensureBoolean($value)?'1':'0'); + ini_set('session.use_trans_sid',TPropertyValue::ensureBoolean($value)?'1':'0'); } /** diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index caa1dcbc..c13b5a9d 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -680,7 +680,7 @@ class TTemplate extends TApplicationComponent implements ITemplate if($matchStart>$textStart) { $value=substr($input,$textStart,$matchStart-$textStart); - if(strrpos($prop,'template')===strlen($prop)-8) + if(substr($prop,-8,8)==='template') $value=$this->parseTemplateProperty($value,$textStart); else $value=$this->parseAttribute($value); @@ -701,7 +701,7 @@ class TTemplate extends TApplicationComponent implements ITemplate } else if(strpos($str,'')===strlen($str)-4) // template comments + if(substr($str,-4,4)==='--!>') // template comments { if($expectPropEnd) throw new TConfigurationException('template_comments_forbidden'); @@ -799,7 +799,7 @@ class TTemplate extends TApplicationComponent implements ITemplate if(isset($attributes[$name])) throw new TConfigurationException('template_property_duplicated',$name); $value=$match[2][0]; - if(strrpos($name,'template')===strlen($name)-8) + if(substr($name,-8,8)==='template') { if($value[0]==='\'' || $value[0]==='"') $attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1); diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index 66bfa8be..245f8049 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -10,6 +10,8 @@ * @package System.Web.UI */ +Prado::using('System.Web.Services.TPageService'); + /** * TThemeManager class * @@ -63,7 +65,11 @@ class TThemeManager extends TModule public function init($config) { $this->_initialized=true; - $this->getService()->setThemeManager($this); + $service=$this->getService(); + if($service instanceof TPageService) + $service->setThemeManager($this); + else + throw new TConfigurationException('thememanager_service_unavailable'); } /** @@ -105,7 +111,7 @@ class TThemeManager extends TModule { $this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).'/'.self::DEFAULT_BASEPATH; if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath)) - throw new TConfigurationException('thememanager_basepath_invalid',$this->_basePath); + throw new TConfigurationException('thememanager_basepath_invalid2',$this->_basePath); $this->_basePath=$basePath; } return $this->_basePath; diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index f811edaf..fead5344 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -954,9 +954,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer { foreach($columns as $column) $column->initialize(); - if($allowPaging) - $this->_topPager=$this->createPager(); - $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,true,null,$columns); + $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); foreach($data as $key=>$row) @@ -965,6 +963,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer $keys->add($this->getDataFieldValue($row,$keyField)); else $keys->add($key); + if($index===0) + { + if($allowPaging) + $this->_topPager=$this->createPager(); + $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,true,null,$columns); + } if($index===$editIndex) $itemType=self::IT_EDITITEM; else if($index===$selectedIndex) @@ -977,9 +981,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer $index++; $dsIndex++; } - $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns); - if($allowPaging) - $this->_bottomPager=$this->createPager(); + if($index>0) + { + $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns); + if($allowPaging) + $this->_bottomPager=$this->createPager(); + } } $this->setViewState('ItemCount',$index,0); if(!$dsIndex && $this->_emptyTemplate!==null) -- cgit v1.2.3