From bde6488e19b9852011a657fda8aa39680d9c4a62 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 6 Jan 2007 00:00:57 +0000 Subject: Update docs. --- .gitattributes | 6 +++ buildscripts/chmbuilder/ChmQuickstartBuilder.php | 2 +- buildscripts/chmbuilder/build.php | 12 ++--- buildscripts/classtree/build.php | 5 +- buildscripts/texbuilder/Page2Tex.php | 20 ++++--- buildscripts/texbuilder/quickstart/pages.php | 23 ++++++-- buildscripts/texbuilder/quickstart/quickstart.tex | 5 ++ demos/quickstart/protected/controls/TopicList.tpl | 15 +----- .../protected/pages/Configurations/UrlMapping.page | 6 +-- .../protected/pages/Tutorial/AjaxChat.page | 50 ++++++++--------- .../pages/Tutorial/CurrencyConverter.page | 8 +-- framework/Data/SqlMap/TSqlMapConfig.php | 4 +- .../Web/UI/ActiveControls/TCallbackClientSide.php | 21 ++++---- .../Web/UI/WebControls/TRequiredFieldValidator.php | 2 +- .../protected/pages/DMessagesPanel.php | 63 ++++++++++++++++++++++ .../protected/pages/DMessagesPanel.tpl | 4 ++ .../protected/pages/DatePickerInCallback.page | 7 +++ .../protected/pages/DatePickerInCallback.php | 17 ++++++ .../protected/pages/MessagesPanelTest.page | 7 +++ .../protected/pages/MessagesPanelTest.php | 16 ++++++ 20 files changed, 214 insertions(+), 79 deletions(-) create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.tpl create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php create mode 100644 tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.php diff --git a/.gitattributes b/.gitattributes index 3ccd211a..2acbb131 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2069,6 +2069,10 @@ tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest. tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php -text tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page -text tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php -text +tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php -text +tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.tpl -text +tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page -text +tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.page -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.php -text tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page -text @@ -2087,6 +2091,8 @@ tests/FunctionalTests/active-controls/protected/pages/LargePageStateTest2.php -t tests/FunctionalTests/active-controls/protected/pages/Master1.php -text tests/FunctionalTests/active-controls/protected/pages/Master1.tpl -text tests/FunctionalTests/active-controls/protected/pages/MasterTest1.page -text +tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.page -text +tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.php -text tests/FunctionalTests/active-controls/protected/pages/MyControl.php -text tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl -text tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page -text diff --git a/buildscripts/chmbuilder/ChmQuickstartBuilder.php b/buildscripts/chmbuilder/ChmQuickstartBuilder.php index 7a954d4a..2b5796fd 100644 --- a/buildscripts/chmbuilder/ChmQuickstartBuilder.php +++ b/buildscripts/chmbuilder/ChmQuickstartBuilder.php @@ -86,7 +86,7 @@ Copyright © 2005-2006 PradoSoft.View Source', '>View Source', $html); $html = preg_replace_callback('/href="\?page=ViewSource&(amp;){0,1}path=([a-zA-z0-9\.\/]+)"/', diff --git a/buildscripts/chmbuilder/build.php b/buildscripts/chmbuilder/build.php index 6c352964..7873c23a 100644 --- a/buildscripts/chmbuilder/build.php +++ b/buildscripts/chmbuilder/build.php @@ -15,7 +15,7 @@ if(!isset($isChild)) $toc_file = $base.'/controls/TopicList.tpl'; -$pages = include($ROOT.'/../texbuilder/pages.php'); +$pages = include($ROOT.'/../texbuilder/quickstart/pages.php'); include($ROOT.'/ChmQuickstartBuilder.php'); include($ROOT.'/../../framework/PradoBase.php'); @@ -53,8 +53,8 @@ else $pages['Control Reference : Standard Controls'][] = 'Controls/Standard.page'; - $quickstart= new ChmQuickstartBuilder($base,$output_dir); - $quickstart->buildDoc($pages); +// $quickstart= new ChmQuickstartBuilder($base,$output_dir); +// $quickstart->buildDoc($pages); //move class data to protected data directory for prado app. $classFile = $ROOT.'/classes/Data/classes.data'; @@ -65,13 +65,13 @@ else $classBuilder = new ClassDocBuilder($classDocBase,$output_dir); //use child process to build doc, otherwise it consumes too much memory - $child_builder = realpath($ROOT.'/build_child.php'); +/* $child_builder = realpath($ROOT.'/build_child.php'); foreach($classes as $class =>$data) { passthru('php '.$child_builder.' '.$class); } - - $classBuilder->parseBasePage(); +*/ +// $classBuilder->parseBasePage(); $toc = new HTMLHelpTOCBuilder(); $toc->buildToc($toc_file,$output_dir,array_keys($classes)); diff --git a/buildscripts/classtree/build.php b/buildscripts/classtree/build.php index 9708d4e7..7f5ddcd7 100644 --- a/buildscripts/classtree/build.php +++ b/buildscripts/classtree/build.php @@ -5,6 +5,9 @@ $frameworkPath=realpath($basePath.'/../../framework'); require_once($frameworkPath.'/prado.php'); require_once($basePath.'/DWExtension.php'); +//the manager class sets up some dependency paths +Prado::using('System.Data.SqlMap.TSqlMapManager'); + $exclusions=array( // 'prado.php', 'pradolite.php', @@ -14,7 +17,7 @@ $exclusions=array( '.svn', '/I18N/core', '/3rdParty', - '/DataAccess/SQLMap' + '/Web/Security' ); $a=new ClassTreeBuilder($frameworkPath,$exclusions); $a->buildTree(); diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php index 9c779a64..5d9a2b81 100644 --- a/buildscripts/texbuilder/Page2Tex.php +++ b/buildscripts/texbuilder/Page2Tex.php @@ -88,7 +88,9 @@ class Page2Tex function texttt($matches) { - return '\texttt{'.str_replace(array('#','_','&'),array('\#','\_','\&'), $matches[1]).'}'; + $text ='\texttt{'.str_replace(array('#','_','&'),array('\#','\_','\&'), $matches[1]).'}'; + //$text = preg_replace('/([^\\\\])&([^;]+)/', '$1\&$2', $text); + return $text; } function get_current_path() @@ -105,8 +107,11 @@ class Page2Tex { if(strpos($matches[1],'?') ===false) { - $target = $this->get_current_path().'/'.substr($matches[1],1); - return '\hyperlink{'.$target.'}{'.$matches[2].'}'; + if(strpos($matches[1],'http://')===false) + { + $target = $this->get_current_path().'/'.substr($matches[1],1); + return '\hyperlink{'.$target.'}{'.$matches[2].'}'; + } } else { @@ -121,7 +126,7 @@ class Page2Tex $page = str_replace('?page=','',$matches[1]); return '\hyperlink{'.$page.'}{'.$matches[2].'}'; } - return '\href{'.$matches[1].'}{'.$matches[2].'}'; + return '\href{'.str_replace('#','\\#',$matches[1]).'}{'.$matches[2].'}'; } function parse_html($page,$html) @@ -144,7 +149,7 @@ class Page2Tex //codes $html = str_replace('$', '\$', $html); - $html = preg_replace_callback('/]*>((.|\n)*?)<\/com:TTextHighlighter>/', array($this,'escape_verbatim'), $html); + $html = preg_replace_callback('/]*>((.|\n)*?)<\/com:TTextHighlighter\s*>/', array($this,'escape_verbatim'), $html); // $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html); // $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', array($this,'escape_verbatim'), $html); $html = preg_replace_callback('/(
)((.|\n)*?)(<\/div>)/', array($this,'escape_verbatim'), $html); @@ -158,12 +163,15 @@ class Page2Tex '\href{http://www.pradosoft.com/demos/quickstart/index.php?page=$1}{$1 Demo}', $html); //DocLink + $html = preg_replace('//', + '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$3}', $html); + $html = preg_replace('//', '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$1.$2 API Reference}', $html); //text modifiers $html = preg_replace('/<(b|strong)[^>]*>([^<]*)<\/(b|strong)>/', '\textbf{$2}', $html); - $html = preg_replace('/]*>([^<]*)<\/i>/', '\emph{$1}', $html); + $html = preg_replace('/]*>([^<]*)+?<\/i>/', '\emph{$1}', $html); $html = preg_replace_callback('/([^<]*)<\/tt>/', array($this,'texttt'), $html); //links diff --git a/buildscripts/texbuilder/quickstart/pages.php b/buildscripts/texbuilder/quickstart/pages.php index 91dba08d..e8518d9d 100644 --- a/buildscripts/texbuilder/quickstart/pages.php +++ b/buildscripts/texbuilder/quickstart/pages.php @@ -8,10 +8,23 @@ $pages['Getting Started'] = array( 'GettingStarted/Introduction.page', 'GettingStarted/AboutPrado.page', 'GettingStarted/Installation.page', - 'GettingStarted/HelloWorld.page', 'GettingStarted/Upgrading.page' ); +$pages['Tutorials'] = array( + 'GettingStarted/HelloWorld.page', + 'Fundamentals/Hangman.page', + 'GettingStarted/CommandLine.page' + ); + +$pages['Tutorial: Currency Converter'] = array( + 'Tutorial/CurrencyConverter.page' + ); + +$pages['Tutorial: Building an AJAX Chat Application'] = array( + 'Tutorial/AjaxChat.page' + ); + $pages['Fundamentals'] = array( 'Fundamentals/Architecture.page', 'Fundamentals/Components.page', @@ -19,8 +32,8 @@ $pages['Fundamentals'] = array( 'Fundamentals/Pages.page', 'Fundamentals/Modules.page', 'Fundamentals/Services.page', - 'Fundamentals/Applications.page', - 'Fundamentals/Hangman.page'); + 'Fundamentals/Applications.page' + ); $pages['Configurations'] = array( 'Configurations/Overview.page', @@ -28,7 +41,9 @@ $pages['Configurations'] = array( 'Configurations/Templates2.page', 'Configurations/Templates3.page', 'Configurations/AppConfig.page', - 'Configurations/PageConfig.page'); + 'Configurations/PageConfig.page', + 'Configurations/UrlMapping.page' + ); $pages['Control Reference : Standard Controls'] = array( 'Controls/Button.page', diff --git a/buildscripts/texbuilder/quickstart/quickstart.tex b/buildscripts/texbuilder/quickstart/quickstart.tex index d84383b8..7008db92 100644 --- a/buildscripts/texbuilder/quickstart/quickstart.tex +++ b/buildscripts/texbuilder/quickstart/quickstart.tex @@ -130,5 +130,10 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \include{ch13} \include{ch14} \include{ch15} +\include{ch16} +\include{ch17} +\include{ch18} +\include{ch19} +\include{ch20} \end{document} diff --git a/demos/quickstart/protected/controls/TopicList.tpl b/demos/quickstart/protected/controls/TopicList.tpl index 40c70424..e7d4a683 100644 --- a/demos/quickstart/protected/controls/TopicList.tpl +++ b/demos/quickstart/protected/controls/TopicList.tpl @@ -14,6 +14,7 @@
Tutorials
@@ -67,26 +67,13 @@
  • SqlMap Data Mapper
  • -
    Advanced Topics
    • Collections
    • Authentication and Authorization
    • Security
    • -
    • Client-side Scripting
    • Assets
    • Master and Content
    • Themes and Skins
    • diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 112d70e2..20954c24 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -43,9 +43,9 @@ To use TUrlMapping, one must set the UrlManager property of th The above example is part of the application configuration of the blog demo in the PRADO release. It enables recognition of the following URL formats:

        -
      • /index.php/post/123 is recognized as /index.php?page=Posts.ViewPost&id=123
      • -
      • /index.php/archive/200605 is recognized as /index.php?page=Posts.ListPost&time=200605
      • -
      • /index.php/category/2 is recognized as /index.php?page=Posts.ListPost&cat=2
      • +
      • /index.php/post/123 is recognized as /index.php?page=Posts.ViewPost&id=123
      • +
      • /index.php/archive/200605 is recognized as /index.php?page=Posts.ListPost&time=200605
      • +
      • /index.php/category/2 is recognized as /index.php?page=Posts.ListPost&cat=2

      diff --git a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page index 3a17b5d4..2d49c9f6 100644 --- a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page +++ b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page @@ -3,9 +3,9 @@

      This tutorial introduces the Prado web application framework's ActiveRecord and Active Controls to build a Chat - web application . It is assumed that you + web application. It is assumed that you are familiar with PHP and you have access to a web server that is able to serve PHP5 scripts. - This basic chat application will utilizing the following ideas/components in Prado. + This basic chat application will utilize the following ideas/components in Prado.

      • Building a custom User Manager class.
      • Authenticating and adding a new user to the database.
      • @@ -39,19 +39,19 @@ php prado/framework/prado-cli.php -c chat

        The above command creates the necessary directory structure and minimal files (including "index.php" and "Home.page") to run a Prado web application. - Now you can point your browser's url to the web server to serve up + Now you can point your browser's URL to the web server to serve up the index.php script in the chat directory. You should see the message "Welcome to Prado!"

        Authentication and Authorization

        The first task for this application is to ensure that each user - of the chat application is assigned with a unique (choosen by the user) + of the chat application is assigned with a unique (chosen by the user) username. To achieve this, we can secure the main chat application - page to deny access to anonymouse users. First, let us create the Login + page to deny access to anonymous users. First, let us create the Login page with the following code. We save the Login.php and Login.page in the chat/protected/pages/ directory (there should be a Home.page - file there create by the command line tool). + file created by the command line tool).

        <?php @@ -88,7 +88,7 @@ class Login extends TPage

        The login page contains - a , + a , a , a and a . The resulting @@ -133,8 +133,8 @@ secure the pages directory. We setup the authentication using the default classes as explained in the authentication/authorization quickstart. -In the authorization definition, we allow anonymouse users to access the -Login page (anonymouse users is specified by the ? question mark). +In the authorization definition, we allow anonymous users to access the +Login page (anonymous users is specified by the ? question mark). We allow any users with role equal to "normal" (to be defined later) to access all the pages, that is, the Login and Home pages. Lastly, we deny all users without any roles to access any page. The authorization @@ -204,7 +204,7 @@ we import classes from the App_Code directory and add an

        Custom User Manager class

        To implement a custom user manager module class we just need to extends the TModule class and implement the IUserManager -interface. The getGuestName(), getUser() and validateUser +interface. The getGuestName(), getUser() and validateUser() methods are required by the IUserManager interface. We save the custom user manager class as App_Code/ChatUserManager.php.

        @@ -273,7 +273,7 @@ configuration with id="users".

        To perform authentication, we just want the user to enter a unique username. We add a -for validate the uniqueness of the username and add a OnClick event handler +for validate the uniqueness of the username and add an OnClick event handler for the login button.

        <com:TCustomValidator @@ -336,7 +336,7 @@ Finally, we redirect the client to the default Home page.

        Default Values for ActiveRecord

        If you try to perform a login now, you will receive an error message like "Property 'ChatUserRecord::$last_activity' must not be null as defined -by column 'last_activity' in table 'chat_users'.". This means that the $last_activity +by column 'last_activity' in table 'chat_users'.". This means that the $last_activity property value was null when we tried to insert a new record. We need to either define a default value in the corresponding column in the table and allow null values or set the default value in the ChatUserRecord class. We shall demonstrate the later by @@ -359,13 +359,13 @@ public function setLast_Activity($value) } Notice that we renamed $last_activity to $_last_activity (note -the under score after the dollar sign). +the underscore after the dollar sign).

        Main Chat Application

        Now we are ready to build the main chat application. We use a simple layout that consist of one panel holding the chat messages, one panel -to hold the users list, a textare for the user to enter the text message +to hold the users list, a textarea for the user to enter the text message and a button to send the message. -We have add two Active Control components: a +We added two Active Control components: a and a . @@ -442,14 +442,14 @@ that will be very useful for understanding how the Active Controls work.

        Exploring the Active Controls

        -

        Lets have some fun before we proceed with setuping the chat buffering. We want +

        We should have some fun before we proceeding with setting up the chat buffering. We want to see how we can update the current page when we receive a message. First, we add an OnClick event handler for the Send button. <com:TActiveButton ID="sendButton" CssClass="send-button" Text="Send" OnClick="processMessage"/> - + And the corresponding event handler method in the Home.php class (we need to create this new file too). @@ -462,7 +462,7 @@ class Home extends TPage } If you now type something in the main application textbox and click the send button -you should see what ever you have typed echoed in the TJavascriptLogger console. +you should see whatever you have typed echoed in the TJavascriptLogger console.

        To append or add some content to the message list panel, we need to use @@ -554,10 +554,10 @@ public function saveMessage() We first find all the current users using the ChatUserRecord finder methods. Then we duplicate the message and save it into the database. In addition, we update the message sender's last activity timestamp. The above piece of code -demonstrates the simplicty and succintness of using ActiveRecords for simple database designs. +demonstrates the simplicity and succinctness of using ActiveRecords for simple database designs.

        -

        The next piece of the logic is to retreive the users messages from the buffer. +

        The next piece of the logic is to retrieve the users' messages from the buffer. We simply load all the messages for a particular username and format that message appropriately (remember to escape the output to prevent Cross-Site Scripting attacks). After we load the messages, we delete those loaded messages and any older @@ -605,7 +605,7 @@ a TRepeater in the template or a custom component).

        Putting It Together

        -

        Nows comes to put the application flow together. In the Home.php we update +

        Now comes to put the application flow together. In the Home.php we update the Send buttons OnClick event handler to use the application logic we just implemented. @@ -631,11 +631,11 @@ response (AJAX style).

        At this point the application is actually already functional, just not very -user friendly. If you open two different browser, you should be able to communicate -between the two users when ever the Send button is clicked. +user friendly. If you open two different browsers, you should be able to communicate +between the two users whenever the Send button is clicked.

        -

        The next part is perphaps the more tricker and fiddly than the other tasks. We +

        The next part is perhaps the more tricker and fiddly than the other tasks. We need to improve the user experience. First, we want a list of current users as well. So we add the following method to Home.php, we can call this method when ever some callback event is raised, e.g. when the Send @@ -709,7 +709,7 @@ public function onLoad($param) refresh the user list. We can accomplish this by polling the server using a control. We add a TTimeTriggeredCallback to the Home.page -and call the refresh handler method to defined in Home.php. +and call the refresh handler method defined in Home.php. We set the polling interval to 2 seconds. <com:TTimeTriggeredCallback OnCallback="refresh" diff --git a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page index fdce0b47..c11c1b94 100644 --- a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page +++ b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page @@ -82,7 +82,7 @@ php prado/framework/prado-cli.php -c currency-converter

        The first component we add is a - + that basically corresponds to the HTML <form> element. In Prado, only one TForm element is allowed per page.

        @@ -151,7 +151,7 @@ class Home extends TPage <com:TButton Text="Convert" OnClick="convert_clicked" /> - The value of the OnClick, "convert_clicked", will be the method + The value of the OnClick, "convert_clicked", will be the method name in the "Home.php" that will called when the user clicks on the "Convert" button. @@ -170,14 +170,14 @@ class Home extends TPage to the "Amount in Other Currency" label.

        -

        In the "convert_clicked" method the first parameter, $sender, +

        In the "convert_clicked" method the first parameter, $sender, corresponds to the object that raised the event, in this case, the "Convert" button. The second parameter, $param contains any additional data that the $sender object may wish to have added.

        We shall now examine, the three lines that implements the simply currency - conversion in the "convert_clicked" method. + conversion in the "convert_clicked" method. $rate = floatval($this->currencyRate->Text); diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php index 883a11e1..95c16336 100644 --- a/framework/Data/SqlMap/TSqlMapConfig.php +++ b/framework/Data/SqlMap/TSqlMapConfig.php @@ -19,8 +19,8 @@ Prado::using('System.Data.TDataSourceConfig'); * * @author Wei Zhuo * @version $Id$ - * @package System - * @since version + * @package System.Data.SqlMap + * @since 3.1 */ class TSqlMapConfig extends TDataSourceConfig { diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSide.php b/framework/Web/UI/ActiveControls/TCallbackClientSide.php index ff347659..1c354c3e 100644 --- a/framework/Web/UI/ActiveControls/TCallbackClientSide.php +++ b/framework/Web/UI/ActiveControls/TCallbackClientSide.php @@ -23,24 +23,21 @@ * - onInteractive executed when callback request is in progress. * - onCompleteexecuted when callback response returns. * - * The OnSuccess and OnFailure events are raised when the + * The OnSuccess and OnFailure events are raised when the * response is returned. A successful request/response will raise - * OnSuccess event otherwise OnFailure will be raised. + * OnSuccess event otherwise OnFailure will be raised. * * - onSuccess executed when callback request returns and is successful. * - onFailure executed when callback request returns and fails. - * - onException raised when callback request fails due to - * request/response errors. + * - onException raised when callback request fails due to request/response errors. * - * - PostInputs true to collect the form inputs and post them during - * callback, default is true. + * - PostInputs true to collect the form inputs and post them during callback, default is true. * - RequestTimeOut The request timeout in milliseconds. - * - HasPriority true to ensure that the callback request will be sent - * immediately and will abort existing prioritized requests. It does not affect - * callbacks that are not prioritized. - * - EnablePageStateUpdate enable the callback response to enable the - * viewstate update. This will automatically set HasPrority to true when - * enabled. + * - HasPriority true to ensure that the callback request will be sent + * immediately and will abort existing prioritized requests. It does not affect + * callbacks that are not prioritized. + * - EnablePageStateUpdate enable the callback response to enable the + * viewstate update. This will automatically set HasPrority to true when enabled. * * @author Wei Zhuo * @version $Id$ diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index 8f75d205..c8488c93 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -116,7 +116,7 @@ class TRequiredFieldValidator extends TBaseValidator { $initial = trim($this->getInitialValue()); $value=$this->getValidationValue($control); - return trim($value)!==$initial || (is_bool($value) && $value); + return (is_bool($value) && $value) || trim($value)!==$initial; } /** diff --git a/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php b/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php new file mode 100644 index 00000000..d318660d --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.php @@ -0,0 +1,63 @@ +MessagesPanelEffect->Text = ""; + } + + public function setMessage($value) + { + $this->Message->Text = $value; + if ($value != '') + $this->setVisible(true); + else + $this->setVisible(false); + } + + public function setVisible($value) + { + $this->ensureChildControls(); + if ($value === true) { + echo "set visible"; + $this->MessagesPanel->Visible = true; + $this->Message->Visible = true; + $this->setEffect(null); + } else { + $this->MessagesPanel->Visible = false; + } + } + + public function setEffect($effect = null) + { + if ($effect !== null) { + $text = ""; + $this->MessagesPanelEffect->Text = $text; + } else { + $this->MessagesPanelEffect->Text = ''; + } + } + + public function setPanelCssClass($value) + { + $this->ensureChildControls(); + $this->MessagesPanel->CssClass = $value; + } + + public function setMessageCssClass($value) + { + $this->ensureChildControls(); + $this->Message->CssClass = $value; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.tpl b/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.tpl new file mode 100644 index 00000000..b7e73119 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DMessagesPanel.tpl @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page b/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page new file mode 100644 index 00000000..8b39dc55 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page @@ -0,0 +1,7 @@ + +

        DatePicker in Callback

        + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php b/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php new file mode 100644 index 00000000..94a4ec25 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php @@ -0,0 +1,17 @@ +IsPostBack) + $this->datepicker->setTimeStamp(time()); + } + + public function testDatePicker($sender, $param){ + $this->status->Text = $this->datepicker->getTimestamp()." ".$this->datepicker->getText(); + } + + } + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.page b/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.page new file mode 100644 index 00000000..ab4798a8 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.page @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.php new file mode 100644 index 00000000..9a59713d --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/MessagesPanelTest.php @@ -0,0 +1,16 @@ +panel1->setMessage("hello world"); + } + + function hide_clicked($sender, $param) + { + $this->panel1->setMessage(""); + } +} + +?> \ No newline at end of file -- cgit v1.2.3