summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial
diff options
context:
space:
mode:
authorxue <>2007-05-28 00:58:40 +0000
committerxue <>2007-05-28 00:58:40 +0000
commit82a351192f38cc73268ea7de7a48e2e0425d5cbf (patch)
tree2d91629f8e5c48bb1e26aef8f420d0e95b4f2bb9 /demos/blog-tutorial
parent87b0b5735f95afb8a59124e3007bd6e6d95d3e48 (diff)
Fixed a bug when using renderer in TWizard's sidebar.
Diffstat (limited to 'demos/blog-tutorial')
-rw-r--r--demos/blog-tutorial/protected/common/TopicList.tpl9
-rw-r--r--demos/blog-tutorial/protected/pages/Day2/CreateDB.page9
-rw-r--r--demos/blog-tutorial/protected/pages/Day3/CreateAdminUser.page13
-rw-r--r--demos/blog-tutorial/protected/pages/Day3/CreateEditUser.page6
-rw-r--r--demos/blog-tutorial/protected/pages/Day3/CreateLoginUser.page16
-rw-r--r--demos/blog-tutorial/protected/pages/Day3/CreateNewUser.page14
-rw-r--r--demos/blog-tutorial/protected/pages/Requirements.page2
7 files changed, 40 insertions, 29 deletions
diff --git a/demos/blog-tutorial/protected/common/TopicList.tpl b/demos/blog-tutorial/protected/common/TopicList.tpl
index e8a8c7bd..71605274 100644
--- a/demos/blog-tutorial/protected/common/TopicList.tpl
+++ b/demos/blog-tutorial/protected/common/TopicList.tpl
@@ -29,7 +29,7 @@
<div class="topic">
<div>Day 3: Implementing User Management</div>
<ul>
- <li><a href="?page=Day3.Overview">User Management Overview</a></li>
+ <li><a href="?page=Day3.Overview">Overview</a></li>
<li><a href="?page=Day3.Auth">Authentication and Authorization</a></li>
<li><a href="?page=Day3.CreateLoginUser">Creating LoginUser Page</a></li>
<li><a href="?page=Day3.CreateNewUser">Creating NewUser Page</a></li>
@@ -41,9 +41,9 @@
<div class="topic">
<div>Day 4: Implementing Post Management</div>
<ul>
- <li><a href="?page=Day4.Overview">Post Management Overview</a></li>
- <li><a href="?page=Day4.CreateReadPost">Creating ReadPost Page</a></li>
+ <li><a href="?page=Day4.Overview">Overview</a></li>
<li><a href="?page=Day4.CreateListPost">Creating ListPost Page</a></li>
+ <li><a href="?page=Day4.CreateReadPost">Creating ReadPost Page</a></li>
<li><a href="?page=Day4.CreateNewPost">Creating NewPost Page</a></li>
<li><a href="?page=Day4.CreateEditPost">Creating EditPost Page</a></li>
<li><a href="?page=Day4.CreateAdminPost">Creating AdminPost Page</a></li>
@@ -53,8 +53,7 @@
<div class="topic">
<div>Day 5: Creating Portlets</div>
<ul>
- <li><a href="?page=Day5.Create">Overview</a></li>
- <li><a href="?page=Day4.CreateReadPost">Creating ReadPost Page</a></li>
+ <li><a href="?page=">Overview</a></li>
</div>
<div class="topic">
diff --git a/demos/blog-tutorial/protected/pages/Day2/CreateDB.page b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page
index de4e2436..7c914962 100644
--- a/demos/blog-tutorial/protected/pages/Day2/CreateDB.page
+++ b/demos/blog-tutorial/protected/pages/Day2/CreateDB.page
@@ -30,8 +30,8 @@ CREATE TABLE users (
/* create posts table */
CREATE TABLE posts (
post_id INTEGER NOT NULL PRIMARY KEY,
- author_id VARCHAR(128) NOT NULL
- CONSTRAINT fk_author REFERENCES users(username),
+ author_id VARCHAR(128) NOT NULL
+ CONSTRAINT fk_author REFERENCES users(username),
create_time INTEGER NOT NULL, /* UNIX timestamp */
title VARCHAR(256) NOT NULL, /* title of the post */
content TEXT, /* post body */
@@ -45,10 +45,7 @@ INSERT INTO posts VALUES (NULL, 'admin', 1175708482, 'first post', 'this is my f
</com:TTextHighlighter>
<com:NoteBox>
-SQLite does not support <a href="http://www.sqlite.org/omitted.html">foreign key constraint</a> such that
-the constraints can still be defined but will be ignored by SQLite.
-Therefore, we will write PHP code to ensure that the <tt>posts.author_id</tt> field contains valid data.
-Also, we are exploiting the fact that the <tt>posts.post_id</tt> field is <a href="http://www.sqlite.org/autoinc.html">auto-incremental</a> if we assign NULL to it.
+The <tt>fk_author</tt> constraint is ignored by SQLite because SQLite does not support <a href="http://www.sqlite.org/omitted.html">foreign key constraint</a>. Nevertheless, we still keep the constraint there for the capability of porting our blog system to different DBMS. Also, in the above we are exploiting the fact that the <tt>posts.post_id</tt> field is <a href="http://www.sqlite.org/autoinc.html">auto-incremental</a> if we assign NULL to it.
</com:NoteBox>
<p>
diff --git a/demos/blog-tutorial/protected/pages/Day3/CreateAdminUser.page b/demos/blog-tutorial/protected/pages/Day3/CreateAdminUser.page
index 95d7dac5..a91895a9 100644
--- a/demos/blog-tutorial/protected/pages/Day3/CreateAdminUser.page
+++ b/demos/blog-tutorial/protected/pages/Day3/CreateAdminUser.page
@@ -16,6 +16,9 @@ We will display the user list in a table. Each row of the table represents a sin
<li>Command - displays a column of "Delete" buttons. Clicking on any of them will lead to deletion of the corresponding user account.</li>
</ul>
+<p>
+We create two files <tt>protected/pages/users/AdminUser.page</tt> and <tt>protected/pages/users/AdminUser.php</tt> to save the page template and page class, respectively.
+</p>
<h2>Creating Page Template</h2>
<p>
@@ -28,13 +31,13 @@ We use <a href="http://www.pradosoft.com/demos/quickstart/?page=Controls.DataGri
<li><a href="http://www.pradosoft.com/docs/classdoc/TButtonColumn">TButtonColumn</a> displays a column of "Delete" buttons.</li>
</ul>
-<p>Complete page template is shown as follows:</p>
+<p>The complete page template is shown as follows:</p>
<com:TTextHighlighter CssClass="source" Language="prado">
&lt;%@ Title="My Blog - Manage User Accounts" %>
&lt;com:TContent ID="Main">
-
+
<h1>Manage User Accounts</h1>
<a href="&lt;%= $this->Service->constructUrl('users.NewUser')%>">Create New User</a>
@@ -57,14 +60,14 @@ We use <a href="http://www.pradosoft.com/demos/quickstart/?page=Controls.DataGri
&lt;com:TBoundColumn
HeaderText="Email"
DataField="email" />
-
+
&lt;com:TCheckBoxColumn
HeaderText="Administrator"
DataField="role" />
-
+
&lt;com:TButtonColumn
HeaderText="Command"
- Text="Delete"
+ Text="Delete"
ButtonType="PushButton"
CommandName="delete" />
diff --git a/demos/blog-tutorial/protected/pages/Day3/CreateEditUser.page b/demos/blog-tutorial/protected/pages/Day3/CreateEditUser.page
index 055ea62b..c2e2db86 100644
--- a/demos/blog-tutorial/protected/pages/Day3/CreateEditUser.page
+++ b/demos/blog-tutorial/protected/pages/Day3/CreateEditUser.page
@@ -15,6 +15,10 @@ To determine which user account is to be editted, we use the following policy:
<li>If the current user is a normal user, he can only edit his own account information, and he cannot modify his role data.</li>
</ul>
+<p>
+We create two files <tt>protected/pages/users/EditUser.page</tt> and <tt>protected/pages/users/EditUser.php</tt> to save the page template and page class, respectively.
+</p>
+
<h2>Creating Page Template</h2>
<p>
As you may have guessed, the page template <tt>EditUser</tt> is largely the same as that of <tt>NewUser</tt>. Besides the difference in page title and the caption of the submit button, there are three main differences.
@@ -30,7 +34,7 @@ As you may have guessed, the page template <tt>EditUser</tt> is largely the same
&lt;%@ Title="My Blog - Edit User" %>
&lt;com:TContent ID="Main">
-
+
<h1>Edit User</h1>
<span>Username:</span>
diff --git a/demos/blog-tutorial/protected/pages/Day3/CreateLoginUser.page b/demos/blog-tutorial/protected/pages/Day3/CreateLoginUser.page
index d54fc967..6d7967d4 100644
--- a/demos/blog-tutorial/protected/pages/Day3/CreateLoginUser.page
+++ b/demos/blog-tutorial/protected/pages/Day3/CreateLoginUser.page
@@ -16,23 +16,27 @@ The workflow of <tt>LoginUser</tt> is very similar to the <a href="?page=Day1.Cr
<li>If the user enters correct username and password, the system assigns him a valid identity and redirects his browser to the desired privileged page; If not, a "password invalid" message is displayed.
</ol>
+<p>
+We create two files <tt>protected/pages/users/LoginUser.page</tt> and <tt>protected/pages/users/LoginUser.php</tt> to save the page template and page class, respectively.
+</p>
+
<h2>Creating Page Template</h2>
<p>
-Below we show the template for <tt>LoginPage</tt>. As we see, the page mainly contains a text box for collecting username and a text box for password. The username input is required, which is ensured by the <tt>TRequiredFieldValidator</tt>. The correctness of the password input is ensured by the <a href="http://www.pradosoft.com/demos/quickstart/index.php?page=Controls.Validation">TCustomValidator</a> which invokes the page's <tt>validateUser()</tt> method when validation is performed. The page also has "login" button which invokes the page's <tt>loginButtonClicked()</tt> when it is clicked.
+Below we show the template for <tt>LoginUser</tt>. As we see, the page mainly contains a text box for collecting username and a text box for password. The username input is required, which is ensured by the <tt>TRequiredFieldValidator</tt>. The correctness of the password input is ensured by the <a href="http://www.pradosoft.com/demos/quickstart/index.php?page=Controls.Validation">TCustomValidator</a> which invokes the page's <tt>validateUser()</tt> method when validation is performed. The page also has "login" button which invokes the page's <tt>loginButtonClicked()</tt> when it is clicked.
</p>
<com:TTextHighlighter CssClass="source" Language="prado">
&lt;%@ Title="My Blog - Login" %>
&lt;com:TContent ID="Main">
-
+
<h1>Login</h1>
<span>Username:</span>
-&lt;com:TRequiredFieldValidator
+&lt;com:TRequiredFieldValidator
ControlToValidate="Username"
- ErrorMessage="Please provide your username."
+ ErrorMessage="Please provide your username."
Display="Dynamic" />
<br/>
&lt;com:TTextBox ID="Username" />
@@ -116,11 +120,11 @@ We modify the footer section of the <tt>MainLayout</tt>'s template as follows. T
<com:TTextHighlighter CssClass="source" Language="prado">
<div id="footer">
-&lt;com:THyperLink Text="Login"
+&lt;com:THyperLink Text="Login"
NavigateUrl="&lt;%= $this->Service->constructUrl('users.LoginUser') %>"
Visible="&lt;%= $this->User->IsGuest %>" />
-&lt;com:TLinkButton Text="Logout"
+&lt;com:TLinkButton Text="Logout"
OnClick="logoutButtonClicked"
Visible="&lt;%= !$this->User->IsGuest %>" />
diff --git a/demos/blog-tutorial/protected/pages/Day3/CreateNewUser.page b/demos/blog-tutorial/protected/pages/Day3/CreateNewUser.page
index 77b97f7d..86da70d1 100644
--- a/demos/blog-tutorial/protected/pages/Day3/CreateNewUser.page
+++ b/demos/blog-tutorial/protected/pages/Day3/CreateNewUser.page
@@ -15,6 +15,10 @@ The <tt>NewUser</tt> page is provided to the administrator user to create new a
<li><tt>last_name</tt> - string, optional</li>
</ul>
+<p>
+We create two files <tt>protected/pages/users/NewUser.page</tt> and <tt>protected/pages/users/NewUser.php</tt> to save the page template and page class, respectively.
+</p>
+
<h2>Creating Page Template</h2>
<p>
Based on the above analysis, we write the page template as follows:
@@ -24,13 +28,13 @@ Based on the above analysis, we write the page template as follows:
&lt;%@ Title="My Blog - New User" %>
&lt;com:TContent ID="Main">
-
+
<h1>Create New User</h1>
<span>Username:</span>
-&lt;com:TRequiredFieldValidator
+&lt;com:TRequiredFieldValidator
ControlToValidate="Username"
- ErrorMessage="Please provide a username."
+ ErrorMessage="Please provide a username."
Display="Dynamic" />
&lt;com:TCustomValidator
ControlToValidate="Username"
@@ -42,9 +46,9 @@ Based on the above analysis, we write the page template as follows:
<br/>
<span>Password:</span>
-&lt;com:TRequiredFieldValidator
+&lt;com:TRequiredFieldValidator
ControlToValidate="Password"
- ErrorMessage="Please provide a password."
+ ErrorMessage="Please provide a password."
Display="Dynamic" />
<br/>
&lt;com:TTextBox ID="Password" TextMode="Password" />
diff --git a/demos/blog-tutorial/protected/pages/Requirements.page b/demos/blog-tutorial/protected/pages/Requirements.page
index 9fb7e2b6..46797b01 100644
--- a/demos/blog-tutorial/protected/pages/Requirements.page
+++ b/demos/blog-tutorial/protected/pages/Requirements.page
@@ -21,7 +21,7 @@ In general, the blog system should allow users to read blogs and authenticated u
<h2>Post Management</h2>
<ul>
-<li>The system shall allow listing posts by their creaing time in descending order with paging.</li>
+<li>The system shall allow listing posts by their creation time in descending order with paging.</li>
<li>The system shall allow viewing the detail of a selected post.</li>
<li>The system shall allow creating a new post by an authenticated user.</li>
<li>The system shall allow updating an existing post by its author or administrator.</li>