From 75583383a6c00704837a753741abfc049dcc5a90 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 24 Sep 2006 02:20:54 +0000 Subject: Merge from 3.0 branch till 1443. --- HISTORY | 5 +-- demos/blog/protected/application.xml | 8 +++-- .../quickstart/protected/pages/Advanced/I18N.page | 2 ++ .../protected/pages/Configurations/UrlMapping.page | 18 +++++++--- framework/I18N/TGlobalization.php | 7 ++-- framework/I18N/Translation.php | 4 +++ framework/Web/THttpRequest.php | 5 +++ framework/Web/TUrlMapping.php | 39 +++++++++++----------- requirements/index.php | 5 +++ requirements/messages-bg.txt | 2 ++ requirements/messages-zh.txt | 2 ++ requirements/messages.txt | 2 ++ 12 files changed, 67 insertions(+), 32 deletions(-) diff --git a/HISTORY b/HISTORY index a205f63d..580f5d62 100644 --- a/HISTORY +++ b/HISTORY @@ -16,11 +16,12 @@ Version 3.0.5 October 8, 2006 CHG: Ticket#358 - TFileUpload::saveAs() now returns false instead of exception when error (Qiang) ENH: Ticket#361 - Introduced include template tag that supports including external templates (Qiang) ENH: Ticket#366 - white spaces are now allowed around attribute names in template (Qiang) -ENH: Added an interactive PHP shell, usage: "prado-cli.php shell" (Wei) +ENH: Ticket#378 - PRADO applications can now run in command line (Qiang) ENH: Ticket#379 - TAuthorizationRule performance enhancement (Qiang) ENH: Easier to customize the TDatePicker using CssClass (Wei) +ENH: Added an interactive PHP shell, usage: "prado-cli.php shell" (Wei) NEW: TLiteralColumn (Qiang) -NSW: TUrlMapping (Wei) +NEW: TUrlMapping (Wei) Version 3.0.4 September 4, 2006 =============================== diff --git a/demos/blog/protected/application.xml b/demos/blog/protected/application.xml index f15c4fe4..d28b2dd7 100644 --- a/demos/blog/protected/application.xml +++ b/demos/blog/protected/application.xml @@ -15,10 +15,12 @@ + + - - - + + + diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page index 1330091f..9c3d620f 100644 --- a/demos/quickstart/protected/pages/Advanced/I18N.page +++ b/demos/quickstart/protected/pages/Advanced/I18N.page @@ -40,6 +40,7 @@ First you need to include the System.I18N.* namespace to your paths. @@ -48,6 +49,7 @@ First you need to include the System.I18N.* namespace to your paths. where you are going to store your translate message catalogue. The autosave attribute if enabled, saves untranslated messages back into the message catalogue. With cache enabled, translated messages are saved in the application runtime/i18n directory. +The marker value is used to surround any untranslated text.

With the configuration complete, we can now start to localize your application. If you have autosave enabled, after running your application with some localization activity (i.e. translating some text), you will see a directory and a messages.xml created within your source directory.

diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 22cb866a..dde6854f 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -20,13 +20,21 @@ file and before any services.

The mapping format is as follows. - +

-

The PageClass set the name of class that the matched URL will -be requested.

The Pattern and Parameters attribute +

The ServiceParameter and ServiceID + (the default ID is 'page') set the service parameter and service ID respectively. + The service parameter for the TPageService service is the + Page class name, e.g., for an URL "index.php?page=Home", "page" is the service ID and the service + parameter is "Home". Other services may use the service parameter and ID differently. +See Services for further details. +

+ +

+The Pattern and Parameters attribute values are regular expression patterns that determine the mapping criteria. The Pattern property takes a regular expression with parameter names enclosed between a left brace '{' @@ -34,13 +42,13 @@ and a right brace '}'. The pattens for each parameter can be set using Parametersattribute collection. For example, -

