From 9af7e1312620de671c4312fbfd723b59ee4685df Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 21 Jun 2006 13:42:04 +0000 Subject: Merge from 3.0 branch till 1191. --- framework/Exceptions/messages.txt | 643 +++++++++++++------------ framework/Web/UI/WebControls/TBaseDataList.php | 9 - framework/Web/UI/WebControls/TButton.php | 84 ++-- framework/Web/UI/WebControls/TDataGrid.php | 88 +++- framework/Web/UI/WebControls/TDataList.php | 40 +- framework/Web/UI/WebControls/THyperLink.php | 2 +- framework/Web/UI/WebControls/TRepeater.php | 34 +- 7 files changed, 506 insertions(+), 394 deletions(-) (limited to 'framework') diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 582195f3..5099e9b3 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -1,321 +1,322 @@ -prado_application_singleton_required = Prado.Application must only be set once. -prado_component_unknown = Unknown component type '{0}'. -prado_using_invalid = '{0}' is not a valid namespace to be used. Make sure '.*' is appended if you want to use a namespace referring to a directory. -prado_alias_redefined = Alias '{0}' cannot be redefined. -prado_alias_invalid = Alias '{0}' refers to an invalid path '{1}'. Only existing directories can be aliased. -prado_aliasname_invalid = Alias '{0}' contains invalid character '.'. - -component_property_undefined = Component property '{0}.{1}' is not defined. -component_property_readonly = Component property '{0}.{1}' is read-only. -component_event_undefined = Component event '{0}.{1}' is not defined. -component_eventhandler_invalid = Component event '{0}.{1}' is attached with an invalid event handler. -component_expression_invalid = Component '{0}' is evaluating an invalid expression '{1}' : {2}. -component_statements_invalid = Component '{0}' is evaluating invalid PHP statements '{1}' : {2}. - -propertyvalue_enumvalue_invalid = Value '{0}' is a not valid enumeration value ({1}). - -list_index_invalid = Index '{0}' is out of range. -list_item_inexistent = The item cannot be found in the list. -list_data_not_iterable = Data must be either an array or an object implementing Traversable interface. -list_readonly = {0} is read-only. - -map_addition_disallowed = The new item cannot be added to the map. -map_item_unremovable = The item cannot be removed from the map. -map_data_not_iterable = Data must be either an array or an object implementing Traversable interface. -map_readonly = {0} is read-only. - -application_basepath_invalid = Application base path '{0}' does not exist or is not a directory. -application_runtimepath_invalid = Application runtime path '{0}' does not exist or is not writable by Web server process. -application_service_invalid = Service '{0}' must implement IService interface. -application_service_unknown = Requested service '{0}' is not defined. -application_service_unavailable = Service Unavailable. -application_moduleid_duplicated = Application module ID '{0}' is not unique. -application_runtimepath_failed = Unable to create runtime path '{0}'. Make sure the parent directory exists and is writable by the Web process. - -appconfig_aliaspath_invalid = Application configuration uses an invalid file path "{1}". -appconfig_alias_invalid = Application configuration element must have an "id" attribute and a "path" attribute. -appconfig_alias_redefined = Application configuration cannot be redefined. -appconfig_using_invalid = Application configuration element must have a "namespace" attribute. -appconfig_moduleid_required = Application configuration element must have an "id" attribute. -appconfig_moduletype_required = Application configuration must have a "class" attribute. -appconfig_serviceid_required = Application configuration element must have an "id" attribute. -appconfig_servicetype_required = Application configuration must have a "class" attribute. -appconfig_parameterid_required = Application configuration element must have an "id" attribute. - -securitymanager_validationkey_invalid = TSecurityManager.ValidationKey must not be empty. -securitymanager_encryptionkey_invalid = TSecurityManager.EncryptionKey must not be empty. -securitymanager_mcryptextension_required = Mcrypt PHP extension is required in order to use TSecurityManager's encryption feature. - -uri_format_invalid = '{0}' is not a valid URI. - -httpresponse_bufferoutput_unchangeable = THttpResponse.BufferOutput cannot be modified after THttpResponse is initialized. -httpresponse_file_inexistent = THttpResponse cannot send file '{0}'. The file does not exist. - -httpsession_sessionid_unchangeable = THttpSession.SessionID cannot be modified after the session is started. -httpsession_sessionname_unchangeable = THttpSession.SessionName cannot be modified after the session is started. -httpsession_sessionname_invalid = THttpSession.SessionName must contain alphanumeric characters only. -httpsession_savepath_unchangeable = THttpSession.SavePath cannot be modified after the session is started. -httpsession_savepath_invalid = THttpSession.SavePath '{0}' is invalid. -httpsession_storage_unchangeable = THttpSession.Storage cannot be modified after the session is started. -httpsession_cookiemode_unchangeable = THttpSession.CookieMode cannot be modified after the session is started. -httpsession_autostart_unchangeable = THttpSession.AutoStart cannot be modified after the session module is initialized. -httpsession_gcprobability_unchangeable = THttpSession.GCProbability cannot be modified after the session is started. -httpsession_gcprobability_invalid = THttpSession.GCProbability must be an integer between 0 and 100. -httpsession_transid_unchangeable = THttpSession.UseTransparentSessionID cannot be modified after the session is started. -httpsession_maxlifetime_unchangeable = THttpSession.Timeout cannot be modified after the session is started. - -assetmanager_basepath_invalid = TAssetManager.BasePath '{0}' is invalid. Make sure it is in namespace form and points to a directory writable by the Web server process. -assetmanager_basepath_unchangeable = TAssetManager.BasePath cannot be modified after the module is initialized. -assetmanager_baseurl_unchangeable = TAssetManager.BaseUrl cannot be modified after the module is initialized. -assetmanager_filepath_invalid = TAssetManager is publishing an invalid file '{0}'. -assetmanager_tarchecksum_invalid = TAssetManager is publishing a tar file with invalid checksum '{0}'. -assetmanager_tarfile_invalid = TAssetManager is publishing an invalid tar file '{0}'. - -cache_primary_duplicated = At most one primary cache module is allowed. {0} is trying to register as another primary cache. -sqlitecache_extension_required = TSqliteCache requires SQLite PHP extension. -sqlitecache_dbfile_required = TSqliteCache.DbFile is required. -sqlitecache_connection_failed = TSqliteCache database connection failed. {0}. -sqlitecache_table_creation_failed = TSqliteCache failed to create cache database. {0}. -sqlitecache_dbfile_unchangeable = TSqliteCache.DbFile cannot be modified after the module is initialized. -sqlitecache_dbfile_invalid = TSqliteCache.DbFile is invalid. Make sure it is in a proper namespace format. - -memcache_extension_required = TMemCache requires memcache PHP extension. -memcache_connection_failed = TMemCache failed to connect to memcache server {0}:{1}. -memcache_host_unchangeable = TMemCache.Host cannot be modified after the module is initialized. -memcache_port_unchangeable = TMemCache.Port cannot be modified after the module is initialized. - -apccache_extension_required = TAPCCache requires APC PHP extension. -apccache_add_unsupported = TAPCCache.add() is not supported. -apccache_replace_unsupported = TAPCCache.replace() is not supported. - -errorhandler_errortemplatepath_invalid = TErrorHandler.ErrorTemplatePath '{0}' is invalid. Make sure it is in namespace form and points to a valid directory containing error template files. - -pageservice_page_unknown = Page '{0}' Not Found -pageservice_pageclass_unknown = Page class '{0}' is unknown. -pageservice_basepath_invalid = TPageService.BasePath '{0}' is not a valid directory. -pageservice_page_required = Page Name Required -pageservice_defaultpage_unchangeable = TPageService.DefaultPage cannot be modified after the service is initialized. -pageservice_basepath_unchangeable = TPageService.BasePath cannot be modified after the service is initialized. - -pageserviceconf_file_invalid = Unable to open page directory configuration file '{0}'. -pageserviceconf_aliaspath_invalid = uses an invalid file path "{1}" in page directory configuration file '{2}'. -pageserviceconf_alias_invalid = element must have an "id" attribute and a "path" attribute in page directory configuration file '{0}'. -pageserviceconf_using_invalid = element must have a "namespace" attribute in page directory configuration file '{0}'. -pageserviceconf_module_invalid = element must have an "id" attribute in page directory configuration file '{0}'. -pageserviceconf_moduletype_required = must have a "class" attribute in page directory configuration file '{1}'. -pageserviceconf_parameter_invalid = element must have an "id" attribute in page directory configuration file '{0}'. -pageserviceconf_page_invalid = element must have an "id" attribute in page directory configuration file '{0}'. - -template_closingtag_unexpected = Unexpected closing tag '{0}' is found. -template_closingtag_expected = Closing tag '{0}' is expected. -template_directive_nonunique = Directive '<%@ ... %>' must appear at the beginning of the template and can appear at most once. -template_comments_forbidden = Template comments are not allowed within property tags. -template_matching_unexpected = Unexpected matching. -template_property_unknown = {0} has no property called '{1}'. -template_event_unknown = {0} has no event called '{1}'. -template_property_readonly = {0} has a read-only property '{1}'. -template_event_forbidden = {0} is a non-control component. No handler can be attached to its event '{1}' in a template. -template_databind_forbidden = {0} is a non-control component. Expressions cannot be bound to its property '{1}'. -template_component_required = '{0}' is not a component. Only components can appear in a template. -template_format_invalid = Error in {0} (line {1}) : {2} -template_format_invalid2 = Error at line {0} of the following template: {1} {2} -template_property_duplicated = Property {0} is configured twice or more. -template_eventhandler_invalid = {0}.{1} can only accept a static string. -template_controlid_invalid = {0}.ID can only accept a static text string. -template_controlskinid_invalid = {0}.SkinID can only accept a static text string. -template_content_unexpected = Unexpected content is encountered when instantiating template: {0}. - -xmldocument_file_read_failed = TXmlDocument is unable to read file '{0}'. -xmldocument_file_write_failed = TXmlDocument is unable to write file '{0}'. - -xmlelementlist_xmlelement_required = TXmlElementList can only accept TXmlElement objects. - -authorizationrule_action_invalid = TAuthorizationRule.Action can only take 'allow' or 'deny' as the value. -authorizationrule_verb_invalid = TAuthorizationRule.Verb can only take 'get' or 'post' as the value. - -authorizationrulecollection_authorizationrule_required = TAuthorizationRuleCollection can only accept TAuthorizationRule objects. - -usermanager_userfile_invalid = TUserManager.UserFile '{0}' is not a valid file. -usermanager_userfile_unchangeable = TUserManager.UserFile cannot be modified. The user module has been initialized already. - -authmanager_usermanager_required = TAuthManager.UserManager must be assigned a value. -authmanager_usermanager_inexistent = TAuthManager.UserManager '{0}' does not refer to an ID of application module. -authmanager_usermanager_invalid = TAuthManager.UserManager '{0}' does not refer to a valid TUserManager application module. -authmanager_usermanager_unchangeable = TAuthManager.UserManager cannot be modified after the module is initialized. -authmanager_session_required = TAuthManager requires a session application module. - -thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid directory. -thememanager_basepath_unchangeable = TThemeManager.BasePath cannot be modified after the module is initialized. - -theme_baseurl_required = TThemeManager.BasePath is required. By default, a directory named 'themes' under the directory containing the application entry script is assumed. -theme_path_inexistent = Theme path '{0}' does not exist. -theme_control_nested = Skin for control type '{0}' in theme '{1}' cannot be within another skin. -theme_skinid_duplicated = SkinID '{0}.{1}' is duplicated in theme '{2}'. -theme_databind_forbidden = Databind cannot be used in theme '{0}' for control skin '{1}.{2}' about property '{3}'. -theme_property_readonly = Skin is being applied to a read-only control property '{0}.{1}'. -theme_property_undefined = Skin is being applied to an inexistent control property '{0}.{1}'. - -control_object_reregistered = Duplicated object ID '{0}' found. -control_id_invalid = {0}.ID '{1}' is invalid. Only alphanumeric and underline characters are allowed. The first character must be an alphabetic or underline character. -control_skinid_unchangeable = {0}.SkinID cannot be modified after a skin has been applied to the control or the child controls have been created. -control_enabletheming_unchangeable = {0}.EnableTheming cannot be modified after the child controls have been created. -control_stylesheet_applied = StyleSheet skin has already been applied to {0}. -control_id_nonunique = {0}.ID '{1}' is not unique among all controls under the same naming container. - -templatecontrol_mastercontrol_invalid = Master control must be of type TTemplateControl or a child class. -templatecontrol_contentid_duplicated = TContent ID '{0}' is duplicated. -templatecontrol_placeholderid_duplicated= TContentPlaceHolder ID '{0}' is duplicated. -templatecontrol_directive_invalid = {0}.{1} can only accept a static text string through a template directive. -templatecontrol_placeholder_inexistent = TContent '{0}' does not have a matching TContentPlaceHolder. - -page_form_duplicated = A page can contain at most one TForm. Use regular HTML form tags for the rest forms. -page_isvalid_unknown = TPage.IsValid has not been evaluated yet. -page_postbackcontrol_invalid = Unable to determine postback control '{0}'. -page_control_outofform = {0} '{1}' must be enclosed within TForm. -page_head_duplicated = A page can contain at most one THead. -page_statepersister_invalid = Page state persister must implement IPageStatePersister interface. - -csmanager_pradoscript_invalid = Unknown Prado script library name '{0}'. - -contentplaceholder_id_required = TContentPlaceHolder must have an ID. - -content_id_required = TContent must have an ID. - -controlcollection_control_required = TControlList can only accept strings or TControl objects. - -webcontrol_accesskey_invalid = {0}.AccessKey '{1}' is invalid. It must be a single character only. -webcontrol_style_invalid = {0}.Style must take string value only. - -listcontrol_selection_invalid = {0} has an invalid selection that is set before performing databinding. -listcontrol_selectedindex_invalid = {0}.SelectedIndex has an invalid value {1}. -listcontrol_selectedvalue_invalid = {0}.SelectedValue has an invalid value '{1}'. -listcontrol_expression_invalid = {0} is evaluating an invalid expression '{1}' : {2} - -label_associatedcontrol_invalid = TLabel.AssociatedControl '{0}' cannot be found. - -hiddenfield_focus_unsupported = THiddenField does not support setting input focus. -hiddenfield_theming_unsupported = THiddenField does not support theming. -hiddenfield_skinid_unsupported = THiddenField does not support control skin. - -panel_defaultbutton_invalid = TPanel.DefaultButton '{0}' does not refer to an existing button control. - -tablestyle_cellpadding_invalid = TTableStyle.CellPadding must take an integer equal to or greater than -1. -tablestyle_cellspacing_invalid = TTableStyle.CellSpacing must take an integer equal to or greater than -1. - -pagestatepersister_pagestate_corrupted = Page state is corrupted. - -sessionpagestatepersister_pagestate_corrupted = Page state is corrupted. -sessionpagestatepersister_historysize_invalid = TSessionPageStatePersister.History must be an integer greater than 0. - -listitemcollection_item_invalid = TListItemCollection can only take strings or TListItem objects. - -dropdownlist_selectedindices_unsupported= TDropDownList.SelectedIndices is read-only. - -bulletedlist_autopostback_unsupported = TBulletedList.AutoPostBack is read-only. -bulletedlist_selectedindex_unsupported = TBulletedList.SelectedIndex is read-only. -bulletedlist_selectedindices_unsupported= TBulletedList.SelectedIndices is read-only. -bulletedlist_selectedvalue_unsupported = TBulletedList.SelectedValue is read-only. - -radiobuttonlist_selectedindices_unsupported = TRadioButtonList.SelectedIndices is read-only. - -logrouter_configfile_invalid = TLogRouter.ConfigFile '{0}' does not exist. -logrouter_routeclass_required = Class attribute is required in configuration. -logrouter_routetype_required = Log route must be an instance of TLogRoute or its derived class. - -filelogroute_logpath_invalid = TFileLogRoute.LogPath '{0}' must be a directory in namespace format and must be writable by the Web server process. -filelogroute_maxfilesize_invalid = TFileLogRoute.MaxFileSize must be greater than 0. -filelogroute_maxlogfiles_invalid = TFileLogRoute.MaxLogFiles must be greater than 0. - -emaillogroute_sentfrom_required = TEmailLogRoute.SentFrom cannot be empty. - -repeatinfo_repeatcolumns_invalid = TRepeatInfo.RepeatColumns must be no less than 0. - -basevalidator_controltovalidate_invalid = {0}.ControlToValidate is empty or contains an invalid control ID path. -basevalidator_validatable_required = {0}.ControlToValidate must point to a control implementing IValidatable interface. -basevalidator_forcontrol_unsupported = {0}.ForControl is not supported. - -comparevalidator_controltocompare_invalid = TCompareValidator.ControlToCompare contains an invalid control ID path. - -listcontrolvalidator_invalid_control = {0}.ControlToValidate contains an invalid TListControl ID path, "{1}" is a {2}. - -repeater_template_required = TRepeater.{0} requires a template instance implementing ITemplate interface. -datalist_template_required = TDataList.{0} requires a template instance implementing ITemplate interface. -templatecolumn_template_required = TTemplateColumn.{0} requires a template instance implementing ITemplate interface. - -datagrid_currentpageindex_invalid = TDataGrid.CurrentPageIndex must be no less than 0. -datagrid_pagesize_invalid = TDataGrid.PageSize must be greater than 0. -datagrid_virtualitemcount_invalid = TDataGrid.VirtualItemCount must be no less than 0. - -datagridpagerstyle_pagebuttoncount_invalid = TDataGridPagerStyle.PageButtonCount must be greater than 0. - -datafieldaccessor_data_invalid = TDataFieldAccessor is trying to evaluate a field value of an invalid data. Make sure the data is an array, TMap, TList, or object that contains the specified field '{0}'. -datafieldaccessor_datafield_invalid = TDataFieldAccessor is trying to evaluate data value of an unknown field '{0}'. - -repeateritemcollection_repeateritem_required = TRepeaterItemCollection can only accept TRepeaterItem objects. - -datagriditemcollection_datagriditem_required = TDataGridItemCollection can only accept TDataGridItem objects. - -datagridcolumncollection_datagridcolumn_required = TDataGridColumnCollection can only accept TDataGridColumn objects. - -datalistitemcollection_datalistitem_required = TDataListItemCollection can only accept TDataListItem objects. - -tablerowcollection_tablerow_required = TTableRowCollection can only accept TTableRow objects. - -tablecellcollection_tablerow_required = TTableCellCollection can only accept TTableCell objects. - -multiview_view_required = TMultiView can only accept TView as child. -multiview_activeviewindex_invalid = TMultiView.ActiveViewIndex has an invalid index '{0}'. -multiview_view_inexistent = TMultiView cannot find the specified view. -multiview_viewid_invalid = TMultiView cannot find the view '{0}' to switch to. - -viewcollection_view_required = TViewCollection can only accept TView as its element. - -view_visible_readonly = TView.Visible is read-only. Use TView.Active to toggle its visibility. - -wizard_step_invalid = The step to be activated cannot be found in wizard step collection. -wizard_command_invalid = Invalid wizard navigation command '{0}'. - -table_tablesection_outoforder = TTable table sections must be in the order of: Header, Body and Footer. - -completewizardstep_steptype_readonly = TCompleteWizardStep.StepType is read-only. - -wizardstepcollection_wizardstep_required = TWizardStepCollection can only accept objects of TWizardStep or its derived classes. - -texthighlighter_stylesheet_invalid = Unable to find the stylesheet file for TTextHighlighter. - -hotspotcollection_hotspot_required = THotSpotCollection can only accept instance of THotSpot or its derived classes. - -htmlarea_textmode_readonly = THtmlArea.TextMode is read-only. -htmlarea_tarfile_invalid = THtmlArea is unable to locate the TinyMCE tar file. - -parametermodule_parameterfile_unchangeable = TParameterModule.ParameterFile is not changeable because the module is already initialized. -parametermodule_parameterfile_invalid = TParameterModule.ParameterFile '{0}' is invalid. Make sure it is in namespace format and the file extension is '.xml'. -parametermodule_parameterid_required = Parameter element must have 'id' attribute. - -datagridcolumn_expression_invalid = {0} is evaluating an invalid expression '{1}' : {2} - -outputcache_cachemoduleid_invalid = TOutputCache.CacheModuleID is set with an invalid cache module ID {0}. Either the module does not exist or does not implement ICache interface. -outputcache_duration_invalid = {0}.Duration must be an integer no less than 0. - -stack_data_not_iterable = TStack can only fetch data from an array or a traversable object. -stack_empty = TStack is empty. - -queue_data_not_iterable = TQueue can only fetch data from an array or a traversable object. -queue_empty = TQueue is empty. - -callback_not_support_no_priority_state_update = Callback request does not support unprioritized pagestate update. -callback_invalid_callback_options = '{1}' is not a valid TCallbackOptions control for Callback control '{0}'. -callback_invalid_clientside_options = Callback ClientSide property must be either a string that is the ID of a TCallbackOptions control or an instance of TCallbackClientSideOptions.======= -callback_not_support_no_priority_state_update = Callback request does not support unprioritized pagestate update. -callback_invalid_handler = Invalid callback handler, control {0} must implement ICallbackEventHandler. -callback_invalid_target = Invalid callback target, no such control with ID {0}. - -callback_interval_be_positive = Interval for TCallbackTimer "{0}" must be strictly greater than zero seconds. -callback_decay_be_not_negative = Decay rate for TCallbackTimer "{0}" must be not negative. - -callback_no_autopostback = Control "{0}" can not enable AutoPostBack. - -xmltransform_xslextension_required = TXmlTransform require the PHP's XSL extension -xmltransform_transformpath_invalid = TransformPath '{0}' is invalid. -xmltransform_documentpath_invalid = DocumentPath '{0}' is invalid. -xmltransform_transform_required = Either TransformContent or TransformPath property must be set. +prado_application_singleton_required = Prado.Application must only be set once. +prado_component_unknown = Unknown component type '{0}'. +prado_using_invalid = '{0}' is not a valid namespace to be used. Make sure '.*' is appended if you want to use a namespace referring to a directory. +prado_alias_redefined = Alias '{0}' cannot be redefined. +prado_alias_invalid = Alias '{0}' refers to an invalid path '{1}'. Only existing directories can be aliased. +prado_aliasname_invalid = Alias '{0}' contains invalid character '.'. + +component_property_undefined = Component property '{0}.{1}' is not defined. +component_property_readonly = Component property '{0}.{1}' is read-only. +component_event_undefined = Component event '{0}.{1}' is not defined. +component_eventhandler_invalid = Component event '{0}.{1}' is attached with an invalid event handler. +component_expression_invalid = Component '{0}' is evaluating an invalid expression '{1}' : {2}. +component_statements_invalid = Component '{0}' is evaluating invalid PHP statements '{1}' : {2}. + +propertyvalue_enumvalue_invalid = Value '{0}' is a not valid enumeration value ({1}). + +list_index_invalid = Index '{0}' is out of range. +list_item_inexistent = The item cannot be found in the list. +list_data_not_iterable = Data must be either an array or an object implementing Traversable interface. +list_readonly = {0} is read-only. + +map_addition_disallowed = The new item cannot be added to the map. +map_item_unremovable = The item cannot be removed from the map. +map_data_not_iterable = Data must be either an array or an object implementing Traversable interface. +map_readonly = {0} is read-only. + +application_basepath_invalid = Application base path '{0}' does not exist or is not a directory. +application_runtimepath_invalid = Application runtime path '{0}' does not exist or is not writable by Web server process. +application_service_invalid = Service '{0}' must implement IService interface. +application_service_unknown = Requested service '{0}' is not defined. +application_service_unavailable = Service Unavailable. +application_moduleid_duplicated = Application module ID '{0}' is not unique. +application_runtimepath_failed = Unable to create runtime path '{0}'. Make sure the parent directory exists and is writable by the Web process. + +appconfig_aliaspath_invalid = Application configuration uses an invalid file path "{1}". +appconfig_alias_invalid = Application configuration element must have an "id" attribute and a "path" attribute. +appconfig_alias_redefined = Application configuration cannot be redefined. +appconfig_using_invalid = Application configuration element must have a "namespace" attribute. +appconfig_moduleid_required = Application configuration element must have an "id" attribute. +appconfig_moduletype_required = Application configuration must have a "class" attribute. +appconfig_serviceid_required = Application configuration element must have an "id" attribute. +appconfig_servicetype_required = Application configuration must have a "class" attribute. +appconfig_parameterid_required = Application configuration element must have an "id" attribute. + +securitymanager_validationkey_invalid = TSecurityManager.ValidationKey must not be empty. +securitymanager_encryptionkey_invalid = TSecurityManager.EncryptionKey must not be empty. +securitymanager_mcryptextension_required = Mcrypt PHP extension is required in order to use TSecurityManager's encryption feature. + +uri_format_invalid = '{0}' is not a valid URI. + +httpresponse_bufferoutput_unchangeable = THttpResponse.BufferOutput cannot be modified after THttpResponse is initialized. +httpresponse_file_inexistent = THttpResponse cannot send file '{0}'. The file does not exist. + +httpsession_sessionid_unchangeable = THttpSession.SessionID cannot be modified after the session is started. +httpsession_sessionname_unchangeable = THttpSession.SessionName cannot be modified after the session is started. +httpsession_sessionname_invalid = THttpSession.SessionName must contain alphanumeric characters only. +httpsession_savepath_unchangeable = THttpSession.SavePath cannot be modified after the session is started. +httpsession_savepath_invalid = THttpSession.SavePath '{0}' is invalid. +httpsession_storage_unchangeable = THttpSession.Storage cannot be modified after the session is started. +httpsession_cookiemode_unchangeable = THttpSession.CookieMode cannot be modified after the session is started. +httpsession_autostart_unchangeable = THttpSession.AutoStart cannot be modified after the session module is initialized. +httpsession_gcprobability_unchangeable = THttpSession.GCProbability cannot be modified after the session is started. +httpsession_gcprobability_invalid = THttpSession.GCProbability must be an integer between 0 and 100. +httpsession_transid_unchangeable = THttpSession.UseTransparentSessionID cannot be modified after the session is started. +httpsession_maxlifetime_unchangeable = THttpSession.Timeout cannot be modified after the session is started. + +assetmanager_basepath_invalid = TAssetManager.BasePath '{0}' is invalid. Make sure it is in namespace form and points to a directory writable by the Web server process. +assetmanager_basepath_unchangeable = TAssetManager.BasePath cannot be modified after the module is initialized. +assetmanager_baseurl_unchangeable = TAssetManager.BaseUrl cannot be modified after the module is initialized. +assetmanager_filepath_invalid = TAssetManager is publishing an invalid file '{0}'. +assetmanager_tarchecksum_invalid = TAssetManager is publishing a tar file with invalid checksum '{0}'. +assetmanager_tarfile_invalid = TAssetManager is publishing an invalid tar file '{0}'. + +cache_primary_duplicated = At most one primary cache module is allowed. {0} is trying to register as another primary cache. +sqlitecache_extension_required = TSqliteCache requires SQLite PHP extension. +sqlitecache_dbfile_required = TSqliteCache.DbFile is required. +sqlitecache_connection_failed = TSqliteCache database connection failed. {0}. +sqlitecache_table_creation_failed = TSqliteCache failed to create cache database. {0}. +sqlitecache_dbfile_unchangeable = TSqliteCache.DbFile cannot be modified after the module is initialized. +sqlitecache_dbfile_invalid = TSqliteCache.DbFile is invalid. Make sure it is in a proper namespace format. + +memcache_extension_required = TMemCache requires memcache PHP extension. +memcache_connection_failed = TMemCache failed to connect to memcache server {0}:{1}. +memcache_host_unchangeable = TMemCache.Host cannot be modified after the module is initialized. +memcache_port_unchangeable = TMemCache.Port cannot be modified after the module is initialized. + +apccache_extension_required = TAPCCache requires APC PHP extension. +apccache_add_unsupported = TAPCCache.add() is not supported. +apccache_replace_unsupported = TAPCCache.replace() is not supported. + +errorhandler_errortemplatepath_invalid = TErrorHandler.ErrorTemplatePath '{0}' is invalid. Make sure it is in namespace form and points to a valid directory containing error template files. + +pageservice_page_unknown = Page '{0}' Not Found +pageservice_pageclass_unknown = Page class '{0}' is unknown. +pageservice_basepath_invalid = TPageService.BasePath '{0}' is not a valid directory. +pageservice_page_required = Page Name Required +pageservice_defaultpage_unchangeable = TPageService.DefaultPage cannot be modified after the service is initialized. +pageservice_basepath_unchangeable = TPageService.BasePath cannot be modified after the service is initialized. + +pageserviceconf_file_invalid = Unable to open page directory configuration file '{0}'. +pageserviceconf_aliaspath_invalid = uses an invalid file path "{1}" in page directory configuration file '{2}'. +pageserviceconf_alias_invalid = element must have an "id" attribute and a "path" attribute in page directory configuration file '{0}'. +pageserviceconf_using_invalid = element must have a "namespace" attribute in page directory configuration file '{0}'. +pageserviceconf_module_invalid = element must have an "id" attribute in page directory configuration file '{0}'. +pageserviceconf_moduletype_required = must have a "class" attribute in page directory configuration file '{1}'. +pageserviceconf_parameter_invalid = element must have an "id" attribute in page directory configuration file '{0}'. +pageserviceconf_page_invalid = element must have an "id" attribute in page directory configuration file '{0}'. + +template_closingtag_unexpected = Unexpected closing tag '{0}' is found. +template_closingtag_expected = Closing tag '{0}' is expected. +template_directive_nonunique = Directive '<%@ ... %>' must appear at the beginning of the template and can appear at most once. +template_comments_forbidden = Template comments are not allowed within property tags. +template_matching_unexpected = Unexpected matching. +template_property_unknown = {0} has no property called '{1}'. +template_event_unknown = {0} has no event called '{1}'. +template_property_readonly = {0} has a read-only property '{1}'. +template_event_forbidden = {0} is a non-control component. No handler can be attached to its event '{1}' in a template. +template_databind_forbidden = {0} is a non-control component. Expressions cannot be bound to its property '{1}'. +template_component_required = '{0}' is not a component. Only components can appear in a template. +template_format_invalid = Error in {0} (line {1}) : {2} +template_format_invalid2 = Error at line {0} of the following template: {1} {2} +template_property_duplicated = Property {0} is configured twice or more. +template_eventhandler_invalid = {0}.{1} can only accept a static string. +template_controlid_invalid = {0}.ID can only accept a static text string. +template_controlskinid_invalid = {0}.SkinID can only accept a static text string. +template_content_unexpected = Unexpected content is encountered when instantiating template: {0}. + +xmldocument_file_read_failed = TXmlDocument is unable to read file '{0}'. +xmldocument_file_write_failed = TXmlDocument is unable to write file '{0}'. + +xmlelementlist_xmlelement_required = TXmlElementList can only accept TXmlElement objects. + +authorizationrule_action_invalid = TAuthorizationRule.Action can only take 'allow' or 'deny' as the value. +authorizationrule_verb_invalid = TAuthorizationRule.Verb can only take 'get' or 'post' as the value. + +authorizationrulecollection_authorizationrule_required = TAuthorizationRuleCollection can only accept TAuthorizationRule objects. + +usermanager_userfile_invalid = TUserManager.UserFile '{0}' is not a valid file. +usermanager_userfile_unchangeable = TUserManager.UserFile cannot be modified. The user module has been initialized already. + +authmanager_usermanager_required = TAuthManager.UserManager must be assigned a value. +authmanager_usermanager_inexistent = TAuthManager.UserManager '{0}' does not refer to an ID of application module. +authmanager_usermanager_invalid = TAuthManager.UserManager '{0}' does not refer to a valid TUserManager application module. +authmanager_usermanager_unchangeable = TAuthManager.UserManager cannot be modified after the module is initialized. +authmanager_session_required = TAuthManager requires a session application module. + +thememanager_basepath_invalid = TThemeManager.BasePath '{0}' is not a valid directory. +thememanager_basepath_unchangeable = TThemeManager.BasePath cannot be modified after the module is initialized. + +theme_baseurl_required = TThemeManager.BasePath is required. By default, a directory named 'themes' under the directory containing the application entry script is assumed. +theme_path_inexistent = Theme path '{0}' does not exist. +theme_control_nested = Skin for control type '{0}' in theme '{1}' cannot be within another skin. +theme_skinid_duplicated = SkinID '{0}.{1}' is duplicated in theme '{2}'. +theme_databind_forbidden = Databind cannot be used in theme '{0}' for control skin '{1}.{2}' about property '{3}'. +theme_property_readonly = Skin is being applied to a read-only control property '{0}.{1}'. +theme_property_undefined = Skin is being applied to an inexistent control property '{0}.{1}'. + +control_object_reregistered = Duplicated object ID '{0}' found. +control_id_invalid = {0}.ID '{1}' is invalid. Only alphanumeric and underline characters are allowed. The first character must be an alphabetic or underline character. +control_skinid_unchangeable = {0}.SkinID cannot be modified after a skin has been applied to the control or the child controls have been created. +control_enabletheming_unchangeable = {0}.EnableTheming cannot be modified after the child controls have been created. +control_stylesheet_applied = StyleSheet skin has already been applied to {0}. +control_id_nonunique = {0}.ID '{1}' is not unique among all controls under the same naming container. + +templatecontrol_mastercontrol_invalid = Master control must be of type TTemplateControl or a child class. +templatecontrol_contentid_duplicated = TContent ID '{0}' is duplicated. +templatecontrol_placeholderid_duplicated= TContentPlaceHolder ID '{0}' is duplicated. +templatecontrol_directive_invalid = {0}.{1} can only accept a static text string through a template directive. +templatecontrol_placeholder_inexistent = TContent '{0}' does not have a matching TContentPlaceHolder. + +page_form_duplicated = A page can contain at most one TForm. Use regular HTML form tags for the rest forms. +page_isvalid_unknown = TPage.IsValid has not been evaluated yet. +page_postbackcontrol_invalid = Unable to determine postback control '{0}'. +page_control_outofform = {0} '{1}' must be enclosed within TForm. +page_head_duplicated = A page can contain at most one THead. +page_statepersister_invalid = Page state persister must implement IPageStatePersister interface. + +csmanager_pradoscript_invalid = Unknown Prado script library name '{0}'. + +contentplaceholder_id_required = TContentPlaceHolder must have an ID. + +content_id_required = TContent must have an ID. + +controlcollection_control_required = TControlList can only accept strings or TControl objects. + +webcontrol_accesskey_invalid = {0}.AccessKey '{1}' is invalid. It must be a single character only. +webcontrol_style_invalid = {0}.Style must take string value only. + +listcontrol_selection_invalid = {0} has an invalid selection that is set before performing databinding. +listcontrol_selectedindex_invalid = {0}.SelectedIndex has an invalid value {1}. +listcontrol_selectedvalue_invalid = {0}.SelectedValue has an invalid value '{1}'. +listcontrol_expression_invalid = {0} is evaluating an invalid expression '{1}' : {2} + +label_associatedcontrol_invalid = TLabel.AssociatedControl '{0}' cannot be found. + +hiddenfield_focus_unsupported = THiddenField does not support setting input focus. +hiddenfield_theming_unsupported = THiddenField does not support theming. +hiddenfield_skinid_unsupported = THiddenField does not support control skin. + +panel_defaultbutton_invalid = TPanel.DefaultButton '{0}' does not refer to an existing button control. + +tablestyle_cellpadding_invalid = TTableStyle.CellPadding must take an integer equal to or greater than -1. +tablestyle_cellspacing_invalid = TTableStyle.CellSpacing must take an integer equal to or greater than -1. + +pagestatepersister_pagestate_corrupted = Page state is corrupted. + +sessionpagestatepersister_pagestate_corrupted = Page state is corrupted. +sessionpagestatepersister_historysize_invalid = TSessionPageStatePersister.History must be an integer greater than 0. + +listitemcollection_item_invalid = TListItemCollection can only take strings or TListItem objects. + +dropdownlist_selectedindices_unsupported= TDropDownList.SelectedIndices is read-only. + +bulletedlist_autopostback_unsupported = TBulletedList.AutoPostBack is read-only. +bulletedlist_selectedindex_unsupported = TBulletedList.SelectedIndex is read-only. +bulletedlist_selectedindices_unsupported= TBulletedList.SelectedIndices is read-only. +bulletedlist_selectedvalue_unsupported = TBulletedList.SelectedValue is read-only. + +radiobuttonlist_selectedindices_unsupported = TRadioButtonList.SelectedIndices is read-only. + +logrouter_configfile_invalid = TLogRouter.ConfigFile '{0}' does not exist. +logrouter_routeclass_required = Class attribute is required in configuration. +logrouter_routetype_required = Log route must be an instance of TLogRoute or its derived class. + +filelogroute_logpath_invalid = TFileLogRoute.LogPath '{0}' must be a directory in namespace format and must be writable by the Web server process. +filelogroute_maxfilesize_invalid = TFileLogRoute.MaxFileSize must be greater than 0. +filelogroute_maxlogfiles_invalid = TFileLogRoute.MaxLogFiles must be greater than 0. + +emaillogroute_sentfrom_required = TEmailLogRoute.SentFrom cannot be empty. + +repeatinfo_repeatcolumns_invalid = TRepeatInfo.RepeatColumns must be no less than 0. + +basevalidator_controltovalidate_invalid = {0}.ControlToValidate is empty or contains an invalid control ID path. +basevalidator_validatable_required = {0}.ControlToValidate must point to a control implementing IValidatable interface. +basevalidator_forcontrol_unsupported = {0}.ForControl is not supported. + +comparevalidator_controltocompare_invalid = TCompareValidator.ControlToCompare contains an invalid control ID path. + +listcontrolvalidator_invalid_control = {0}.ControlToValidate contains an invalid TListControl ID path, "{1}" is a {2}. + +repeater_template_required = TRepeater.{0} requires a template instance implementing ITemplate interface. +datalist_template_required = TDataList.{0} requires a template instance implementing ITemplate interface. +datagrid_template_required = TDataGrid.{0} requires a template instance implementing ITemplate interface. +templatecolumn_template_required = TTemplateColumn.{0} requires a template instance implementing ITemplate interface. + +datagrid_currentpageindex_invalid = TDataGrid.CurrentPageIndex must be no less than 0. +datagrid_pagesize_invalid = TDataGrid.PageSize must be greater than 0. +datagrid_virtualitemcount_invalid = TDataGrid.VirtualItemCount must be no less than 0. + +datagridpagerstyle_pagebuttoncount_invalid = TDataGridPagerStyle.PageButtonCount must be greater than 0. + +datafieldaccessor_data_invalid = TDataFieldAccessor is trying to evaluate a field value of an invalid data. Make sure the data is an array, TMap, TList, or object that contains the specified field '{0}'. +datafieldaccessor_datafield_invalid = TDataFieldAccessor is trying to evaluate data value of an unknown field '{0}'. + +repeateritemcollection_repeateritem_required = TRepeaterItemCollection can only accept TRepeaterItem objects. + +datagriditemcollection_datagriditem_required = TDataGridItemCollection can only accept TDataGridItem objects. + +datagridcolumncollection_datagridcolumn_required = TDataGridColumnCollection can only accept TDataGridColumn objects. + +datalistitemcollection_datalistitem_required = TDataListItemCollection can only accept TDataListItem objects. + +tablerowcollection_tablerow_required = TTableRowCollection can only accept TTableRow objects. + +tablecellcollection_tablerow_required = TTableCellCollection can only accept TTableCell objects. + +multiview_view_required = TMultiView can only accept TView as child. +multiview_activeviewindex_invalid = TMultiView.ActiveViewIndex has an invalid index '{0}'. +multiview_view_inexistent = TMultiView cannot find the specified view. +multiview_viewid_invalid = TMultiView cannot find the view '{0}' to switch to. + +viewcollection_view_required = TViewCollection can only accept TView as its element. + +view_visible_readonly = TView.Visible is read-only. Use TView.Active to toggle its visibility. + +wizard_step_invalid = The step to be activated cannot be found in wizard step collection. +wizard_command_invalid = Invalid wizard navigation command '{0}'. + +table_tablesection_outoforder = TTable table sections must be in the order of: Header, Body and Footer. + +completewizardstep_steptype_readonly = TCompleteWizardStep.StepType is read-only. + +wizardstepcollection_wizardstep_required = TWizardStepCollection can only accept objects of TWizardStep or its derived classes. + +texthighlighter_stylesheet_invalid = Unable to find the stylesheet file for TTextHighlighter. + +hotspotcollection_hotspot_required = THotSpotCollection can only accept instance of THotSpot or its derived classes. + +htmlarea_textmode_readonly = THtmlArea.TextMode is read-only. +htmlarea_tarfile_invalid = THtmlArea is unable to locate the TinyMCE tar file. + +parametermodule_parameterfile_unchangeable = TParameterModule.ParameterFile is not changeable because the module is already initialized. +parametermodule_parameterfile_invalid = TParameterModule.ParameterFile '{0}' is invalid. Make sure it is in namespace format and the file extension is '.xml'. +parametermodule_parameterid_required = Parameter element must have 'id' attribute. + +datagridcolumn_expression_invalid = {0} is evaluating an invalid expression '{1}' : {2} + +outputcache_cachemoduleid_invalid = TOutputCache.CacheModuleID is set with an invalid cache module ID {0}. Either the module does not exist or does not implement ICache interface. +outputcache_duration_invalid = {0}.Duration must be an integer no less than 0. + +stack_data_not_iterable = TStack can only fetch data from an array or a traversable object. +stack_empty = TStack is empty. + +queue_data_not_iterable = TQueue can only fetch data from an array or a traversable object. +queue_empty = TQueue is empty. + +callback_not_support_no_priority_state_update = Callback request does not support unprioritized pagestate update. +callback_invalid_callback_options = '{1}' is not a valid TCallbackOptions control for Callback control '{0}'. +callback_invalid_clientside_options = Callback ClientSide property must be either a string that is the ID of a TCallbackOptions control or an instance of TCallbackClientSideOptions.======= +callback_not_support_no_priority_state_update = Callback request does not support unprioritized pagestate update. +callback_invalid_handler = Invalid callback handler, control {0} must implement ICallbackEventHandler. +callback_invalid_target = Invalid callback target, no such control with ID {0}. + +callback_interval_be_positive = Interval for TCallbackTimer "{0}" must be strictly greater than zero seconds. +callback_decay_be_not_negative = Decay rate for TCallbackTimer "{0}" must be not negative. + +callback_no_autopostback = Control "{0}" can not enable AutoPostBack. + +xmltransform_xslextension_required = TXmlTransform require the PHP's XSL extension +xmltransform_transformpath_invalid = TransformPath '{0}' is invalid. +xmltransform_documentpath_invalid = DocumentPath '{0}' is invalid. +xmltransform_transform_required = Either TransformContent or TransformPath property must be set. diff --git a/framework/Web/UI/WebControls/TBaseDataList.php b/framework/Web/UI/WebControls/TBaseDataList.php index 479fb2ef..a8ab8faf 100644 --- a/framework/Web/UI/WebControls/TBaseDataList.php +++ b/framework/Web/UI/WebControls/TBaseDataList.php @@ -43,15 +43,6 @@ Prado::using('System.Util.TDataFieldAccessor'); */ abstract class TBaseDataList extends TDataBoundControl { - /** - * No body content should be added to data list control. - * This method is invoked when body content is parsed and added to this control. - * @param mixed body content to be added - */ - public function addParsedObject($object) - { - } - /** * Creates a style object for the control. * This method creates a {@link TTableStyle} to be used by the data list control. diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index b77ca111..f1132625 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -13,37 +13,35 @@ /** * TButton class * - * TButton creates a click button on the page. It is used to submit data to a page. - * You can create either a submit button or a command button. + * TButton creates a click button on the page. It is mainly used to submit data to a page. * - * A command button has a command name (specified by - * the {@link setCommandName CommandName} property) and and a command parameter - * (specified by {@link setCommandParameter CommandParameter} property) - * associated with the button. This allows you to create multiple TButton + * TButton raises two server-side events, {@link onClick OnClick} and {@link onCommand OnCommand}, + * when it is clicked on the client-side. The difference between these two events + * is that the event {@link onCommand OnCommand} is bubbled up to the button's ancestor controls. + * And within the event parameter for {@link onCommand OnCommand} contains the reference + * to the {@link setCommandName CommandName} and {@link setCommandParameter CommandParameter} + * property values that are set for the button object. This allows you to create multiple TButton * components on a Web page and programmatically determine which one is clicked - * with what parameter. You can provide an event handler for - * {@link onCommand OnCommand} event to programmatically control the actions performed - * when the command button is clicked. In the event handler, you can determine - * the {@link setCommandName CommandName} property value and - * the {@link setCommandParameter CommandParameter} property value - * through the {@link TCommandParameter::getName Name} and - * {@link TCommandParameter::getParameter Parameter} properties of the event - * parameter which is of type {@link TCommandEventParameter}. + * with what parameter. * - * A submit button does not have a command name associated with the button - * and clicking on it simply posts the Web page back to the server. - * By default, a TButton component is a submit button. - * You can provide an event handler for the {@link onClick OnClick} event - * to programmatically control the actions performed when the submit button is clicked. - * - * Clicking on button can trigger form validation, if + * Clicking on button can also trigger form validation, if * {@link setCausesValidation CausesValidation} is true. - * And the validation may be restricted within a certain group of validator + * The validation may be restricted within a certain group of validator * controls by setting {@link setValidationGroup ValidationGroup} property. * If validation is successful, the data will be post back to the same page. * * TButton displays the {@link setText Text} property as the button caption. * + * TButton can be one of three {@link setButtonType ButtonType}: Submit, Button and Reset. + * By default, it is a Submit button and the form submission uses the browser's + * default submission capability. If it is Button or Reset, postback may occur + * if one of the following conditions is met: + * - an event handler is attached to {@link onClick OnClick} event; + * - an event handler is attached to {@link onCommand OnCommand} event; + * - the button is in a non-empty validation group. + * In addition, clicking on a Reset button will clear up all input fields + * if the button does not cause a postback. + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls @@ -68,12 +66,15 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr { $page=$this->getPage(); $page->ensureRenderInForm($this); - $writer->addAttribute('type','submit'); + $writer->addAttribute('type',strtolower($this->getButtonType())); if(($uniqueID=$this->getUniqueID())!=='') $writer->addAttribute('name',$uniqueID); $writer->addAttribute('value',$this->getText()); - if($this->getEnabled(true) ) - $this->renderClientControlScript($writer); + if($this->getEnabled(true)) + { + if($this->needPostBackScript()) + $this->renderClientControlScript($writer); + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' $writer->addAttribute('disabled','disabled'); @@ -85,12 +86,8 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr */ protected function renderClientControlScript($writer) { - if($this->canCauseValidation()) - { - $writer->addAttribute('id',$this->getClientID()); - $cs = $this->getPage()->getClientScript(); - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); - } + $writer->addAttribute('id',$this->getClientID()); + $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); } /** @@ -117,6 +114,15 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr return false; } + /** + * @return boolean whether the button needs javascript to do postback + */ + protected function needPostBackScript() + { + return $this->canCauseValidation() || ($this->getButtonType()!=='Submit' && + ($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand'))); + } + /** * Returns postback specifications for the button. * This method is used by framework and control developers. @@ -262,6 +268,22 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr { $this->setViewState('ValidationGroup',$value,''); } + + /** + * @return string the type of the button. Defaults to 'Submit'. + */ + public function getButtonType() + { + return $this->getViewState('ButtonType','Submit'); + } + + /** + * @param string the type of the button. Valid values include 'Submit', 'Reset', 'Button'. + */ + public function setButtonType($value) + { + $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Submit','Reset','Button'),'Submit'); + } } ?> diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 69798c1a..dae2d2cd 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -186,6 +186,14 @@ class TDataGrid extends TBaseDataList implements INamingContainer private $_pagedDataSource=null; private $_topPager=null; private $_bottomPager=null; + /** + * @var ITemplate template used when empty data is bounded + */ + private $_emptyTemplate=null; + /** + * @var boolean whether empty template is effective + */ + private $_useEmptyTemplate=false; /** * @return string tag name (table) of the datagrid @@ -197,13 +205,15 @@ class TDataGrid extends TBaseDataList implements INamingContainer /** * Adds objects parsed in template to datagrid. - * Only datagrid columns are added into {@link getColumns Columns} collection. + * Datagrid columns are added into {@link getColumns Columns} collection. * @param mixed object parsed in template */ public function addParsedObject($object) { if($object instanceof TDataGridColumn) $this->getColumns()->add($object); + else + parent::addParsedObject($object); } /** @@ -682,6 +692,26 @@ class TDataGrid extends TBaseDataList implements INamingContainer $this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),false); } + /** + * @return ITemplate the template applied when no data is bound to the datagrid + */ + public function getEmptyTemplate() + { + return $this->_emptyTemplate; + } + + /** + * @param ITemplate the template applied when no data is bound to the datagrid + * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null. + */ + public function setEmptyTemplate($value) + { + if($value instanceof ITemplate || $value===null) + $this->_emptyTemplate=$value; + else + throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate'); + } + /** * This method overrides parent's implementation to handle * {@link onItemCommand OnItemCommand} event which is bubbled from @@ -953,6 +983,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $this->_footer=null; $this->_topPager=null; $this->_bottomPager=null; + $this->_useEmptyTemplate=false; } /** @@ -968,6 +999,17 @@ class TDataGrid extends TBaseDataList implements INamingContainer $ds->setDataSource(new TDummyDataSource($itemCount)); else $ds->setDataSource(new TDummyDataSource($this->getViewState('DataSourceCount',0))); + + if($ds->getCount()===0 && $ds->getCurrentPageIndex()===0 && $this->_emptyTemplate!==null) + { + $this->_emptyTemplate->instantiateIn($this); + $this->_useEmptyTemplate=true; + $this->clearViewState('ItemCount'); + $this->clearViewState('PageCount'); + $this->clearViewState('DataSourceCount'); + return; + } + $columns=new TList($this->getColumns()); $columns->mergeWith($this->_autoColumns); @@ -1020,9 +1062,21 @@ class TDataGrid extends TBaseDataList implements INamingContainer $keyField=$this->getDataKeyField(); $this->_pagedDataSource=$ds=$this->createPagedDataSource(); $ds->setDataSource($data); + $allowPaging=$ds->getAllowPaging(); if($allowPaging && $ds->getCurrentPageIndex()>=$ds->getPageCount()) throw new TInvalidDataValueException('datagrid_currentpageindex_invalid'); + + if($ds->getCount()===0 && $ds->getCurrentPageIndex()===0 && $this->_emptyTemplate!==null) + { + $this->_emptyTemplate->instantiateIn($this); + $this->_useEmptyTemplate=true; + $this->clearViewState('ItemCount'); + $this->clearViewState('PageCount'); + $this->clearViewState('DataSourceCount'); + return; + } + // get all columns if($this->getAutoGenerateColumns()) { @@ -1046,7 +1100,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $selectedIndex=$this->getSelectedItemIndex(); $editIndex=$this->getEditItemIndex(); $index=0; - $dsIndex=$ds->getAllowPaging()?$ds->getFirstIndexInPage():0; + $dsIndex=$allowPaging?$ds->getFirstIndexInPage():0; foreach($ds as $key=>$data) { if($keyField!=='') @@ -1502,17 +1556,31 @@ class TDataGrid extends TBaseDataList implements INamingContainer { if($this->getHasControls()) { - $this->applyItemStyles(); - if($this->_topPager) + if($this->_useEmptyTemplate) { - $this->_topPager->renderControl($writer); - $writer->writeLine(); + $control=new TWebControl; + $control->setID($this->getClientID()); + $control->copyBaseAttributes($this); + if($this->getHasStyle()) + $control->getStyle()->copyFrom($this->getStyle()); + $control->renderBeginTag($writer); + $this->renderContents($writer); + $control->renderEndTag($writer); } - $this->renderTable($writer); - if($this->_bottomPager) + else { - $writer->writeLine(); - $this->_bottomPager->renderControl($writer); + $this->applyItemStyles(); + if($this->_topPager) + { + $this->_topPager->renderControl($writer); + $writer->writeLine(); + } + $this->renderTable($writer); + if($this->_bottomPager) + { + $writer->writeLine(); + $this->_bottomPager->renderControl($writer); + } } } } diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index b2bd9229..0dac2be2 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -115,6 +115,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs * @var Itemplate various item templates */ private $_itemTemplate=null; + private $_emptyTemplate=null; private $_alternatingItemTemplate=null; private $_selectedItemTemplate=null; private $_editItemTemplate=null; @@ -362,6 +363,26 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs return $this->_footer; } + /** + * @return ITemplate the template applied when no data is bound to the datalist + */ + public function getEmptyTemplate() + { + return $this->_emptyTemplate; + } + + /** + * @param ITemplate the template applied when no data is bound to the datalist + * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null. + */ + public function setEmptyTemplate($value) + { + if($value instanceof ITemplate || $value===null) + $this->_emptyTemplate=$value; + else + throw new TInvalidDataTypeException('datalist_template_required','EmptyTemplate'); + } + /** * @return ITemplate the separator template */ @@ -1109,6 +1130,8 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs if($this->_footerTemplate!==null) $this->_footer=$this->createItemInternal(-1,'Footer',false,null); } + else if($this->_emptyTemplate!==null) + $this->_emptyTemplate->instantiateIn($this); $this->clearChildState(); } @@ -1150,6 +1173,8 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs } if($itemIndex>0 && $this->_footerTemplate!==null) $this->_footer=$this->createItemInternal(-1,'Footer',true,null); + if($itemIndex===0 && $this->_emptyTemplate!==null) + $this->_emptyTemplate->instantiateIn($this); $this->setViewState('ItemCount',$itemIndex,0); } @@ -1162,9 +1187,14 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs { if($this->getHasControls()) { - $this->applyItemStyles(); - $repeatInfo=$this->getRepeatInfo(); - $repeatInfo->renderRepeater($writer,$this); + if($this->getItemCount()>0) + { + $this->applyItemStyles(); + $repeatInfo=$this->getRepeatInfo(); + $repeatInfo->renderRepeater($writer,$this); + } + else if($this->_emptyTemplate!==null) + parent::render($writer); } } } @@ -1317,7 +1347,7 @@ class TDataListItem extends TWebControl implements INamingContainer } /** - * @return string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager' + * @return string item type */ public function getItemType() { @@ -1325,7 +1355,7 @@ class TDataListItem extends TWebControl implements INamingContainer } /** - * @param mixed data to be associated with the item + * @param string item type. Valid values include 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'. */ public function setItemType($value) { diff --git a/framework/Web/UI/WebControls/THyperLink.php b/framework/Web/UI/WebControls/THyperLink.php index 5489727c..011ce4db 100644 --- a/framework/Web/UI/WebControls/THyperLink.php +++ b/framework/Web/UI/WebControls/THyperLink.php @@ -73,7 +73,7 @@ class THyperLink extends TWebControl if(($toolTip=$this->getToolTip())!=='') $image->setToolTip($toolTip); if(($text=$this->getText())!=='') - $image->setAlternateText(THttpUtility::htmlEncode($text)); + $image->setAlternateText($text); $image->renderControl($writer); } } diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php index 9c1cc4ac..a2fc01d7 100644 --- a/framework/Web/UI/WebControls/TRepeater.php +++ b/framework/Web/UI/WebControls/TRepeater.php @@ -62,7 +62,6 @@ class TRepeater extends TDataBoundControl implements INamingContainer */ const IT_HEADER='Header'; const IT_FOOTER='Footer'; - const IT_EMPTY='Empty'; const IT_ITEM='Item'; const IT_SEPARATOR='Separator'; const IT_ALTERNATINGITEM='AlternatingItem'; @@ -104,15 +103,6 @@ class TRepeater extends TDataBoundControl implements INamingContainer */ private $_footer=null; - /** - * No body content should be added to repeater. - * This method is invoked when body content is parsed and added to this control. - * @param mixed body content to be added - */ - public function addParsedObject($object) - { - } - /** * @return ITemplate the template for repeater items */ @@ -343,7 +333,6 @@ class TRepeater extends TDataBoundControl implements INamingContainer { case self::IT_HEADER: $template=$this->_headerTemplate; break; case self::IT_FOOTER: $template=$this->_footerTemplate; break; - case self::IT_EMPTY : $template=$this->_emptyTemplate; break; case self::IT_ITEM : $template=$this->_itemTemplate; break; case self::IT_SEPARATOR : $template=$this->_separatorTemplate; break; case self::IT_ALTERNATINGITEM : $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break; @@ -360,7 +349,10 @@ class TRepeater extends TDataBoundControl implements INamingContainer */ public function render($writer) { - $this->renderContents($writer); + if($this->_items && $this->_items->getCount()) + $this->renderContents($writer); + else if($this->_emptyTemplate!==null) + parent::render($writer); } /** @@ -422,7 +414,7 @@ class TRepeater extends TDataBoundControl implements INamingContainer $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,false,null); } else if($this->_emptyTemplate!==null) - $this->createItemInternal(-1,self::IT_EMPTY,false,null); + $this->_emptyTemplate->instantiateIn($this); $this->clearChildState(); } @@ -460,7 +452,7 @@ class TRepeater extends TDataBoundControl implements INamingContainer if($itemIndex>0 && $this->_footerTemplate!==null) $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,true,null); if($itemIndex===0 && $this->_emptyTemplate!==null) - $this->createItemInternal(-1,self::IT_EMPTY,true,null); + $this->_emptyTemplate->instantiateIn($this); $this->setViewState('ItemCount',$itemIndex,0); } @@ -677,22 +669,30 @@ class TRepeaterItem extends TControl implements INamingContainer /** * Constructor. * @param integer zero-based index of the item in the item collection of repeater - * @param string item type, can be 'Header','Footer','Empty','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'. + * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'. */ public function __construct($itemIndex,$itemType) { $this->_itemIndex=$itemIndex; - $this->_itemType=$itemType; + $this->setItemType($itemType); } /** - * @return string item type, can be 'Header','Footer','Empty','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager' + * @return string item type */ public function getItemType() { return $this->_itemType; } + /** + * @param string item type. Valid values include 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'. + */ + public function setItemType($value) + { + $this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'); + } + /** * @return integer zero-based index of the item in the item collection of repeater */ -- cgit v1.2.3