summaryrefslogtreecommitdiff
path: root/demos/personal/protected/Common
diff options
context:
space:
mode:
authorxue <>2007-02-09 19:02:43 +0000
committerxue <>2007-02-09 19:02:43 +0000
commit8d156610be187427d43f4d033b258f060f8968ad (patch)
treea4aa2a899d47dec014bb61d307930fed579a75bb /demos/personal/protected/Common
parent08fab57660b3cac36630ca6e2c4f677d1d7f2655 (diff)
reorganize personal demo.
Diffstat (limited to 'demos/personal/protected/Common')
-rw-r--r--demos/personal/protected/Common/LoginPortlet.php19
-rw-r--r--demos/personal/protected/Common/LoginPortlet.tpl44
-rw-r--r--demos/personal/protected/Common/MainMenu.php12
-rw-r--r--demos/personal/protected/Common/MainMenu.tpl15
4 files changed, 90 insertions, 0 deletions
diff --git a/demos/personal/protected/Common/LoginPortlet.php b/demos/personal/protected/Common/LoginPortlet.php
new file mode 100644
index 00000000..1f5cd4f5
--- /dev/null
+++ b/demos/personal/protected/Common/LoginPortlet.php
@@ -0,0 +1,19 @@
+<?php
+
+class LoginPortlet extends TTemplateControl
+{
+ public function validateUser($sender,$param)
+ {
+ $authManager=$this->Application->getModule('auth');
+ if(!$authManager->login($this->Username->Text,$this->Password->Text))
+ $param->IsValid=false;
+ }
+
+ public function loginButtonClicked($sender,$param)
+ {
+ if($this->Page->IsValid)
+ $this->Response->redirect($this->Application->getModule('auth')->getReturnUrl());
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/personal/protected/Common/LoginPortlet.tpl b/demos/personal/protected/Common/LoginPortlet.tpl
new file mode 100644
index 00000000..82f9c045
--- /dev/null
+++ b/demos/personal/protected/Common/LoginPortlet.tpl
@@ -0,0 +1,44 @@
+<com:TPanel CssClass="login" DefaultButton="LoginButton">
+ <h4>Login to Site</h4>
+ <com:TLabel
+ ForControl="Username"
+ Text="User Name"
+ CssClass="label"/>
+ <com:TTextBox ID="Username"
+ AccessKey="u"
+ ValidationGroup="login"
+ CssClass="textbox"/>
+ <com:TRequiredFieldValidator
+ ControlToValidate="Username"
+ ValidationGroup="login"
+ Display="Dynamic"
+ ErrorMessage="*"/>
+
+ <com:TLabel
+ ForControl="Password"
+ Text="Password"
+ CssClass="label"/>
+ <com:TTextBox ID="Password"
+ AccessKey="p"
+ CssClass="textbox"
+ ValidationGroup="login"
+ TextMode="Password"/>
+ <com:TCustomValidator
+ ControlToValidate="Password"
+ ValidationGroup="login"
+ Text="...invalid"
+ Display="Dynamic"
+ OnServerValidate="validateUser" />
+
+ <div>
+ <com:TCheckBox ID="RememberMe" Text="Remember me next time"/>
+ </div>
+
+ <com:TImageButton ID="LoginButton"
+ OnClick="loginButtonClicked"
+ ImageUrl="<%=$this->Page->Theme->BaseUrl.'/images/button-login.gif'%>"
+ ValidationGroup="login"
+ CssClass="button"/>
+ or
+ <a href="<%=$this->Service->constructUrl('Register')%>" class="button"><img src="<%=$this->Page->Theme->BaseUrl.'/images/button-create.gif'%>" alt="Create a new account"/></a>
+</com:TPanel> \ No newline at end of file
diff --git a/demos/personal/protected/Common/MainMenu.php b/demos/personal/protected/Common/MainMenu.php
new file mode 100644
index 00000000..a2334c03
--- /dev/null
+++ b/demos/personal/protected/Common/MainMenu.php
@@ -0,0 +1,12 @@
+<?php
+
+class MainMenu 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/Common/MainMenu.tpl b/demos/personal/protected/Common/MainMenu.tpl
new file mode 100644
index 00000000..7e3e59f1
--- /dev/null
+++ b/demos/personal/protected/Common/MainMenu.tpl
@@ -0,0 +1,15 @@
+<a href="<%=$this->Service->constructUrl('Home') %>" >HOME</a> |
+<a href="<%=$this->Service->constructUrl('Resume') %>" >RESUME</a> |
+<a href="<%=$this->Service->constructUrl('Links') %>" >LINKS</a> |
+<a href="<%=$this->Service->constructUrl('Albums') %>" >ALBUMS</a> |
+<a href="<%=$this->Service->constructUrl('Register') %>" >REGISTER</a> |
+<com:THyperLink
+ NavigateUrl="<%=$this->Service->constructUrl('UserLogin') %>"
+ Text="LOGIN"
+ Visible="<%= $this->User->IsGuest %>"
+ />
+<com:TLinkButton
+ Text="LOGOUT"
+ Visible="<%= !$this->User->IsGuest %>"
+ OnClick="logout"
+ />