diff options
| author | wei <> | 2007-01-17 11:55:40 +0000 | 
|---|---|---|
| committer | wei <> | 2007-01-17 11:55:40 +0000 | 
| commit | 912dc30b43330a3e99a3e1f947ff14de108a3701 (patch) | |
| tree | 064a66120c95b043de9f9d56fb52d3e66bfe3e81 | |
| parent | 3dc598bc7c2604e24b9e0be1189d9d78b43737ea (diff) | |
Add address-book flex demo
29 files changed, 1559 insertions, 5 deletions
diff --git a/.gitattributes b/.gitattributes index 7d86a321..bf37df4b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -643,6 +643,33 @@ buildscripts/wikibuilder/dumpHTML.inc -text  buildscripts/wikibuilder/dumpHTML.php -text  buildscripts/wikibuilder/external.png -text  buildscripts/wikibuilder/main.css -text +demos/address-book/index.php -text +demos/address-book/protected/application.xml -text +demos/address-book/protected/pages/AddressProvider.php -text +demos/address-book/protected/pages/AddressRecord.php -text +demos/address-book/protected/pages/FlexApp.php -text +demos/address-book/protected/pages/FlexApp.tpl -text +demos/address-book/protected/pages/Home.page -text +demos/address-book/protected/pages/flex/.actionScriptProperties -text +demos/address-book/protected/pages/flex/.flexProperties -text +demos/address-book/protected/pages/flex/.project -text +demos/address-book/protected/pages/flex/.settings/org.eclipse.core.resources.prefs -text +demos/address-book/protected/pages/flex/bin/AC_OETags.js -text +demos/address-book/protected/pages/flex/bin/flex_address_book-debug.html -text +demos/address-book/protected/pages/flex/bin/flex_address_book.html -text +demos/address-book/protected/pages/flex/bin/flex_address_book.swf -text +demos/address-book/protected/pages/flex/bin/history.htm -text +demos/address-book/protected/pages/flex/bin/history.js -text +demos/address-book/protected/pages/flex/bin/history.swf -text +demos/address-book/protected/pages/flex/bin/playerProductInstall.swf -text +demos/address-book/protected/pages/flex/flex_address_book.mxml -text +demos/address-book/protected/pages/flex/html-template/AC_OETags.js -text +demos/address-book/protected/pages/flex/html-template/history.htm -text +demos/address-book/protected/pages/flex/html-template/history.js -text +demos/address-book/protected/pages/flex/html-template/history.swf -text +demos/address-book/protected/pages/flex/html-template/index.template.html -text +demos/address-book/protected/pages/flex/html-template/playerProductInstall.swf -text +demos/address-book/protected/pages/sqlite.db -text  demos/blog/index.php -text  demos/blog/protected/.htaccess -text  demos/blog/protected/Common/BlogDataModule.php -text diff --git a/demos/address-book/index.php b/demos/address-book/index.php new file mode 100644 index 00000000..90149c02 --- /dev/null +++ b/demos/address-book/index.php @@ -0,0 +1,27 @@ +<?php
 +$frameworkPath='../../framework/prado.php';
 +
 +/** The directory checks may be removed if performance is required **/
 +$basePath=dirname(__FILE__);
 +$assetsPath=$basePath."/assets";
 +$runtimePath=$basePath."/protected/runtime";
 +$sqliteDbDir=$basePath."/protected/pages/";
 +$sqliteDb=$sqliteDbDir.'sqlite.db';
 +
 +if(!is_file($frameworkPath))
 +	die("Unable to find prado framework path $frameworkPath.");
 +if(!is_writable($assetsPath))
 +	die("Please make sure that the directory $assetsPath is writable by Web server process.");
 +if(!is_writable($runtimePath))
 +	die("Please make sure that the directory $runtimePath is writable by Web server process.");
 +if(!is_writable($sqliteDbDir))
 +	die("Please make sure that the directory $sqliteDbDir is writable by Web server process.");
 +if(!is_writable($sqliteDb))
 +	die("Please make sure that the file $sqliteDbDir is writable by Web server process.");
 +
 +require_once($frameworkPath);
 +
 +$application=new TApplication;
 +$application->run();
 +
 +?>
