summaryrefslogtreecommitdiff
path: root/demos/controls
diff options
context:
space:
mode:
authorxue <>2005-11-10 12:47:19 +0000
committerxue <>2005-11-10 12:47:19 +0000
commit55c4ac1bfe565f1ca7f537fdd8b7a201be28e581 (patch)
treea0599d5e36fdbb3f1e169ae56bab7d529597e3eb /demos/controls
Initial import of prado framework
Diffstat (limited to 'demos/controls')
-rw-r--r--demos/controls/index.php8
-rw-r--r--demos/controls/protected/application.xml21
-rw-r--r--demos/controls/protected/pages/HomePage.php14
-rw-r--r--demos/controls/protected/pages/HomePage.tpl12
-rw-r--r--demos/controls/protected/pages/LoginPage.php15
-rw-r--r--demos/controls/protected/pages/LoginPage.tpl6
-rw-r--r--demos/controls/protected/pages/PlainPage.tpl1
-rw-r--r--demos/controls/protected/pages/config.xml12
-rw-r--r--demos/controls/protected/pages/private/MemberPage.php12
-rw-r--r--demos/controls/protected/pages/private/MemberPage.tpl8
-rw-r--r--demos/controls/protected/pages/private/config.xml10
11 files changed, 119 insertions, 0 deletions
diff --git a/demos/controls/index.php b/demos/controls/index.php
new file mode 100644
index 00000000..2349623f
--- /dev/null
+++ b/demos/controls/index.php
@@ -0,0 +1,8 @@
+<?php
+
+require_once(dirname(__FILE__).'/../../framework/prado.php');
+
+$application=new TApplication('protected/application.xml','protected/application.cache');
+$application->run();
+
+?> \ No newline at end of file
diff --git a/demos/controls/protected/application.xml b/demos/controls/protected/application.xml
new file mode 100644
index 00000000..6211399b
--- /dev/null
+++ b/demos/controls/protected/application.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <paths>
+ <alias id="Demo" path="." />
+ </paths>
+ <modules>
+ <!--
+ <module id="cache" type="System.Data.TSqliteCache" DbFile="Demo.cache"/>
+ -->
+ <module id="session" type="THttpSession" />
+ <module id="users" type="System.Security.TUserManager" PasswordMode="Clear">
+ <user name="xue" password="qiang" />
+ <user name="xue2" password="qiang2" />
+ </module>
+ <module id="auth" type="System.Security.TAuthManager" UserManager="users" LoginPage="login" />
+ </modules>
+ <services>
+ <service id="page" RootPath="Demo.pages" DefaultPage="home" />
+ </services>
+</configuration> \ No newline at end of file
diff --git a/demos/controls/protected/pages/HomePage.php b/demos/controls/protected/pages/HomePage.php
new file mode 100644
index 00000000..4cfc3b0a
--- /dev/null
+++ b/demos/controls/protected/pages/HomePage.php
@@ -0,0 +1,14 @@
+<?php
+
+class HomePage extends TPage
+{
+ public function testClick($sender,$param)
+ {
+ if($sender->BackColor==='')
+ $sender->BackColor='blue';
+ else
+ $sender->BackColor='';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/controls/protected/pages/HomePage.tpl b/demos/controls/protected/pages/HomePage.tpl
new file mode 100644
index 00000000..fdef6fdd
--- /dev/null
+++ b/demos/controls/protected/pages/HomePage.tpl
@@ -0,0 +1,12 @@
+<com:TForm>
+
+<com:TLiteral Text="literal" />
+<com:TTextBox Text="textbox" />
+<com:TLabel Text="label" /><br/>
+<com:System.Web.UI.WebControls.TButton text="Toggle Button" ForeColor="red" Font.size="18" Click="testClick" /> (requires membership)<br/>
+<com:TCheckBox Text="Checkbox" /><br/>
+<com:TImage ImageUrl="/prado3/demos/images/fungii_logo.gif" />
+<com:TImageButton ImageUrl="/prado3/demos/images/fungii_logo.gif" /><br/>
+<com:THyperLink Text="Visit a 'classless' page" NavigateUrl="?sp=page.plain" /> |
+<com:THyperLink Text="Visit member only page" NavigateUrl="?sp=page.private.member" />
+</com:TForm> \ No newline at end of file
diff --git a/demos/controls/protected/pages/LoginPage.php b/demos/controls/protected/pages/LoginPage.php
new file mode 100644
index 00000000..3a3b8432
--- /dev/null
+++ b/demos/controls/protected/pages/LoginPage.php
@@ -0,0 +1,15 @@
+<?php
+
+class LoginPage extends TPage
+{
+ public function login($sender,$param)
+ {
+ $manager=$this->Application->AuthManager;
+ if($manager->login($this->username->Text,$this->password->Text))
+ $this->Application->Response->redirect($this->Application->Request->Items['ReturnUrl']);
+ else
+ $this->error->Text='login failed';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/controls/protected/pages/LoginPage.tpl b/demos/controls/protected/pages/LoginPage.tpl
new file mode 100644
index 00000000..cbbd683b
--- /dev/null
+++ b/demos/controls/protected/pages/LoginPage.tpl
@@ -0,0 +1,6 @@
+<com:TForm>
+Username: <com:TTextBox ID="username" /><br/>
+Password: <com:TTextBox ID="password" TextMode="Password" /><br/>
+<com:TButton Text="Login" Click="login" />
+<com:TLabel ID="error" />
+</com:TForm> \ No newline at end of file
diff --git a/demos/controls/protected/pages/PlainPage.tpl b/demos/controls/protected/pages/PlainPage.tpl
new file mode 100644
index 00000000..7591d700
--- /dev/null
+++ b/demos/controls/protected/pages/PlainPage.tpl
@@ -0,0 +1 @@
+This is a page without explicitly defined page class. \ No newline at end of file
diff --git a/demos/controls/protected/pages/config.xml b/demos/controls/protected/pages/config.xml
new file mode 100644
index 00000000..224a058c
--- /dev/null
+++ b/demos/controls/protected/pages/config.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <authorization>
+ <deny pages="home" users="?" verb="post" />
+ </authorization>
+ <pages>
+ <page id="home" type="HomePage" />
+ <page id="login" type="LoginPage" />
+ <page id="plain" type="TPage" TemplateFile="Demo.pages.PlainPage" />
+ </pages>
+</configuration> \ No newline at end of file
diff --git a/demos/controls/protected/pages/private/MemberPage.php b/demos/controls/protected/pages/private/MemberPage.php
new file mode 100644
index 00000000..61fd113d
--- /dev/null
+++ b/demos/controls/protected/pages/private/MemberPage.php
@@ -0,0 +1,12 @@
+<?php
+
+class MemberPage extends TPage
+{
+ public function logout($sender,$param)
+ {
+ $this->Application->AuthManager->logout();
+ $this->Application->Response->redirect($this->Application->Service->constructUrl('home'));
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/controls/protected/pages/private/MemberPage.tpl b/demos/controls/protected/pages/private/MemberPage.tpl
new file mode 100644
index 00000000..cf92f22c
--- /dev/null
+++ b/demos/controls/protected/pages/private/MemberPage.tpl
@@ -0,0 +1,8 @@
+<com:TForm>
+Congratulations, <com:TLabel Text=<%=$this->Application->User->Name%> />!<br/>
+<%=
+ $this->Application->User->Name;
+%>
+You have reached this member-only area.
+<com:TButton Text="Logout" Click="logout" />
+</com:TForm> \ No newline at end of file
diff --git a/demos/controls/protected/pages/private/config.xml b/demos/controls/protected/pages/private/config.xml
new file mode 100644
index 00000000..ecfb6b00
--- /dev/null
+++ b/demos/controls/protected/pages/private/config.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <authorization>
+ <deny pages="member" users="?" />
+ </authorization>
+ <pages>
+ <page id="member" type="MemberPage" />
+ </pages>
+</configuration> \ No newline at end of file