From c54a230a5926086ff1b69a0dd7e6352dbc0b40ff Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 20 Apr 2006 17:09:09 +0000 Subject: Merge from 3.0 branch till 947. --- HISTORY | 2 ++ demos/quickstart/protected/pages/Advanced/I18N.page | 4 ++-- .../quickstart/protected/pages/Configurations/Templates2.page | 2 +- .../quickstart/protected/pages/Configurations/Templates3.page | 2 +- framework/Web/THttpResponse.php | 7 +++---- framework/Web/THttpUtility.php | 4 ++-- framework/Web/UI/WebControls/THtmlArea.php | 9 ++++++++- framework/Web/UI/WebControls/TJavascriptLogger.php | 11 +++++++++-- framework/Web/UI/WebControls/TTableRow.php | 3 ++- 9 files changed, 30 insertions(+), 14 deletions(-) diff --git a/HISTORY b/HISTORY index 5921c653..e88bf225 100644 --- a/HISTORY +++ b/HISTORY @@ -12,6 +12,8 @@ Version 3.0.0 May 1, 2006 ========================= BUG: Ticket#131 - TImageMap and TLinkButton continue to postback even client validator fails (Wei) BUG: Ticket#135 - TBrowserLogRoute reports wrong timings (Qiang) +BUG: Ticket#137 - The JavasciptLogger does not work (Qiang) +BUG: Ticket#138 - missing file in TDataGrid (Qiang) BUG: Non-control components can now use expressions in their properties (Qiang) BUG: TControl.Visible did not make use of overriden getVisible() (Qiang) BUG: TWizard did not stop navigation upon a validation failure (Qiang) diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page index 75ee59ee..f37e5cf6 100644 --- a/demos/quickstart/protected/pages/Advanced/I18N.page +++ b/demos/quickstart/protected/pages/Advanced/I18N.page @@ -114,7 +114,7 @@ function clickMe($sender,$param) function clickMe($sender,$param) { - $sender->Text=localize("Hello, world!"); + $sender->Text=Prado::localize("Hello, world!"); } @@ -129,7 +129,7 @@ $message = "There are " . $num_users . " users online."; This problem can be solved using the localize function with string substitution. For example, the $message string above can be constructed as follows. $num_users = 12; -$message = localize("There are {num_users} users online.", array('num_users'=>$num_users)); +$message = Prado::localize("There are {num_users} users online.", array('num_users'=>$num_users));

Where the second parameter in localize takes an associative array with the key as the substitution to find in the text and replaced it with the associated value. The localize function does not solve the problem of localizing languages that have plural forms, the solution is to use TChoiceFormat.

diff --git a/demos/quickstart/protected/pages/Configurations/Templates2.page b/demos/quickstart/protected/pages/Configurations/Templates2.page index 9fc06fb4..17502151 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates2.page +++ b/demos/quickstart/protected/pages/Configurations/Templates2.page @@ -93,7 +93,7 @@ Localization tags represent localized texts. They are in the following format, <%[string]%>

-where string will be translated to different languages according to the end-user's language preference. +where string will be translated to different languages according to the end-user's language preference. Localization tags are in fact shortcuts to the function call Prado::localize(string).

\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/Templates3.page b/demos/quickstart/protected/pages/Configurations/Templates3.page index b97b1583..457c1a38 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates3.page +++ b/demos/quickstart/protected/pages/Configurations/Templates3.page @@ -84,7 +84,7 @@ Localization tags represent localized texts. They are in the following format, <%[string]%>

-where string will be translated to different languages according to the end-user's language preference. The localization tags are evaluated when the template is instantiated. +where string will be translated to different languages according to the end-user's language preference. The localization tags are evaluated when the template is instantiated. Localization tags are in fact shortcuts to the function call Prado::localize(string).

\ No newline at end of file diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index 18be9fec..29258259 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -238,15 +238,14 @@ class THttpResponse extends TModule implements ITextWriter if($mimeType===null) { + $mimeType='text/plain'; if(function_exists('mime_content_type')) $mimeType=mime_content_type($fileName); - else + else if(($ext=strrchr($fileName,'.'))!==false) { - $ext=array_pop(explode('.',$fileName)); + $ext=substr($ext,1); if(isset($defaultMimeTypes[$ext])) $mimeType=$defaultMimeTypes[$ext]; - else - $mimeType='text/plain'; } } $fn=basename($fileName); diff --git a/framework/Web/THttpUtility.php b/framework/Web/THttpUtility.php index 4cd869b4..3bb78f0f 100644 --- a/framework/Web/THttpUtility.php +++ b/framework/Web/THttpUtility.php @@ -20,8 +20,8 @@ */ class THttpUtility { - private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"e;'); - private static $_decodeTable=array('<'=>'<','>'=>'>','"e;'=>'"'); + private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"'); + private static $_decodeTable=array('<'=>'<','>'=>'>','"'=>'"'); /** * HTML-encodes a string. diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index 7ad2d06f..038c7368 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -10,6 +10,11 @@ * @package System.Web.UI */ +/** + * Includes TTextBox class + */ +Prado::using('System.Web.UI.WebControls.TTextBox'); + /** * THtmlArea class * @@ -73,7 +78,8 @@ */ class THtmlArea extends TTextBox { - protected $langs = array( + // Qiang: need to clean up the following (too inefficient) + private $langs = array( 'da' => array('da'), 'fa' => array('fa'), 'hu' => array('hu'), @@ -310,6 +316,7 @@ class THtmlArea extends TTextBox if(count($variants) == 0) $variants[] = empty($culture) ? 'en' : strtolower($culture); + // TODO: triple loops??? foreach($this->langs as $js => $langs) { foreach($variants as $variant) diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php index 3196d3b6..0296a276 100644 --- a/framework/Web/UI/WebControls/TJavascriptLogger.php +++ b/framework/Web/UI/WebControls/TJavascriptLogger.php @@ -40,6 +40,15 @@ class TJavascriptLogger extends TWebControl return 'div'; } + /** + * Registers the required logger javascript. + * @param TEventParameter event parameter + */ + public function onPreRender($param) + { + $this->getPage()->getClientScript()->registerPradoScript('logger'); + } + /** * Register the required javascript libraries and * display some general usage information. @@ -47,11 +56,9 @@ class TJavascriptLogger extends TWebControl */ public function renderContents($writer) { - $this->getPage()->getClientScript()->registerPradoScript('logger'); $info = '(more info).'; $usage = 'Press ALT-D (Or CTRL-D on OS X) to toggle the javascript log console'; $writer->write("{$usage} {$info}"); - parent::renderContents($writer); } } diff --git a/framework/Web/UI/WebControls/TTableRow.php b/framework/Web/UI/WebControls/TTableRow.php index 04a1555d..6a3f196a 100644 --- a/framework/Web/UI/WebControls/TTableRow.php +++ b/framework/Web/UI/WebControls/TTableRow.php @@ -11,9 +11,10 @@ */ /** - * Includes TTableCell class + * Includes TTableCell and TTableHeaderCell classes */ Prado::using('System.Web.UI.WebControls.TTableCell'); +Prado::using('System.Web.UI.WebControls.TTableHeaderCell'); /** * TTableRow class. -- cgit v1.2.3