summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-09-24 02:20:54 +0000
committerxue <>2006-09-24 02:20:54 +0000
commit75583383a6c00704837a753741abfc049dcc5a90 (patch)
treefcb5ac38b1eb3abfa5d17bdee494641be8d206ed
parent6fd29b65290509f55172efccaacb5f91a4a884df (diff)
Merge from 3.0 branch till 1443.
-rw-r--r--HISTORY5
-rw-r--r--demos/blog/protected/application.xml8
-rw-r--r--demos/quickstart/protected/pages/Advanced/I18N.page2
-rw-r--r--demos/quickstart/protected/pages/Configurations/UrlMapping.page18
-rw-r--r--framework/I18N/TGlobalization.php7
-rw-r--r--framework/I18N/Translation.php4
-rw-r--r--framework/Web/THttpRequest.php5
-rw-r--r--framework/Web/TUrlMapping.php39
-rw-r--r--requirements/index.php5
-rw-r--r--requirements/messages-bg.txt2
-rw-r--r--requirements/messages-zh.txt2
-rw-r--r--requirements/messages.txt2
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 @@
<route class="TFileLogRoute" Categories="BlogApplication" />
</module>
<module class="System.Util.TParameterModule" ParameterFile="Application.Data.Settings" />
+
+ <!-- use TUrlMapping to map URL patterns to particular requests -->
<module id="friendly-url" class="System.Web.TUrlMapping">
- <url pageClass="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
- <url pageClass="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
- <url pageClass="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
+ <url ServiceParameter="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
+ <url ServiceParameter="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
+ <url ServiceParameter="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
</module>
</modules>
<services>
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 <tt>System.I18N.*</tt> namespace to your paths.
<module id="globalization" class="TGlobalization">
<translation type="XLIFF"
source="MyApp.messages"
+ marker="@@"
autosave="true" cache="true" />
</module>
</com:TTextHighlighter>
@@ -48,6 +49,7 @@ First you need to include the <tt>System.I18N.*</tt> namespace to your paths.
where you are going to store your translate message catalogue. The <tt>autosave</tt>
attribute if enabled, saves untranslated messages back into the message catalogue.
With <tt>cache</tt> enabled, translated messages are saved in the application <tt>runtime/i18n</tt> directory.
+The <tt>marker</tt> value is used to surround any untranslated text.
</p>
<p>With the configuration complete, we can now start to localize your application. If you have <tt>autosave</tt> enabled, after running your application with some localization activity (i.e. translating some text), you will see a directory and a <tt>messages.xml</tt> created within your <tt>source</tt> directory.</p>
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.
<p>The mapping format is as follows.
<com:TTextHighlighter Language="xml" CssClass="source">
<module id="friendly-url" class="System.Web.TUrlMapping">
- <url pageClass="ClassName" pattern="regexp" parameters.id="regexp" />
+ <url serviceParameter="ClassName" pattern="regexp" parameters.id="regexp" />
</module>
</com:TTextHighlighter>
</p>
-<p>The <tt>PageClass</tt> set the name of class that the matched URL will
-be requested.</p> The <tt>Pattern</tt> and <tt>Parameters</tt> attribute
+<p>The <tt>ServiceParameter</tt> and <tt>ServiceID</tt>
+ (the default ID is 'page') set the service parameter and service ID respectively.
+ The service parameter for the <tt>TPageService</tt> 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 <a href="?page=Fundamentals.Services">Services</a> for further details.
+</p>
+
+<p>
+The <tt>Pattern</tt> and <tt>Parameters</tt> attribute
values are regular expression patterns that
determine the mapping criteria. The <tt>Pattern</tt> property takes
a regular expression with parameter names enclosed between a left brace '<tt>{</tt>'
@@ -34,13 +42,13 @@ and a right brace '<tt>}</tt>'. The pattens for each parameter can be set
using <tt>Parameters</tt>attribute collection.
For example,
<com:TTextHighlighter Language="xml" CssClass="source">
-<url pageClass="Pages.ShowArticles" pattern="articles/{year}/{month}/{day}"
+<url ServiceParameter="Pages.ShowArticles" pattern="articles/{year}/{month}/{day}"
parameters.year="\d{4}" parameters.month="\d{2}" parameters.day="\d+" />
</com:TTextHighlighter>
</p>
The example is equivalent, using regular expression only, to
<com:TTextHighlighter Language="xml" CssClass="source">
-<url pageClass="Pages.ShowArticles">
+<url ServiceParmaeter="Pages.ShowArticles">
<![CDATA[
articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\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 '@@'
* </code>
* 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.
* <code>
* <module id="friendly-url" class="System.Web.TUrlMapping">
- * <url pageClass="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
- * <url pageClass="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
- * <url pageClass="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
+ * <url ServiceParameter="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
+ * <url ServiceParameter="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
+ * <url ServiceParameter="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
* </module>
* </code>
*
@@ -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 <tt>Request</tt>
* object. For example, <tt>$this->Request['year']</tt>.
*
- * 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 <tt>&lt;url&gt;</tt>
* 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
@@ -56,6 +56,11 @@ $requirements = array(
'PATH_INFO required'),
array(
true,
+ class_exists('Reflection',false),
+ 'Reflection extension check',
+ 'Reflection extension required'),
+ array(
+ true,
class_exists("DOMDocument",false),
'DOM extension check',
'DOM extension required'),
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