From f56a3799ded6b18c98eb9810d9e4c79a9c23c796 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 19 Jan 2006 14:40:15 +0000 Subject: Updated "personal" demo. --- demos/personal/protected/Pages/Home.php | 14 --------- demos/personal/protected/Pages/Layout.php | 5 ++++ demos/personal/protected/Pages/Layout.tpl | 42 ++++++++++++++++++--------- demos/personal/protected/Pages/Settings.page | 4 +++ demos/personal/protected/Pages/UserLogin.page | 23 +++++++++++---- demos/personal/protected/Pages/UserLogin.php | 13 ++++++--- demos/personal/protected/Pages/config.xml | 3 ++ demos/personal/protected/application.xml | 6 +++- 8 files changed, 72 insertions(+), 38 deletions(-) create mode 100644 demos/personal/protected/Pages/Settings.page (limited to 'demos/personal') diff --git a/demos/personal/protected/Pages/Home.php b/demos/personal/protected/Pages/Home.php index cca7d57b..badbca73 100644 --- a/demos/personal/protected/Pages/Home.php +++ b/demos/personal/protected/Pages/Home.php @@ -2,20 +2,6 @@ class Home extends TPage { - public function onPreInit($param) - { - parent::onPreInit($param); - if(!$this->getUser()->getIsGuest()) - $this->setTheme(''); - } - - public function testClick($sender,$param) - { - if($sender->BackColor==='') - $sender->BackColor='blue'; - else - $sender->BackColor=''; - } } ?> \ No newline at end of file diff --git a/demos/personal/protected/Pages/Layout.php b/demos/personal/protected/Pages/Layout.php index ba96038b..37ed95d4 100644 --- a/demos/personal/protected/Pages/Layout.php +++ b/demos/personal/protected/Pages/Layout.php @@ -2,6 +2,11 @@ class Layout extends TTemplateControl { + public function logout($sender,$param) + { + $this->Application->getModule('auth')->logout(); + $this->Response->redirect($this->Service->constructUrl('Home')); + } } ?> \ No newline at end of file diff --git a/demos/personal/protected/Pages/Layout.tpl b/demos/personal/protected/Pages/Layout.tpl index db6dd242..f1064231 100644 --- a/demos/personal/protected/Pages/Layout.tpl +++ b/demos/personal/protected/Pages/Layout.tpl @@ -1,29 +1,45 @@ - -My Personal Website - + + + + +
-

Your Name Here

-

My Personal Site

- +

Your Name Here

+

My Personal Site

+ +
+
+
+
+ \ No newline at end of file diff --git a/demos/personal/protected/Pages/Settings.page b/demos/personal/protected/Pages/Settings.page new file mode 100644 index 00000000..48dfde96 --- /dev/null +++ b/demos/personal/protected/Pages/Settings.page @@ -0,0 +1,4 @@ + +Welcome, User->Name %> />! +This page contains site settings accessible only to site admin. + \ No newline at end of file diff --git a/demos/personal/protected/Pages/UserLogin.page b/demos/personal/protected/Pages/UserLogin.page index 588b8f6a..4bad6780 100644 --- a/demos/personal/protected/Pages/UserLogin.page +++ b/demos/personal/protected/Pages/UserLogin.page @@ -1,7 +1,18 @@ -Username:
-Password:
- - -
- +Username: + + +
+Password:
+ + + + \ No newline at end of file diff --git a/demos/personal/protected/Pages/UserLogin.php b/demos/personal/protected/Pages/UserLogin.php index 70cbc986..0dd2cd79 100644 --- a/demos/personal/protected/Pages/UserLogin.php +++ b/demos/personal/protected/Pages/UserLogin.php @@ -5,10 +5,15 @@ class UserLogin extends TPage public function login($sender,$param) { $manager=$this->Application->getModule('auth'); - if($manager->login($this->username->Text,$this->password->Text)) - $this->Application->Response->redirect($this->Application->Request->Items['ReturnUrl']); - else - $this->error->Text='login failed'; + if(!$manager->login($this->Username->Text,$this->Password->Text)) + $param->IsValid=false; + } + + public function onLoadComplete($param) + { + parent::onLoadComplete($param); + if($this->IsPostBack && $this->IsValid) + $this->Response->redirect($this->Request->Items['ReturnUrl']); } } diff --git a/demos/personal/protected/Pages/config.xml b/demos/personal/protected/Pages/config.xml index ca63c17b..fa047ceb 100644 --- a/demos/personal/protected/Pages/config.xml +++ b/demos/personal/protected/Pages/config.xml @@ -1,5 +1,8 @@ + + + \ No newline at end of file diff --git a/demos/personal/protected/application.xml b/demos/personal/protected/application.xml index dbb51264..84467e98 100644 --- a/demos/personal/protected/application.xml +++ b/demos/personal/protected/application.xml @@ -7,6 +7,10 @@ --> + + + + @@ -18,7 +22,7 @@ - + -- cgit v1.2.3