\ No newline at end of file diff --git a/demos/address-book/protected/application.xml b/demos/address-book/protected/application.xml new file mode 100644 index 00000000..8e87be8c --- /dev/null +++ b/demos/address-book/protected/application.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
 +<application id="address-book" mode="Debug">
 +
 +<paths>
 +	<using namespace="System.Data.*" />
 +	<using namespace="System.Data.ActiveRecord.*" />
 +	<using namespace="System.Web.Services.TSoapService" />
 +</paths>
 +
 +<modules>
 +	<!-- database configuration for Active Record -->
 +	<module id="sqlite-db" class="TActiveRecordConfig">
 +		<database ConnectionString="sqlite:./protected/pages/sqlite.db" />
 +	</module>
 +</modules>
 +
 +<services>
 +	<!-- soap entry point definition for address book service -->
 +	<service id="soap" class="TSoapService">
 +		<soap id="address-book"
 +			provider="Application.pages.AddressProvider"
 +			ClassMaps="AddressRecord" />
 +	</service>
 +</services>
 +
 +</application>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/AddressProvider.php b/demos/address-book/protected/pages/AddressProvider.php new file mode 100644 index 00000000..bbfedd1b --- /dev/null +++ b/demos/address-book/protected/pages/AddressProvider.php @@ -0,0 +1,52 @@ +<?php +
 +Prado::using('Application.pages.AddressRecord');
 +/**
 + * @author Wei Zhuo <weizho[at]gmail[dot]com>
 + * @version $Id$
 + * @since 3.1
 + */
 +class AddressProvider
 +{
 +	/**
 +	 * @return AddressRecord[]
 +	 * @soapmethod
 +	 */
 +	public function getAllAddress()
 +	{
 +		return AddressRecord::finder()->findAll();
 +	}
 +
 +
 +	/**
 +	 * Update address if $data->id > 0, otherwise add new address.
 +	 * @param AddressRecord $data
 +	 * @return boolean
 +	 * @soapmethod
 +	 */
 +	public function saveAddress($data)
 +	{
 +		$finder = AddressRecord::finder();
 +		if($data->id > 0 && $address=$finder->findByPk($data->id))
 +		{
 +			return $address->copyFrom($data)->save();
 +		}
 +		else
 +		{
 +			$data->id = null; //nullify the id
 +			return $data->save();
 +		}
 +	}
 +
 +	/**
 +	 * @param integer $id
 +	 * @return integer number of records deleted
 +	 * @soapmethod
 +	 */
 +	public function deleteAddress($id)
 +	{
 +		return AddressRecord::finder()->deleteByPk($id);
 +	}
 +}
 + +?>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/AddressRecord.php b/demos/address-book/protected/pages/AddressRecord.php new file mode 100644 index 00000000..e61ed233 --- /dev/null +++ b/demos/address-book/protected/pages/AddressRecord.php @@ -0,0 +1,40 @@ +<?php
 +/**
 + * Auto generated by prado-cli.php on 2007-01-16 06:44:16.
 + */
 +class AddressRecord extends TActiveRecord
 +{
 +	public static $_tablename='addresses';
 +
 +	/**
 +	 * @var integer $id
 +	 * @soapproperty
 +	 */
 +	public $id; + +	
 +	
 +	/**
 +	 * @var string $username
 +	 * @soapproperty
 +	 */
 +	public $username; + +	
 +	
 +	/**
 +	 * @var string $phone
 +	 * @soapproperty
 +	 */
 +	public $phone; +
 +	
 +	/**
 +	 * @return AddressRecord
 +	 */
 +	public static function finder()
 +	{
 +		return self::getRecordFinder('AddressRecord');
 +	}
 +}
 +?>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/FlexApp.php b/demos/address-book/protected/pages/FlexApp.php new file mode 100644 index 00000000..e7a5bf2a --- /dev/null +++ b/demos/address-book/protected/pages/FlexApp.php @@ -0,0 +1,114 @@ +<?php
 +/**
 + * @author Wei Zhuo <weizho[at]gmail[dot]com>
 + * @version $Id$
 + * @since 3.1
 + */
 +class FlexApp extends TTemplateControl
 +{
 +	private $_parameters;
 +
 +	/**
 +	 * FlashVar parameter name value pairs.
 +	 *
 +	 * NOTE: parameter names must be accessed in lowercase in Flex Applications!
 +	 *
 +	 * @return TAttributeCollection
 +	 */
 +	public function getParameters()
 +	{
 +		if($this->_parameters===null)
 +			$this->_parameters = new TAttributeCollection();
 +		return $this->_parameters;
 +	}
 +
 +	public function getFlashVars()
 +	{
 +		$params = array();
 +		foreach($this->getParameters() as $name=>$value)
 +			$params[] = $name.'='.$value;
 +		return implode('&', $params);
 +	}
 +
 +	public function getWidth()
 +	{
 +		return $this->getViewState('Width', '450');
 +	}
 +
 +	public function setWidth($value)
 +	{
 +		$this->setViewState('Width', $value, '450');
 +	}
 +
 +	public function getHeight()
 +	{
 +		return $this->getViewState('Height', '300');
 +	}
 +
 +	public function setHeight($value)
 +	{
 +		$this->setViewState('Height', $value, '300');
 +	}
 +
 +	public function getBinDirectory()
 +	{
 +		return $this->getViewState('Bin');
 +	}
 +
 +	public function setBinDirectory($value)
 +	{
 +		$this->setViewState('Bin', $value);
 +	}
 +
 +	public function getAppName()
 +	{
 +		return $this->getViewState('AppName');
 +	}
 +
 +	public function setAppName($value)
 +	{
 +		$this->setViewState('AppName', $value);
 +	}
 +
 +	public function getQuality()
 +	{
 +		return $this->getViewState('Quality', 'high');
 +	}
 +
 +	public function setQuality($value)
 +	{
 +		$this->setViewState('Quality', $value, 'high');
 +	}
 +
 +	public function getBgcolor()
 +	{
 +		return $this->getViewState('bgcolor', '#ffffff');
 +	}
 +
 +	public function setBgColor($value)
 +	{
 +		$this->setViewState('bgcolor', $value, '#ffffff');
 +	}
 +
 +	public function getAlign()
 +	{
 +		return $this->getViewState('align', 'middle');
 +	}
 +
 +	public function setAlign($value)
 +	{
 +		$this->setViewState('align', $value, 'middle');
 +	}
 +
 +	public function getAllowScriptAccess()
 +	{
 +		return $this->getViewState('allowScriptAccess', 'sameDomain');
 +	}
 +
 +	public function setAllowScriptAccess($value)
 +	{
 +		$this->setViewState('allowScriptAccess', $value, 'sameDomain');
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/FlexApp.tpl b/demos/address-book/protected/pages/FlexApp.tpl new file mode 100644 index 00000000..f3abe1cc --- /dev/null +++ b/demos/address-book/protected/pages/FlexApp.tpl @@ -0,0 +1,93 @@ +<script src="<%= $this->BinDirectory %>/AC_OETags.js" language="javascript"></script>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// -----------------------------------------------------------------------------
 +// Globals
 +// Major version of Flash required
 +var requiredMajorVersion = 9;
 +// Minor version of Flash required
 +var requiredMinorVersion = 0;
 +// Minor version of Flash required
 +var requiredRevision = 0;
 +// -----------------------------------------------------------------------------
 +// -->
 +</script>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
 +var hasProductInstall = DetectFlashVer(6, 0, 65);
 +
 +// Version check based upon the values defined in globals
 +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
 +
 +
 +// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
 +if ( hasProductInstall && !hasRequestedVersion ) {
 +	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
 +	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
 +	// DO NOT MODIFY THE FOLLOWING FOUR LINES
 +	// Location visited after installation is complete if installation is required
 +	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
 +	var MMredirectURL = window.location;
 +    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
 +    var MMdoctitle = document.title;
 +
 +	AC_FL_RunContent(
 +		"src", "<%= $this->BinDirectory %>/playerProductInstall",
 +		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
 +		"width", "<%= $this->Width %>",
 +		"height", "<%= $this->Height %>",
 +		"align", "<%= $this->Align %>",
 +		"id", "<%= $this->AppName %>",
 +		"quality", "<%= $this->Quality %>",
 +		"bgcolor", "<%= $this->BgColor %>",
 +		"name", "<%= $this->AppName %>",
 +		"allowScriptAccess","<%= $this->AllowScriptAccess %>",
 +		"type", "application/x-shockwave-flash",
 +		"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +} else if (hasRequestedVersion) {
 +	// if we've detected an acceptable version
 +	// embed the Flash Content SWF when all tests are passed
 +	AC_FL_RunContent(
 +			"src", "<%= $this->BinDirectory %>/<%= $this->AppName %>",
 +			"width", "<%= $this->Width %>",
 +			"height", "<%= $this->Height %>",
 +			"align", "<%= $this->Align %>",
 +			"id", "<%= $this->AppName %>",
 +			"quality", "<%= $this->Quality %>",
 +			"bgcolor", "<%= $this->BgColor %>",
 +			"name", "<%= $this->AppName %>",
 +			"flashvars",'<%= $this->FlashVars %>',
 +			"allowScriptAccess","<%= $this->AllowScriptAccess %>",
 +			"type", "application/x-shockwave-flash",
 +			"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +  } else {  // flash is too old or we can't detect the plugin
 +    var alternateContent = 'Alternate HTML content should be placed here. '
 +  	+ 'This content requires the Adobe Flash Player. '
 +   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
 +    document.write(alternateContent);  // insert non-flash content
 +  }
 +// -->
 +</script>
 +<noscript>
 +  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 +			id="<%= $this->AppName %>" width="<%= $this->Width %>" height="<%= $this->Height %>"
 +			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
 +			<param name="flashvars" value="<%= $this->FlashVars %>" />
 +			<param name="movie" value="<%= $this->BinDirectory %>/<%= $this->AppName %>.swf" />
 +			<param name="quality" value="<%= $this->Quality %>" />
 +			<param name="bgcolor" value="<%= $this->BgColor %>" />
 +			<param name="allowScriptAccess" value="<%= $this->AllowScriptAccess %>" />
 +			<embed src="<%= $this->BinDirectory %>/<%= $this->AppName %>.swf?<%= $this->FlashVars %>" quality="<%= $this->Quality %>" bgcolor="<%= $this->BgColor %>"
 +				width="<%= $this->Width %>" height="<%= $this->Height %>" name="<%= $this->AppName %>" align="<%= $this->Align %>"
 +				play="true"
 +				loop="false"
 +				quality="<%= $this->Quality %>"
 +				allowScriptAccess="<%= $this->AllowScriptAccess %>"
 +				type="application/x-shockwave-flash"
 +				pluginspage="http://www.adobe.com/go/getflashplayer">
 +			</embed>
 +	</object>
 +</noscript>
 diff --git a/demos/address-book/protected/pages/Home.page b/demos/address-book/protected/pages/Home.page new file mode 100644 index 00000000..801267e7 --- /dev/null +++ b/demos/address-book/protected/pages/Home.page @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 +<head>
 +	<title>Prado Address Book</title>
 +	<style type="text/css">
 +	/*<![CDATA[*/
 +		body
 +		{
 +			margin:0; padding: 0;
 +		}
 +	/*]]>*/
 +	</style>
 +</head>
 +<body>
 +
 +<div style="margin: 5em auto">
 +<com:Application.pages.FlexApp
 +	BinDirectory=<%~ flex/bin %>
 +	AppName="flex_address_book"
 +	Parameters.wsdl="<%= $this->Request->constructUrl('soap', 'address-book.wsdl') %>"
 +	Width="100%" Height="300"/>
 +</div>
 +
 +</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 new file mode 100644 index 00000000..43e782c3 --- /dev/null +++ b/demos/address-book/protected/pages/flex/.actionScriptProperties @@ -0,0 +1,21 @@ +<?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">
 +<compilerSourcePath/>
 +<libraryPath>
 +<libraryPathEntry kind="3" linkType="2" path="${FRAMEWORKS}/libs/playerglobal.swc"/>
 +<libraryPathEntry kind="3" linkType="1" path="${FRAMEWORKS}/libs/utilities.swc"/>
 +<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="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"/>
 +</sourceAttachmentPath>
 +</compiler>
 +<applications>
 +<application path="flex_address_book.mxml"/>
 +</applications>
 +</actionScriptProperties>
 diff --git a/demos/address-book/protected/pages/flex/.flexProperties b/demos/address-book/protected/pages/flex/.flexProperties new file mode 100644 index 00000000..9e63031c --- /dev/null +++ b/demos/address-book/protected/pages/flex/.flexProperties @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?>
 +<flexProperties flexServerType="0" toolCompile="true" version="1"/>
 diff --git a/demos/address-book/protected/pages/flex/.project b/demos/address-book/protected/pages/flex/.project new file mode 100644 index 00000000..b9d6c02b --- /dev/null +++ b/demos/address-book/protected/pages/flex/.project @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
 +<projectDescription>
 +	<name>flex_address_book</name>
 +	<comment></comment>
 +	<projects>
 +	</projects>
 +	<buildSpec>
 +		<buildCommand>
 +			<name>com.adobe.flexbuilder.project.flexbuilder</name>
 +			<arguments>
 +			</arguments>
 +		</buildCommand>
 +	</buildSpec>
 +	<natures>
 +		<nature>com.adobe.flexbuilder.project.flexnature</nature>
 +		<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
 +	</natures>
 +</projectDescription>
 diff --git a/demos/address-book/protected/pages/flex/.settings/org.eclipse.core.resources.prefs b/demos/address-book/protected/pages/flex/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..246a6e57 --- /dev/null +++ b/demos/address-book/protected/pages/flex/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Tue Jan 16 18:14:52 EST 2007
 +eclipse.preferences.version=1
 +encoding/<project>=utf-8
 diff --git a/demos/address-book/protected/pages/flex/bin/AC_OETags.js b/demos/address-book/protected/pages/flex/bin/AC_OETags.js new file mode 100644 index 00000000..157eb218 --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/AC_OETags.js @@ -0,0 +1,269 @@ +// Flash Player Version Detection - Rev 1.5
 +// Detect Client Browser type
 +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
 +var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
 +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
 +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
 +
 +function ControlVersion()
 +{
 +	var version;
 +	var axo;
 +	var e;
 +
 +	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
 +
 +	try {
 +		// version will be set for 7.X or greater players
 +		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
 +		version = axo.GetVariable("$version");
 +	} catch (e) {
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 6.X players only
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
 +			
 +			// installed player is some revision of 6.0
 +			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
 +			// so we have to be careful. 
 +			
 +			// default to the first public version
 +			version = "WIN 6,0,21,0";
 +
 +			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
 +			axo.AllowScriptAccess = "always";
 +
 +			// safe to call for 6.0r47 or greater
 +			version = axo.GetVariable("$version");
 +
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 4.X or 5.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
 +			version = axo.GetVariable("$version");
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 3.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
 +			version = "WIN 3,0,18,0";
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 2.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
 +			version = "WIN 2,0,0,11";
 +		} catch (e) {
 +			version = -1;
 +		}
 +	}
 +	
 +	return version;
 +}
 +
 +// JavaScript helper required to detect Flash Player PlugIn version information
 +function GetSwfVer(){
 +	// NS/Opera version >= 3 check for Flash plugin in plugin array
 +	var flashVer = -1;
 +	
 +	if (navigator.plugins != null && navigator.plugins.length > 0) {
 +		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
 +			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
 +			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
 +			var descArray = flashDescription.split(" ");
 +			var tempArrayMajor = descArray[2].split(".");
 +			var versionMajor = tempArrayMajor[0];
 +			var versionMinor = tempArrayMajor[1];
 +			if ( descArray[3] != "" ) {
 +				tempArrayMinor = descArray[3].split("r");
 +			} else {
 +				tempArrayMinor = descArray[4].split("r");
 +			}
 +			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
 +			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
 +		}
 +	}
 +	// MSN/WebTV 2.6 supports Flash 4
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
 +	// WebTV 2.5 supports Flash 3
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
 +	// older WebTV supports Flash 2
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
 +	else if ( isIE && isWin && !isOpera ) {
 +		flashVer = ControlVersion();
 +	}	
 +	return flashVer;
 +}
 +
 +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
 +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
 +{
 +	versionStr = GetSwfVer();
 +	if (versionStr == -1 ) {
 +		return false;
 +	} else if (versionStr != 0) {
 +		if(isIE && isWin && !isOpera) {
 +			// Given "WIN 2,0,0,11"
 +			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
 +			tempString        = tempArray[1];			// "2,0,0,11"
 +			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
 +		} else {
 +			versionArray      = versionStr.split(".");
 +		}
 +		var versionMajor      = versionArray[0];
 +		var versionMinor      = versionArray[1];
 +		var versionRevision   = versionArray[2];
 +
 +        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
 +		if (versionMajor > parseFloat(reqMajorVer)) {
 +			return true;
 +		} else if (versionMajor == parseFloat(reqMajorVer)) {
 +			if (versionMinor > parseFloat(reqMinorVer))
 +				return true;
 +			else if (versionMinor == parseFloat(reqMinorVer)) {
 +				if (versionRevision >= parseFloat(reqRevision))
 +					return true;
 +			}
 +		}
 +		return false;
 +	}
 +}
 +
 +function AC_AddExtension(src, ext)
 +{
 +  if (src.indexOf('?') != -1)
 +    return src.replace(/\?/, ext+'?'); 
 +  else
 +    return src + ext;
 +}
 +
 +function AC_Generateobj(objAttrs, params, embedAttrs) 
 +{ 
 +    var str = '';
 +    if (isIE && isWin && !isOpera)
 +    {
 +  		str += '<object ';
 +  		for (var i in objAttrs)
 +  			str += i + '="' + objAttrs[i] + '" ';
 +  		for (var i in params)
 +  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
 +  		str += '></object>';
 +    } else {
 +  		str += '<embed ';
 +  		for (var i in embedAttrs)
 +  			str += i + '="' + embedAttrs[i] + '" ';
 +  		str += '> </embed>';
 +    }
 +
 +    document.write(str);
 +}
 +
 +function AC_FL_RunContent(){
 +  var ret = 
 +    AC_GetArgs
 +    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
 +     , "application/x-shockwave-flash"
 +    );
 +  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
 +}
 +
 +function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
 +  var ret = new Object();
 +  ret.embedAttrs = new Object();
 +  ret.params = new Object();
 +  ret.objAttrs = new Object();
 +  for (var i=0; i < args.length; i=i+2){
 +    var currArg = args[i].toLowerCase();    
 +
 +    switch (currArg){	
 +      case "classid":
 +        break;
 +      case "pluginspage":
 +        ret.embedAttrs[args[i]] = args[i+1];
 +        break;
 +      case "src":
 +      case "movie":	
 +        args[i+1] = AC_AddExtension(args[i+1], ext);
 +        ret.embedAttrs["src"] = args[i+1];
 +        ret.params[srcParamName] = args[i+1];
 +        break;
 +      case "onafterupdate":
 +      case "onbeforeupdate":
 +      case "onblur":
 +      case "oncellchange":
 +      case "onclick":
 +      case "ondblClick":
 +      case "ondrag":
 +      case "ondragend":
 +      case "ondragenter":
 +      case "ondragleave":
 +      case "ondragover":
 +      case "ondrop":
 +      case "onfinish":
 +      case "onfocus":
 +      case "onhelp":
 +      case "onmousedown":
 +      case "onmouseup":
 +      case "onmouseover":
 +      case "onmousemove":
 +      case "onmouseout":
 +      case "onkeypress":
 +      case "onkeydown":
 +      case "onkeyup":
 +      case "onload":
 +      case "onlosecapture":
 +      case "onpropertychange":
 +      case "onreadystatechange":
 +      case "onrowsdelete":
 +      case "onrowenter":
 +      case "onrowexit":
 +      case "onrowsinserted":
 +      case "onstart":
 +      case "onscroll":
 +      case "onbeforeeditfocus":
 +      case "onactivate":
 +      case "onbeforedeactivate":
 +      case "ondeactivate":
 +      case "type":
 +      case "codebase":
 +      case "id":
 +        ret.objAttrs[args[i]] = args[i+1];
 +        break;
 +      case "width":
 +      case "height":
 +      case "align":
 +      case "vspace": 
 +      case "hspace":
 +      case "class":
 +      case "title":
 +      case "accesskey":
 +      case "name":
 +      case "tabindex":
 +        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
 +        break;
 +      default:
 +        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
 +    }
 +  }
 +  ret.objAttrs["classid"] = classid;
 +  if (mimeType) ret.embedAttrs["type"] = mimeType;
 +  return ret;
 +}
 +
 +
 diff --git a/demos/address-book/protected/pages/flex/bin/flex_address_book-debug.html b/demos/address-book/protected/pages/flex/bin/flex_address_book-debug.html new file mode 100644 index 00000000..6da5de3b --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/flex_address_book-debug.html @@ -0,0 +1,107 @@ +<!-- saved from url=(0014)about:internet -->
 +<html lang="en">
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 +<title></title>
 +<script src="AC_OETags.js" language="javascript"></script>
 +<style>
 +body { margin: 0px; overflow:hidden }
 +</style>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// -----------------------------------------------------------------------------
 +// Globals
 +// Major version of Flash required
 +var requiredMajorVersion = 9;
 +// Minor version of Flash required
 +var requiredMinorVersion = 0;
 +// Minor version of Flash required
 +var requiredRevision = 0;
 +// -----------------------------------------------------------------------------
 +// -->
 +</script>
 +</head>
 +
 +<body scroll="no">
 +<script language="JavaScript" type="text/javascript" src="history.js"></script>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
 +var hasProductInstall = DetectFlashVer(6, 0, 65);
 +
 +// Version check based upon the values defined in globals
 +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
 +
 +
 +// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
 +if ( hasProductInstall && !hasRequestedVersion ) {
 +	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
 +	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
 +	// DO NOT MODIFY THE FOLLOWING FOUR LINES
 +	// Location visited after installation is complete if installation is required
 +	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
 +	var MMredirectURL = window.location;
 +    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
 +    var MMdoctitle = document.title;
 +
 +	AC_FL_RunContent(
 +		"src", "playerProductInstall",
 +		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
 +		"width", "100%",
 +		"height", "100%",
 +		"align", "middle",
 +		"id", "flex_address_book",
 +		"quality", "high",
 +		"bgcolor", "#ffffff",
 +		"name", "flex_address_book",
 +		"allowScriptAccess","sameDomain",
 +		"type", "application/x-shockwave-flash",
 +		"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +} else if (hasRequestedVersion) {
 +	// if we've detected an acceptable version
 +	// embed the Flash Content SWF when all tests are passed
 +	AC_FL_RunContent(
 +			"src", "flex_address_book-debug",
 +			"width", "100%",
 +			"height", "100%",
 +			"align", "middle",
 +			"id", "flex_address_book",
 +			"quality", "high",
 +			"bgcolor", "#ffffff",
 +			"name", "flex_address_book",
 +			"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '',
 +			"allowScriptAccess","sameDomain",
 +			"type", "application/x-shockwave-flash",
 +			"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +  } else {  // flash is too old or we can't detect the plugin
 +    var alternateContent = 'Alternate HTML content should be placed here. '
 +  	+ 'This content requires the Adobe Flash Player. '
 +   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
 +    document.write(alternateContent);  // insert non-flash content
 +  }
 +// -->
 +</script>
 +<noscript>
 +  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 +			id="flex_address_book" width="100%" height="100%"
 +			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
 +			<param name="movie" value="flex_address_book-debug.swf" />
 +			<param name="quality" value="high" />
 +			<param name="bgcolor" value="#ffffff" />
 +			<param name="allowScriptAccess" value="sameDomain" />
 +			<embed src="flex_address_book-debug.swf" quality="high" bgcolor="#ffffff"
 +				width="100%" height="100%" name="flex_address_book" align="middle"
 +				play="true"
 +				loop="false"
 +				quality="high"
 +				allowScriptAccess="sameDomain"
 +				type="application/x-shockwave-flash"
 +				pluginspage="http://www.adobe.com/go/getflashplayer">
 +			</embed>
 +	</object>
 +</noscript>
 +<iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
 +</body>
 +</html>
 diff --git a/demos/address-book/protected/pages/flex/bin/flex_address_book.html b/demos/address-book/protected/pages/flex/bin/flex_address_book.html new file mode 100644 index 00000000..7802a896 --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/flex_address_book.html @@ -0,0 +1,107 @@ +<!-- saved from url=(0014)about:internet -->
 +<html lang="en">
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 +<title></title>
 +<script src="AC_OETags.js" language="javascript"></script>
 +<style>
 +body { margin: 0px; overflow:hidden }
 +</style>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// -----------------------------------------------------------------------------
 +// Globals
 +// Major version of Flash required
 +var requiredMajorVersion = 9;
 +// Minor version of Flash required
 +var requiredMinorVersion = 0;
 +// Minor version of Flash required
 +var requiredRevision = 0;
 +// -----------------------------------------------------------------------------
 +// -->
 +</script>
 +</head>
 +
 +<body scroll="no">
 +<script language="JavaScript" type="text/javascript" src="history.js"></script>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
 +var hasProductInstall = DetectFlashVer(6, 0, 65);
 +
 +// Version check based upon the values defined in globals
 +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
 +
 +
 +// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
 +if ( hasProductInstall && !hasRequestedVersion ) {
 +	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
 +	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
 +	// DO NOT MODIFY THE FOLLOWING FOUR LINES
 +	// Location visited after installation is complete if installation is required
 +	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
 +	var MMredirectURL = window.location;
 +    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
 +    var MMdoctitle = document.title;
 +
 +	AC_FL_RunContent(
 +		"src", "playerProductInstall",
 +		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
 +		"width", "100%",
 +		"height", "100%",
 +		"align", "middle",
 +		"id", "flex_address_book",
 +		"quality", "high",
 +		"bgcolor", "#ffffff",
 +		"name", "flex_address_book",
 +		"allowScriptAccess","sameDomain",
 +		"type", "application/x-shockwave-flash",
 +		"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +} else if (hasRequestedVersion) {
 +	// if we've detected an acceptable version
 +	// embed the Flash Content SWF when all tests are passed
 +	AC_FL_RunContent(
 +			"src", "flex_address_book",
 +			"width", "100%",
 +			"height", "100%",
 +			"align", "middle",
 +			"id", "flex_address_book",
 +			"quality", "high",
 +			"bgcolor", "#ffffff",
 +			"name", "flex_address_book",
 +			"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '',
 +			"allowScriptAccess","sameDomain",
 +			"type", "application/x-shockwave-flash",
 +			"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +  } else {  // flash is too old or we can't detect the plugin
 +    var alternateContent = 'Alternate HTML content should be placed here. '
 +  	+ 'This content requires the Adobe Flash Player. '
 +   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
 +    document.write(alternateContent);  // insert non-flash content
 +  }
 +// -->
 +</script>
 +<noscript>
 +  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 +			id="flex_address_book" width="100%" height="100%"
 +			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
 +			<param name="movie" value="flex_address_book.swf" />
 +			<param name="quality" value="high" />
 +			<param name="bgcolor" value="#ffffff" />
 +			<param name="allowScriptAccess" value="sameDomain" />
 +			<embed src="flex_address_book.swf" quality="high" bgcolor="#ffffff"
 +				width="100%" height="100%" name="flex_address_book" align="middle"
 +				play="true"
 +				loop="false"
 +				quality="high"
 +				allowScriptAccess="sameDomain"
 +				type="application/x-shockwave-flash"
 +				pluginspage="http://www.adobe.com/go/getflashplayer">
 +			</embed>
 +	</object>
 +</noscript>
 +<iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
 +</body>
 +</html>
 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 differnew file mode 100644 index 00000000..9c3e63ef --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/flex_address_book.swf diff --git a/demos/address-book/protected/pages/flex/bin/history.htm b/demos/address-book/protected/pages/flex/bin/history.htm new file mode 100644 index 00000000..69e8c722 --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/history.htm @@ -0,0 +1,21 @@ +<html>
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 +<script type='text/javascript' language='JavaScript1.2' charset='utf-8'>
 +var v = new top.Vars(top.getSearch(window));
 +var fv = v.toString('$_');
 +</script>
 +</head>
 +<body >
 +<script type='text/javascript' language='JavaScript1.2' charset='utf-8'>
 +document.writeln('<object id=\"utility\" name=\" \" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"" + activexDownloadURL + "#version=7,0,14,0\" width=\"100\" height=\"50\">');
 +document.writeln('<param name=\"movie\" value=\"history.swf\" />');
 +document.writeln('<param name=\"FlashVars\" value=\"'+fv+'&$_lconid='+top.lc_id+'\"/>');
 +document.writeln('<param name=\"quality\" value=\"high\" />');
 +document.writeln('<param name=\"bgcolor\" value=\"#FFFFFF\" />');
 +document.writeln('<param name=\"profile\" value=\"false\" />');
 +document.writeln('<embed id=\"utilityEmbed\" name=\"history.swf\" src=\"history.swf\" type=\"application/x-shockwave-flash\" flashvars=\"'+fv+'&$_lconid='+top.lc_id+'\" profile=\"false\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"100\" height=\"50\" align=\"\" pluginspage=\"" + pluginDownloadURL + "\"></embed>');
 +document.writeln('</object>');
 +</script>
 +</body>
 +</html>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/flex/bin/history.js b/demos/address-book/protected/pages/flex/bin/history.js new file mode 100644 index 00000000..b0537ef1 --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/history.js @@ -0,0 +1,48 @@ +// $Revision: 1.49 $
 +// Vars
 +Vars = function(qStr) {
 +	this.numVars = 0;
 +	if(qStr != null) {
 +		var nameValue, name;
 +		var pairs = qStr.split('&');
 +		var pairLen = pairs.length;
 +		for(var i = 0; i < pairLen; i++) {
 +			var pair = pairs[i];
 +			if( (pair.indexOf('=')!= -1) && (pair.length > 3) ) {
 +				var nameValue = pair.split('=');
 +				var name = nameValue[0];
 +				var value = nameValue[1];
 +				if(this[name] == null && name.length > 0 && value.length > 0) { 
 +					this[name] = value;
 +					this.numVars++;
 +				}
 +			}
 +		} 
 +	}
 +}
 +Vars.prototype.toString = function(pre) {
 +	var result = '';
 +	if(pre == null) { pre = ''; }
 +	for(var i in this) {
 +		if(this[i] != null && typeof(this[i]) != 'object' && typeof(this[i]) != 'function' && i != 'numVars') {
 +			result += pre + i + '=' + this[i] + '&';
 +		}
 +	}
 +	if(result.length > 0) result = result.substr(0, result.length-1);
 +	return result;
 +}
 +function getSearch(wRef) {
 +	var searchStr = '';
 +	if(wRef.location.search.length > 1) {
 +		searchStr = new String(wRef.location.search);
 +		searchStr = searchStr.substring(1, searchStr.length);
 +	}
 +	return searchStr;
 +}
 +var lc_id = Math.floor(Math.random() * 100000).toString(16);
 +if (this != top)
 +{
 +	top.Vars = Vars;
 +	top.getSearch = getSearch;
 +	top.lc_id = lc_id;
 +}
 diff --git a/demos/address-book/protected/pages/flex/bin/history.swf b/demos/address-book/protected/pages/flex/bin/history.swf Binary files differnew file mode 100644 index 00000000..e6e03ecb --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/history.swf diff --git a/demos/address-book/protected/pages/flex/bin/playerProductInstall.swf b/demos/address-book/protected/pages/flex/bin/playerProductInstall.swf Binary files differnew file mode 100644 index 00000000..bdc34378 --- /dev/null +++ b/demos/address-book/protected/pages/flex/bin/playerProductInstall.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 new file mode 100644 index 00000000..d6db809a --- /dev/null +++ b/demos/address-book/protected/pages/flex/flex_address_book.mxml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?>
 +<!--
 + * @author Wei Zhuo <weizho[at]gmail[dot]com>
 + * @version $Id$
 + * @since 3.1
 +-->
 +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
 +	backgroundColor="white"
 +	backgroundGradientAlphas="0"
 +	backgroundGradientColors="0" 
 +	layout="vertical" creationComplete="initApp()">
 +	<mx:states>
 +		<mx:State name="details">
 +			<mx:AddChild relativeTo="{hbox1}" position="lastChild">
 +				<mx:Form>
 +					<mx:FormItem label="Username:">
 +						<mx:TextInput id="_username" text="{list1.selectedItem.username}"/>
 +					</mx:FormItem>
 +					<mx:FormItem label="Phone:">
 +						<mx:TextInput id="_phone" text="{list1.selectedItem.phone}" />
 +						<mx:Button id="saveButton" label="Save" click="doSave()" />
 +					</mx:FormItem>
 +				</mx:Form>
 +			</mx:AddChild>
 +		</mx:State>
 +	</mx:states>
 +	
 +	<mx:PhoneNumberValidator id="val1" source="{_phone}" property="text" />
 +	<mx:StringValidator id="val2" source="{_username}" property="text"
 +		minLength="3" maxLength="20" />
 +
 +	<mx:WebService id="addrSrv" fault="dataError(event)">
 +		<mx:operation name="saveAddress" result="addrSrv.getAllAddress()" />
 +		<mx:operation name="deleteAddress" result="addrSrv.getAllAddress()" />
 +	</mx:WebService>
 +
 +	<mx:Script>
 +		<![CDATA[
 +			import mx.validators.Validator;
 +			import mx.utils.ArrayUtil;
 +			import mx.collections.ArrayCollection;
 +			import mx.controls.Alert;
 +			import mx.rpc.events.ResultEvent;
 +			import mx.rpc.events.FaultEvent;
 +			
 +			[Bindable]
 +			private var addressList:ArrayCollection;			
 +						
 +			private function initApp():void
 +			{
 +				addrSrv.loadWSDL(getAddressBookWsdl());
 +				addrSrv.getAllAddress();
 +			}
 +			
 +			private function getAddressBookWsdl():String
 +			{
 +				var appUrl:Object=application.parameters.wsdl;
 +				if(appUrl!=null)  // running in PRADO page
 +					return appUrl.toString();
 +				else  // running in static html for debugging.
 +					return "http://127.0.0.1/prado-trunk/demos/address-book/index.php?soap=address-book.wsdl";				
 +			}
 +			
 +			private function dataError(event:FaultEvent):void
 +			{
 +				Alert.show(event.fault.faultString,"Data Communication Error");
 +			}
 +
 +			private function doSave():void
 +			{
 +				if(Validator.validateAll([val1, val2]).length == 0)
 +				{
 +					var data:Object = new Object;
 +					data.id = list1.selectedItem != null ? list1.selectedItem.id : -1;
 +					data.username = _username.text;
 +					data.phone = _phone.text;
 +					addrSrv.saveAddress(data);
 +					currentState='';
 +				}
 +			}
 +			
 +			private function doDelete():void
 +			{
 +				addrSrv.deleteAddress(list1.selectedItem.id);
 +				currentState='';
 +			}
 +		]]>
 +	</mx:Script>
 +
 +	
 +	<mx:Panel layout="vertical" title="Prado Address Book" id="panel1" resizeEffect="Resize">
 +		<mx:HBox id="hbox1">
 +			<mx:DataGrid id="list1" dataProvider="{addrSrv.getAllAddress.lastResult}" width="350" click="currentState='details'">
 +				<mx:columns>
 +					<mx:DataGridColumn headerText="Name" width="150" 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'"/>
 +			<mx:Button label="Delete" enabled="{list1.selectedIndex >= 0}" click="doDelete()"/>
 +		</mx:ControlBar>
 +	</mx:Panel>
 +	
 +</mx:Application>
 diff --git a/demos/address-book/protected/pages/flex/html-template/AC_OETags.js b/demos/address-book/protected/pages/flex/html-template/AC_OETags.js new file mode 100644 index 00000000..157eb218 --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/AC_OETags.js @@ -0,0 +1,269 @@ +// Flash Player Version Detection - Rev 1.5
 +// Detect Client Browser type
 +// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
 +var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
 +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
 +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
 +
 +function ControlVersion()
 +{
 +	var version;
 +	var axo;
 +	var e;
 +
 +	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
 +
 +	try {
 +		// version will be set for 7.X or greater players
 +		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
 +		version = axo.GetVariable("$version");
 +	} catch (e) {
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 6.X players only
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
 +			
 +			// installed player is some revision of 6.0
 +			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
 +			// so we have to be careful. 
 +			
 +			// default to the first public version
 +			version = "WIN 6,0,21,0";
 +
 +			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
 +			axo.AllowScriptAccess = "always";
 +
 +			// safe to call for 6.0r47 or greater
 +			version = axo.GetVariable("$version");
 +
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 4.X or 5.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
 +			version = axo.GetVariable("$version");
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 3.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
 +			version = "WIN 3,0,18,0";
 +		} catch (e) {
 +		}
 +	}
 +
 +	if (!version)
 +	{
 +		try {
 +			// version will be set for 2.X player
 +			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
 +			version = "WIN 2,0,0,11";
 +		} catch (e) {
 +			version = -1;
 +		}
 +	}
 +	
 +	return version;
 +}
 +
 +// JavaScript helper required to detect Flash Player PlugIn version information
 +function GetSwfVer(){
 +	// NS/Opera version >= 3 check for Flash plugin in plugin array
 +	var flashVer = -1;
 +	
 +	if (navigator.plugins != null && navigator.plugins.length > 0) {
 +		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
 +			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
 +			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
 +			var descArray = flashDescription.split(" ");
 +			var tempArrayMajor = descArray[2].split(".");
 +			var versionMajor = tempArrayMajor[0];
 +			var versionMinor = tempArrayMajor[1];
 +			if ( descArray[3] != "" ) {
 +				tempArrayMinor = descArray[3].split("r");
 +			} else {
 +				tempArrayMinor = descArray[4].split("r");
 +			}
 +			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
 +			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
 +		}
 +	}
 +	// MSN/WebTV 2.6 supports Flash 4
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
 +	// WebTV 2.5 supports Flash 3
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
 +	// older WebTV supports Flash 2
 +	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
 +	else if ( isIE && isWin && !isOpera ) {
 +		flashVer = ControlVersion();
 +	}	
 +	return flashVer;
 +}
 +
 +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
 +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
 +{
 +	versionStr = GetSwfVer();
 +	if (versionStr == -1 ) {
 +		return false;
 +	} else if (versionStr != 0) {
 +		if(isIE && isWin && !isOpera) {
 +			// Given "WIN 2,0,0,11"
 +			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
 +			tempString        = tempArray[1];			// "2,0,0,11"
 +			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
 +		} else {
 +			versionArray      = versionStr.split(".");
 +		}
 +		var versionMajor      = versionArray[0];
 +		var versionMinor      = versionArray[1];
 +		var versionRevision   = versionArray[2];
 +
 +        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
 +		if (versionMajor > parseFloat(reqMajorVer)) {
 +			return true;
 +		} else if (versionMajor == parseFloat(reqMajorVer)) {
 +			if (versionMinor > parseFloat(reqMinorVer))
 +				return true;
 +			else if (versionMinor == parseFloat(reqMinorVer)) {
 +				if (versionRevision >= parseFloat(reqRevision))
 +					return true;
 +			}
 +		}
 +		return false;
 +	}
 +}
 +
 +function AC_AddExtension(src, ext)
 +{
 +  if (src.indexOf('?') != -1)
 +    return src.replace(/\?/, ext+'?'); 
 +  else
 +    return src + ext;
 +}
 +
 +function AC_Generateobj(objAttrs, params, embedAttrs) 
 +{ 
 +    var str = '';
 +    if (isIE && isWin && !isOpera)
 +    {
 +  		str += '<object ';
 +  		for (var i in objAttrs)
 +  			str += i + '="' + objAttrs[i] + '" ';
 +  		for (var i in params)
 +  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
 +  		str += '></object>';
 +    } else {
 +  		str += '<embed ';
 +  		for (var i in embedAttrs)
 +  			str += i + '="' + embedAttrs[i] + '" ';
 +  		str += '> </embed>';
 +    }
 +
 +    document.write(str);
 +}
 +
 +function AC_FL_RunContent(){
 +  var ret = 
 +    AC_GetArgs
 +    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
 +     , "application/x-shockwave-flash"
 +    );
 +  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
 +}
 +
 +function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
 +  var ret = new Object();
 +  ret.embedAttrs = new Object();
 +  ret.params = new Object();
 +  ret.objAttrs = new Object();
 +  for (var i=0; i < args.length; i=i+2){
 +    var currArg = args[i].toLowerCase();    
 +
 +    switch (currArg){	
 +      case "classid":
 +        break;
 +      case "pluginspage":
 +        ret.embedAttrs[args[i]] = args[i+1];
 +        break;
 +      case "src":
 +      case "movie":	
 +        args[i+1] = AC_AddExtension(args[i+1], ext);
 +        ret.embedAttrs["src"] = args[i+1];
 +        ret.params[srcParamName] = args[i+1];
 +        break;
 +      case "onafterupdate":
 +      case "onbeforeupdate":
 +      case "onblur":
 +      case "oncellchange":
 +      case "onclick":
 +      case "ondblClick":
 +      case "ondrag":
 +      case "ondragend":
 +      case "ondragenter":
 +      case "ondragleave":
 +      case "ondragover":
 +      case "ondrop":
 +      case "onfinish":
 +      case "onfocus":
 +      case "onhelp":
 +      case "onmousedown":
 +      case "onmouseup":
 +      case "onmouseover":
 +      case "onmousemove":
 +      case "onmouseout":
 +      case "onkeypress":
 +      case "onkeydown":
 +      case "onkeyup":
 +      case "onload":
 +      case "onlosecapture":
 +      case "onpropertychange":
 +      case "onreadystatechange":
 +      case "onrowsdelete":
 +      case "onrowenter":
 +      case "onrowexit":
 +      case "onrowsinserted":
 +      case "onstart":
 +      case "onscroll":
 +      case "onbeforeeditfocus":
 +      case "onactivate":
 +      case "onbeforedeactivate":
 +      case "ondeactivate":
 +      case "type":
 +      case "codebase":
 +      case "id":
 +        ret.objAttrs[args[i]] = args[i+1];
 +        break;
 +      case "width":
 +      case "height":
 +      case "align":
 +      case "vspace": 
 +      case "hspace":
 +      case "class":
 +      case "title":
 +      case "accesskey":
 +      case "name":
 +      case "tabindex":
 +        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
 +        break;
 +      default:
 +        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
 +    }
 +  }
 +  ret.objAttrs["classid"] = classid;
 +  if (mimeType) ret.embedAttrs["type"] = mimeType;
 +  return ret;
 +}
 +
 +
 diff --git a/demos/address-book/protected/pages/flex/html-template/history.htm b/demos/address-book/protected/pages/flex/html-template/history.htm new file mode 100644 index 00000000..69e8c722 --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/history.htm @@ -0,0 +1,21 @@ +<html>
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 +<script type='text/javascript' language='JavaScript1.2' charset='utf-8'>
 +var v = new top.Vars(top.getSearch(window));
 +var fv = v.toString('$_');
 +</script>
 +</head>
 +<body >
 +<script type='text/javascript' language='JavaScript1.2' charset='utf-8'>
 +document.writeln('<object id=\"utility\" name=\" \" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"" + activexDownloadURL + "#version=7,0,14,0\" width=\"100\" height=\"50\">');
 +document.writeln('<param name=\"movie\" value=\"history.swf\" />');
 +document.writeln('<param name=\"FlashVars\" value=\"'+fv+'&$_lconid='+top.lc_id+'\"/>');
 +document.writeln('<param name=\"quality\" value=\"high\" />');
 +document.writeln('<param name=\"bgcolor\" value=\"#FFFFFF\" />');
 +document.writeln('<param name=\"profile\" value=\"false\" />');
 +document.writeln('<embed id=\"utilityEmbed\" name=\"history.swf\" src=\"history.swf\" type=\"application/x-shockwave-flash\" flashvars=\"'+fv+'&$_lconid='+top.lc_id+'\" profile=\"false\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"100\" height=\"50\" align=\"\" pluginspage=\"" + pluginDownloadURL + "\"></embed>');
 +document.writeln('</object>');
 +</script>
 +</body>
 +</html>
