From 3a7602effa90c05e8f9e4fbfd6db7d774e16beb1 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 1 Oct 2007 01:10:04 +0000 Subject: final fixes. --- demos/blog/protected/Common/BlogUserManager.php | 22 +++++++++++++++++ demos/chat/protected/App_Code/ChatUserManager.php | 28 +++++++++++++++++++--- .../protected/pages/Configurations/UrlMapping.page | 2 +- .../protected/pages/Controls/TabPanel.page | 14 +++++------ .../protected/pages/Database/ActiveRecord.page | 16 ++++++------- .../pages/GettingStarted/NewFeatures.page | 2 +- .../protected/App_Code/UserManager.php | 26 ++++++++++++++++++-- 7 files changed, 88 insertions(+), 22 deletions(-) (limited to 'demos') diff --git a/demos/blog/protected/Common/BlogUserManager.php b/demos/blog/protected/Common/BlogUserManager.php index a3053c61..efaa7f1f 100644 --- a/demos/blog/protected/Common/BlogUserManager.php +++ b/demos/blog/protected/Common/BlogUserManager.php @@ -68,6 +68,28 @@ class BlogUserManager extends TModule implements IUserManager else return false; } + + /** + * Saves user auth data into a cookie. + * @param THttpCookie the cookie to receive the user auth data. + * @since 3.1.1 + */ + public function saveUserToCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + } + + /** + * Returns a user instance according to auth data stored in a cookie. + * @param THttpCookie the cookie storing user authentication information + * @return TUser the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data. + * @since 3.1.1 + */ + public function getUserFromCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + return null; + } } ?> \ No newline at end of file diff --git a/demos/chat/protected/App_Code/ChatUserManager.php b/demos/chat/protected/App_Code/ChatUserManager.php index f8fe09cc..f28ee362 100644 --- a/demos/chat/protected/App_Code/ChatUserManager.php +++ b/demos/chat/protected/App_Code/ChatUserManager.php @@ -9,7 +9,7 @@ class ChatUserManager extends TModule implements IUserManager { return 'Guest'; } - + /** * Returns a user instance given the user name. * @param string user name, null if it is a guest. @@ -18,7 +18,7 @@ class ChatUserManager extends TModule implements IUserManager public function getUser($username=null) { $user=new TUser($this); - $user->setIsGuest(true); + $user->setIsGuest(true); if($username !== null) { $user->setIsGuest(false); @@ -27,7 +27,7 @@ class ChatUserManager extends TModule implements IUserManager } return $user; } - + /** * Add a new user to the database. * @param string username. @@ -57,6 +57,28 @@ class ChatUserManager extends TModule implements IUserManager { return $this->usernameExists($username); } + + /** + * Saves user auth data into a cookie. + * @param THttpCookie the cookie to receive the user auth data. + * @since 3.1.1 + */ + public function saveUserToCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + } + + /** + * Returns a user instance according to auth data stored in a cookie. + * @param THttpCookie the cookie storing user authentication information + * @return TUser the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data. + * @since 3.1.1 + */ + public function getUserFromCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + return null; + } } diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 0837d50d..9ffec5f2 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -118,7 +118,7 @@ Since version 3.1.1, TUrlMapping starts to support constructing customi
A matching pattern is one whose ServiceID and ServiceParameter properties are the same as those passed to constructUrl() and whose named parameters are found in the GET variables. For example, constructUrl('Posts.ListPost',array('cat'=>2)) will use the third pattern in the above example. -
+
By default, TUrlMapping will construct URLs prefixed with the currently requesting PHP script path, such as /path/to/index.php/article/3. Users may change this behavior by explicitly specifying the URL prefix through its UrlPrefix property. For example, if the Web server configuration treats index.php as the default script, we can set UrlPrefix as /path/to and the constructed URL will look like /path/to/article/3.
diff --git a/demos/quickstart/protected/pages/Controls/TabPanel.page b/demos/quickstart/protected/pages/Controls/TabPanel.page
index d85de681..c9faaa19 100644
--- a/demos/quickstart/protected/pages/Controls/TabPanel.page
+++ b/demos/quickstart/protected/pages/Controls/TabPanel.page
@@ -1,13 +1,13 @@
+
TTabPanel displays a tabbed panel. Users can click on the tab bar to switching among different tab views. Each tab view is an independent panel that can contain arbitrary content.
+
A TTabPanel control consists of one or several TTabView controls representing the possible tab views. At any time, only one tab view is visible (active), which is specified by any of the following properties:
+
If both ActiveViewIndex and ActiveViewID are set, the latter takes precedence.
+
TTabPanel uses CSS to specify the appearance of the tab bar and panel. By default, an embedded CSS file will be published which contains the default CSS for TTabPanel. You may also use your own CSS file by specifying the CssUrl property. The following properties specify the CSS classes used for elements in a TTabPanel:
+
To use TTabPanel, write a template like following:
+
Prado's implementation of Active Record does not maintain referential identity. Each object obtained using
Active Record is a copy of the data in the database. For example, If you ask for
a particular customer and get back a Customer object, the next time you ask for
that customer you get back another instance of a Customer object. This implies that a strict
comparison (i.e., using ===) will return false, while loose comparison (i.e., using ==) will
return true if the object values are equal by loose comparison.
-
-
+
+
This is design implication related to the following question.
"Do you think of the customer as an object, of which there's only one,
or do you think of the objects you operate on as copies of the database?"
@@ -1059,14 +1059,14 @@ arrays. E.g. $player->skills[] = new SkillRecord(). If array w
will be thrown.
+
Since v3.1.1, Active Record starts to support column mapping. Column mapping allows developers
to address columns in Active Record using a more consistent naming convention. In particular,
using column mapping, one can access a column using whatever name he likes, rather than limited by
the name defined in the database schema.
+
To use column mapping, declare a static array named COLUMN_MAPPING in the Active Record class.
The keys of the array are column names (called physical column names) as defined in the database
schema, while the values are corresponding property names (called logical column names) defined
@@ -1093,7 +1093,7 @@ class UserRecord extends TActiveRecord
//....
}
+
With the above column mapping, we can address first_name using $userRecord->firstName
instead of $userRecord->first_name. This helps separation of logic and model.
TTabPanel
+TTabPanel
Design Implications
-Design Implications
+Column Mapping
-Column Mapping
+