diff options
author | wei <> | 2007-05-11 12:14:26 +0000 |
---|---|---|
committer | wei <> | 2007-05-11 12:14:26 +0000 |
commit | 4a6af98cfcf115219216b2f1102cc3785083c6c8 (patch) | |
tree | 618d8bf057918bf3886a055c4b731ce7609f2fcb /demos/address-book/protected | |
parent | f03007a11887dbc4139d5d259c8e9fa18c4488bb (diff) |
Update address book demo
Diffstat (limited to 'demos/address-book/protected')
-rw-r--r-- | demos/address-book/protected/pages/AddressProvider.php | 27 | ||||
-rw-r--r-- | demos/address-book/protected/pages/Home.page | 11 | ||||
-rw-r--r-- | demos/address-book/protected/pages/flex/.actionScriptProperties | 4 | ||||
-rw-r--r-- | demos/address-book/protected/pages/flex/bin/flex_address_book.swf | bin | 307529 -> 300246 bytes | |||
-rw-r--r-- | demos/address-book/protected/pages/flex/flex_address_book.mxml | 86 | ||||
-rw-r--r-- | demos/address-book/protected/pages/sqlite.db | bin | 2048 -> 2048 bytes |
6 files changed, 30 insertions, 98 deletions
diff --git a/demos/address-book/protected/pages/AddressProvider.php b/demos/address-book/protected/pages/AddressProvider.php index ae0b369f..94b71e11 100644 --- a/demos/address-book/protected/pages/AddressProvider.php +++ b/demos/address-book/protected/pages/AddressProvider.php @@ -1,36 +1,13 @@ -<?php -
+<?php
Prado::using('Application.pages.AddressRecord');
/**
* @author Wei Zhuo <weizho[at]gmail[dot]com>
* @version $Id$
* @since 3.1
*/
-class AddressProvider extends TApplicationComponent
+class AddressProvider
{
/**
- * @throws exception if not logged in
- */
- public function __construct($server)
- {
- $authMethods = $server->getRequestedMethod()!=='login';
- $guestUser = $this->User ? $this->User->IsGuest : true;
- if($authMethods && $guestUser)
- throw new TException('authentication required');
- }
-
- /**
- * @param string $username
- * @param string $password
- * @return boolean
- * @soapmethod
- */
- public function login($username, $password)
- {
- return $this->Application->Modules['auth']->login($username, $password);
- }
-
- /**
* @return AddressRecord[]
* @soapmethod
*/
diff --git a/demos/address-book/protected/pages/Home.page b/demos/address-book/protected/pages/Home.page index 1489cf86..12d36ecf 100644 --- a/demos/address-book/protected/pages/Home.page +++ b/demos/address-book/protected/pages/Home.page @@ -2,15 +2,20 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Prado Address Book</title>
+ <style>
+ body{ font-family: cambria; "New Times Roman" }
+ </style>
</head>
<body>
-<h1>Prado + Flex + Soap Demo</h1>
-<h3>Flash player version 9 or greater is required.</h3>
-<p>Username/password: demo/demo </p>
+<h1>Prado + Adobe Flex + Soap Demo</h1>
+<h2><a href="?soap=address-book.wsdl">View SOAP WSDL</a></h2>
+<p>Flash player version 9 or greater is required.</p>
<com:Application.pages.FlexApp
BinDirectory=<%~ flex/bin %>
AppName="flex_address_book"
Parameters.wsdl="<%= $this->Request->constructUrl('soap', 'address-book.wsdl') %>"
Width="100%" Height="300"/>
+
</body>
+
</html>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/flex/.actionScriptProperties b/demos/address-book/protected/pages/flex/.actionScriptProperties index 43e782c3..3adb49a4 100644 --- a/demos/address-book/protected/pages/flex/.actionScriptProperties +++ b/demos/address-book/protected/pages/flex/.actionScriptProperties @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?>
<actionScriptProperties mainApplicationPath="flex_address_book.mxml" version="1">
-<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.0" htmlPlayerVersionCheck="true" outputFolderPath="bin" strict="true" warn="true">
+<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.0" htmlPlayerVersionCheck="true" outputFolderPath="bin" sourceFolderPath="" strict="true" warn="true">
<compilerSourcePath/>
<libraryPath>
<libraryPathEntry kind="3" linkType="2" path="${FRAMEWORKS}/libs/playerglobal.swc"/>
@@ -8,11 +8,13 @@ <libraryPathEntry kind="3" linkType="1" path="${FRAMEWORKS}/libs/flex.swc" sourcepath="${FRAMEWORKS}/source"/>
<libraryPathEntry kind="3" linkType="1" path="${FRAMEWORKS}/libs/framework.swc" sourcepath="${FRAMEWORKS}/source"/>
<libraryPathEntry kind="3" linkType="1" path="${FRAMEWORKS}/libs/rpc.swc"/>
+<libraryPathEntry kind="3" linkType="1" path="${FRAMEWORKS}/libs/charts.swc" sourcepath="${FRAMEWORKS}/source"/>
<libraryPathEntry kind="1" linkType="1" path="${FRAMEWORKS}/locale/{locale}"/>
</libraryPath>
<sourceAttachmentPath>
<sourceAttachmentPathEntry kind="3" path="${FRAMEWORKS}/libs/flex.swc" sourcepath="${FRAMEWORKS}/source"/>
<sourceAttachmentPathEntry kind="3" path="${FRAMEWORKS}/libs/framework.swc" sourcepath="${FRAMEWORKS}/source"/>
+<sourceAttachmentPathEntry kind="3" path="${FRAMEWORKS}/libs/charts.swc" sourcepath="${FRAMEWORKS}/source"/>
</sourceAttachmentPath>
</compiler>
<applications>
diff --git a/demos/address-book/protected/pages/flex/bin/flex_address_book.swf b/demos/address-book/protected/pages/flex/bin/flex_address_book.swf Binary files differindex 03e29cf8..8eadaf84 100644 --- a/demos/address-book/protected/pages/flex/bin/flex_address_book.swf +++ b/demos/address-book/protected/pages/flex/bin/flex_address_book.swf diff --git a/demos/address-book/protected/pages/flex/flex_address_book.mxml b/demos/address-book/protected/pages/flex/flex_address_book.mxml index eac50fe7..6a82966e 100644 --- a/demos/address-book/protected/pages/flex/flex_address_book.mxml +++ b/demos/address-book/protected/pages/flex/flex_address_book.mxml @@ -10,24 +10,7 @@ backgroundGradientColors="0"
layout="vertical" creationComplete="initApp()">
<mx:states>
- <mx:State name="grid">
- <mx:RemoveChild target="{form1}"/>
- <mx:AddChild relativeTo="{panel1}" position="lastChild">
- <mx:HBox id="hbox1">
- <mx:DataGrid id="list1" dataProvider="{addrSrv.getAllAddress.lastResult}"
- width="350" click="currentState='details'">
- <mx:columns>
- <mx:DataGridColumn headerText="Name" width="175" dataField="username"/>
- <mx:DataGridColumn headerText="Phone" dataField="phone"/>
- </mx:columns>
- </mx:DataGrid>
- </mx:HBox>
- </mx:AddChild>
- <mx:SetProperty target="{button2}" name="visible" value="true"/>
- <mx:SetProperty target="{button3}" name="visible" value="true"/>
- <mx:SetProperty target="{controlbar1}" name="height"/>
- </mx:State>
- <mx:State name="details" basedOn="grid">
+ <mx:State name="details">
<mx:AddChild relativeTo="{hbox1}" position="lastChild">
<mx:Form>
<mx:FormItem label="Name:">
@@ -46,14 +29,9 @@ <mx:StringValidator id="val2" source="{_username}" property="text"
minLength="3" maxLength="20" />
- <mx:Validator id="val3" source="{login_name}" property="text" />
- <mx:Validator id="val4" source="{login_pass}" property="text" />
- <mx:Validator id="val5" requiredFieldError="Username and password did not match!" />
-
<mx:WebService id="addrSrv" fault="dataError(event)">
<mx:operation name="saveAddress" result="addrSrv.getAllAddress()" />
<mx:operation name="deleteAddress" result="addrSrv.getAllAddress()" />
- <mx:operation name="login" result="loginReturned(event)" />
</mx:WebService>
<mx:Script>
@@ -71,6 +49,7 @@ private function initApp():void
{
addrSrv.loadWSDL(getAddressBookWsdl());
+ addrSrv.getAllAddress();
}
private function getAddressBookWsdl():String
@@ -96,62 +75,31 @@ data.username = _username.text;
data.phone = _phone.text;
addrSrv.saveAddress(data);
- currentState='grid';
+ currentState='';
}
}
private function doDelete():void
{
addrSrv.deleteAddress(list1.selectedItem.id);
- currentState='grid';
- }
-
- private function doLogin():void
- {
- if(Validator.validateAll([val3, val4]).length == 0)
- {
- addrSrv.login(login_name.text, login_pass.text);
- login_name.enabled=false;
- login_pass.enabled=false;
- progress1.visible=true;
- }
- }
-
- private function loginReturned(event:ResultEvent):void
- {
- if(!event.result)
- {
- login_name.enabled=true;
- login_pass.enabled=true;
- progress1.visible=false;
- Alert.show("Username and password did not match!", "Login Error");
- }
- else
- {
- addrSrv.getAllAddress();
- currentState='grid';
- }
- }
+ currentState='';
+ }
]]>
</mx:Script>
<mx:Panel layout="vertical" title="Prado Address Book" id="panel1" resizeEffect="Resize">
- <mx:Form id="form1">
- <mx:FormItem label="Username:">
- <mx:TextInput id="login_name" />
- </mx:FormItem>
- <mx:FormItem label="Password:">
- <mx:TextInput id="login_pass"/>
- </mx:FormItem>
- <mx:FormItem>
- <mx:Button label="Login" click="doLogin()" id="button1"/>
- </mx:FormItem>
- <mx:ProgressBar width="100%" indeterminate="true" id="progress1" showEffect="Fade" hideEffect="Fade"
- labelPlacement="center" label="Verifying..." color="#ffffff" visible="false"/>
- </mx:Form>
- <mx:ControlBar id="controlbar1" height="10">
- <mx:Button label="New" click="list1.selectedIndex=-1; currentState='details'" visible="false" id="button2"/>
- <mx:Button label="Delete" enabled="{list1.selectedIndex >= 0}" click="doDelete()" visible="false" id="button3"/>
+ <mx:HBox id="hbox1">
+ <mx:DataGrid id="list1" dataProvider="{addrSrv.getAllAddress.lastResult}"
+ width="350" click="if(list1.selectedIndex >= 0) currentState='details'">
+ <mx:columns>
+ <mx:DataGridColumn headerText="Name" width="175" dataField="username"/>
+ <mx:DataGridColumn headerText="Phone" dataField="phone"/>
+ </mx:columns>
+ </mx:DataGrid>
+ </mx:HBox>
+ <mx:ControlBar id="controlbar1">
+ <mx:Button label="New" click="list1.selectedIndex=-1; currentState='details'" id="button2"/>
+ <mx:Button label="Delete" enabled="{list1.selectedIndex >= 0}" click="doDelete()" id="button3"/>
</mx:ControlBar>
</mx:Panel>
diff --git a/demos/address-book/protected/pages/sqlite.db b/demos/address-book/protected/pages/sqlite.db Binary files differindex 997be3ed..6b7ec59e 100644 --- a/demos/address-book/protected/pages/sqlite.db +++ b/demos/address-book/protected/pages/sqlite.db |