diff options
author | wei <> | 2007-01-06 00:00:57 +0000 |
---|---|---|
committer | wei <> | 2007-01-06 00:00:57 +0000 |
commit | bde6488e19b9852011a657fda8aa39680d9c4a62 (patch) | |
tree | 4550e521558ddde1e4c42c9d992501beda48b489 | |
parent | 6c2a7b9b5674c5c9f0c8e78e32531af43462638c (diff) |
Update docs.
20 files changed, 214 insertions, 79 deletions
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 <a href="http://www.pradosoft.com">PradoSoft</a>.</di $html = preg_replace_callback('/(?<=RunButton" )href=".*\?page=([a-zA-Z0-9\.#]+)"/',
array($this, 'update_run_url'), $html);
- $html = preg_replace('/(src|href)="\//', 'src="assets/',$html);
+ $html = preg_replace('/(src|href)=("?)\//', '$1=$2assets/',$html);
$html = str_replace('http://www.pradosoft.com/docs/manual', '../manual/CHMdefaultConverter', $html);
$html = str_replace('target="_blank">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('/<com:TTextHighlighter[^>]*>((.|\n)*?)<\/com:TTextHighlighter>/', array($this,'escape_verbatim'), $html);
+ $html = preg_replace_callback('/<com:TTextHighlighter[^>]*>((.|\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('/(<div class="source">)((.|\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('/<com:DocLink\s+ClassPath="([^"]*)[.]([^."]*)"\s+Text="([^"]+)"\s*\/>/',
+ '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$3}', $html);
+
$html = preg_replace('/<com:DocLink\s+ClassPath="([^"]*)[.]([^.]*)"\s+\/>/',
'\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[^>]*>([^<]*)<\/i>/', '\emph{$1}', $html);
+ $html = preg_replace('/<i[^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html);
$html = preg_replace_callback('/<tt>([^<]*)<\/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 @@ <div>Tutorials</div>
<ul>
<li><a href="?page=GettingStarted.HelloWorld">Creating First PRADO Application</a></li>
+ <li><a href="?page=Fundamentals.Hangman">Sample: Hangman Game</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Currency Converter</a></li>
<li><a href="?page=Tutorial.AjaxChat">AJAX Chat Client</a></li>
<li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
@@ -30,7 +31,6 @@ <li><a href="?page=Fundamentals.Modules">Modules</a></li>
<li><a href="?page=Fundamentals.Services">Services</a></li>
<li><a href="?page=Fundamentals.Applications">Applications</a></li>
- <li><a href="?page=Fundamentals.Hangman">Sample: Hangman Game</a></li>
</ul>
</div>
@@ -67,26 +67,13 @@ <li><a href="?page=Database.SqlMap">SqlMap Data Mapper</a></li>
</ul>
</div>
-<!--
-<div class="topic">
-<div>Module Reference</div>
-<ul>
-</ul>
-</div>
<div class="topic">
-<div>Service Reference</div>
-<ul>
-</ul>
-</div>
--->
-<div class="topic">
<div>Advanced Topics</div>
<ul>
<li><a href="?page=Advanced.Collections">Collections</a></li>
<li><a href="?page=Advanced.Auth">Authentication and Authorization</a></li>
<li><a href="?page=Advanced.Security">Security</a></li>
- <li><a href="?page=Advanced.Scripts">Client-side Scripting</a></li>
<li><a href="?page=Advanced.Assets">Assets</a></li>
<li><a href="?page=Advanced.MasterContent">Master and Content</a></li>
<li><a href="?page=Advanced.Themes">Themes and Skins</a></li>
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 <tt>TUrlMapping</tt>, one must set the <tt>UrlManager</tt> property of th The above example is part of the application configuration of the <tt>blog</tt> demo in the PRADO release. It enables recognition of the following URL formats:
</p>
<ul>
- <li><tt>/index.php/post/123</tt> is recognized as <tt>/index.php?page=Posts.ViewPost&id=123</tt></li>
- <li><tt>/index.php/archive/200605</tt> is recognized as <tt>/index.php?page=Posts.ListPost&time=200605</tt></li>
- <li><tt>/index.php/category/2</tt> is recognized as <tt>/index.php?page=Posts.ListPost&cat=2</tt></li>
+ <li><tt>/index.php/post/123</tt> is recognized as <tt>/index.php?page=Posts.ViewPost&id=123</tt></li>
+ <li><tt>/index.php/archive/200605</tt> is recognized as <tt>/index.php?page=Posts.ListPost&time=200605</tt></li>
+ <li><tt>/index.php/category/2</tt> is recognized as <tt>/index.php?page=Posts.ListPost&cat=2</tt></li>
</ul>
<p>
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 @@ <p>This tutorial introduces the Prado web application framework's <a href="?page=Database.ActiveRecord">ActiveRecord</a> and <a href="?page=ActiveControls.Home">Active Controls</a> 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. <ul> <li>Building a custom User Manager class.</li> <li>Authenticating and adding a new user to the database.</li> @@ -39,19 +39,19 @@ php prado/framework/prado-cli.php -c chat <p>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 <tt>index.php</tt> script in the <tt>chat</tt> directory. You should see the message "Welcome to Prado!" </p> <h1>Authentication and Authorization</h1> <p>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 <tt>Login</tt> + page to deny access to anonymous users. First, let us create the <tt>Login</tt> page with the following code. We save the <tt>Login.php</tt> and <tt>Login.page</tt> in the <tt>chat/protected/pages/</tt> directory (there should be a <tt>Home.page</tt> - file there create by the command line tool). + file created by the command line tool). </p> <com:TTextHighlighter Language="php" CssClass="source"> <?php @@ -88,7 +88,7 @@ class Login extends TPage </html> </com:TTextHighlighter> <p>The login page contains - a <com:DocLink ClassPath="System.Web.UI.WebControls.TForm" Text="TForm" />, + a <com:DocLink ClassPath="System.Web.UI.TForm" Text="TForm" />, a <com:DocLink ClassPath="System.Web.UI.WebControls.TTextBox" Text="TTextBox" />, a <com:DocLink ClassPath="System.Web.UI.WebControls.TRequiredFieldValidator" Text="TRequiredFieldValidator" /> and a <com:DocLink ClassPath="System.Web.UI.WebControls.TButton" Text="TButton" />. The resulting @@ -133,8 +133,8 @@ secure the <tt>pages</tt> directory. </com:TTextHighlighter> We setup the authentication using the default classes as explained in the <a href="?page=Advanced.Auth">authentication/authorization quickstart</a>. -In the authorization definition, we allow anonymouse users to access the -<tt>Login</tt> page (anonymouse users is specified by the <tt>?</tt> question mark). +In the authorization definition, we allow anonymous users to access the +<tt>Login</tt> page (anonymous users is specified by the <tt>?</tt> question mark). We allow any users with role equal to "normal" (to be defined later) to access all the pages, that is, the <tt>Login</tt> and <tt>Home</tt> pages. Lastly, we deny all users without any roles to access any page. The authorization @@ -204,7 +204,7 @@ we import classes from the <tt>App_Code</tt> directory and add an <h2>Custom User Manager class</h2> <p>To implement a custom user manager module class we just need to extends the <tt>TModule</tt> class and implement the <tt>IUserManager</tt> -interface. The <tt>getGuestName()</tt>, <tt>getUser()</tt> and <tt>validateUser</tt> +interface. The <tt>getGuestName()</tt>, <tt>getUser()</tt> and <tt>validateUser()</tt> methods are required by the <tt>IUserManager</tt> interface. We save the custom user manager class as <tt>App_Code/ChatUserManager.php</tt>. </p> @@ -273,7 +273,7 @@ configuration with <tt>id="users"</tt>.</p> <p>To perform authentication, we just want the user to enter a unique username. We add a <com:DocLink ClassPath="System.Web.UI.WebControls.TCustomValidator" Text="TCustomValidator" /> -for validate the uniqueness of the username and add a <tt>OnClick</tt> event handler +for validate the uniqueness of the username and add an <tt>OnClick</tt> event handler for the login button.</p> <com:TTextHighlighter Language="prado" CssClass="source"> <com:TCustomValidator @@ -336,7 +336,7 @@ Finally, we redirect the client to the default <tt>Home</tt> page. <h2>Default Values for ActiveRecord</h2> <p>If you try to perform a login now, you will receive an error message like "<i>Property '<tt>ChatUserRecord::$last_activity</tt>' must not be null as defined -by column 'last_activity' in table 'chat_users'.</i>". This means that the <tt>$last_activity</tt> +by column '<tt>last_activity</tt>' in table '<tt>chat_users</tt>'.</i>". This means that the <tt>$last_activity</tt> 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 <tt>ChatUserRecord</tt> class. We shall demonstrate the later by @@ -359,13 +359,13 @@ public function setLast_Activity($value) } </com:TTextHighlighter> Notice that we renamed <tt>$last_activity</tt> to <tt>$_last_activity</tt> (note -the under score after the dollar sign). +the underscore after the dollar sign). </p> <h1>Main Chat Application</h1> <p>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. <com:TTextHighlighter Language="prado" CssClass="source"> <!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -432,7 +432,7 @@ and a button to send the message. </body> </html> </com:TTextHighlighter> -We have add two Active Control components: a +We added two Active Control components: a <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveTextBox" Text="TActiveTextBox" /> and a <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveButton" Text="TActiveButton" />. @@ -442,14 +442,14 @@ that will be very useful for understanding how the Active Controls work. </p> <h2>Exploring the Active Controls</h2> -<p>Lets have some fun before we proceed with setuping the chat buffering. We want +<p>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 <tt>OnClick</tt> event handler for the <tt>Send</tt> button. <com:TTextHighlighter Language="prado" CssClass="source"> <com:TActiveButton ID="sendButton" CssClass="send-button" Text="Send" OnClick="processMessage"/> -</com:TTextHighlighter > +</com:TTextHighlighter> And the corresponding event handler method in the <tt>Home.php</tt> class (we need to create this new file too). <com:TTextHighlighter Language="php" CssClass="source"> @@ -462,7 +462,7 @@ class Home extends TPage } </com:TTextHighlighter> 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 <tt>TJavascriptLogger</tt> console. +you should see whatever you have typed echoed in the <tt>TJavascriptLogger</tt> console. </p> <p>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 <tt>ChatUserRecord</tt> 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. </p> -<p>The next piece of the logic is to retreive the users messages from the buffer. +<p>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). </p> <h1>Putting It Together</h1> -<p>Nows comes to put the application flow together. In the <tt>Home.php</tt> we update +<p>Now comes to put the application flow together. In the <tt>Home.php</tt> we update the <tt>Send</tt> buttons <tt>OnClick</tt> event handler to use the application logic we just implemented. <com:TTextHighlighter Language="php" CssClass="source"> @@ -631,11 +631,11 @@ response (AJAX style). </p> <p>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 <tt>Send</tt> button is clicked. +user friendly. If you open two different browsers, you should be able to communicate +between the two users whenever the <tt>Send</tt> button is clicked. </p> -<p>The next part is perphaps the more tricker and fiddly than the other tasks. We +<p>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 <tt>Home.php</tt>, we can call this method when ever some callback event is raised, e.g. when the <tt>Send</tt> @@ -709,7 +709,7 @@ public function onLoad($param) refresh the user list. We can accomplish this by polling the server using a <com:DocLink ClassPath="System.Web.UI.ActiveControls.TTimeTriggeredCallback" Text="TTimeTriggeredCallback" /> control. We add a <tt>TTimeTriggeredCallback</tt> to the <tt>Home.page</tt> -and call the <tt>refresh</tt> handler method to defined in <tt>Home.php</tt>. +and call the <tt>refresh</tt> handler method defined in <tt>Home.php</tt>. We set the polling interval to 2 seconds. <com:TTextHighlighter Language="prado" CssClass="source"> <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 <p> The first component we add is a - <com:DocLink ClassPath="System.Web.UI.WebControls.TForm" Text="TForm" /> + <com:DocLink ClassPath="System.Web.UI.TForm" Text="TForm" /> that basically corresponds to the HTML <tt><form></tt> element. In Prado, only <b>one</b> <tt>TForm</tt> element is allowed per page. </p> @@ -151,7 +151,7 @@ class Home extends TPage <com:TTextHighlighter Language="prado" CssClass="source"> <com:TButton Text="Convert" OnClick="convert_clicked" /> </com:TTextHighlighter> - The value of the <tt>OnClick</tt>, "convert_clicked", will be the method + The value of the <tt>OnClick</tt>, "<tt>convert_clicked</tt>", will be the method name in the "Home.php" that will called when the user clicks on the "Convert" button. <com:TTextHighlighter Language="php" CssClass="source"> @@ -170,14 +170,14 @@ class Home extends TPage to the "Amount in Other Currency" label. </p> - <p>In the "convert_clicked" method the first parameter, <tt>$sender</tt>, + <p>In the "<tt>convert_clicked</tt>" method the first parameter, <tt>$sender</tt>, corresponds to the object that raised the event, in this case, the "Convert" button. The second parameter, <tt>$param</tt> contains any additional data that the <tt>$sender</tt> object may wish to have added. </p> <p>We shall now examine, the three lines that implements the simply currency - conversion in the "convert_clicked" method. + conversion in the "<tt>convert_clicked</tt>" method. <com:TTextHighlighter Language="php" CssClass="source"> $rate = floatval($this->currencyRate->Text); </com:TTextHighlighter> 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 <weizho[at]gmail[dot]com>
* @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 @@ * - <b>onInteractive</b> executed when callback request is in progress.
* - <b>onComplete</b>executed when callback response returns.
*
- * The <tt>OnSuccess</tt> and <tt>OnFailure</tt> events are raised when the
+ * The OnSuccess and OnFailure events are raised when the
* response is returned. A successful request/response will raise
- * <tt>OnSuccess</tt> event otherwise <tt>OnFailure</tt> will be raised.
+ * OnSuccess event otherwise OnFailure will be raised.
*
* - <b>onSuccess</b> executed when callback request returns and is successful.
* - <b>onFailure</b> executed when callback request returns and fails.
- * - <b>onException</b> raised when callback request fails due to
- * request/response errors.
+ * - <b>onException</b> raised when callback request fails due to request/response errors.
*
- * - <b>PostInputs</b> true to collect the form inputs and post them during
- * callback, default is true.
+ * - <b>PostInputs</b> true to collect the form inputs and post them during callback, default is true.
* - <b>RequestTimeOut</b> The request timeout in milliseconds.
- * - <b>HasPriority</b> 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.
- * - <b>EnablePageStateUpdate</b> enable the callback response to enable the
- * viewstate update. This will automatically set HasPrority to true when
- * enabled.
+ * - <b>HasPriority</b> 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.
+ * - <b>EnablePageStateUpdate</b> enable the callback response to enable the
+ * viewstate update. This will automatically set HasPrority to true when enabled.
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @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 @@ +<?php
+
+class DMessagesPanel extends TTemplateControl
+{
+ private $_panelCssClass = '';
+
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ $this->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 = "<script type=\"text/javascript\" language=\"javascript\">\r\n";
+ $text .= "// <![CDATA[\r\n";
+ //$text .= "new Effect.$effect(\"" . $this->Page->DMessagesPanel->MessagesPanel->ClientID . "\");\r\n";
+ $text .= "new Effect.$effect(\"" . $this->ClientID . "\");\r\n";
+ $text .= "// ]]>\r\n";
+ $text .= "</script>";
+ $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 @@ +<com:TActivePanel ID="MessagesPanel" Visible="true">
+ <com:TActiveLabel ID="Message" Visible="true"/>
+</com:TActivePanel>
+<com:TLiteral ID="MessagesPanelEffect"/>
\ 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 @@ +<com:TForm>
+<h1>DatePicker in Callback</h1>
+
+<com:TDatePicker ID="datepicker" />
+<com:TActiveLinkButton OnCallback="testDatePicker" Text="testDatePicker" />
+<com:TActiveLabel ID="status" />
+</com:TForm>
\ 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 @@ +<?php
+
+class DatePickerInCallback extends TPage {
+
+ public function onLoad($param){
+ parent::onLoad($param);
+ if(!$this->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 @@ +<com:TForm>
+
+<com:Application.pages.DMessagesPanel ID="panel1" PanelCssClass="one1" />
+<com:TActiveButton Text="Show" OnClick="show_clicked" />
+<com:TActiveButton Text="Hide" OnClick="hide_clicked" />
+<com:TJavascriptLogger />
+</com:TForm>
\ 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 @@ +<?php
+
+class MessagesPanelTest extends TPage
+{
+ function show_clicked($sender, $param)
+ {
+ $this->panel1->setMessage("hello world");
+ }
+
+ function hide_clicked($sender, $param)
+ {
+ $this->panel1->setMessage("");
+ }
+}
+
+?>
\ No newline at end of file |