From 6228873cf9d6471463d2413e7dfd7447f759baf2 Mon Sep 17 00:00:00 2001 From: "christophe.boulain" <> Date: Wed, 3 Dec 2008 14:22:03 +0000 Subject: Merge from trunk --- framework/3rdParty/TinyMCE/tiny_mce.md5 | 2 +- framework/3rdParty/TinyMCE/tiny_mce.tar | Bin 3645440 -> 3880960 bytes framework/Caching/TAPCCache.php | 1 - framework/Caching/TCache.php | 20 +- framework/Caching/TMemCache.php | 1 - framework/Caching/TSqliteCache.php | 1 - framework/Collections/TAttributeCollection.php | 1 - framework/Collections/TDummyDataSource.php | 1 - framework/Collections/TList.php | 1 - framework/Collections/TMap.php | 1 - framework/Collections/TPagedDataSource.php | 1 - framework/Collections/TPagedList.php | 1 - framework/Collections/TQueue.php | 1 - framework/Collections/TStack.php | 1 - .../Exceptions/TActiveRecordException.php | 1 - .../Data/ActiveRecord/Exceptions/messages.txt | 3 +- .../Relations/TActiveRecordBelongsTo.php | 1 - .../Relations/TActiveRecordHasMany.php | 1 - .../Relations/TActiveRecordHasManyAssociation.php | 1 - .../ActiveRecord/Relations/TActiveRecordHasOne.php | 1 - .../Relations/TActiveRecordRelation.php | 1 - .../Relations/TActiveRecordRelationContext.php | 1 - .../Scaffold/InputBuilder/TIbmScaffoldInput.php | 1 - .../Scaffold/InputBuilder/TMssqlScaffoldInput.php | 1 - .../Scaffold/InputBuilder/TMysqlScaffoldInput.php | 1 - .../Scaffold/InputBuilder/TPgsqlScaffoldInput.php | 1 - .../Scaffold/InputBuilder/TScaffoldInputBase.php | 1 - .../Scaffold/InputBuilder/TScaffoldInputCommon.php | 1 - .../Scaffold/InputBuilder/TSqliteScaffoldInput.php | 1 - .../Data/ActiveRecord/Scaffold/TScaffoldBase.php | 1 - .../ActiveRecord/Scaffold/TScaffoldEditView.php | 1 - .../ActiveRecord/Scaffold/TScaffoldListView.php | 1 - .../Data/ActiveRecord/Scaffold/TScaffoldSearch.php | 1 - .../Data/ActiveRecord/Scaffold/TScaffoldView.php | 1 - framework/Data/ActiveRecord/TActiveRecord.php | 29 +- .../Data/ActiveRecord/TActiveRecordConfig.php | 1 - .../Data/ActiveRecord/TActiveRecordCriteria.php | 1 - .../Data/ActiveRecord/TActiveRecordGateway.php | 839 +++++++++++---------- .../Data/ActiveRecord/TActiveRecordManager.php | 1 - .../Data/Common/IbmDb2/TIbmColumnMetaData.php | 1 - framework/Data/Common/IbmDb2/TIbmMetaData.php | 1 - .../Data/Common/IbmDb2/TIbmMetaDataInspector.php | 1 - .../Data/Common/Mssql/TMssqlCommandBuilder.php | 1 - framework/Data/Common/Mssql/TMssqlMetaData.php | 1 - framework/Data/Common/Mssql/TMssqlTableColumn.php | 1 - framework/Data/Common/Mssql/TMssqlTableInfo.php | 1 - .../Data/Common/Mysql/TMysqlCommandBuilder.php | 1 - framework/Data/Common/Mysql/TMysqlMetaData.php | 5 +- framework/Data/Common/Mysql/TMysqlTableColumn.php | 1 - .../Data/Common/Pgsql/TPgsqlCommandBuilder.php | 1 - framework/Data/Common/Pgsql/TPgsqlMetaData.php | 1 - framework/Data/Common/Pgsql/TPgsqlTableColumn.php | 1 - framework/Data/Common/Pgsql/TPgsqlTableInfo.php | 1 - .../Data/Common/Sqlite/TSqliteCommandBuilder.php | 1 - framework/Data/Common/Sqlite/TSqliteMetaData.php | 1 - .../Data/Common/Sqlite/TSqliteTableColumn.php | 1 - framework/Data/Common/Sqlite/TSqliteTableInfo.php | 1 - framework/Data/Common/TDbMetaData.php | 1 - framework/Data/Common/TDbTableColumn.php | 1 - framework/Data/Common/TDbTableInfo.php | 1 - framework/Data/DataGateway/TTableGateway.php | 1 - .../Data/SqlMap/Configuration/TDiscriminator.php | 1 - .../Configuration/TInlineParameterMapParser.php | 3 +- .../Data/SqlMap/Configuration/TParameterMap.php | 1 - .../SqlMap/Configuration/TParameterProperty.php | 1 - framework/Data/SqlMap/Configuration/TResultMap.php | 1 - .../Data/SqlMap/Configuration/TResultProperty.php | 1 - .../SqlMap/Configuration/TSimpleDynamicParser.php | 1 - .../SqlMap/Configuration/TSqlMapCacheModel.php | 1 - .../Data/SqlMap/Configuration/TSqlMapStatement.php | 1 - .../Configuration/TSqlMapXmlConfiguration.php | 15 +- framework/Data/SqlMap/DataMapper/TLazyLoadList.php | 1 - .../Data/SqlMap/DataMapper/TPropertyAccess.php | 3 +- framework/Data/SqlMap/DataMapper/TSqlMapCache.php | 1 - .../Data/SqlMap/DataMapper/TSqlMapException.php | 1 - .../Data/SqlMap/DataMapper/TSqlMapPagedList.php | 1 - .../DataMapper/TSqlMapTypeHandlerRegistry.php | 1 - .../Data/SqlMap/Statements/IMappedStatement.php | 1 - .../Data/SqlMap/Statements/TCachingStatement.php | 1 - .../SqlMap/Statements/TDeleteMappedStatement.php | 1 - .../SqlMap/Statements/TInsertMappedStatement.php | 1 - .../Data/SqlMap/Statements/TMappedStatement.php | 7 +- .../Data/SqlMap/Statements/TPreparedCommand.php | 1 - .../Data/SqlMap/Statements/TPreparedStatement.php | 1 - .../Statements/TPreparedStatementFactory.php | 1 - .../SqlMap/Statements/TSelectMappedStatement.php | 1 - .../Data/SqlMap/Statements/TSimpleDynamicSql.php | 1 - framework/Data/SqlMap/Statements/TStaticSql.php | 1 - .../SqlMap/Statements/TUpdateMappedStatement.php | 1 - framework/Data/SqlMap/TSqlMapConfig.php | 1 - framework/Data/SqlMap/TSqlMapGateway.php | 1 - framework/Data/SqlMap/TSqlMapManager.php | 1 - framework/Data/TDataSourceConfig.php | 2 - framework/Data/TDbCommand.php | 1 - framework/Data/TDbConnection.php | 6 +- framework/Data/TDbDataReader.php | 1 - framework/Data/TDbTransaction.php | 1 - framework/Exceptions/TErrorHandler.php | 1 - framework/Exceptions/TException.php | 1 - framework/Exceptions/messages/messages.txt | 7 + framework/I18N/TDateFormat.php | 41 +- framework/I18N/TGlobalizationAutoDetect.php | 1 - framework/I18N/TI18NControl.php | 1 - framework/I18N/TNumberFormat.php | 29 +- framework/I18N/TTranslate.php | 1 - framework/I18N/TTranslateParameter.php | 1 - framework/I18N/Translation.php | 1 - framework/I18N/core/CultureInfo.php | 1 - framework/I18N/core/DateTimeFormatInfo.php | 1 - framework/I18N/core/Gettext/MO.php | 1 - framework/I18N/core/Gettext/PO.php | 1 - framework/I18N/core/Gettext/TGettext.php | 1 - framework/I18N/core/HTTPNegotiator.php | 1 - framework/I18N/core/IMessageSource.php | 1 - framework/I18N/core/MessageFormat.php | 1 - framework/I18N/core/MessageSource_XLIFF.php | 2 +- framework/I18N/core/NumberFormat.php | 1 - framework/I18N/core/NumberFormatInfo.php | 1 - framework/IO/TTextWriter.php | 1 - framework/PradoBase.php | 5 + framework/Security/IUserManager.php | 1 - framework/Security/TAuthManager.php | 61 +- framework/Security/TAuthorizationRule.php | 1 - framework/Security/TDbUserManager.php | 1 - framework/Security/TSecurityManager.php | 1 - framework/Security/TUser.php | 1 - framework/Security/TUserManager.php | 2 +- framework/TApplication.php | 36 +- framework/TApplicationComponent.php | 1 - framework/TComponent.php | 1 - framework/TModule.php | 1 - framework/TService.php | 1 - framework/TShellApplication.php | 1 - framework/Util/TDataFieldAccessor.php | 1 - framework/Util/TLogRouter.php | 21 +- framework/Util/TLogger.php | 1 - framework/Util/TParameterModule.php | 1 - framework/Util/TVarDumper.php | 1 - framework/Web/Javascripts/TJavaScript.php | 1 - framework/Web/Javascripts/source/packages.php | 36 +- .../source/prado/activecontrols/activecontrols3.js | 749 +++++++++--------- .../prado/activecontrols/activedatepicker.js | 79 ++ .../source/prado/activecontrols/dragdrop.js | 24 + .../source/prado/activecontrols/inlineeditor.js | 2 +- .../activefileupload/ActiveFileUploadBlank.html | 1 + .../activefileupload/ActiveFileUploadComplete.png | Bin 0 -> 663 bytes .../activefileupload/ActiveFileUploadError.png | Bin 0 -> 589 bytes .../activefileupload/ActiveFileUploadIndicator.gif | Bin 0 -> 1553 bytes .../prado/activefileupload/activefileupload.js | 63 ++ .../source/prado/activeratings/blocks.css | 42 -- .../source/prado/activeratings/default.css | 43 -- .../source/prado/activeratings/ratings.js | 178 ----- .../Javascripts/source/prado/controls/controls.js | 19 +- .../source/prado/datepicker/datepicker.js | 21 +- .../Javascripts/source/prado/ratings/ratings.js | 207 ++++- .../source/prado/validator/validation3.js | 13 +- .../source/scriptaculous-1.8.1/dragdrop.js | 2 +- framework/Web/Services/TFeedService.php | 1 - framework/Web/Services/TJsonService.php | 2 +- framework/Web/Services/TSoapService.php | 1 - framework/Web/TAssetManager.php | 9 +- framework/Web/TCacheHttpSession.php | 1 - framework/Web/THttpRequest.php | 1 - framework/Web/THttpResponse.php | 1 - framework/Web/THttpSession.php | 1 - framework/Web/THttpUtility.php | 1 - framework/Web/TUrlManager.php | 1 - framework/Web/TUrlMapping.php | 50 +- framework/Web/UI/ActiveControls/TActiveButton.php | 1 - .../UI/ActiveControls/TActiveControlAdapter.php | 9 +- .../UI/ActiveControls/TActiveCustomValidator.php | 1 - .../Web/UI/ActiveControls/TActiveDatePicker.php | 129 ++++ .../Web/UI/ActiveControls/TActiveFileUpload.php | 315 ++++++++ .../Web/UI/ActiveControls/TActiveHiddenField.php | 1 - framework/Web/UI/ActiveControls/TActiveLabel.php | 10 +- .../Web/UI/ActiveControls/TActiveLinkButton.php | 5 + .../Web/UI/ActiveControls/TActivePageAdapter.php | 9 +- framework/Web/UI/ActiveControls/TActivePager.php | 9 +- framework/Web/UI/ActiveControls/TActivePanel.php | 1 - .../UI/ActiveControls/TActiveRadioButtonList.php | 6 + .../Web/UI/ActiveControls/TActiveRatingList.php | 344 ++------- framework/Web/UI/ActiveControls/TActiveTextBox.php | 1 - framework/Web/UI/ActiveControls/TAutoComplete.php | 9 +- .../Web/UI/ActiveControls/TBaseActiveControl.php | 5 +- framework/Web/UI/ActiveControls/TCallback.php | 1 - .../UI/ActiveControls/TCallbackClientScript.php | 1 - .../Web/UI/ActiveControls/TCallbackClientSide.php | 1 - .../UI/ActiveControls/TCallbackEventParameter.php | 1 - .../Web/UI/ActiveControls/TCallbackOptions.php | 1 - framework/Web/UI/ActiveControls/TDraggable.php | 152 ++++ framework/Web/UI/ActiveControls/TDropContainer.php | 275 +++++++ .../UI/ActiveControls/TEventTriggeredCallback.php | 1 - .../Web/UI/ActiveControls/TInPlaceTextBox.php | 1 - .../UI/ActiveControls/TTimeTriggeredCallback.php | 24 +- .../Web/UI/ActiveControls/TTriggeredCallback.php | 1 - .../UI/ActiveControls/TValueTriggeredCallback.php | 1 - framework/Web/UI/TCachePageStatePersister.php | 1 - framework/Web/UI/TClientScriptManager.php | 10 +- framework/Web/UI/TCompositeControl.php | 1 - framework/Web/UI/TControl.php | 8 + framework/Web/UI/TControlAdapter.php | 1 - framework/Web/UI/TForm.php | 1 - framework/Web/UI/THtmlWriter.php | 1 - framework/Web/UI/TPage.php | 8 +- framework/Web/UI/TPageStatePersister.php | 1 - framework/Web/UI/TSessionPageStatePersister.php | 1 - framework/Web/UI/TTemplateControl.php | 1 - framework/Web/UI/TTemplateManager.php | 9 +- framework/Web/UI/WebControls/TBaseDataList.php | 1 - framework/Web/UI/WebControls/TBaseValidator.php | 15 +- framework/Web/UI/WebControls/TBoundColumn.php | 1 - framework/Web/UI/WebControls/TBulletedList.php | 1 - framework/Web/UI/WebControls/TButton.php | 1 - framework/Web/UI/WebControls/TButtonColumn.php | 1 - framework/Web/UI/WebControls/TCaptcha.php | 1 - framework/Web/UI/WebControls/TCaptchaValidator.php | 1 - framework/Web/UI/WebControls/TCheckBox.php | 18 + framework/Web/UI/WebControls/TCheckBoxColumn.php | 1 - framework/Web/UI/WebControls/TCheckBoxList.php | 19 +- framework/Web/UI/WebControls/TClientScript.php | 1 - .../Web/UI/WebControls/TClientScriptLoader.php | 1 - framework/Web/UI/WebControls/TColorPicker.php | 4 +- framework/Web/UI/WebControls/TCompareValidator.php | 1 - framework/Web/UI/WebControls/TConditional.php | 1 - framework/Web/UI/WebControls/TContent.php | 1 - .../Web/UI/WebControls/TContentPlaceHolder.php | 1 - framework/Web/UI/WebControls/TCustomValidator.php | 26 +- framework/Web/UI/WebControls/TDataGrid.php | 1 - framework/Web/UI/WebControls/TDataGridColumn.php | 1 - .../Web/UI/WebControls/TDataGridItemRenderer.php | 1 - .../Web/UI/WebControls/TDataGridPagerStyle.php | 1 - framework/Web/UI/WebControls/TDataList.php | 1 - .../Web/UI/WebControls/TDataListItemRenderer.php | 1 - framework/Web/UI/WebControls/TDataRenderer.php | 1 - .../Web/UI/WebControls/TDataSourceControl.php | 1 - framework/Web/UI/WebControls/TDataSourceView.php | 1 - .../Web/UI/WebControls/TDataTypeValidator.php | 1 - framework/Web/UI/WebControls/TDatePicker.php | 46 +- framework/Web/UI/WebControls/TDropDownList.php | 19 +- .../Web/UI/WebControls/TDropDownListColumn.php | 1 - .../Web/UI/WebControls/TEditCommandColumn.php | 1 - .../Web/UI/WebControls/TEmailAddressValidator.php | 1 - framework/Web/UI/WebControls/TExpression.php | 1 - framework/Web/UI/WebControls/TFileUpload.php | 20 +- framework/Web/UI/WebControls/TFont.php | 1 - framework/Web/UI/WebControls/THead.php | 21 +- framework/Web/UI/WebControls/THiddenField.php | 19 +- framework/Web/UI/WebControls/THtmlArea.php | 1 - framework/Web/UI/WebControls/THyperLink.php | 1 - framework/Web/UI/WebControls/THyperLinkColumn.php | 1 - framework/Web/UI/WebControls/TImage.php | 1 - framework/Web/UI/WebControls/TImageMap.php | 1 - framework/Web/UI/WebControls/TInlineFrame.php | 1 - framework/Web/UI/WebControls/TItemDataRenderer.php | 1 - framework/Web/UI/WebControls/TJavascriptLogger.php | 1 - framework/Web/UI/WebControls/TKeyboard.php | 1 - framework/Web/UI/WebControls/TLabel.php | 1 - framework/Web/UI/WebControls/TLinkButton.php | 1 - framework/Web/UI/WebControls/TListBox.php | 19 +- .../Web/UI/WebControls/TListControlValidator.php | 1 - framework/Web/UI/WebControls/TListItem.php | 1 - framework/Web/UI/WebControls/TLiteral.php | 1 - framework/Web/UI/WebControls/TLiteralColumn.php | 1 - framework/Web/UI/WebControls/TMarkdown.php | 1 - framework/Web/UI/WebControls/TMultiView.php | 1 - framework/Web/UI/WebControls/TOutputCache.php | 1 - framework/Web/UI/WebControls/TPager.php | 1 - framework/Web/UI/WebControls/TPanel.php | 1 - framework/Web/UI/WebControls/TPanelStyle.php | 1 - framework/Web/UI/WebControls/TPlaceHolder.php | 1 - framework/Web/UI/WebControls/TRadioButton.php | 1 - framework/Web/UI/WebControls/TRadioButtonList.php | 1 - framework/Web/UI/WebControls/TRangeValidator.php | 1 - framework/Web/UI/WebControls/TRatingList.php | 348 ++++++--- .../UI/WebControls/TRegularExpressionValidator.php | 21 +- framework/Web/UI/WebControls/TRepeatInfo.php | 1 - framework/Web/UI/WebControls/TRepeater.php | 1 - .../Web/UI/WebControls/TRepeaterItemRenderer.php | 1 - .../Web/UI/WebControls/TRequiredFieldValidator.php | 1 - framework/Web/UI/WebControls/TSafeHtml.php | 1 - framework/Web/UI/WebControls/TSlider.php | 7 +- framework/Web/UI/WebControls/TStatements.php | 1 - framework/Web/UI/WebControls/TStyle.php | 1 - framework/Web/UI/WebControls/TTable.php | 1 - framework/Web/UI/WebControls/TTableCell.php | 1 - framework/Web/UI/WebControls/TTableFooterRow.php | 1 - framework/Web/UI/WebControls/TTableHeaderCell.php | 1 - framework/Web/UI/WebControls/TTableHeaderRow.php | 1 - framework/Web/UI/WebControls/TTableRow.php | 1 - framework/Web/UI/WebControls/TTemplateColumn.php | 1 - framework/Web/UI/WebControls/TTextBox.php | 19 +- framework/Web/UI/WebControls/TTextHighlighter.php | 1 - framework/Web/UI/WebControls/TTextProcessor.php | 1 - .../Web/UI/WebControls/TValidationSummary.php | 1 - framework/Web/UI/WebControls/TWebControl.php | 1 - .../Web/UI/WebControls/TWebControlAdapter.php | 1 - framework/Web/UI/WebControls/TWizard.php | 1 - .../WebControls/TWizardNavigationButtonStyle.php | 1 - framework/Web/UI/WebControls/TXmlTransform.php | 1 - framework/Web/UI/WebControls/assets/captcha.php | 1 - framework/Xml/TXmlDocument.php | 1 - framework/interfaces.php | 1 - framework/prado.php | 1 - 303 files changed, 2995 insertions(+), 1867 deletions(-) create mode 100755 framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js create mode 100755 framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js create mode 100755 framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html create mode 100755 framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png create mode 100755 framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png create mode 100755 framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif create mode 100755 framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js delete mode 100644 framework/Web/Javascripts/source/prado/activeratings/blocks.css delete mode 100644 framework/Web/Javascripts/source/prado/activeratings/default.css delete mode 100644 framework/Web/Javascripts/source/prado/activeratings/ratings.js create mode 100755 framework/Web/UI/ActiveControls/TActiveDatePicker.php create mode 100755 framework/Web/UI/ActiveControls/TActiveFileUpload.php create mode 100755 framework/Web/UI/ActiveControls/TDraggable.php create mode 100755 framework/Web/UI/ActiveControls/TDropContainer.php (limited to 'framework') diff --git a/framework/3rdParty/TinyMCE/tiny_mce.md5 b/framework/3rdParty/TinyMCE/tiny_mce.md5 index a5b8fc8e..bf138c10 100644 --- a/framework/3rdParty/TinyMCE/tiny_mce.md5 +++ b/framework/3rdParty/TinyMCE/tiny_mce.md5 @@ -1 +1 @@ -6f0b8991531854895cb4461d218023bd tiny_mce.tar +cf8b1ec3fc54577b1d834772ddecfc2e tiny_mce.tar diff --git a/framework/3rdParty/TinyMCE/tiny_mce.tar b/framework/3rdParty/TinyMCE/tiny_mce.tar index b4e9060d..beb06fb9 100644 Binary files a/framework/3rdParty/TinyMCE/tiny_mce.tar and b/framework/3rdParty/TinyMCE/tiny_mce.tar differ diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index 057d7585..5935e732 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -131,4 +131,3 @@ class TAPCCache extends TCache } } -?> diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php index 27618e84..02a4ae3b 100644 --- a/framework/Caching/TCache.php +++ b/framework/Caching/TCache.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Caching @@ -136,7 +136,8 @@ abstract class TCache extends TModule implements ICache, ArrayAccess /** * Stores a value identified by a key into cache. * If the cache already contains such a key, the existing value and - * expiration time will be replaced with the new ones. + * expiration time will be replaced with the new ones. If the value is + * empty, the cache key will be deleted. * * @param string the key identifying the value to be cached * @param mixed the value to be cached @@ -146,13 +147,18 @@ abstract class TCache extends TModule implements ICache, ArrayAccess */ public function set($id,$value,$expire=0,$dependency=null) { - $data=array($value,$dependency); - return $this->setValue($this->generateUniqueKey($id),serialize($data),$expire); + if(empty($value) && $expire === 0) + $this->delete($id); + else + { + $data=array($value,$dependency); + return $this->setValue($this->generateUniqueKey($id),serialize($data),$expire); + } } /** * Stores a value identified by a key into cache if the cache does not contain this key. - * Nothing will be done if the cache already contains the key. + * Nothing will be done if the cache already contains the key or if value is empty. * @param string the key identifying the value to be cached * @param mixed the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. @@ -161,6 +167,8 @@ abstract class TCache extends TModule implements ICache, ArrayAccess */ public function add($id,$value,$expire=0,$dependency=null) { + if(empty($value) && $expire === 0) + return false; $data=array($value,$dependency); return $this->addValue($this->generateUniqueKey($id),serialize($data),$expire); } @@ -710,4 +718,4 @@ class TCacheDependencyList extends TList } } -?> +?> diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php index b6e9c7d8..0f0ac26d 100644 --- a/framework/Caching/TMemCache.php +++ b/framework/Caching/TMemCache.php @@ -307,4 +307,3 @@ class TMemCache extends TCache } } -?> diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php index 4d41542c..ca8d2261 100644 --- a/framework/Caching/TSqliteCache.php +++ b/framework/Caching/TSqliteCache.php @@ -221,4 +221,3 @@ class TSqliteCache extends TCache } } -?> diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php index 6b35d70e..93a48e1c 100644 --- a/framework/Collections/TAttributeCollection.php +++ b/framework/Collections/TAttributeCollection.php @@ -170,4 +170,3 @@ class TAttributeCollection extends TMap } } -?> diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php index ef11b286..491c36c0 100644 --- a/framework/Collections/TDummyDataSource.php +++ b/framework/Collections/TDummyDataSource.php @@ -144,4 +144,3 @@ class TDummyDataSourceIterator implements Iterator } } -?> diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index 329e162f..50cbaf01 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -427,4 +427,3 @@ class TListIterator implements Iterator } } -?> diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php index 42f57890..56748ea2 100644 --- a/framework/Collections/TMap.php +++ b/framework/Collections/TMap.php @@ -350,4 +350,3 @@ class TMapIterator implements Iterator return $this->_key!==false; } } -?> diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php index 3db4882a..fcb17f53 100644 --- a/framework/Collections/TPagedDataSource.php +++ b/framework/Collections/TPagedDataSource.php @@ -444,4 +444,3 @@ class TPagedMapIterator implements Iterator } } -?> diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php index a2a2aa14..50286aec 100644 --- a/framework/Collections/TPagedList.php +++ b/framework/Collections/TPagedList.php @@ -475,4 +475,3 @@ class TPagedListFetchDataEventParameter extends TEventParameter } } -?> diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php index 856b12ff..d8b692d1 100644 --- a/framework/Collections/TQueue.php +++ b/framework/Collections/TQueue.php @@ -261,4 +261,3 @@ class TQueueIterator implements Iterator } } -?> diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php index 58394a8a..0d3890b4 100644 --- a/framework/Collections/TStack.php +++ b/framework/Collections/TStack.php @@ -260,4 +260,3 @@ class TStackIterator implements Iterator } } -?> diff --git a/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php index be88f015..eaab5735 100644 --- a/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php +++ b/framework/Data/ActiveRecord/Exceptions/TActiveRecordException.php @@ -39,4 +39,3 @@ class TActiveRecordConfigurationException extends TActiveRecordException } -?> diff --git a/framework/Data/ActiveRecord/Exceptions/messages.txt b/framework/Data/ActiveRecord/Exceptions/messages.txt index fabfc1a4..0702c840 100644 --- a/framework/Data/ActiveRecord/Exceptions/messages.txt +++ b/framework/Data/ActiveRecord/Exceptions/messages.txt @@ -10,6 +10,7 @@ ar_primary_key_is_scalar = Primary key '{1}' in table '{0}' is NOT a composi ar_invalid_db_connection = Missing or invalid default database connection for ActiveRecord class '{0}', default connection is set by the DbConnection property of TActiveRecordManager. ar_mismatch_args_exception = ActiveRecord finder method '{0}' expects {1} parameters but found only {2} parameters instead. ar_invalid_tablename_property = Constant {0}::{1} must be a valid database table name. +ar_invalid_tablename_method = Method {0}::{1} must return a valid database table name. ar_value_must_not_be_null = Property '{0}::${2}' must not be null as defined by column '{2}' in table '{1}'. ar_missing_pk_values = Missing primary key values in forming IN(key1, key2, ...) for table '{0}'. ar_pk_value_count_mismatch = Composite key value count mismatch in forming IN( (key1, key2, ..), (key3, key4, ..)) for table '{0}'. @@ -21,4 +22,4 @@ ar_invalid_criteria = Invalid criteria object, must be a string or instanc ar_relations_undefined = Unable to determine Active Record relationships because static array property {0}::${1} is not defined. ar_undefined_relation_prop = Unable to find {1}::${2}['{0}'], Active Record relationship definition for property "{0}" not found in entries of {1}::${2}. ar_invalid_relationship = Invalid active record relationship. -ar_relations_missing_fk = Unable to find foreign key relationships in table '{0}' that corresponds to table '{1}'. \ No newline at end of file +ar_relations_missing_fk = Unable to find foreign key relationships in table '{0}' that corresponds to table '{1}'. diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php index 9f8777e2..40936011 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php @@ -136,4 +136,3 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation } } -?> diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php index c66afa14..6f191b9f 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php @@ -119,4 +119,3 @@ class TActiveRecordHasMany extends TActiveRecordRelation } } -?> diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php index 9b01d323..4c71f91c 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php @@ -374,4 +374,3 @@ class TActiveRecordHasManyAssociation extends TActiveRecordRelation return $data; } } -?> diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php index 6e8d30de..b1aa7b91 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php @@ -143,4 +143,3 @@ class TActiveRecordHasOne extends TActiveRecordRelation } } -?> diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index 4044a5ce..a352cb07 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -247,4 +247,3 @@ abstract class TActiveRecordRelation } } -?> diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php index 329007af..696bb5b1 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php @@ -228,4 +228,3 @@ class TActiveRecordRelationContext } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TIbmScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TIbmScaffoldInput.php index 05de2019..c8177d5e 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TIbmScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TIbmScaffoldInput.php @@ -49,4 +49,3 @@ class TIbmScaffoldInput extends TScaffoldInputCommon } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php index bca1bcb2..be495e98 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMssqlScaffoldInput.php @@ -51,4 +51,3 @@ class TMssqlScaffoldInput extends TScaffoldInputCommon } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMysqlScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMysqlScaffoldInput.php index a8ecdd13..c06e4113 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMysqlScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TMysqlScaffoldInput.php @@ -81,4 +81,3 @@ class TMysqlScaffoldInput extends TScaffoldInputCommon } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TPgsqlScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TPgsqlScaffoldInput.php index 69b67e7f..cd244b27 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TPgsqlScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TPgsqlScaffoldInput.php @@ -52,4 +52,3 @@ class TPgsqlScaffoldInput extends TScaffoldInputCommon } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php index ad563f2f..d8db9c59 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php @@ -101,4 +101,3 @@ class TScaffoldInputBase } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php index 12f9bc25..d02bc9a0 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php @@ -307,4 +307,3 @@ class TScaffoldInputCommon extends TScaffoldInputBase } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php index c187e825..5f431067 100644 --- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php +++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php @@ -97,4 +97,3 @@ class TSqliteScaffoldInput extends TScaffoldInputCommon } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php index 1e9b87e7..9c548308 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php @@ -204,4 +204,3 @@ abstract class TScaffoldBase extends TTemplateControl } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php index 1760b27d..b38b739f 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php @@ -307,4 +307,3 @@ interface IScaffoldEditRenderer extends IDataRenderer public function updateRecord($record); } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php index 79ab40ab..6c28651a 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php @@ -304,4 +304,3 @@ class TScaffoldListView extends TScaffoldBase } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php index a7f58735..b1cd6cbc 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php @@ -148,4 +148,3 @@ class TScaffoldSearch extends TScaffoldBase } } -?> diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldView.php index 1ddba335..04420e9a 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldView.php @@ -141,4 +141,3 @@ class TScaffoldView extends TScaffoldBase } } -?> diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 370dd69a..fa134a9f 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -79,7 +79,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelationContext'); * 'email_address'=>'email', * ); * public $username; - * pulbic $email; + * public $email; * } * * In the above, the 'users' table consists of 'user_id' and 'email_address' columns, @@ -129,6 +129,18 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelationContext'); * } * * + * Since v3.1.3 you can also define a method that returns the table name. + * + * class UserRecord extends TActiveRecord + * { + * public function table() + * { + * return 'users'; + * } + * + * } + * + * * @author Wei Zhuo * @version $Id$ * @package System.Data.ActiveRecord @@ -317,6 +329,14 @@ abstract class TActiveRecord extends TComponent $this->_connection=$connection; } + /** + * @return TDbTableInfo the meta information of the table associated with this AR class. + */ + public function getRecordTableInfo() + { + return $this->getRecordGateway()->getRecordTableInfo($this); + } + /** * Compare two records using their primary key values (all column values if * table does not defined primary keys). The default uses simple == for @@ -329,7 +349,7 @@ abstract class TActiveRecord extends TComponent { if($record===null || get_class($this)!==get_class($record)) return false; - $tableInfo = $this->getRecordGateway()->getRecordTableInfo($this); + $tableInfo = $this->getRecordTableInfo(); $pks = $tableInfo->getPrimaryKeys(); $properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); $equals=true; @@ -378,7 +398,7 @@ abstract class TActiveRecord extends TComponent /** * @return TActiveRecordGateway record table gateway. */ - public static function getRecordGateway() + public function getRecordGateway() { return TActiveRecordManager::getInstance()->getRecordGateway(); } @@ -552,6 +572,7 @@ abstract class TActiveRecord extends TComponent { $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; $criteria = $this->getRecordCriteria($criteria,$parameters, $args); + $criteria->setLimit(1); $data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria); return $this->populateObject($data); } @@ -629,6 +650,7 @@ abstract class TActiveRecord extends TComponent { $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; $criteria = $this->getRecordCriteria($sql,$parameters, $args); + $criteria->setLimit(1); $data = $this->getRecordGateway()->findRecordBySql($this,$criteria); return $this->populateObject($data); } @@ -1000,4 +1022,3 @@ class TActiveRecordChangeEventParameter extends TEventParameter } } -?> diff --git a/framework/Data/ActiveRecord/TActiveRecordConfig.php b/framework/Data/ActiveRecord/TActiveRecordConfig.php index 4e21635e..63f05aef 100644 --- a/framework/Data/ActiveRecord/TActiveRecordConfig.php +++ b/framework/Data/ActiveRecord/TActiveRecordConfig.php @@ -105,4 +105,3 @@ class TActiveRecordConfig extends TDataSourceConfig } } -?> diff --git a/framework/Data/ActiveRecord/TActiveRecordCriteria.php b/framework/Data/ActiveRecord/TActiveRecordCriteria.php index eec6df04..41e8ad02 100644 --- a/framework/Data/ActiveRecord/TActiveRecordCriteria.php +++ b/framework/Data/ActiveRecord/TActiveRecordCriteria.php @@ -37,4 +37,3 @@ class TActiveRecordCriteria extends TSqlCriteria } -?> diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php index 23104c00..6cce9eb9 100644 --- a/framework/Data/ActiveRecord/TActiveRecordGateway.php +++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php @@ -1,414 +1,425 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id$ - * @package System.Data.ActiveRecord - */ - -/** - * TActiveRecordGateway excutes the SQL command queries and returns the data - * record as arrays (for most finder methods). - * - * @author Wei Zhuo - * @version $Id$ - * @package System.Data.ActiveRecord - * @since 3.1 - */ -class TActiveRecordGateway extends TComponent -{ - private $_manager; - private $_tables=array(); //table cache - private $_meta=array(); //meta data cache. - private $_commandBuilders=array(); - private $_currentRecord; - - /** - * Constant name for specifying optional table name in TActiveRecord. - */ - const TABLE_CONST='TABLE'; - - /** - * Record gateway constructor. - * @param TActiveRecordManager $manager - */ - public function __construct(TActiveRecordManager $manager) - { - $this->_manager=$manager; - } - - /** - * @return TActiveRecordManager record manager. - */ - protected function getManager() - { - return $this->_manager; - } - - /** - * Gets the table name from the 'TABLE' constant of the active record - * class if defined, otherwise use the class name as table name. - * @param TActiveRecord active record instance - * @return string table name for the given record class. - */ - protected function getRecordTableName(TActiveRecord $record) - { - $class = new ReflectionClass($record); - if($class->hasConstant(self::TABLE_CONST)) - { - $value = $class->getConstant(self::TABLE_CONST); - if(empty($value)) - throw new TActiveRecordException('ar_invalid_tablename_property', - get_class($record),self::TABLE_CONST); - return $value; - } - else - return strtolower(get_class($record)); - } - - /** - * Returns table information, trys the application cache first. - * @param TActiveRecord $record - * @return TDbTableInfo table information. - */ - public function getRecordTableInfo(TActiveRecord $record) - { - $tableName = $this->getRecordTableName($record); - return $this->getTableInfo($record->getDbConnection(), $tableName); - } - - /** - * Returns table information for table in the database connection. - * @param TDbConnection database connection - * @param string table name - * @return TDbTableInfo table details. - */ - public function getTableInfo(TDbConnection $connection, $tableName) - { - $connStr = $connection->getConnectionString(); - $key = $connStr.$tableName; - if(!isset($this->_tables[$key])) - { - //call this first to ensure that unserializing the cache - //will find the correct driver dependent classes. - if(!isset($this->_meta[$connStr])) - { - Prado::using('System.Data.Common.TDbMetaData'); - $this->_meta[$connStr] = TDbMetaData::getInstance($connection); - } - - $tableInfo = null; - if(($cache=$this->getManager()->getCache())!==null) - $tableInfo = $cache->get($key); - if(empty($tableInfo)) - { - $tableInfo = $this->_meta[$connStr]->getTableInfo($tableName); - if($cache!==null) - $cache->set($key, $tableInfo); - } - $this->_tables[$key] = $tableInfo; - } - return $this->_tables[$key]; - } - - /** - * @param TActiveRecord $record - * @return TDataGatewayCommand - */ - public function getCommand(TActiveRecord $record) - { - $conn = $record->getDbConnection(); - $connStr = $conn->getConnectionString(); - $tableInfo = $this->getRecordTableInfo($record); - if(!isset($this->_commandBuilders[$connStr])) - { - $builder = $tableInfo->createCommandBuilder($record->getDbConnection()); - Prado::using('System.Data.DataGateway.TDataGatewayCommand'); - $command = new TDataGatewayCommand($builder); - $command->OnCreateCommand[] = array($this, 'onCreateCommand'); - $command->OnExecuteCommand[] = array($this, 'onExecuteCommand'); - $this->_commandBuilders[$connStr] = $command; - - } - $this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo); - $this->_currentRecord=$record; - return $this->_commandBuilders[$connStr]; - } - - /** - * Raised when a command is prepared and parameter binding is completed. - * The parameter object is TDataGatewayEventParameter of which the - * {@link TDataGatewayEventParameter::getCommand Command} property can be - * inspected to obtain the sql query to be executed. - * This method also raises the OnCreateCommand event on the ActiveRecord - * object calling this gateway. - * @param TDataGatewayCommand originator $sender - * @param TDataGatewayEventParameter - */ - public function onCreateCommand($sender, $param) - { - $this->raiseEvent('OnCreateCommand', $this, $param); - if($this->_currentRecord!==null) - $this->_currentRecord->onCreateCommand($param); - } - - /** - * Raised when a command is executed and the result from the database was returned. - * The parameter object is TDataGatewayResultEventParameter of which the - * {@link TDataGatewayEventParameter::getResult Result} property contains - * the data return from the database. The data returned can be changed - * by setting the {@link TDataGatewayEventParameter::setResult Result} property. - * This method also raises the OnCreateCommand event on the ActiveRecord - * object calling this gateway. - * @param TDataGatewayCommand originator $sender - * @param TDataGatewayResultEventParameter - */ - public function onExecuteCommand($sender, $param) - { - $this->raiseEvent('OnExecuteCommand', $this, $param); - if($this->_currentRecord!==null) - $this->_currentRecord->onExecuteCommand($param); - } - - /** - * Returns record data matching the given primary key(s). If the table uses - * composite key, specify the name value pairs as an array. - * @param TActiveRecord active record instance. - * @param array primary name value pairs - * @return array record data - */ - public function findRecordByPK(TActiveRecord $record,$keys) - { - $command = $this->getCommand($record); - return $command->findByPk($keys); - } - - /** - * Returns records matching the list of given primary keys. - * @param TActiveRecord active record instance. - * @param array list of primary name value pairs - * @return array matching data. - */ - public function findRecordsByPks(TActiveRecord $record, $keys) - { - return $this->getCommand($record)->findAllByPk($keys); - } - - - /** - * Returns record data matching the given critera. If $iterator is true, it will - * return multiple rows as TDbDataReader otherwise it returns the first row data. - * @param TActiveRecord active record finder instance. - * @param TActiveRecordCriteria search criteria. - * @param boolean true to return multiple rows as iterator, false returns first row. - * @return mixed matching data. - */ - public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false) - { - $command = $this->getCommand($record); - return $iterator ? $command->findAll($criteria) : $command->find($criteria); - } - - /** - * Return record data from sql query. - * @param TActiveRecord active record finder instance. - * @param TActiveRecordCriteria sql query - * @return array result. - */ - public function findRecordBySql(TActiveRecord $record, $criteria) - { - return $this->getCommand($record)->findBySql($criteria); - } - - /** - * Return record data from sql query. - * @param TActiveRecord active record finder instance. - * @param TActiveRecordCriteria sql query - * @return TDbDataReader result iterator. - */ - public function findRecordsBySql(TActiveRecord $record, $criteria) - { - return $this->getCommand($record)->findAllBySql($criteria); - } - - public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values) - { - return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values); - } - - /** - * Returns the number of records that match the given criteria. - * @param TActiveRecord active record finder instance. - * @param TActiveRecordCriteria search criteria - * @return int number of records. - */ - public function countRecords(TActiveRecord $record, $criteria) - { - return $this->getCommand($record)->count($criteria); - } - - /** - * Insert a new record. - * @param TActiveRecord new record. - * @return int number of rows affected. - */ - public function insert(TActiveRecord $record) - { - //$this->updateAssociatedRecords($record,true); - $result = $this->getCommand($record)->insert($this->getInsertValues($record)); - if($result) - $this->updatePostInsert($record); - //$this->updateAssociatedRecords($record); - return $result; - } - - /** - * Sets the last insert ID to the corresponding property of the record if available. - * @param TActiveRecord record for insertion - */ - protected function updatePostInsert($record) - { - $command = $this->getCommand($record); - $tableInfo = $command->getTableInfo(); - foreach($tableInfo->getColumns() as $name => $column) - { - if($column->hasSequence()) - $record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName())); - } - } - - /** - * @param TActiveRecord record - * @return array insert values. - */ - protected function getInsertValues(TActiveRecord $record) - { - $values=array(); - $tableInfo = $this->getCommand($record)->getTableInfo(); - foreach($tableInfo->getColumns() as $name=>$column) - { - if($column->getIsExcluded()) - continue; - $value = $record->getColumnValue($name); - if(!$column->getAllowNull() && $value===null && !$column->hasSequence()) - { - throw new TActiveRecordException( - 'ar_value_must_not_be_null', get_class($record), - $tableInfo->getTableFullName(), $name); - } - if($value!==null) - $values[$name] = $value; - } - return $values; - } - - /** - * Update the record. - * @param TActiveRecord dirty record. - * @return int number of rows affected. - */ - public function update(TActiveRecord $record) - { - //$this->updateAssociatedRecords($record,true); - list($data, $keys) = $this->getUpdateValues($record); - $result = $this->getCommand($record)->updateByPk($data, $keys); - //$this->updateAssociatedRecords($record); - return $result; - } - - protected function getUpdateValues(TActiveRecord $record) - { - $values=array(); - $tableInfo = $this->getCommand($record)->getTableInfo(); - $primary=array(); - foreach($tableInfo->getColumns() as $name=>$column) - { - if($column->getIsExcluded()) - continue; - $value = $record->getColumnValue($name); - if(!$column->getAllowNull() && $value===null) - { - throw new TActiveRecordException( - 'ar_value_must_not_be_null', get_class($record), - $tableInfo->getTableFullName(), $name); - } - if($column->getIsPrimaryKey()) - $primary[] = $value; - else - $values[$name] = $value; - } - return array($values,$primary); - } - - protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false) - { - $context = new TActiveRecordRelationContext($record); - return $context->updateAssociatedRecords($updateBelongsTo); - } - - /** - * Delete the record. - * @param TActiveRecord record to be deleted. - * @return int number of rows affected. - */ - public function delete(TActiveRecord $record) - { - return $this->getCommand($record)->deleteByPk($this->getPrimaryKeyValues($record)); - } - - protected function getPrimaryKeyValues(TActiveRecord $record) - { - $tableInfo = $this->getCommand($record)->getTableInfo(); - $primary=array(); - foreach($tableInfo->getColumns() as $name=>$column) - { - if($column->getIsPrimaryKey()) - $primary[$name] = $record->getColumnValue($name); - } - return $primary; - } - - /** - * Delete multiple records using primary keys. - * @param TActiveRecord finder instance. - * @return int number of rows deleted. - */ - public function deleteRecordsByPk(TActiveRecord $record, $keys) - { - return $this->getCommand($record)->deleteByPk($keys); - } - - /** - * Delete multiple records by criteria. - * @param TActiveRecord active record finder instance. - * @param TActiveRecordCriteria search criteria - * @return int number of records. - */ - public function deleteRecordsByCriteria(TActiveRecord $record, $criteria) - { - return $this->getCommand($record)->delete($criteria); - } - - /** - * Raise the corresponding command event, insert, update, delete or select. - * @param string command type - * @param TDbCommand sql command to be executed. - * @param TActiveRecord active record - * @param TActiveRecordCriteria data for the command. - */ - protected function raiseCommandEvent($event,$command,$record,$criteria) - { - if(!($criteria instanceof TSqlCriteria)) - $criteria = new TActiveRecordCriteria(null,$criteria); - $param = new TActiveRecordEventParameter($command,$record,$criteria); - $manager = $record->getRecordManager(); - $manager->{$event}($param); - $record->{$event}($param); - } -} - -?> + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2008 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package System.Data.ActiveRecord + */ + +/** + * TActiveRecordGateway excutes the SQL command queries and returns the data + * record as arrays (for most finder methods). + * + * @author Wei Zhuo + * @version $Id$ + * @package System.Data.ActiveRecord + * @since 3.1 + */ +class TActiveRecordGateway extends TComponent +{ + private $_manager; + private $_tables=array(); //table cache + private $_meta=array(); //meta data cache. + private $_commandBuilders=array(); + private $_currentRecord; + + /** + * Constant name for specifying optional table name in TActiveRecord. + */ + const TABLE_CONST='TABLE'; + /** + * Method name for returning optional table name in in TActiveRecord + */ + const TABLE_METHOD='table'; + + /** + * Record gateway constructor. + * @param TActiveRecordManager $manager + */ + public function __construct(TActiveRecordManager $manager) + { + $this->_manager=$manager; + } + + /** + * @return TActiveRecordManager record manager. + */ + protected function getManager() + { + return $this->_manager; + } + + /** + * Gets the table name from the 'TABLE' constant of the active record + * class if defined, otherwise use the class name as table name. + * @param TActiveRecord active record instance + * @return string table name for the given record class. + */ + protected function getRecordTableName(TActiveRecord $record) + { + $class = new ReflectionClass($record); + if($class->hasConstant(self::TABLE_CONST)) + { + $value = $class->getConstant(self::TABLE_CONST); + if(empty($value)) + throw new TActiveRecordException('ar_invalid_tablename_property', + get_class($record),self::TABLE_CONST); + return $value; + } + elseif ($class->hasMethod(self::TABLE_METHOD)) + { + $value = $record->{self::TABLE_METHOD}(); + if(empty($value)) + throw new TActiveRecordException('ar_invalid_tablename_method', + get_class($record),self::TABLE_METHOD); + return $value; + } + else + return strtolower(get_class($record)); + } + + /** + * Returns table information, trys the application cache first. + * @param TActiveRecord $record + * @return TDbTableInfo table information. + */ + public function getRecordTableInfo(TActiveRecord $record) + { + $tableName = $this->getRecordTableName($record); + return $this->getTableInfo($record->getDbConnection(), $tableName); + } + + /** + * Returns table information for table in the database connection. + * @param TDbConnection database connection + * @param string table name + * @return TDbTableInfo table details. + */ + public function getTableInfo(TDbConnection $connection, $tableName) + { + $connStr = $connection->getConnectionString(); + $key = $connStr.$tableName; + if(!isset($this->_tables[$key])) + { + //call this first to ensure that unserializing the cache + //will find the correct driver dependent classes. + if(!isset($this->_meta[$connStr])) + { + Prado::using('System.Data.Common.TDbMetaData'); + $this->_meta[$connStr] = TDbMetaData::getInstance($connection); + } + + $tableInfo = null; + if(($cache=$this->getManager()->getCache())!==null) + $tableInfo = $cache->get($key); + if(empty($tableInfo)) + { + $tableInfo = $this->_meta[$connStr]->getTableInfo($tableName); + if($cache!==null) + $cache->set($key, $tableInfo); + } + $this->_tables[$key] = $tableInfo; + } + return $this->_tables[$key]; + } + + /** + * @param TActiveRecord $record + * @return TDataGatewayCommand + */ + public function getCommand(TActiveRecord $record) + { + $conn = $record->getDbConnection(); + $connStr = $conn->getConnectionString(); + $tableInfo = $this->getRecordTableInfo($record); + if(!isset($this->_commandBuilders[$connStr])) + { + $builder = $tableInfo->createCommandBuilder($record->getDbConnection()); + Prado::using('System.Data.DataGateway.TDataGatewayCommand'); + $command = new TDataGatewayCommand($builder); + $command->OnCreateCommand[] = array($this, 'onCreateCommand'); + $command->OnExecuteCommand[] = array($this, 'onExecuteCommand'); + $this->_commandBuilders[$connStr] = $command; + + } + $this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo); + $this->_currentRecord=$record; + return $this->_commandBuilders[$connStr]; + } + + /** + * Raised when a command is prepared and parameter binding is completed. + * The parameter object is TDataGatewayEventParameter of which the + * {@link TDataGatewayEventParameter::getCommand Command} property can be + * inspected to obtain the sql query to be executed. + * This method also raises the OnCreateCommand event on the ActiveRecord + * object calling this gateway. + * @param TDataGatewayCommand originator $sender + * @param TDataGatewayEventParameter + */ + public function onCreateCommand($sender, $param) + { + $this->raiseEvent('OnCreateCommand', $this, $param); + if($this->_currentRecord!==null) + $this->_currentRecord->onCreateCommand($param); + } + + /** + * Raised when a command is executed and the result from the database was returned. + * The parameter object is TDataGatewayResultEventParameter of which the + * {@link TDataGatewayEventParameter::getResult Result} property contains + * the data return from the database. The data returned can be changed + * by setting the {@link TDataGatewayEventParameter::setResult Result} property. + * This method also raises the OnCreateCommand event on the ActiveRecord + * object calling this gateway. + * @param TDataGatewayCommand originator $sender + * @param TDataGatewayResultEventParameter + */ + public function onExecuteCommand($sender, $param) + { + $this->raiseEvent('OnExecuteCommand', $this, $param); + if($this->_currentRecord!==null) + $this->_currentRecord->onExecuteCommand($param); + } + + /** + * Returns record data matching the given primary key(s). If the table uses + * composite key, specify the name value pairs as an array. + * @param TActiveRecord active record instance. + * @param array primary name value pairs + * @return array record data + */ + public function findRecordByPK(TActiveRecord $record,$keys) + { + $command = $this->getCommand($record); + return $command->findByPk($keys); + } + + /** + * Returns records matching the list of given primary keys. + * @param TActiveRecord active record instance. + * @param array list of primary name value pairs + * @return array matching data. + */ + public function findRecordsByPks(TActiveRecord $record, $keys) + { + return $this->getCommand($record)->findAllByPk($keys); + } + + + /** + * Returns record data matching the given critera. If $iterator is true, it will + * return multiple rows as TDbDataReader otherwise it returns the first row data. + * @param TActiveRecord active record finder instance. + * @param TActiveRecordCriteria search criteria. + * @param boolean true to return multiple rows as iterator, false returns first row. + * @return mixed matching data. + */ + public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false) + { + $command = $this->getCommand($record); + return $iterator ? $command->findAll($criteria) : $command->find($criteria); + } + + /** + * Return record data from sql query. + * @param TActiveRecord active record finder instance. + * @param TActiveRecordCriteria sql query + * @return array result. + */ + public function findRecordBySql(TActiveRecord $record, $criteria) + { + return $this->getCommand($record)->findBySql($criteria); + } + + /** + * Return record data from sql query. + * @param TActiveRecord active record finder instance. + * @param TActiveRecordCriteria sql query + * @return TDbDataReader result iterator. + */ + public function findRecordsBySql(TActiveRecord $record, $criteria) + { + return $this->getCommand($record)->findAllBySql($criteria); + } + + public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values) + { + return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values); + } + + /** + * Returns the number of records that match the given criteria. + * @param TActiveRecord active record finder instance. + * @param TActiveRecordCriteria search criteria + * @return int number of records. + */ + public function countRecords(TActiveRecord $record, $criteria) + { + return $this->getCommand($record)->count($criteria); + } + + /** + * Insert a new record. + * @param TActiveRecord new record. + * @return int number of rows affected. + */ + public function insert(TActiveRecord $record) + { + //$this->updateAssociatedRecords($record,true); + $result = $this->getCommand($record)->insert($this->getInsertValues($record)); + if($result) + $this->updatePostInsert($record); + //$this->updateAssociatedRecords($record); + return $result; + } + + /** + * Sets the last insert ID to the corresponding property of the record if available. + * @param TActiveRecord record for insertion + */ + protected function updatePostInsert($record) + { + $command = $this->getCommand($record); + $tableInfo = $command->getTableInfo(); + foreach($tableInfo->getColumns() as $name => $column) + { + if($column->hasSequence()) + $record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName())); + } + } + + /** + * @param TActiveRecord record + * @return array insert values. + */ + protected function getInsertValues(TActiveRecord $record) + { + $values=array(); + $tableInfo = $this->getCommand($record)->getTableInfo(); + foreach($tableInfo->getColumns() as $name=>$column) + { + if($column->getIsExcluded()) + continue; + $value = $record->getColumnValue($name); + if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && !$column->getDefaultValue()) + { + throw new TActiveRecordException( + 'ar_value_must_not_be_null', get_class($record), + $tableInfo->getTableFullName(), $name); + } + if($value!==null) + $values[$name] = $value; + } + return $values; + } + + /** + * Update the record. + * @param TActiveRecord dirty record. + * @return int number of rows affected. + */ + public function update(TActiveRecord $record) + { + //$this->updateAssociatedRecords($record,true); + list($data, $keys) = $this->getUpdateValues($record); + $result = $this->getCommand($record)->updateByPk($data, $keys); + //$this->updateAssociatedRecords($record); + return $result; + } + + protected function getUpdateValues(TActiveRecord $record) + { + $values=array(); + $tableInfo = $this->getCommand($record)->getTableInfo(); + $primary=array(); + foreach($tableInfo->getColumns() as $name=>$column) + { + if($column->getIsExcluded()) + continue; + $value = $record->getColumnValue($name); + if(!$column->getAllowNull() && $value===null) + { + throw new TActiveRecordException( + 'ar_value_must_not_be_null', get_class($record), + $tableInfo->getTableFullName(), $name); + } + if($column->getIsPrimaryKey()) + $primary[] = $value; + else + $values[$name] = $value; + } + return array($values,$primary); + } + + protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false) + { + $context = new TActiveRecordRelationContext($record); + return $context->updateAssociatedRecords($updateBelongsTo); + } + + /** + * Delete the record. + * @param TActiveRecord record to be deleted. + * @return int number of rows affected. + */ + public function delete(TActiveRecord $record) + { + return $this->getCommand($record)->deleteByPk($this->getPrimaryKeyValues($record)); + } + + protected function getPrimaryKeyValues(TActiveRecord $record) + { + $tableInfo = $this->getCommand($record)->getTableInfo(); + $primary=array(); + foreach($tableInfo->getColumns() as $name=>$column) + { + if($column->getIsPrimaryKey()) + $primary[$name] = $record->getColumnValue($name); + } + return $primary; + } + + /** + * Delete multiple records using primary keys. + * @param TActiveRecord finder instance. + * @return int number of rows deleted. + */ + public function deleteRecordsByPk(TActiveRecord $record, $keys) + { + return $this->getCommand($record)->deleteByPk($keys); + } + + /** + * Delete multiple records by criteria. + * @param TActiveRecord active record finder instance. + * @param TActiveRecordCriteria search criteria + * @return int number of records. + */ + public function deleteRecordsByCriteria(TActiveRecord $record, $criteria) + { + return $this->getCommand($record)->delete($criteria); + } + + /** + * Raise the corresponding command event, insert, update, delete or select. + * @param string command type + * @param TDbCommand sql command to be executed. + * @param TActiveRecord active record + * @param TActiveRecordCriteria data for the command. + */ + protected function raiseCommandEvent($event,$command,$record,$criteria) + { + if(!($criteria instanceof TSqlCriteria)) + $criteria = new TActiveRecordCriteria(null,$criteria); + $param = new TActiveRecordEventParameter($command,$record,$criteria); + $manager = $record->getRecordManager(); + $manager->{$event}($param); + $record->{$event}($param); + } +} + diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index ce14ac4d..9912e7ff 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -109,4 +109,3 @@ class TActiveRecordManager extends TComponent } -?> diff --git a/framework/Data/Common/IbmDb2/TIbmColumnMetaData.php b/framework/Data/Common/IbmDb2/TIbmColumnMetaData.php index ee87a374..3b7001ab 100644 --- a/framework/Data/Common/IbmDb2/TIbmColumnMetaData.php +++ b/framework/Data/Common/IbmDb2/TIbmColumnMetaData.php @@ -154,4 +154,3 @@ class TIbmColumnMetaData extends TComponent } -?> diff --git a/framework/Data/Common/IbmDb2/TIbmMetaData.php b/framework/Data/Common/IbmDb2/TIbmMetaData.php index 059ef2d5..496bb12f 100644 --- a/framework/Data/Common/IbmDb2/TIbmMetaData.php +++ b/framework/Data/Common/IbmDb2/TIbmMetaData.php @@ -110,4 +110,3 @@ class TIbmMetaData extends TDbMetaDataCommon } -?> diff --git a/framework/Data/Common/IbmDb2/TIbmMetaDataInspector.php b/framework/Data/Common/IbmDb2/TIbmMetaDataInspector.php index cfb4803d..a37fad6e 100644 --- a/framework/Data/Common/IbmDb2/TIbmMetaDataInspector.php +++ b/framework/Data/Common/IbmDb2/TIbmMetaDataInspector.php @@ -110,4 +110,3 @@ class TIbmMetaDataInspector extends TDbMetaDataInspector return new TIbmMetaData($table,$columns,$pks); } } -?> diff --git a/framework/Data/Common/Mssql/TMssqlCommandBuilder.php b/framework/Data/Common/Mssql/TMssqlCommandBuilder.php index 75d98198..1a0ad4ce 100644 --- a/framework/Data/Common/Mssql/TMssqlCommandBuilder.php +++ b/framework/Data/Common/Mssql/TMssqlCommandBuilder.php @@ -170,4 +170,3 @@ class TMssqlCommandBuilder extends TDbCommandBuilder } } -?> diff --git a/framework/Data/Common/Mssql/TMssqlMetaData.php b/framework/Data/Common/Mssql/TMssqlMetaData.php index faa94e69..8309e4ec 100644 --- a/framework/Data/Common/Mssql/TMssqlMetaData.php +++ b/framework/Data/Common/Mssql/TMssqlMetaData.php @@ -232,4 +232,3 @@ EOD; } } -?> diff --git a/framework/Data/Common/Mssql/TMssqlTableColumn.php b/framework/Data/Common/Mssql/TMssqlTableColumn.php index 5f41f429..8a291b52 100644 --- a/framework/Data/Common/Mssql/TMssqlTableColumn.php +++ b/framework/Data/Common/Mssql/TMssqlTableColumn.php @@ -62,4 +62,3 @@ class TMssqlTableColumn extends TDbTableColumn } } -?> diff --git a/framework/Data/Common/Mssql/TMssqlTableInfo.php b/framework/Data/Common/Mssql/TMssqlTableInfo.php index 3a2ae033..356c6f26 100644 --- a/framework/Data/Common/Mssql/TMssqlTableInfo.php +++ b/framework/Data/Common/Mssql/TMssqlTableInfo.php @@ -62,4 +62,3 @@ class TMssqlTableInfo extends TDbTableInfo } } -?> diff --git a/framework/Data/Common/Mysql/TMysqlCommandBuilder.php b/framework/Data/Common/Mysql/TMysqlCommandBuilder.php index b296a82d..3326851f 100644 --- a/framework/Data/Common/Mysql/TMysqlCommandBuilder.php +++ b/framework/Data/Common/Mysql/TMysqlCommandBuilder.php @@ -24,4 +24,3 @@ class TMysqlCommandBuilder extends TDbCommandBuilder { } -?> diff --git a/framework/Data/Common/Mysql/TMysqlMetaData.php b/framework/Data/Common/Mysql/TMysqlMetaData.php index aaebd8dc..75f7a7cf 100644 --- a/framework/Data/Common/Mysql/TMysqlMetaData.php +++ b/framework/Data/Common/Mysql/TMysqlMetaData.php @@ -246,7 +246,9 @@ class TMysqlMetaData extends TDbMetaData if($row['Key_name']==='PRIMARY') $primary[] = $row['Column_name']; } - if($this->getServerVersion() > 5) + // MySQL version was increased to >=5.1.21 instead of 5.x + // due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588) + if($this->getServerVersion() >= 5.121) $foreign = $this->getForeignConstraints($schemaName,$tableName); else $foreign = $this->findForeignConstraints($schemaName,$tableName); @@ -352,4 +354,3 @@ EOD; } } -?> diff --git a/framework/Data/Common/Mysql/TMysqlTableColumn.php b/framework/Data/Common/Mysql/TMysqlTableColumn.php index 99b4333a..5f4351a7 100644 --- a/framework/Data/Common/Mysql/TMysqlTableColumn.php +++ b/framework/Data/Common/Mysql/TMysqlTableColumn.php @@ -70,4 +70,3 @@ class TMysqlTableColumn extends TDbTableColumn } } -?> diff --git a/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php index 460da46a..4cae8b89 100644 --- a/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php +++ b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php @@ -67,4 +67,3 @@ class TPgsqlCommandBuilder extends TDbCommandBuilder } -?> diff --git a/framework/Data/Common/Pgsql/TPgsqlMetaData.php b/framework/Data/Common/Pgsql/TPgsqlMetaData.php index 45d55086..a2243531 100644 --- a/framework/Data/Common/Pgsql/TPgsqlMetaData.php +++ b/framework/Data/Common/Pgsql/TPgsqlMetaData.php @@ -390,4 +390,3 @@ EOD; } } -?> diff --git a/framework/Data/Common/Pgsql/TPgsqlTableColumn.php b/framework/Data/Common/Pgsql/TPgsqlTableColumn.php index 7ec2312a..562e2c56 100644 --- a/framework/Data/Common/Pgsql/TPgsqlTableColumn.php +++ b/framework/Data/Common/Pgsql/TPgsqlTableColumn.php @@ -47,4 +47,3 @@ class TPgsqlTableColumn extends TDbTableColumn } } -?> diff --git a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php b/framework/Data/Common/Pgsql/TPgsqlTableInfo.php index 2a3a8461..2447c141 100644 --- a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php +++ b/framework/Data/Common/Pgsql/TPgsqlTableInfo.php @@ -56,4 +56,3 @@ class TPgsqlTableInfo extends TDbTableInfo } } -?> diff --git a/framework/Data/Common/Sqlite/TSqliteCommandBuilder.php b/framework/Data/Common/Sqlite/TSqliteCommandBuilder.php index c02ed76d..c60e17a3 100644 --- a/framework/Data/Common/Sqlite/TSqliteCommandBuilder.php +++ b/framework/Data/Common/Sqlite/TSqliteCommandBuilder.php @@ -45,4 +45,3 @@ class TSqliteCommandBuilder extends TDbCommandBuilder } } -?> diff --git a/framework/Data/Common/Sqlite/TSqliteMetaData.php b/framework/Data/Common/Sqlite/TSqliteMetaData.php index c562c930..010a2148 100644 --- a/framework/Data/Common/Sqlite/TSqliteMetaData.php +++ b/framework/Data/Common/Sqlite/TSqliteMetaData.php @@ -178,4 +178,3 @@ CREATE TABLE bar ); */ -?> diff --git a/framework/Data/Common/Sqlite/TSqliteTableColumn.php b/framework/Data/Common/Sqlite/TSqliteTableColumn.php index 3c9100ab..4e79de6d 100644 --- a/framework/Data/Common/Sqlite/TSqliteTableColumn.php +++ b/framework/Data/Common/Sqlite/TSqliteTableColumn.php @@ -62,4 +62,3 @@ class TSqliteTableColumn extends TDbTableColumn } } -?> diff --git a/framework/Data/Common/Sqlite/TSqliteTableInfo.php b/framework/Data/Common/Sqlite/TSqliteTableInfo.php index 95c3fe02..b729a593 100644 --- a/framework/Data/Common/Sqlite/TSqliteTableInfo.php +++ b/framework/Data/Common/Sqlite/TSqliteTableInfo.php @@ -45,4 +45,3 @@ class TSqliteTableInfo extends TDbTableInfo } } -?> diff --git a/framework/Data/Common/TDbMetaData.php b/framework/Data/Common/TDbMetaData.php index c0f10d41..bcdf0e46 100644 --- a/framework/Data/Common/TDbMetaData.php +++ b/framework/Data/Common/TDbMetaData.php @@ -121,4 +121,3 @@ abstract class TDbMetaData extends TComponent } } -?> diff --git a/framework/Data/Common/TDbTableColumn.php b/framework/Data/Common/TDbTableColumn.php index b3d603ae..3bb9454b 100644 --- a/framework/Data/Common/TDbTableColumn.php +++ b/framework/Data/Common/TDbTableColumn.php @@ -197,4 +197,3 @@ class TDbTableColumn extends TComponent } } -?> diff --git a/framework/Data/Common/TDbTableInfo.php b/framework/Data/Common/TDbTableInfo.php index 87af2234..e2aae3d0 100644 --- a/framework/Data/Common/TDbTableInfo.php +++ b/framework/Data/Common/TDbTableInfo.php @@ -156,4 +156,3 @@ class TDbTableInfo extends TComponent } } -?> diff --git a/framework/Data/DataGateway/TTableGateway.php b/framework/Data/DataGateway/TTableGateway.php index 0f2644be..163efcf5 100644 --- a/framework/Data/DataGateway/TTableGateway.php +++ b/framework/Data/DataGateway/TTableGateway.php @@ -474,4 +474,3 @@ class TTableGateway extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Configuration/TDiscriminator.php b/framework/Data/SqlMap/Configuration/TDiscriminator.php index 75ce2352..747c4158 100644 --- a/framework/Data/SqlMap/Configuration/TDiscriminator.php +++ b/framework/Data/SqlMap/Configuration/TDiscriminator.php @@ -230,4 +230,3 @@ class TSubMap extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php index d29d5f27..2e8f38d6 100644 --- a/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php +++ b/framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php @@ -27,7 +27,7 @@ class TInlineParameterMapParser /** * Regular expression for parsing inline parameter maps. */ - const PARAMETER_TOKEN_REGEXP = '/#(#?[^#]+#?)#/'; + const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/'; /** * Parse the sql text for inline parameters. @@ -77,4 +77,3 @@ class TInlineParameterMapParser } } -?> diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index 117c6037..f4fbbe1c 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -205,4 +205,3 @@ class TParameterMap extends TComponent return $value; } } -?> diff --git a/framework/Data/SqlMap/Configuration/TParameterProperty.php b/framework/Data/SqlMap/Configuration/TParameterProperty.php index d0af3a75..dcea754c 100644 --- a/framework/Data/SqlMap/Configuration/TParameterProperty.php +++ b/framework/Data/SqlMap/Configuration/TParameterProperty.php @@ -136,4 +136,3 @@ class TParameterProperty extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index 168041d2..d59d9522 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -198,4 +198,3 @@ class TResultMap extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index 711fa7a0..8e20d5e4 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -326,4 +326,3 @@ class TResultProperty extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php b/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php index 6df8cefd..9a9b1277 100644 --- a/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php +++ b/framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php @@ -43,4 +43,3 @@ class TSimpleDynamicParser } } -?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index edb78ea7..d7984dc4 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -214,4 +214,3 @@ class TSqlMapCacheKey } } -?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php index 77b714fd..3afcc75f 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php @@ -428,4 +428,3 @@ class TSqlMapSelectKey extends TSqlMapStatement } } -?> diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index d0c57d57..f2d13966 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -309,6 +309,16 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder private $_FlushOnExecuteStatements=array(); + /** + * Regular expressions for escaping simple/inline parameter symbols + */ + const SIMPLE_MARK='$'; + const INLINE_SYMBOL='#'; + const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/'; + const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/'; + const SIMPLE_PLACEHOLDER='`!!`'; + const INLINE_PLACEHOLDER='`!!!`'; + /** * @param TSqlMapXmlConfiguration parent xml configuration. */ @@ -532,6 +542,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder $scope['file'] = $this->_configFile; $scope['node'] = $node; + $sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement); if($statement->parameterMap() === null) { // Build a Parametermap with the inline parameters. @@ -548,6 +559,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } $sqlStatement = $sqlText['sql']; } + $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); $this->prepareSql($statement, $sqlStatement, $node); } @@ -562,6 +574,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder protected function prepareSql($statement,$sqlStatement, $node) { $simpleDynamic = new TSimpleDynamicParser; + $sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement); $dynamics = $simpleDynamic->parse($sqlStatement); if(count($dynamics['parameters']) > 0) { @@ -570,6 +583,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } else $sql = new TStaticSql(); + $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); $sql->buildPreparedStatement($statement, $sqlStatement); $statement->setSqlText($sql); } @@ -724,4 +738,3 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } } -?> diff --git a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php index 02b08e8e..69b20bf6 100644 --- a/framework/Data/SqlMap/DataMapper/TLazyLoadList.php +++ b/framework/Data/SqlMap/DataMapper/TLazyLoadList.php @@ -142,4 +142,3 @@ class TObjectProxy } } -?> diff --git a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php index 23e854ac..a27cb50f 100644 --- a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php +++ b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php @@ -106,7 +106,8 @@ class TPropertyAccess $object = $object->{$getter}(); else if(in_array($prop, array_keys(get_object_vars($object)))) $object = $object->{$prop}; - return false; + else + return false; } else return false; diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php index 61c5bb95..05b72e08 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapCache.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapCache.php @@ -225,4 +225,3 @@ class TSqlMapApplicationCache implements ICache } } -?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapException.php b/framework/Data/SqlMap/DataMapper/TSqlMapException.php index 69a0b0cd..0bf0ac32 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapException.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapException.php @@ -113,4 +113,3 @@ class TSqlMapExecutionException extends TSqlMapException { } -?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php index b3a88653..86171c1e 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php @@ -206,4 +206,3 @@ class TSqlMapPagedList extends TPagedList } } -?> diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php index aa39dce1..05866395 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandlerRegistry.php @@ -190,4 +190,3 @@ abstract class TSqlMapTypeHandler extends TComponent public abstract function createNewInstance($row=null); } -?> diff --git a/framework/Data/SqlMap/Statements/IMappedStatement.php b/framework/Data/SqlMap/Statements/IMappedStatement.php index 94189420..dc628c9e 100644 --- a/framework/Data/SqlMap/Statements/IMappedStatement.php +++ b/framework/Data/SqlMap/Statements/IMappedStatement.php @@ -80,4 +80,3 @@ interface IMappedStatement public function executeQueryForObject($connection,$parameter, $result=null); } -?> diff --git a/framework/Data/SqlMap/Statements/TCachingStatement.php b/framework/Data/SqlMap/Statements/TCachingStatement.php index 7c9498d4..c8a748c1 100644 --- a/framework/Data/SqlMap/Statements/TCachingStatement.php +++ b/framework/Data/SqlMap/Statements/TCachingStatement.php @@ -106,4 +106,3 @@ class TCachingStatement implements IMappedStatement } } -?> diff --git a/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php b/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php index bb95cab9..1a3d738a 100644 --- a/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TDeleteMappedStatement.php @@ -22,4 +22,3 @@ class TDeleteMappedStatement extends TUpdateMappedStatement { } -?> diff --git a/framework/Data/SqlMap/Statements/TInsertMappedStatement.php b/framework/Data/SqlMap/Statements/TInsertMappedStatement.php index 28ade045..1efb5b6b 100644 --- a/framework/Data/SqlMap/Statements/TInsertMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TInsertMappedStatement.php @@ -47,4 +47,3 @@ class TInsertMappedStatement extends TMappedStatement } } -?> diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index 2feeba90..6a9130fe 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -561,7 +561,7 @@ class TMappedStatement extends TComponent implements IMappedStatement else $obj = $this->fillDefaultResultMap(null, $row, $resultObject); if(class_exists('TActiveRecord',false) && $obj instanceof TActiveRecord) - //Create a new clean active record. + //Create a new clean active record. $obj=TActiveRecord::createRecord(get_class($obj),$obj); return $obj; } @@ -1115,7 +1115,7 @@ class TSqlMapObjectCollectionTree else if(is_array($list)) $list[] = $this->_entries[$node]['object']; else - throw TSqlMapExecutionException( + throw new TSqlMapExecutionException( 'sqlmap_property_must_be_list'); } @@ -1216,4 +1216,3 @@ class TResultSetMapItemParameter extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Statements/TPreparedCommand.php b/framework/Data/SqlMap/Statements/TPreparedCommand.php index 76407190..99bb6eff 100644 --- a/framework/Data/SqlMap/Statements/TPreparedCommand.php +++ b/framework/Data/SqlMap/Statements/TPreparedCommand.php @@ -58,4 +58,3 @@ class TPreparedCommand } } -?> diff --git a/framework/Data/SqlMap/Statements/TPreparedStatement.php b/framework/Data/SqlMap/Statements/TPreparedStatement.php index be005e81..7d862378 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatement.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatement.php @@ -41,4 +41,3 @@ class TPreparedStatement extends TComponent } -?> diff --git a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php index 5c3e2f22..44603408 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php @@ -47,4 +47,3 @@ class TPreparedStatementFactory } } -?> diff --git a/framework/Data/SqlMap/Statements/TSelectMappedStatement.php b/framework/Data/SqlMap/Statements/TSelectMappedStatement.php index a8253536..1802db2f 100644 --- a/framework/Data/SqlMap/Statements/TSelectMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TSelectMappedStatement.php @@ -34,4 +34,3 @@ class TSelectMappedStatement extends TMappedStatement } -?> diff --git a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php index 38554778..910fd659 100644 --- a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php +++ b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php @@ -47,4 +47,3 @@ class TSimpleDynamicSql extends TStaticSql } } -?> diff --git a/framework/Data/SqlMap/Statements/TStaticSql.php b/framework/Data/SqlMap/Statements/TStaticSql.php index 8f4687df..eba54ed7 100644 --- a/framework/Data/SqlMap/Statements/TStaticSql.php +++ b/framework/Data/SqlMap/Statements/TStaticSql.php @@ -34,4 +34,3 @@ class TStaticSql extends TComponent } } -?> diff --git a/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php b/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php index c0aa798e..633ec797 100644 --- a/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TUpdateMappedStatement.php @@ -47,4 +47,3 @@ class TUpdateMappedStatement extends TMappedStatement } } -?> diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php index 5a779dda..98f2a844 100644 --- a/framework/Data/SqlMap/TSqlMapConfig.php +++ b/framework/Data/SqlMap/TSqlMapConfig.php @@ -162,4 +162,3 @@ class TSqlMapConfig extends TDataSourceConfig } } -?> diff --git a/framework/Data/SqlMap/TSqlMapGateway.php b/framework/Data/SqlMap/TSqlMapGateway.php index dd7c2069..97b31b50 100644 --- a/framework/Data/SqlMap/TSqlMapGateway.php +++ b/framework/Data/SqlMap/TSqlMapGateway.php @@ -259,4 +259,3 @@ class TSqlMapGateway extends TComponent } } -?> diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php index 62c2de20..290050d1 100644 --- a/framework/Data/SqlMap/TSqlMapManager.php +++ b/framework/Data/SqlMap/TSqlMapManager.php @@ -258,4 +258,3 @@ class TSqlMapManager extends TComponent } } -?> diff --git a/framework/Data/TDataSourceConfig.php b/framework/Data/TDataSourceConfig.php index 804ea848..9e6bb2fc 100644 --- a/framework/Data/TDataSourceConfig.php +++ b/framework/Data/TDataSourceConfig.php @@ -165,5 +165,3 @@ class TDataSourceConfig extends TModule throw new TConfigurationException('datasource_dbconnection_invalid',$id); } } - -?> diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php index c48e7ded..d09c53f4 100644 --- a/framework/Data/TDbCommand.php +++ b/framework/Data/TDbCommand.php @@ -305,4 +305,3 @@ class TDbCommand extends TComponent } } -?> diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index 5489c7fd..259ca7b7 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -167,9 +167,11 @@ class TDbConnection extends TComponent try { $this->_pdo=new PDO($this->getConnectionString(),$this->getUsername(), - $this->getPassword(),$this->_attributes); + $this->getPassword(),$this->_attributes); + // This attribute is only useful for PDO::MySql driver. + // Ignore the warning if a driver doesn't understand this. + @$this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->_active=true; $this->setConnectionCharset(); } diff --git a/framework/Data/TDbDataReader.php b/framework/Data/TDbDataReader.php index 65fc363d..7b54414e 100644 --- a/framework/Data/TDbDataReader.php +++ b/framework/Data/TDbDataReader.php @@ -223,4 +223,3 @@ class TDbDataReader extends TComponent implements Iterator } } -?> diff --git a/framework/Data/TDbTransaction.php b/framework/Data/TDbTransaction.php index 5a19cacf..60b14a55 100644 --- a/framework/Data/TDbTransaction.php +++ b/framework/Data/TDbTransaction.php @@ -110,4 +110,3 @@ class TDbTransaction extends TComponent } } -?> diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 589e841c..fa8e6d4a 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -362,4 +362,3 @@ class TErrorHandler extends TModule } } -?> diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index 4173a04e..c6a87b4d 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -417,4 +417,3 @@ class THttpException extends TSystemException } } -?> diff --git a/framework/Exceptions/messages/messages.txt b/framework/Exceptions/messages/messages.txt index 3edd5d49..fc2b63f1 100644 --- a/framework/Exceptions/messages/messages.txt +++ b/framework/Exceptions/messages/messages.txt @@ -408,6 +408,11 @@ soapservice_serverid_duplicated = SOAP server ID '{0}' is duplicated. soapserver_id_invalid = Invalid SOAP server ID '{0}'. It should not end with '.wsdl'. soapserver_version_invalid = Invalid SOAP version '{0}'. It must be either '1.1' or '1.2'. +jsonservice_id_required = TJsonService requires 'id' attribute in its JSON elements. +jsonservice_response_type_invalid = JSON class {0} is invalid. It should be TJsonResponse or extend from TJsonResponse. +jsonservice_class_required = TJsonService requires 'class' attribute in its JSON elements. +jsonservice_provider_unknown = Unknown JSON provider '{0}' requested. + dbusermanager_userclass_required = TDbUserManager.UserClass is required. dbusermanager_userclass_invalid = TDbUserManager.UserClass '{0}' is not a valid user class. The class must extend TDbUser. dbusermanager_connectionid_invalid = TDbUserManager.ConnectionID '{0}' does not point to a valid TDataSourceConfig module. @@ -466,3 +471,5 @@ datasource_dbconnection_invalid = TDataSourceConfig.DbConnection '{0}' is inva response_status_reason_missing = HTTP 1.1 need reason for extended status-codes response_status_reason_badchars = For HTTP 1.1 header, the token status-reason must not contain token CR or LF + +activefileupload_temppath_invalid = TActiveFileUpload TempPath path '{0}' does not exist or is not writable by Web server process. diff --git a/framework/I18N/TDateFormat.php b/framework/I18N/TDateFormat.php index 2343011e..914131bd 100644 --- a/framework/I18N/TDateFormat.php +++ b/framework/I18N/TDateFormat.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.I18N @@ -51,6 +51,9 @@ Prado::using('System.I18N.TI18NControl'); * 'fulldate', 'longdate', 'mediumdate', 'shortdate', 'fulltime', * 'longtime', 'mediumtime', and 'shorttime'. Custom patterns can specified * when the Pattern property does not match the predefined patterns. + * - DefaultText, string, + *
Gets or sets the default text. If Value is not set, DefaultText will be + * shown instead of todays date and time. * * @author Xiang Wei Zhuo * @version v1.0, last update on Sat Dec 11 15:25:11 EST 2004 @@ -146,7 +149,11 @@ class TDateFormat extends TI18NControl implements IDataRenderer { $value = $this->getViewState('Value',''); if(empty($value)) - return time(); + { + $defaultText = $this->getDefaultText(); + if(empty($defaultText)) + return time(); + } return $value; } @@ -158,6 +165,24 @@ class TDateFormat extends TI18NControl implements IDataRenderer { $this->setViewState('Value',$value,''); } + + /** + * Get the default text value for this control. + * @return string default text value + */ + public function getDefaultText() + { + return $this->getViewState('DefaultText',''); + } + + /** + * Set the default text value for this control. + * @param string default text value + */ + public function setDefaultText($value) + { + $this->setViewState('DefaultText',$value,''); + } /** * Get the date-time value for this control. @@ -193,6 +218,11 @@ class TDateFormat extends TI18NControl implements IDataRenderer */ protected function getFormattedDate() { + $value = $this->getValue(); + $defaultText = $this->getDefaultText(); + if(empty($value) && !empty($defaultText)) + return $this->getDefaultText(); + $app = $this->getApplication()->getGlobalization(); //initialized the default class wide formatter @@ -205,12 +235,12 @@ class TDateFormat extends TI18NControl implements IDataRenderer if(strlen($culture) && $app->getCulture() !== $culture) { $formatter = new DateFormat($culture); - return $formatter->format($this->getValue(), + return $formatter->format($value, $this->getPattern(), $this->getCharset()); } //return the application wide culture formatted date time. - $result = self::$formatter->format($this->getValue(), + $result = self::$formatter->format($value, $this->getPattern(), $this->getCharset()); return $result; @@ -221,5 +251,4 @@ class TDateFormat extends TI18NControl implements IDataRenderer $writer->write($this->getFormattedDate()); } -} -?> +} \ No newline at end of file diff --git a/framework/I18N/TGlobalizationAutoDetect.php b/framework/I18N/TGlobalizationAutoDetect.php index b4611910..a77ea861 100644 --- a/framework/I18N/TGlobalizationAutoDetect.php +++ b/framework/I18N/TGlobalizationAutoDetect.php @@ -47,4 +47,3 @@ class TGlobalizationAutoDetect extends TGlobalization } } -?> diff --git a/framework/I18N/TI18NControl.php b/framework/I18N/TI18NControl.php index 9060ee77..ac3246fe 100644 --- a/framework/I18N/TI18NControl.php +++ b/framework/I18N/TI18NControl.php @@ -88,4 +88,3 @@ class TI18NControl extends TControl } } -?> diff --git a/framework/I18N/TNumberFormat.php b/framework/I18N/TNumberFormat.php index 12422521..62b43243 100644 --- a/framework/I18N/TNumberFormat.php +++ b/framework/I18N/TNumberFormat.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.I18N @@ -56,6 +56,9 @@ Prado::using('System.I18N.TI18NControl'); * The default is 'USD' if the Currency property is not specified. * - Pattern, string, *
Gets or sets the custom number formatting pattern. + * - DefaultText, string, + *
Gets or sets the default text. If Value is not set, DefaultText will be + * shown instead of the default currency Value/Pattern. * * @author Xiang Wei Zhuo * @version v1.0, last update on Sat Dec 11 17:49:56 EST 2004 @@ -105,6 +108,23 @@ class TNumberFormat extends TI18NControl implements IDataRenderer $this->setViewState('Value',$value,''); } + /** + * Get the default text value for this control. + * @return string default text value + */ + public function getDefaultText() + { + return $this->getViewState('DefaultText',''); + } + + /** + * Set the default text value for this control. + * @param string default text value + */ + public function setDefaultText($value) + { + $this->setViewState('DefaultText',$value,''); + } /** * Get the numberic value for this control. @@ -193,6 +213,11 @@ class TNumberFormat extends TI18NControl implements IDataRenderer */ protected function getFormattedValue() { + $value = $this->getValue(); + $defaultText = $this->getDefaultText(); + if(empty($value) && !empty($defaultText)) + return $this->getDefaultText(); + $app = $this->getApplication()->getGlobalization(); //initialized the default class wide formatter if(is_null(self::$formatter)) @@ -223,4 +248,4 @@ class TNumberFormat extends TI18NControl implements IDataRenderer } } -?> +?> diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php index c3b28c79..2f1e0633 100644 --- a/framework/I18N/TTranslate.php +++ b/framework/I18N/TTranslate.php @@ -254,4 +254,3 @@ class TTranslate extends TI18NControl } } -?> diff --git a/framework/I18N/TTranslateParameter.php b/framework/I18N/TTranslateParameter.php index 2b32b27b..37443133 100644 --- a/framework/I18N/TTranslateParameter.php +++ b/framework/I18N/TTranslateParameter.php @@ -117,4 +117,3 @@ class TTranslateParameter extends TControl } } -?> diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php index cb90577f..a0fa504d 100644 --- a/framework/I18N/Translation.php +++ b/framework/I18N/Translation.php @@ -106,4 +106,3 @@ class Translation extends TComponent } } -?> diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index 46b833b7..7ee50bba 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -630,4 +630,3 @@ class CultureInfo } } -?> diff --git a/framework/I18N/core/DateTimeFormatInfo.php b/framework/I18N/core/DateTimeFormatInfo.php index 0a99082d..aebd094a 100644 --- a/framework/I18N/core/DateTimeFormatInfo.php +++ b/framework/I18N/core/DateTimeFormatInfo.php @@ -514,4 +514,3 @@ class DateTimeFormatInfo } } -?> diff --git a/framework/I18N/core/Gettext/MO.php b/framework/I18N/core/Gettext/MO.php index 2a85598a..2a97aee7 100644 --- a/framework/I18N/core/Gettext/MO.php +++ b/framework/I18N/core/Gettext/MO.php @@ -353,4 +353,3 @@ class TGettext_MO extends TGettext return true; } } -?> diff --git a/framework/I18N/core/Gettext/PO.php b/framework/I18N/core/Gettext/PO.php index edadbf9a..54fe10e3 100644 --- a/framework/I18N/core/Gettext/PO.php +++ b/framework/I18N/core/Gettext/PO.php @@ -158,4 +158,3 @@ class TGettext_PO extends TGettext return true; } } -?> diff --git a/framework/I18N/core/Gettext/TGettext.php b/framework/I18N/core/Gettext/TGettext.php index ea35154b..39e5d07e 100644 --- a/framework/I18N/core/Gettext/TGettext.php +++ b/framework/I18N/core/Gettext/TGettext.php @@ -284,4 +284,3 @@ class TGettext return $PO; } } -?> diff --git a/framework/I18N/core/HTTPNegotiator.php b/framework/I18N/core/HTTPNegotiator.php index f76efbe2..9199ba15 100644 --- a/framework/I18N/core/HTTPNegotiator.php +++ b/framework/I18N/core/HTTPNegotiator.php @@ -127,4 +127,3 @@ class HTTPNegotiator } } -?> diff --git a/framework/I18N/core/IMessageSource.php b/framework/I18N/core/IMessageSource.php index eb0e5a1a..1d40bd73 100644 --- a/framework/I18N/core/IMessageSource.php +++ b/framework/I18N/core/IMessageSource.php @@ -120,4 +120,3 @@ interface IMessageSource } -?> diff --git a/framework/I18N/core/MessageFormat.php b/framework/I18N/core/MessageFormat.php index 21cf5f23..7af6deb1 100644 --- a/framework/I18N/core/MessageFormat.php +++ b/framework/I18N/core/MessageFormat.php @@ -253,4 +253,3 @@ class MessageFormat } } -?> diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php index f962e9a1..4c101bf0 100644 --- a/framework/I18N/core/MessageSource_XLIFF.php +++ b/framework/I18N/core/MessageSource_XLIFF.php @@ -502,7 +502,7 @@ class MessageSource_XLIFF extends MessageSource { $date = @date('c'); $xml = << + diff --git a/framework/I18N/core/NumberFormatInfo.php b/framework/I18N/core/NumberFormatInfo.php index 136a20eb..17149317 100644 --- a/framework/I18N/core/NumberFormatInfo.php +++ b/framework/I18N/core/NumberFormatInfo.php @@ -648,4 +648,3 @@ class NumberFormatInfo } } -?> diff --git a/framework/IO/TTextWriter.php b/framework/IO/TTextWriter.php index 0dd9bcf5..b043e217 100644 --- a/framework/IO/TTextWriter.php +++ b/framework/IO/TTextWriter.php @@ -57,4 +57,3 @@ class TTextWriter extends TComponent implements ITextWriter } } -?> diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 15932cad..11bc7f41 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -115,6 +115,11 @@ class PradoBase return 'Powered by PRADO'; } + public static function metaGenerator() + { + return 'PRADO - http://www.pradosoft.com/'; + } + /** * PHP error handler. * This method should be registered as PHP error handler using diff --git a/framework/Security/IUserManager.php b/framework/Security/IUserManager.php index d8907160..37cf632f 100644 --- a/framework/Security/IUserManager.php +++ b/framework/Security/IUserManager.php @@ -56,4 +56,3 @@ interface IUserManager public function validateUser($username,$password); } -?> diff --git a/framework/Security/TAuthManager.php b/framework/Security/TAuthManager.php index 64422845..40d94e19 100644 --- a/framework/Security/TAuthManager.php +++ b/framework/Security/TAuthManager.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Security @@ -25,6 +25,13 @@ Prado::using('System.Security.IUserManager'); * browser to a login page that is specified via the {@link setLoginPage LoginPage}. * To login or logout a user, call {@link login} or {@link logout}, respectively. * + * The {@link setAuthExpire AuthExpire} property can be used to define the time + * in seconds after which the authentication should expire. + * {@link setAllowAutoLogin AllowAutoLogin} specifies if the login information + * should be stored in a cookie to perform automatic login. Enabling this + * feature will cause that {@link setAuthExpire AuthExpire} has no effect + * since the user will be logged in again on authentication expiration. + * * To load TAuthManager, configure it in application configuration as follows, * * @@ -68,6 +75,10 @@ class TAuthManager extends TModule * @var string variable name used to store user session or cookie */ private $_userKey; + /** + * @var integer authentication expiration time in seconds. Defaults to zero (no expiration) + */ + private $_authExpire=0; /** * Initializes this module. @@ -241,6 +252,24 @@ class TAuthManager extends TModule $this->_allowAutoLogin=TPropertyValue::ensureBoolean($value); } + /** + * @return integer authentication expiration time in seconds. Defaults to zero (no expiration). + * @since 3.1.3 + */ + public function getAuthExpire() + { + return $this->_authExpire; + } + + /** + * @param integer authentication expiration time in seconds. Defaults to zero (no expiration). + * @since 3.1.3 + */ + public function setAuthExpire($value) + { + $this->_authExpire=TPropertyValue::ensureInteger($value); + } + /** * Performs the real authentication work. * An OnAuthenticate event will be raised if there is any handler attached to it. @@ -260,8 +289,12 @@ class TAuthManager extends TModule $sessionInfo=$session->itemAt($this->getUserKey()); $user=$this->_userManager->getUser(null)->loadFromString($sessionInfo); + // check for authentication expiration + $isAuthExpired = $this->_authExpire>0 && !$user->getIsGuest() && + ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretimegetAllowAutoLogin() && $user->getIsGuest()) + if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired)) { $cookie=$this->getRequest()->getCookies()->itemAt($this->getUserKey()); if($cookie instanceof THttpCookie) @@ -270,17 +303,37 @@ class TAuthManager extends TModule { $user=$user2; $this->updateSessionUser($user); + // user is restored from cookie, auth may not expire + $isAuthExpired = false; } } } $application->setUser($user); + // handle authentication expiration or update expiration time + if($isAuthExpired) + $this->onAuthExpire($param); + else + $session->add('AuthExpireTime', time() + $this->_authExpire); + // event handler gets a chance to do further auth work if($this->hasEventHandler('OnAuthenticate')) $this->raiseEvent('OnAuthenticate',$this,$application); } - + + /** + * Performs user logout on authentication expiration. + * An 'OnAuthExpire' event will be raised if there is any handler attached to it. + * @param mixed parameter to be passed to OnAuthExpire event. + */ + public function onAuthExpire($param) + { + $this->logout(); + if($this->hasEventHandler('OnAuthExpire')) + $this->raiseEvent('OnAuthExpire',$this,$param); + } + /** * Performs the real authorization work. * Authorization rules obtained from the application will be used to check @@ -401,4 +454,4 @@ class TAuthManager extends TModule } } -?> +?> diff --git a/framework/Security/TAuthorizationRule.php b/framework/Security/TAuthorizationRule.php index d301737b..896ce376 100644 --- a/framework/Security/TAuthorizationRule.php +++ b/framework/Security/TAuthorizationRule.php @@ -294,4 +294,3 @@ class TAuthorizationRuleCollection extends TList } } -?> diff --git a/framework/Security/TDbUserManager.php b/framework/Security/TDbUserManager.php index bd70de8d..873d43f8 100644 --- a/framework/Security/TDbUserManager.php +++ b/framework/Security/TDbUserManager.php @@ -318,4 +318,3 @@ abstract class TDbUser extends TUser } } -?> diff --git a/framework/Security/TSecurityManager.php b/framework/Security/TSecurityManager.php index 9fbadd10..d43c9fec 100644 --- a/framework/Security/TSecurityManager.php +++ b/framework/Security/TSecurityManager.php @@ -279,4 +279,3 @@ class TSecurityManagerValidationMode extends TEnumerable const SHA1='SHA1'; } -?> diff --git a/framework/Security/TUser.php b/framework/Security/TUser.php index d0e850cf..35e3e3a5 100644 --- a/framework/Security/TUser.php +++ b/framework/Security/TUser.php @@ -220,4 +220,3 @@ class TUser extends TComponent implements IUser } } -?> diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php index 6326803d..dbaa5ffb 100644 --- a/framework/Security/TUserManager.php +++ b/framework/Security/TUserManager.php @@ -148,7 +148,7 @@ class TUserManager extends TModule implements IUserManager * Loads user/role information from an XML node. * @param TXmlElement the XML node containing the user information */ - private function loadUserDataFromXml($xmlNode) + protected function loadUserDataFromXml($xmlNode) { foreach($xmlNode->getElementsByTagName('user') as $node) { diff --git a/framework/TApplication.php b/framework/TApplication.php index d9626179..e690aa96 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -293,6 +293,11 @@ class TApplication extends TComponent * @var TApplicationMode application mode */ private $_mode=TApplicationMode::Debug; + + /** + * @var string Customizable page service ID + */ + private $_pageServiceID = self::PAGE_SERVICE_ID; /** * Constructor. @@ -325,7 +330,8 @@ class TApplication extends TComponent // generates unique ID by hashing the runtime path $this->_uniqueID=md5($this->_runtimePath); $this->_parameters=new TMap; - $this->_services=array(self::PAGE_SERVICE_ID=>array('TPageService',array(),null)); + $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); + Prado::setPathOfAlias('Application',$this->_basePath); } @@ -509,6 +515,22 @@ class TApplication extends TComponent { $this->_id=$value; } + + /** + * @return string page service ID + */ + public function getPageServiceID() + { + return $this->_pageServiceID; + } + + /** + * @param string page service ID + */ + public function setPageServiceID($value) + { + $this->_pageServiceID=$value; + } /** * @return string an ID that uniquely identifies this Prado application from the others @@ -623,6 +645,10 @@ class TApplication extends TComponent public function setRuntimePath($value) { $this->_runtimePath=$value; + if($this->_cacheFile) + $this->_cacheFile=$this->_runtimePath.DIRECTORY_SEPARATOR.self::CONFIGCACHE_FILE; + // generates unique ID by hashing the runtime path + $this->_uniqueID=md5($this->_runtimePath); } /** @@ -912,6 +938,9 @@ class TApplication extends TComponent foreach($config->getProperties() as $name=>$value) $this->setSubProperty($name,$value); } + + if(empty($this->_services)) + $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); // load parameters foreach($config->getParameters() as $id=>$parameter) @@ -996,8 +1025,8 @@ class TApplication extends TComponent } if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null) - $serviceID=self::PAGE_SERVICE_ID; - + $serviceID=$this->getPageServiceID(); + $this->startService($serviceID); } @@ -1761,4 +1790,3 @@ class TApplicationStatePersister extends TModule implements IStatePersister } } -?> diff --git a/framework/TApplicationComponent.php b/framework/TApplicationComponent.php index 41e1b80e..6e2c5bbe 100644 --- a/framework/TApplicationComponent.php +++ b/framework/TApplicationComponent.php @@ -116,4 +116,3 @@ class TApplicationComponent extends TComponent } } -?> diff --git a/framework/TComponent.php b/framework/TComponent.php index cba21b7d..f9c36cc8 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -839,4 +839,3 @@ class TComponentReflection extends TComponent } } -?> diff --git a/framework/TModule.php b/framework/TModule.php index 9ff20d6f..6426aa70 100644 --- a/framework/TModule.php +++ b/framework/TModule.php @@ -54,4 +54,3 @@ abstract class TModule extends TApplicationComponent implements IModule } } -?> diff --git a/framework/TService.php b/framework/TService.php index a10460cc..cf2fb142 100644 --- a/framework/TService.php +++ b/framework/TService.php @@ -81,4 +81,3 @@ abstract class TService extends TApplicationComponent implements IService } } -?> diff --git a/framework/TShellApplication.php b/framework/TShellApplication.php index ad219cd1..0d2cb826 100644 --- a/framework/TShellApplication.php +++ b/framework/TShellApplication.php @@ -46,4 +46,3 @@ class TShellApplication extends TApplication } } -?> diff --git a/framework/Util/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php index fa65a9a2..bf0b58ae 100644 --- a/framework/Util/TDataFieldAccessor.php +++ b/framework/Util/TDataFieldAccessor.php @@ -80,4 +80,3 @@ class TDataFieldAccessor } } -?> diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index 5c755985..aa772194 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -95,6 +95,20 @@ class TLogRouter extends TModule } } + /** + * Adds a TLogRoute instance to the log router. + * + * @param TLogRoute $route + * @throws TInvalidDataTypeException if the route object is invalid + */ + public function addRoute($route) + { + if(!($route instanceof TLogRoute)) + throw new TInvalidDataTypeException('logrouter_routetype_invalid'); + $this->_routes[]=$route; + $route->init(null); + } + /** * @return string external configuration file. Defaults to null. */ @@ -106,11 +120,11 @@ class TLogRouter extends TModule /** * @param string external configuration file in namespace format. The file * must be suffixed with '.xml'. - * @throws TInvalidDataValueException if the file is invalid. + * @throws TConfigurationException if the file is invalid. */ public function setConfigFile($value) { - if(($this->_configFile=Prado::getPathOfNamespace($value,self::LOG_FILE_EXT))===null) + if(($this->_configFile=Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT))===null) throw new TConfigurationException('logrouter_configfile_invalid',$value); } @@ -509,8 +523,9 @@ class TEmailLogRoute extends TLogRoute foreach($logs as $log) $message.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]); $message=wordwrap($message,70); + $returnPath = ini_get('sendmail_path') ? "Return-Path:{$this->_from}\r\n" : ''; foreach($this->_emails as $email) - mail($email,$this->getSubject(),$message,"From:{$this->_from}\r\n"); + mail($email,$this->getSubject(),$message,"From:{$this->_from}\r\n{$returnPath}"); } diff --git a/framework/Util/TLogger.php b/framework/Util/TLogger.php index 6d5385eb..51005883 100644 --- a/framework/Util/TLogger.php +++ b/framework/Util/TLogger.php @@ -127,4 +127,3 @@ class TLogger extends TComponent } } -?> diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 020db8db..529f20ca 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -141,4 +141,3 @@ class TParameterModule extends TModule } } -?> diff --git a/framework/Util/TVarDumper.php b/framework/Util/TVarDumper.php index 180bb71a..e30e2400 100644 --- a/framework/Util/TVarDumper.php +++ b/framework/Util/TVarDumper.php @@ -126,4 +126,3 @@ class TVarDumper } } -?> diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 511515c8..9c4741a4 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -227,4 +227,3 @@ class TJavaScript } } -?> diff --git a/framework/Web/Javascripts/source/packages.php b/framework/Web/Javascripts/source/packages.php index 1cca7b7c..d6c04e7f 100644 --- a/framework/Web/Javascripts/source/packages.php +++ b/framework/Web/Javascripts/source/packages.php @@ -47,7 +47,8 @@ $packages = array( ), 'dragdrop'=>array( - SCRIPTACULOUS_DIR.'/dragdrop.js' + SCRIPTACULOUS_DIR.'/dragdrop.js', + 'prado/activecontrols/dragdrop.js' ), 'slider'=>array( @@ -60,6 +61,14 @@ $packages = array( 'tabpanel'=>array( 'prado/controls/tabpanel.js' + ), + + 'activedatepicker' => array( + 'prado/activecontrols/activedatepicker.js' + ), + + 'activefileupload' => array( + 'prado/activefileupload/activefileupload.js' ), ); @@ -67,19 +76,20 @@ $packages = array( //package names and their dependencies $dependencies = array( - 'prado' => array('prado'), - 'effects' => array('prado', 'effects'), - 'validator' => array('prado', 'validator'), - 'logger' => array('prado', 'logger'), - 'datepicker' => array('prado', 'datepicker'), - 'colorpicker' => array('prado', 'colorpicker'), - 'ajax' => array('prado', 'effects', 'ajax'), - 'dragdrop' => array('prado', 'effects', 'dragdrop'), - 'slider' => array('prado', 'slider'), - 'keyboard' => array('prado', 'keyboard'), - 'tabpanel' => array('prado', 'tabpanel'), + 'prado' => array('prado'), + 'effects' => array('prado', 'effects'), + 'validator' => array('prado', 'validator'), + 'logger' => array('prado', 'logger'), + 'datepicker' => array('prado', 'datepicker'), + 'colorpicker' => array('prado', 'colorpicker'), + 'ajax' => array('prado', 'effects', 'ajax'), + 'dragdrop' => array('prado', 'effects', 'ajax', 'dragdrop'), + 'slider' => array('prado', 'slider'), + 'keyboard' => array('prado', 'keyboard'), + 'tabpanel' => array('prado', 'tabpanel'), + 'activedatepicker' => array('datepicker', 'ajax', 'activedatepicker'), + 'activefileupload' => array('prado', 'ajax', 'activefileupload'), ); return array($packages, $dependencies); -?> diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js index 7ee4c0e6..d5cae7b8 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js @@ -1,362 +1,387 @@ -/** - * Generic postback control. - */ -Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, -{ - onPostBack : function(event, options) - { - var request = new Prado.CallbackRequest(options.EventTarget, options); - request.dispatch(); - Event.stop(event); - } -}); - -/** - * TActiveButton control. - */ -Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl); -/** - * TActiveLinkButton control. - */ -Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl); - -Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, -{ - onPostBack : function(event, options) - { - this.addXYInput(event,options); - var request = new Prado.CallbackRequest(options.EventTarget, options); - request.dispatch(); - Event.stop(event); - } -}); -/** - * Active check box. - */ -Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, -{ - onPostBack : function(event, options) - { - var request = new Prado.CallbackRequest(options.EventTarget, options); - if(request.dispatch()==false) - Event.stop(event); - } -}); - -/** - * TActiveRadioButton control. - */ -Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox); - - -Prado.WebUI.TActiveCheckBoxList = Base.extend( -{ - constructor : function(options) - { - for(var i = 0; i 0) - { - this.hasResults = true; - this.updateChoices(result); - } - else - { - this.active = false; - this.hasResults = false; - this.hide(); - } - } - } -}); - -/** - * Time Triggered Callback class. - */ -Prado.WebUI.TTimeTriggeredCallback = Base.extend( -{ - constructor : function(options) - { - this.options = Object.extend({ Interval : 1 }, options || {}); - Prado.WebUI.TTimeTriggeredCallback.register(this); - }, - - startTimer : function() - { - setTimeout(this.onTimerEvent.bind(this), 100); - if(typeof(this.timer) == 'undefined' || this.timer == null) - this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); - }, - - stopTimer : function() - { - if(typeof(this.timer) != 'undefined') - { - clearInterval(this.timer); - this.timer = null; - } - }, - - onTimerEvent : function() - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - } -}, -//class methods -{ - timers : {}, - - register : function(timer) - { - Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer; - }, - - start : function(id) - { - if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) - Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer(); - }, - - stop : function(id) - { - if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) - Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer(); - } -}); - -Prado.WebUI.ActiveListControl = Base.extend( -{ - constructor : function(options) - { - this.element = $(options.ID); - if(this.element) - { - this.options = options; - Event.observe(this.element, "change", this.doCallback.bind(this)); - } - }, - - doCallback : function(event) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - Event.stop(event); - } -}); - -Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl; -Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl; - -/** - * Observe event of a particular control to trigger a callback request. - */ -Prado.WebUI.TEventTriggeredCallback = Base.extend( -{ - constructor : function(options) - { - this.options = options; - var element = $(options['ControlID']); - if(element) - Event.observe(element, this.getEventName(element), this.doCallback.bind(this)); - }, - - getEventName : function(element) - { - var name = this.options.EventName; - if(typeof(name) == "undefined" && element.type) - { - switch (element.type.toLowerCase()) - { - case 'password': - case 'text': - case 'textarea': - case 'select-one': - case 'select-multiple': - return 'change'; - } - } - return typeof(name) == "undefined" || name == "undefined" ? 'click' : name; - }, - - doCallback : function(event) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - if(this.options.StopEvent == true) - Event.stop(event); - } -}); - -/** - * Observe changes to a property of a particular control to trigger a callback. - */ -Prado.WebUI.TValueTriggeredCallback = Base.extend( -{ - count : 1, - - observing : true, - - constructor : function(options) - { - this.options = options; - this.options.PropertyName = this.options.PropertyName || 'value'; - var element = $(options['ControlID']); - this.value = element ? element[this.options.PropertyName] : undefined; - Prado.WebUI.TValueTriggeredCallback.register(this); - this.startObserving(); - }, - - stopObserving : function() - { - clearTimeout(this.timer); - this.observing = false; - }, - - startObserving : function() - { - this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000); - }, - - checkChanges : function() - { - var element = $(this.options.ControlID); - if(element) - { - var value = element[this.options.PropertyName]; - if(this.value != value) - { - this.doCallback(this.value, value); - this.value = value; - this.count=1; - } - else - this.count = this.count + this.options.Decay; - if(this.observing) - this.time = setTimeout(this.checkChanges.bind(this), - parseInt(this.options.Interval*1000*this.count)); - } - }, - - doCallback : function(oldValue, newValue) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - var param = {'OldValue' : oldValue, 'NewValue' : newValue}; - request.setCallbackParameter(param); - request.dispatch(); - } -}, -//class methods -{ - timers : {}, - - register : function(timer) - { - Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer; - }, - - stop : function(id) - { - Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving(); - } -}); +/** + * Generic postback control. + */ +Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, +{ + onPostBack : function(event, options) + { + var request = new Prado.CallbackRequest(options.EventTarget, options); + request.dispatch(); + Event.stop(event); + } +}); + +/** + * TActiveButton control. + */ +Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl); +/** + * TActiveLinkButton control. + */ +Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl); + +Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, +{ + onPostBack : function(event, options) + { + this.addXYInput(event,options); + var request = new Prado.CallbackRequest(options.EventTarget, options); + request.dispatch(); + Event.stop(event); + this.removeXYInput(event,options); + } +}); +/** + * Active check box. + */ +Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, +{ + onPostBack : function(event, options) + { + var request = new Prado.CallbackRequest(options.EventTarget, options); + if(request.dispatch()==false) + Event.stop(event); + } +}); + +/** + * TActiveRadioButton control. + */ +Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox); + + +Prado.WebUI.TActiveCheckBoxList = Base.extend( +{ + constructor : function(options) + { + for(var i = 0; i 0) + { + this.hasResults = true; + this.updateChoices(result); + } + else + { + this.active = false; + this.hasResults = false; + this.hide(); + } + } + } +}); + +/** + * Time Triggered Callback class. + */ +Prado.WebUI.TTimeTriggeredCallback = Base.extend( +{ + constructor : function(options) + { + this.options = Object.extend({ Interval : 1 }, options || {}); + Prado.WebUI.TTimeTriggeredCallback.register(this); + }, + + startTimer : function() + { + setTimeout(this.onTimerEvent.bind(this), 100); + if(typeof(this.timer) == 'undefined' || this.timer == null) + this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); + }, + + stopTimer : function() + { + if(typeof(this.timer) != 'undefined') + { + clearInterval(this.timer); + this.timer = null; + } + }, + + resetTimer : function() + { + if(typeof(this.timer) != 'undefined') + { + clearInterval(this.timer); + this.timer = null; + this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); + } + }, + + onTimerEvent : function() + { + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + request.dispatch(); + }, + + setInterval : function(value) + { + if (this.options.Interval != value){ + this.options.Interval = value; + this.resetTimer(); + } + } +}, +//class methods +{ + timers : {}, + + register : function(timer) + { + Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer; + }, + + start : function(id) + { + if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) + Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer(); + }, + + stop : function(id) + { + if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) + Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer(); + }, + + setInterval : function (id,value) + { + if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) + Prado.WebUI.TTimeTriggeredCallback.timers[id].setInterval(value); + } +}); + +Prado.WebUI.ActiveListControl = Base.extend( +{ + constructor : function(options) + { + this.element = $(options.ID); + if(this.element) + { + this.options = options; + Event.observe(this.element, "change", this.doCallback.bind(this)); + } + }, + + doCallback : function(event) + { + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + request.dispatch(); + Event.stop(event); + } +}); + +Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl; +Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl; + +/** + * Observe event of a particular control to trigger a callback request. + */ +Prado.WebUI.TEventTriggeredCallback = Base.extend( +{ + constructor : function(options) + { + this.options = options; + var element = $(options['ControlID']); + if(element) + Event.observe(element, this.getEventName(element), this.doCallback.bind(this)); + }, + + getEventName : function(element) + { + var name = this.options.EventName; + if(typeof(name) == "undefined" && element.type) + { + switch (element.type.toLowerCase()) + { + case 'password': + case 'text': + case 'textarea': + case 'select-one': + case 'select-multiple': + return 'change'; + } + } + return typeof(name) == "undefined" || name == "undefined" ? 'click' : name; + }, + + doCallback : function(event) + { + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + request.dispatch(); + if(this.options.StopEvent == true) + Event.stop(event); + } +}); + +/** + * Observe changes to a property of a particular control to trigger a callback. + */ +Prado.WebUI.TValueTriggeredCallback = Base.extend( +{ + count : 1, + + observing : true, + + constructor : function(options) + { + this.options = options; + this.options.PropertyName = this.options.PropertyName || 'value'; + var element = $(options['ControlID']); + this.value = element ? element[this.options.PropertyName] : undefined; + Prado.WebUI.TValueTriggeredCallback.register(this); + this.startObserving(); + }, + + stopObserving : function() + { + clearTimeout(this.timer); + this.observing = false; + }, + + startObserving : function() + { + this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000); + }, + + checkChanges : function() + { + var element = $(this.options.ControlID); + if(element) + { + var value = element[this.options.PropertyName]; + if(this.value != value) + { + this.doCallback(this.value, value); + this.value = value; + this.count=1; + } + else + this.count = this.count + this.options.Decay; + if(this.observing) + this.time = setTimeout(this.checkChanges.bind(this), + parseInt(this.options.Interval*1000*this.count)); + } + }, + + doCallback : function(oldValue, newValue) + { + var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); + var param = {'OldValue' : oldValue, 'NewValue' : newValue}; + request.setCallbackParameter(param); + request.dispatch(); + } +}, +//class methods +{ + timers : {}, + + register : function(timer) + { + Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer; + }, + + stop : function(id) + { + Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving(); + } +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js new file mode 100755 index 00000000..87b48bf3 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js @@ -0,0 +1,79 @@ +/** + * TActiveDatePicker control + */ +Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker, +{ + initialize : function(options) + { + this.options = options || []; + this.control = $(options.ID); + this.dateSlot = new Array(42); + this.weekSlot = new Array(6); + this.minimalDaysInFirstWeek = 4; + this.selectedDate = this.newDate(); + this.positionMode = 'Bottom'; + + //which element to trigger to show the calendar + if(this.options.Trigger) + { + this.trigger = $(this.options.Trigger) ; + var triggerEvent = this.options.TriggerEvent || "click"; + } + else + { + this.trigger = this.control; + var triggerEvent = this.options.TriggerEvent || "focus"; + } + + // Popup position + if(this.options.PositionMode == 'Top') + { + this.positionMode = this.options.PositionMode; + } + + Object.extend(this,options); + + Event.observe(this.trigger, triggerEvent, this.show.bindEvent(this)); + + // Listen to change event + if(this.options.InputMode == "TextBox") + { + Event.observe(this.control, "change", this.onDateChanged.bindEvent(this)); + } + else + { + var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); + var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control); + var year = Prado.WebUI.TDatePicker.getYearListControl(this.control); + Event.observe (day, "change", this.onDateChanged.bindEvent(this)); + Event.observe (month, "change", this.onDateChanged.bindEvent(this)); + Event.observe (year, "change", this.onDateChanged.bindEvent(this)); + + } + + }, + + // Respond to change event on the textbox or dropdown list + // This method raises OnDateChanged event on client side if it has been defined, + // and raise the callback request + onDateChanged : function () + { + var date; + if (this.options.InputMode == "TextBox") + { + date=this.control.value; + } + else + { + var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1; + var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex; + var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value; + date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this); + } + if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date); + + // Make callback request + var request = new Prado.CallbackRequest(this.options.EventTarget,this.options); + request.dispatch(); + } +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js new file mode 100755 index 00000000..0b42afd5 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js @@ -0,0 +1,24 @@ +/** + * DropContainer control + */ + +Prado.WebUI.DropContainer = Class.extend(Prado.WebUI.CallbackControl); + +Object.extend(Prado.WebUI.DropContainer.prototype, +{ + initialize: function(options) + { + this.options = options; + Object.extend (this.options, + { + onDrop: this.onDrop.bind(this) + }); + + Droppables.add (options.ID, this.options); + }, + + onDrop: function(dragElement, dropElement) + { + Prado.Callback(this.options.EventTarget, dragElement.id, null, this.options); + } +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js index 87b8ddde..51e3f489 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js @@ -188,7 +188,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( if(this.options.AutoHide) this.showLabel(); } - else if (Event.keyCode(e) == Event.KEY_RETURN) + else if (Event.keyCode(e) == Event.KEY_RETURN && this.options.TextMode != 'MultiLine') Event.stop(e); }, diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html new file mode 100755 index 00000000..44f50ce4 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png new file mode 100755 index 00000000..98badd7f Binary files /dev/null and b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png differ diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png new file mode 100755 index 00000000..26c529fc Binary files /dev/null and b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png differ diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif new file mode 100755 index 00000000..085ccaec Binary files /dev/null and b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif differ diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js new file mode 100755 index 00000000..9f57f912 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -0,0 +1,63 @@ +Prado.WebUI.TActiveFileUpload = Base.extend( +{ + constructor : function(options) + { + this.options = options || {}; + Prado.WebUI.TActiveFileUpload.register(this); + + this.input = $(options.inputID); + this.flag = $(options.flagID); + this.form = $(options.formID); + + this.indicator = $(options.indicatorID); + this.complete = $(options.completeID); + this.error = $(options.errorID); + + // set up events + Event.observe(this.input,"change",this.fileChanged.bind(this)); + }, + + fileChanged:function(){ + // show the upload indicator, and hide the complete and error indicators (if they areSn't already). + this.flag.value = '1'; + this.complete.style.display = 'none'; + this.error.style.display = 'none'; + this.indicator.style.display = ''; + + // set the form to submit in the iframe, submit it, and then reset it. + this.oldtargetID = this.form.target; + this.form.target = this.options.targetID; + this.form.submit(); + this.form.target = this.oldtargetID; + }, + + finishUpload:function(options){ + // hide the display indicator. + this.flag.value = ''; + this.indicator.style.display = 'none'; + if (this.options.targetID == options.targetID){ + // show the complete indicator. + if (options.errorCode == 0){ + this.complete.style.display = ''; + this.input.value = ''; + } else { + this.error.style.display = ''; + } + Prado.Callback(this.options.EventTarget, options, null, this.options); + } + } +}, +{ +// class methods + controls : {}, + + register : function(control) + { + Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control; + }, + + onFileUpload: function(options) + { + Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options); + } +}); \ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/activeratings/blocks.css b/framework/Web/Javascripts/source/prado/activeratings/blocks.css deleted file mode 100644 index bb846094..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/blocks.css +++ /dev/null @@ -1,42 +0,0 @@ -.TActiveRatingList_blocks -{ - border-collapse: collapse; -} -.TActiveRatingList_blocks input, .TActiveRatingList_blocks label -{ - display: none; -} - -.TActiveRatingList_blocks td -{ - width: 18px; - height: 9px; - padding: 1px; -} - -.TActiveRatingList_blocks td.rating -{ - background-image: url(blocks_combined.gif); - background-repeat: no-repeat; - cursor: pointer; - background-position: 1px 0px; -} -.TActiveRatingList_blocks td.rating_selected -{ - background-position: 1px -100px; -} - -.TActiveRatingList_blocks td.rating_half -{ - background-position: 1px -200px; -} - -.TActiveRatingList_blocks td.rating_hover -{ - background-position: 1px -300px; -} - -.TActiveRatingList_blocks td.rating_disabled -{ - cursor: default !important; -} diff --git a/framework/Web/Javascripts/source/prado/activeratings/default.css b/framework/Web/Javascripts/source/prado/activeratings/default.css deleted file mode 100644 index ba90eb27..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/default.css +++ /dev/null @@ -1,43 +0,0 @@ -.TActiveRatingList_default -{ - border-collapse: collapse; -} -.TActiveRatingList_default input, .TActiveRatingList_default label -{ - display: none; -} - -.TActiveRatingList_default td -{ - width: 18px; - height: 18px; - padding: 0; -} - -.TActiveRatingList_default td.rating -{ - background-image: url(default_combined.gif); - background-repeat: no-repeat; - cursor: pointer; - background-position: 0px 0px; -} - -.TActiveRatingList_default td.rating_selected -{ - background-position: 0px -100px; -} - -.TActiveRatingList_default td.rating_half -{ - background-position: 0px -200px; -} - -.TActiveRatingList_default td.rating_hover -{ - background-position: 0px -300px; -} - -.TActiveRatingList_default td.rating_disabled -{ - cursor: default !important; -} \ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/activeratings/ratings.js b/framework/Web/Javascripts/source/prado/activeratings/ratings.js deleted file mode 100644 index 4eeddbd8..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/ratings.js +++ /dev/null @@ -1,178 +0,0 @@ -Prado.WebUI.TActiveRatingList = Base.extend( -{ - selectedIndex : -1, - rating: -1, - enabled : true, - readOnly : false, - - constructor : function(options) - { - var cap = $(options.CaptionID); - this.options = Object.extend( - { - caption : cap ? cap.innerHTML : '' - }, options || {}); - - Prado.WebUI.TActiveRatingList.register(this); - this._init(); - this.selectedIndex = options.SelectedIndex; - this.rating = options.Rating; - if(options.Rating <= 0 && options.SelectedIndex >= 0) - this.rating = options.SelectedIndex+1; - this.showRating(this.rating); - }, - - _init: function(options) - { - Element.addClassName($(this.options.ListID),this.options.Style); - this.radios = new Array(); - var index=0; - for(var i = 0; i halfMax ? base+1 : base; - for(var i = 0; i halfMax ? base+1 : base; - var hasHalf = remainder >= halfMin && remainder <= halfMax; - for(var i = 0; i index ? 'removeClassName' : 'addClassName'; - Element[action](node, "rating_selected"); - if(i==index+1 && hasHalf) - Element.addClassName(node, "rating_half"); - else - Element.removeClassName(node, "rating_half"); - Element.removeClassName(node,"rating_hover"); - } - }, - - getIndexCaption : function(index) - { - return index > -1 ? this.radios[index].value : this.options.caption; - }, - - showCaption : function(value) - { - var caption = $(this.options.CaptionID); - if(caption) caption.innerHTML = value; - $(this.options.ListID).title = value; - }, - - setCaption : function(value) - { - this.options.caption = value; - this.showCaption(value); - }, - - setEnabled : function(value) - { - this.enabled = value; - for(var i = 0; i