The example is equivalent, using regular expression only, to - + \d{4})/(?P\d{2})/(?P\d+) ]]> diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index d3c6d233..90fd3d53 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -93,7 +93,7 @@ class TGlobalization extends TModule */ public function setDefaultCulture($culture) { - $this->_defaultCharset = str_replace('-','_',$culture); + $this->_defaultCulture = str_replace('-','_',$culture); } /** @@ -160,6 +160,7 @@ class TGlobalization extends TModule * $config['catalogue'] = 'messages'; //default catalog * $config['autosave'] = 'true'; //save untranslated message * $config['cache'] = 'true'; //cache translated message + * $config['marker'] = '@@'; // surround untranslated text with '@@' * * Throws exception is source is not found. * @param TMap configuration options @@ -176,7 +177,7 @@ class TGlobalization extends TModule if(@mkdir($config['source'])===false) throw new TConfigurationException('globalization_source_path_failed', $config['source']); - chmod($config['source'], 0777); //make it deletable + chmod($config['source'], 0777); //make it deletable } } else @@ -192,7 +193,7 @@ class TGlobalization extends TModule if(@mkdir($config['cache'])===false) throw new TConfigurationException('globalization_cache_path_failed', $config['cache']); - chmod($config['cache'], 0777); //make it deletable + chmod($config['cache'], 0777); //make it deletable } } $this->_translation = $config; diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php index 33696304..7394842b 100644 --- a/framework/I18N/Translation.php +++ b/framework/I18N/Translation.php @@ -54,6 +54,10 @@ class Translation extends TComponent self::$formatter = new MessageFormat($source, $app->getCharset()); + //mark untranslated text + if($ps=$config['marker']) + self::$formatter->setUntranslatedPS(array($ps,$ps)); + //save the message on end request Prado::getApplication()->attachEventHandler( 'OnEndRequest', array('Translation', 'saveMessages')); diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 33839ed0..aa690540 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -596,6 +596,11 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } } + protected function getRequestResolved() + { + return $this->_requestResolved; + } + /** * @return array IDs of the available services */ diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index 3062b898..62656563 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -21,9 +21,9 @@ * The mapping format is as follows. * * - * - * - * + * + * + * * * * @@ -189,10 +189,10 @@ class TUrlMapping extends THttpRequest { $request = $this->getRequest(); $id = $pattern->getServiceID(); - $page = $pattern->getPageClass(); + $param = $pattern->getServiceParameter(); $request->setServiceID($id); - $request->setServiceParameter($page); - $request->add($id,$page); + $request->setServiceParameter($param); + $request->add($id,$param); } } @@ -227,9 +227,10 @@ class TUrlMapping extends THttpRequest * The parameter values are available through the standard Request * object. For example, $this->Request['year']. * - * The {@link setPageClass PageClass} and {@link setServiceID ServiceID} - * (the default ID is 'page') set the class and the service that will - * handle the matching URL. + * The {@link setServiceParameter ServiceParameter} and {@link setServiceID ServiceID} + * (the default ID is 'page') set the service parameter and service id respectively. + * The service parameter for the TPageService is the Page class name, other service + * may use the service parameter differently. * * For more complicated mappings, the body of the <url> * can be used to specify the mapping pattern. @@ -242,9 +243,9 @@ class TUrlMapping extends THttpRequest class TUrlMappingPattern extends TComponent { /** - * @var string page class name. + * @var string service parameter such as Page class name. */ - private $_pageClass; + private $_serviceParameter; /** * @var string service ID, default is 'page'. */ @@ -277,10 +278,10 @@ class TUrlMappingPattern extends TComponent $body = trim($config->getValue()); if(strlen($body)>0) $this->setPattern($body); - if(is_null($this->_pageClass)) + if(is_null($this->_serviceParameter)) { throw new TConfigurationException( - 'dispatcher_url_page_class_missing', $this->getPattern()); + 'dispatcher_url_service_parameter_missing', $this->getPattern()); } $this->initializePattern(); } @@ -310,19 +311,19 @@ class TUrlMappingPattern extends TComponent } /** - * @param string name of the page class to handle the request. + * @param string service parameter, such as page class name. */ - public function setPageClass($value) + public function setServiceParameter($value) { - $this->_pageClass=$value; + $this->_serviceParameter=$value; } /** - * @return string page class name. + * @return string service parameter, such as page class name. */ - public function getPageClass() + public function getServiceParameter() { - return $this->_pageClass; + return $this->_serviceParameter; } /** diff --git a/requirements/index.php b/requirements/index.php index 4c6f242e..dca23a06 100644 --- a/requirements/index.php +++ b/requirements/index.php @@ -54,6 +54,11 @@ $requirements = array( isset($_SERVER["PATH_INFO"]) || strpos($_SERVER["PHP_SELF"],$_SERVER["SCRIPT_NAME"])===0, '$_SERVER["PATH_INFO"] check', 'PATH_INFO required'), + array( + true, + class_exists('Reflection',false), + 'Reflection extension check', + 'Reflection extension required'), array( true, class_exists("DOMDocument",false), diff --git a/requirements/messages-bg.txt b/requirements/messages-bg.txt index aaf1ba56..8e38c93d 100644 --- a/requirements/messages-bg.txt +++ b/requirements/messages-bg.txt @@ -11,6 +11,8 @@ APC extension check = Проверка за APC cache APC extension optional = APC разширението е незадължително. Ако не е заредено, няма да можете да ползвате TAPCCache. Zlib extension check = Проверка за Zlib Zlib extension optional = Zlib разширението е незадължително. Ако не е заредено, състоянието на страницата няма да бъде компресирано и размера на страницата може да се увеличи. +Reflection extension check = Проверка за Reflection разширението +Reflection extension required = Reflection разширението е задължително за PRADO. DOM extension check = Проверка за DOM разширението DOM extension required = DOM разширението е задължително за PRADO. Използва се в TXmlDocument за анализ на XML-базирани конфигурации. ICONV extension check = Проверка за ICONV разширението diff --git a/requirements/messages-zh.txt b/requirements/messages-zh.txt index eb25d760..f7f6958c 100644 --- a/requirements/messages-zh.txt +++ b/requirements/messages-zh.txt @@ -11,6 +11,8 @@ APC extension check = APC缓存模块检查 APC extension optional = APC模块是可选的。如果它不存在,您将无法使用TAPCCache。 Zlib extension check = Zlib模块检查 Zlib extension optional = Zlib模块是可选的。如果它不存在,页面的状态信息将无法压缩,由此可能导致您的页面传送数据量增大。 +Reflection extension check = Reflection模块检查 +Reflection extension required = Reflection模块是必须的。如果它不存在,PRADO将无法验证控件模板的正确性。 DOM extension check = DOM模块检查 DOM extension required = DOM模块是必须的。如果它不存在,基于XML的各种配置文件将无法解析。 ICONV extension check = ICONV模块检查 diff --git a/requirements/messages.txt b/requirements/messages.txt index 47bb888f..f4cc7e33 100644 --- a/requirements/messages.txt +++ b/requirements/messages.txt @@ -11,6 +11,8 @@ APC extension check = APC extension check APC extension optional = APC extension is optional. If it is absent, you will not be able to use TAPCCache. Zlib extension check = Zlib extension check Zlib extension optional = Zlib extension is optional. If it is absent, page state will not be compressed and your page size may increase. +Reflection extension check = Reflection extension check +Reflection extension required = Reflection extension is required by PRADO. It is used in by PRADO to check the validity of page templates. DOM extension check = DOM extension check DOM extension required = DOM extension is required by PRADO. It is used in TXmlDocument to parse all sorts of XML-based configurations. ICONV extension check = ICONV extension check -- cgit v1.2.3