diff options
Diffstat (limited to 'demos')
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">
<%@ Title="My Blog - Manage User Accounts" %>
<com:TContent ID="Main">
-
+
<h1>Manage User Accounts</h1>
<a href="<%= $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 <com:TBoundColumn
HeaderText="Email"
DataField="email" />
-
+
<com:TCheckBoxColumn
HeaderText="Administrator"
DataField="role" />
-
+
<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 <%@ Title="My Blog - Edit User" %>
<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">
<%@ Title="My Blog - Login" %>
<com:TContent ID="Main">
-
+
<h1>Login</h1>
<span>Username:</span>
-<com:TRequiredFieldValidator
+<com:TRequiredFieldValidator
ControlToValidate="Username"
- ErrorMessage="Please provide your username."
+ ErrorMessage="Please provide your username."
Display="Dynamic" />
<br/>
<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">
-<com:THyperLink Text="Login"
+<com:THyperLink Text="Login"
NavigateUrl="<%= $this->Service->constructUrl('users.LoginUser') %>"
Visible="<%= $this->User->IsGuest %>" />
-<com:TLinkButton Text="Logout"
+<com:TLinkButton Text="Logout"
OnClick="logoutButtonClicked"
Visible="<%= !$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: <%@ Title="My Blog - New User" %>
<com:TContent ID="Main">
-
+
<h1>Create New User</h1>
<span>Username:</span>
-<com:TRequiredFieldValidator
+<com:TRequiredFieldValidator
ControlToValidate="Username"
- ErrorMessage="Please provide a username."
+ ErrorMessage="Please provide a username."
Display="Dynamic" />
<com:TCustomValidator
ControlToValidate="Username"
@@ -42,9 +46,9 @@ Based on the above analysis, we write the page template as follows: <br/>
<span>Password:</span>
-<com:TRequiredFieldValidator
+<com:TRequiredFieldValidator
ControlToValidate="Password"
- ErrorMessage="Please provide a password."
+ ErrorMessage="Please provide a password."
Display="Dynamic" />
<br/>
<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>
|