\ No newline at end of file diff --git a/demos/address-book/protected/pages/flex/html-template/history.js b/demos/address-book/protected/pages/flex/html-template/history.js new file mode 100644 index 00000000..b0537ef1 --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/history.js @@ -0,0 +1,48 @@ +// $Revision: 1.49 $
 +// Vars
 +Vars = function(qStr) {
 +	this.numVars = 0;
 +	if(qStr != null) {
 +		var nameValue, name;
 +		var pairs = qStr.split('&');
 +		var pairLen = pairs.length;
 +		for(var i = 0; i < pairLen; i++) {
 +			var pair = pairs[i];
 +			if( (pair.indexOf('=')!= -1) && (pair.length > 3) ) {
 +				var nameValue = pair.split('=');
 +				var name = nameValue[0];
 +				var value = nameValue[1];
 +				if(this[name] == null && name.length > 0 && value.length > 0) { 
 +					this[name] = value;
 +					this.numVars++;
 +				}
 +			}
 +		} 
 +	}
 +}
 +Vars.prototype.toString = function(pre) {
 +	var result = '';
 +	if(pre == null) { pre = ''; }
 +	for(var i in this) {
 +		if(this[i] != null && typeof(this[i]) != 'object' && typeof(this[i]) != 'function' && i != 'numVars') {
 +			result += pre + i + '=' + this[i] + '&';
 +		}
 +	}
 +	if(result.length > 0) result = result.substr(0, result.length-1);
 +	return result;
 +}
 +function getSearch(wRef) {
 +	var searchStr = '';
 +	if(wRef.location.search.length > 1) {
 +		searchStr = new String(wRef.location.search);
 +		searchStr = searchStr.substring(1, searchStr.length);
 +	}
 +	return searchStr;
 +}
 +var lc_id = Math.floor(Math.random() * 100000).toString(16);
 +if (this != top)
 +{
 +	top.Vars = Vars;
 +	top.getSearch = getSearch;
 +	top.lc_id = lc_id;
 +}
 diff --git a/demos/address-book/protected/pages/flex/html-template/history.swf b/demos/address-book/protected/pages/flex/html-template/history.swf Binary files differnew file mode 100644 index 00000000..e6e03ecb --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/history.swf diff --git a/demos/address-book/protected/pages/flex/html-template/index.template.html b/demos/address-book/protected/pages/flex/html-template/index.template.html new file mode 100644 index 00000000..4aa4ffbc --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/index.template.html @@ -0,0 +1,107 @@ +<!-- saved from url=(0014)about:internet -->
 +<html lang="en">
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 +<title>${title}</title>
 +<script src="AC_OETags.js" language="javascript"></script>
 +<style>
 +body { margin: 0px; overflow:hidden }
 +</style>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// -----------------------------------------------------------------------------
 +// Globals
 +// Major version of Flash required
 +var requiredMajorVersion = ${version_major};
 +// Minor version of Flash required
 +var requiredMinorVersion = ${version_minor};
 +// Minor version of Flash required
 +var requiredRevision = ${version_revision};
 +// -----------------------------------------------------------------------------
 +// -->
 +</script>
 +</head>
 +
 +<body scroll="no">
 +<script language="JavaScript" type="text/javascript" src="history.js"></script>
 +<script language="JavaScript" type="text/javascript">
 +<!--
 +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
 +var hasProductInstall = DetectFlashVer(6, 0, 65);
 +
 +// Version check based upon the values defined in globals
 +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
 +
 +
 +// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
 +if ( hasProductInstall && !hasRequestedVersion ) {
 +	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
 +	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
 +	// DO NOT MODIFY THE FOLLOWING FOUR LINES
 +	// Location visited after installation is complete if installation is required
 +	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
 +	var MMredirectURL = window.location;
 +    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
 +    var MMdoctitle = document.title;
 +
 +	AC_FL_RunContent(
 +		"src", "playerProductInstall",
 +		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
 +		"width", "${width}",
 +		"height", "${height}",
 +		"align", "middle",
 +		"id", "${application}",
 +		"quality", "high",
 +		"bgcolor", "${bgcolor}",
 +		"name", "${application}",
 +		"allowScriptAccess","sameDomain",
 +		"type", "application/x-shockwave-flash",
 +		"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +} else if (hasRequestedVersion) {
 +	// if we've detected an acceptable version
 +	// embed the Flash Content SWF when all tests are passed
 +	AC_FL_RunContent(
 +			"src", "${swf}",
 +			"width", "${width}",
 +			"height", "${height}",
 +			"align", "middle",
 +			"id", "${application}",
 +			"quality", "high",
 +			"bgcolor", "${bgcolor}",
 +			"name", "${application}",
 +			"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '',
 +			"allowScriptAccess","sameDomain",
 +			"type", "application/x-shockwave-flash",
 +			"pluginspage", "http://www.adobe.com/go/getflashplayer"
 +	);
 +  } else {  // flash is too old or we can't detect the plugin
 +    var alternateContent = 'Alternate HTML content should be placed here. '
 +  	+ 'This content requires the Adobe Flash Player. '
 +   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
 +    document.write(alternateContent);  // insert non-flash content
 +  }
 +// -->
 +</script>
 +<noscript>
 +  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 +			id="${application}" width="${width}" height="${height}"
 +			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
 +			<param name="movie" value="${swf}.swf" />
 +			<param name="quality" value="high" />
 +			<param name="bgcolor" value="${bgcolor}" />
 +			<param name="allowScriptAccess" value="sameDomain" />
 +			<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
 +				width="${width}" height="${height}" name="${application}" align="middle"
 +				play="true"
 +				loop="false"
 +				quality="high"
 +				allowScriptAccess="sameDomain"
 +				type="application/x-shockwave-flash"
 +				pluginspage="http://www.adobe.com/go/getflashplayer">
 +			</embed>
 +	</object>
 +</noscript>
 +<iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
 +</body>
 +</html>
 diff --git a/demos/address-book/protected/pages/flex/html-template/playerProductInstall.swf b/demos/address-book/protected/pages/flex/html-template/playerProductInstall.swf Binary files differnew file mode 100644 index 00000000..bdc34378 --- /dev/null +++ b/demos/address-book/protected/pages/flex/html-template/playerProductInstall.swf diff --git a/demos/address-book/protected/pages/sqlite.db b/demos/address-book/protected/pages/sqlite.db Binary files differnew file mode 100644 index 00000000..997be3ed --- /dev/null +++ b/demos/address-book/protected/pages/sqlite.db diff --git a/framework/prado-cli.php b/framework/prado-cli.php index 4c3e7c61..0cd33a74 100755 --- a/framework/prado-cli.php +++ b/framework/prado-cli.php @@ -204,7 +204,11 @@ EOD;  			return Prado::getApplication();  		}  		else +		{ +			echo '+'.str_repeat('-',77)."+\n";  			echo '** Unable to load Prado application in directory "'.$directory."\".\n"; +			echo '+'.str_repeat('-',77)."+\n"; +		}  		return false;  	} @@ -684,13 +688,12 @@ if(class_exists('PHP_Shell_Commands', false))  			$args = explode(" ", trim($l));  			if(count($args) > 2)  			{ +				$app_dir = '.'; +				if(Prado::getApplication()!==null) +					$app_dir = dirname(Prado::getApplication()->getBasePath()); +				$args = array($args[0],$args[1], $args[2],$app_dir);  				if(count($args)>3) -				{ -					$app_dir = '.'; -					if(Prado::getApplication()!==null) -						$app_dir = dirname(Prado::getApplication()->getBasePath());  					$args = array($args[0],$args[1], $args[2],$app_dir,'soap'); -				}  				$cmd = new PradoCommandLineActiveRecordGen;  				$cmd->performAction($args);  			}  | 
