From 82a351192f38cc73268ea7de7a48e2e0425d5cbf Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 28 May 2007 00:58:40 +0000 Subject: Fixed a bug when using renderer in TWizard's sidebar. --- demos/blog-tutorial/protected/pages/Day2/CreateDB.page | 9 +++------ .../protected/pages/Day3/CreateAdminUser.page | 13 ++++++++----- .../protected/pages/Day3/CreateEditUser.page | 6 +++++- .../protected/pages/Day3/CreateLoginUser.page | 16 ++++++++++------ .../protected/pages/Day3/CreateNewUser.page | 14 +++++++++----- demos/blog-tutorial/protected/pages/Requirements.page | 2 +- 6 files changed, 36 insertions(+), 24 deletions(-) (limited to 'demos/blog-tutorial/protected/pages') 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 -SQLite does not support foreign key constraint such that -the constraints can still be defined but will be ignored by SQLite. -Therefore, we will write PHP code to ensure that the posts.author_id field contains valid data. -Also, we are exploiting the fact that the posts.post_id field is auto-incremental if we assign NULL to it. +The fk_author constraint is ignored by SQLite because SQLite does not support foreign key constraint. 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 posts.post_id field is auto-incremental if we assign NULL to it.

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

  • Command - displays a column of "Delete" buttons. Clicking on any of them will lead to deletion of the corresponding user account.
  • +

    +We create two files protected/pages/users/AdminUser.page and protected/pages/users/AdminUser.php to save the page template and page class, respectively. +

    Creating Page Template

    @@ -28,13 +31,13 @@ We use TButtonColumn displays a column of "Delete" buttons. -

    Complete page template is shown as follows:

    +

    The complete page template is shown as follows:

    <%@ Title="My Blog - Manage User Accounts" %> <com:TContent ID="Main"> - +

    Manage User Accounts

    Create New User @@ -57,14 +60,14 @@ We use - + <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:
  • If the current user is a normal user, he can only edit his own account information, and he cannot modify his role data.
  • +

    +We create two files protected/pages/users/EditUser.page and protected/pages/users/EditUser.php to save the page template and page class, respectively. +

    +

    Creating Page Template

    As you may have guessed, the page template EditUser is largely the same as that of NewUser. 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 EditUser is largely the same <%@ Title="My Blog - Edit User" %> <com:TContent ID="Main"> - +

    Edit User

    Username: 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 LoginUser is very similar to the
    +

    +We create two files protected/pages/users/LoginUser.page and protected/pages/users/LoginUser.php to save the page template and page class, respectively. +

    +

    Creating Page Template

    -Below we show the template for LoginPage. 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 TRequiredFieldValidator. The correctness of the password input is ensured by the TCustomValidator which invokes the page's validateUser() method when validation is performed. The page also has "login" button which invokes the page's loginButtonClicked() when it is clicked. +Below we show the template for LoginUser. 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 TRequiredFieldValidator. The correctness of the password input is ensured by the TCustomValidator which invokes the page's validateUser() method when validation is performed. The page also has "login" button which invokes the page's loginButtonClicked() when it is clicked.

    <%@ Title="My Blog - Login" %> <com:TContent ID="Main"> - +

    Login

    Username: -<com:TRequiredFieldValidator +<com:TRequiredFieldValidator ControlToValidate="Username" - ErrorMessage="Please provide your username." + ErrorMessage="Please provide your username." Display="Dynamic" />
    <com:TTextBox ID="Username" /> @@ -116,11 +120,11 @@ We modify the footer section of the MainLayout's template as follows. T