diff options
Diffstat (limited to 'demos')
24 files changed, 616 insertions, 2 deletions
diff --git a/demos/address-book/index_php.php b/demos/address-book/index_php.php new file mode 100644 index 00000000..17cf61ad --- /dev/null +++ b/demos/address-book/index_php.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('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run(); + +?>
\ No newline at end of file diff --git a/demos/address-book/protected/application.php b/demos/address-book/protected/application.php new file mode 100644 index 00000000..ace63d2d --- /dev/null +++ b/demos/address-book/protected/application.php @@ -0,0 +1,54 @@ +<?php + +return array( + 'application' => array( + 'id' => 'address-book', + 'mode' => 'Debug', + ), + 'paths' => array( + 'using'=>array( + 'System.Data.*', + 'System.Security.*', + 'System.Data.ActiveRecord.*', + 'System.Web.Services.*', + ) + ), + 'modules' => array( + 'sqlite-db' => array( + 'class' => 'TActiveRecordConfig', + 'database' => array( + 'ConnectionString' => 'sqlite:./protected/pages/sqlite.db', + ), + ), + 'users' => array( + 'class' => 'TUserManager', + 'properties' => array( + 'PasswordMode' => 'Clear', + ), + 'users' => array( + array( + 'name'=>'demo', + 'password'=>'demo' + ), + ), + ), + 'auth' => array( + 'class' => 'System.Security.TAuthManager', + 'properties' => array( + 'userManager' => 'users', + 'loginPage' => 'Login', + ), + ), + ), + 'services' => array( + 'soap' => array( + 'class' => 'TSoapService', + 'address-book' => array( + 'properties' => array( + 'provider' => 'Application.pages.AddressProvider', + 'ClassMaps' => 'AddressRecord', + ), + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/blog/index_php.php b/demos/blog/index_php.php new file mode 100644 index 00000000..a5434860 --- /dev/null +++ b/demos/blog/index_php.php @@ -0,0 +1,20 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; +$runtimePath=$basePath.'/protected/runtime'; +$dataPath=$basePath.'/protected/Data'; + +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($dataPath)) + die("Please make sure that the directory $dataPath is writable by Web server process."); +if(!extension_loaded("sqlite")) + die("SQLite PHP extension is required."); + +require_once($frameworkPath); +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/blog/protected/Data/Settings.php b/demos/blog/protected/Data/Settings.php new file mode 100644 index 00000000..a4adcd9f --- /dev/null +++ b/demos/blog/protected/Data/Settings.php @@ -0,0 +1,13 @@ +<?php +return array( + 'SiteTitle' => 'MyBlog', + 'SiteSubtitle' => 'A Prado-driven weblog', + 'SiteOwner' => 'Prado User', + 'AdminEmail' => 'admin@example.com', + 'MultipleUser' => false, + 'AccountApproval' => false, + 'PostPerPage' => 6, + 'RecentComments' => 6, + 'PostApproval' => false, + 'ThemeName' => 'Winter' +);
\ No newline at end of file diff --git a/demos/blog/protected/Pages/Admin/config.php b/demos/blog/protected/Pages/Admin/config.php new file mode 100644 index 00000000..d392da4e --- /dev/null +++ b/demos/blog/protected/Pages/Admin/config.php @@ -0,0 +1,13 @@ +<?php +return array( + 'authorization' => array( + array( + 'action' => 'allow', + 'roles' => 'admin', + ), + array( + 'action' => 'deny', + 'users' => '*', + ), + ), +);
\ No newline at end of file diff --git a/demos/blog/protected/Pages/Posts/config.php b/demos/blog/protected/Pages/Posts/config.php new file mode 100644 index 00000000..8af0dd56 --- /dev/null +++ b/demos/blog/protected/Pages/Posts/config.php @@ -0,0 +1,20 @@ +<?php +return array( + 'authorization' => array( + array( + 'action' => 'deny', + 'pages' => 'EditPost,NewPost,MyPost', + 'users' => '?', + ), + array( + 'action' => 'allow', + 'pages' => 'NewCategory,EditCategory', + 'users' => 'admin', + ), + array( + 'action' => 'deny', + 'pages' => 'NewCategory,EditCategory', + 'users' => '*', + ), + ) +);
\ No newline at end of file diff --git a/demos/blog/protected/application.php b/demos/blog/protected/application.php new file mode 100644 index 00000000..d7d7c97b --- /dev/null +++ b/demos/blog/protected/application.php @@ -0,0 +1,86 @@ +<?php +return array( + 'application' => array( + 'id' => 'blog', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using' => array( + 'Application.Common.*', + ), + ), + // Modules configured and loaded for all services + 'modules' => array( + 'request' => array( + 'class' => 'THttpRequest', + 'properties' => array( + 'UrlFormat' => 'Path', + 'UrlManager' => 'friendly-url', + ), + ), + + 'cache' => array( + 'class' => 'System.Caching.TSqliteCache', + ), + + 'error' => array( + 'class' => 'Application.Common.BlogErrorHandler', + ), + array( + 'class' => 'System.Util.TLogRouter', + 'routes' => array( + array( + 'class' => 'TFileLogRoute', + 'properties' => array( + 'Categories' => 'BlogApplication', + ), + ), + ), + ), + array( + 'class' => 'System.Util.TParameterModule', + 'properties' => array( + 'ParameterFile' => 'Application.Data.Settings', + ), + ), + 'friendly-url' => array( + 'class' => 'System.Web.TUrlMapping', + 'properties' => array( + 'EnableCustomUrl' => true, + ), + 'urls' => array( + array('properties' => array('ServiceParameter'=>'Posts.ViewPost','pattern'=>'post/{id}/?','parameters.id'=>'\d+')), + ), + ), + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'BasePath' => 'Application.Pages', + 'DefaultPage' => 'Posts.ListPost', + ), + 'modules' => array( + 'users' => array( + 'class' => 'Application.Common.BlogUserManager', + ), + 'auth' => array( + 'class' => 'System.Security.TAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'Posts.ListPost', + ), + ), + 'data' => array( + 'class' => 'Application.Common.BlogDataModule', + ), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.Layouts.MainLayout', + 'Theme' => 'Basic', + ), + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/chat/index_php.php b/demos/chat/index_php.php new file mode 100644 index 00000000..88427e4a --- /dev/null +++ b/demos/chat/index_php.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/App_Code"; +$sqliteDb = $sqliteDbDir."/chat.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 sqlite file $sqliteDb is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/chat/protected/application.php b/demos/chat/protected/application.php new file mode 100644 index 00000000..ae4e1d8c --- /dev/null +++ b/demos/chat/protected/application.php @@ -0,0 +1,25 @@ +<?php +return array( + 'application' => array( + 'id' => 'Chat', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using'=>array( + 'Application.App_Code.*', + 'System.Data.*', + 'System.Data.ActiveRecord.*', + 'System.Security.*', + 'System.Web.UI.ActiveControls.*', + ), + ), + 'modules' => array( + 'db' => array( + 'class' => 'TActiveRecordConfig', + 'properties' => array( + 'EnableCache' => 'true', + 'Database.ConnectionString'=>"sqlite:protected/App_Code/chat.db", + ) + ), + ), +);
\ No newline at end of file diff --git a/demos/chat/protected/pages/config.php b/demos/chat/protected/pages/config.php new file mode 100644 index 00000000..926bf150 --- /dev/null +++ b/demos/chat/protected/pages/config.php @@ -0,0 +1,31 @@ +<?php +return array( + 'modules' => array( + 'users' => array( + 'class' => 'ChatUserManager', + ), + 'auth' => array( + 'class' => 'TAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'Login', + ), + ), + ), + + 'authorization' => array( + array( + 'action' => 'allow', + 'pages' => 'Login', + 'users' => '?', + ), + array( + 'action' => 'allow', + 'roles' => 'normal', + ), + array( + 'action' => 'deny', + 'users' => '*', + ), + ), +);
\ No newline at end of file diff --git a/demos/northwind-db/index_php.php b/demos/northwind-db/index_php.php new file mode 100644 index 00000000..d3fe038b --- /dev/null +++ b/demos/northwind-db/index_php.php @@ -0,0 +1,26 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; +$runtimePath=$basePath.'/protected/runtime'; + +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."); + +/** SQLite Northwind database file **/ +$sqlite_dir = $basePath.'/protected/data'; +$sqlite_db = $sqlite_dir.'/Northwind.db'; +if(!is_writable($sqlite_dir)) + die("Please make sure that the directory $sqlite_dir is writable by Web server process."); +if(!is_writable($sqlite_db)) + die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/northwind-db/protected/application.php b/demos/northwind-db/protected/application.php new file mode 100644 index 00000000..2d6d4ec7 --- /dev/null +++ b/demos/northwind-db/protected/application.php @@ -0,0 +1,29 @@ +<?php +return array( + 'application' => array( + 'id' => 'northwind-db', + 'mode' => 'Debug' + ), + 'paths' => array( + 'using'=>array( + 'System.Data.*', + 'System.Data.ActiveRecord.*', + 'System.Data.ActiveRecord.Scaffold.*', + 'Application.database.*', + ), + ), + 'modules' => array( + 'db' => array( + 'class' => 'TActiveRecordConfig', + 'database' => array( + 'ConnectionString' => 'sqlite:protected/data/Northwind.db', + ), + ), + 'i81n' => array( + 'class' => 'System.I18N.TGlobalization', + 'properties' => array( + 'DefaultCharSet'=>'UTF-8', + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/personal/index_php.php b/demos/personal/index_php.php new file mode 100644 index 00000000..cf57d82d --- /dev/null +++ b/demos/personal/index_php.php @@ -0,0 +1,13 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; + +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication('protected',false,TApplication::CONFIG_TYPE_PHP); +$application->run();
\ No newline at end of file diff --git a/demos/personal/protected/Pages/Layout.tpl b/demos/personal/protected/Pages/Layout.tpl index 3ffb5306..d650a689 100644 --- a/demos/personal/protected/Pages/Layout.tpl +++ b/demos/personal/protected/Pages/Layout.tpl @@ -8,7 +8,7 @@ <div class="header">
<h1>Your Name Here</h1>
-<h2>My Personal Site</h2>
+<h2><%$siteName%></h2>
<div class="mainmenu">
<com:MainMenu />
diff --git a/demos/personal/protected/Pages/Settings.page b/demos/personal/protected/Pages/Settings.page index 48dfde96..f461fa13 100644 --- a/demos/personal/protected/Pages/Settings.page +++ b/demos/personal/protected/Pages/Settings.page @@ -1,4 +1,4 @@ -<com:TContent ID="main" >
+<com:TContent ID="content" >
Welcome, <com:TLabel Text=<%= $this->User->Name %> />!
This page contains site settings accessible only to site admin.
</com:TContent>
\ No newline at end of file diff --git a/demos/personal/protected/Pages/config.php b/demos/personal/protected/Pages/config.php new file mode 100644 index 00000000..7a42d866 --- /dev/null +++ b/demos/personal/protected/Pages/config.php @@ -0,0 +1,16 @@ +<?php +return array( + 'authorization' => array( + array( + 'action' => 'deny', + 'pages' => 'Settings', + 'users' => '?', + ), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.Pages.Layout', + 'Theme' => 'White', + ), + ), +);
\ No newline at end of file diff --git a/demos/personal/protected/application.php b/demos/personal/protected/application.php new file mode 100644 index 00000000..0d9cadd4 --- /dev/null +++ b/demos/personal/protected/application.php @@ -0,0 +1,41 @@ +<?php +return array( + 'application' => array( + 'id' => 'personal', + 'mode' => 'Debug', + ), + 'paths' => array( + 'using'=>array('Application.common.*'), + ), + 'modules' => array( + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'basePath' => 'Application.Pages', + ), + 'modules' => array( + 'users' => array( + 'class' => 'System.Security.TUserManager', + 'properties' => array( + 'passwordMode' => 'Clear', + ), + 'users' => array( + array('name'=>'demo','password'=>'demo'), + ), + ), // users + 'auth' => array( + 'class' => 'System.Security.TAuthManager', + 'properties' => array( + 'userManager' => 'users', + 'loginPage' => 'UserLogin', + ), + ), + ), + ), + ), + 'parameters' => array( + 'siteName' => 'My Personal Site (PHP Config)', + ) +);
\ No newline at end of file diff --git a/demos/personal/protected/application.xml b/demos/personal/protected/application.xml index d2affe24..b67df94a 100644 --- a/demos/personal/protected/application.xml +++ b/demos/personal/protected/application.xml @@ -33,4 +33,7 @@ </modules>
</service>
</services>
+ <parameters>
+ <parameter id="siteName" value="My Personal Site" />
+ </parameters>
</application>
\ No newline at end of file diff --git a/demos/sqlmap/index_php.php b/demos/sqlmap/index_php.php new file mode 100644 index 00000000..4c382999 --- /dev/null +++ b/demos/sqlmap/index_php.php @@ -0,0 +1,18 @@ +<?php + +$basePath=dirname(__FILE__); +$frameworkPath='../../framework/prado.php'; +$assetsPath=$basePath."/assets"; +$runtimePath=$basePath."/protected/runtime"; + +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."); + +require_once($frameworkPath); + +$application=new TApplication; +$application->run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file diff --git a/demos/sqlmap/protected/application.php b/demos/sqlmap/protected/application.php new file mode 100644 index 00000000..60d9549c --- /dev/null +++ b/demos/sqlmap/protected/application.php @@ -0,0 +1,22 @@ +<?php +return array( + 'application' => array( + 'id' => 'Database', + 'Mode' => 'Debug', + ), + 'paths' => array( + 'Example' => 'APP_CODE', + 'Quickstart' => '../../quickstart', + ), + 'using' => array( + 'Quickstart.protected.controls.*', + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'DefaultPage' => 'Manual.Overview', + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/sqlmap/protected/pages/Manual/config.php b/demos/sqlmap/protected/pages/Manual/config.php new file mode 100644 index 00000000..ca1ec772 --- /dev/null +++ b/demos/sqlmap/protected/pages/Manual/config.php @@ -0,0 +1,18 @@ +<?php +return array( + 'modules' => array( + 'theme' => array( + 'class' => 'System.Web.UI.TThemeManager', + 'properties' => array( + 'BasePath' => 'Quickstart.themes', + 'BaseUrl' => '../quickstart/themes', + ), + ), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.pages.Manual.Layout', + 'Theme' => 'PradoSoft', + ), + ), +);
\ No newline at end of file diff --git a/demos/time-tracker/index_php.php b/demos/time-tracker/index_php.php new file mode 100644 index 00000000..b74690e4 --- /dev/null +++ b/demos/time-tracker/index_php.php @@ -0,0 +1,33 @@ +<?php + +$basePath=dirname(__FILE__); +//$frameworkPath='../../framework/pradolite.php'; +$frameworkPath='../../framework/prado.php'; +$assetsPath=$basePath."/assets"; +$runtimePath=$basePath."/protected/runtime"; + +$sqlite_dir = $basePath."/protected/App_Data/SQLite"; +$sqlite_db = $sqlite_dir.'/time-tracker.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($sqlite_dir)) + die("Please make sure that the directory $sqlite_dir is writable by Web server process."); +if(!is_writable($sqlite_db)) + die("Please make sure that the sqlite database file $sqlite_dir is writable by Web server process."); + +require_once($frameworkPath); + +function h($text) +{ + $app = Prado::getApplication()->getGlobalization(); + $charset = $app ? $app->getCharset() : 'UTF-8'; + return htmlentities($text, ENT_QUOTES, $charset); +} + +$application=new TApplication; +$application->run('protected',false,TApplication::CONFIG_TYPE_PHP);
\ No newline at end of file diff --git a/demos/time-tracker/protected/application.php b/demos/time-tracker/protected/application.php new file mode 100644 index 00000000..4fd65d04 --- /dev/null +++ b/demos/time-tracker/protected/application.php @@ -0,0 +1,49 @@ +<?php +return array( + 'application' => array( + 'id'=>'Time-Tracker', + 'Mode'=>'Debug' + ), + 'paths' => array( + 'aliases' => array( + 'Quickstart' => '../../quickstart', + ), + 'using' => array( + 'System.Data.*', + 'System.Security.*', + 'Application.App_Code.*', + 'Application.App_Code.Dao.*', + 'Application.App_Data.*', + ), + ), + 'modules' => array( + 'daos' => array( + 'class' => 'DaoManager', + 'properties' => array( + 'EnableCache' => 'true', + 'configFile' => 'Application.App_Data.sqlite-sqlmap', + ), + 'daos' => array( + 'UserDao' => 'Application.App_Code.Dao.UserDao', + 'ProjectDao' => 'Application.App_Code.Dao.ProjectDao', + 'TimeEntryDao' => 'Application.App_Code.Dao.TimeEntryDao', + 'CategoryDao' => 'Application.App_Code.Dao.CategoryDao', + 'ReportDao' => 'Application.App_Code.Dao.ReportDao', + ) + ), + 'globalization' => array( + 'class' => 'System.I18N.TGlobalization', + 'properties' => array( + 'CharSet' => 'UTF-8', + ), + ), + ), + 'services' => array( + 'page' => array( + 'class' => 'TPageService', + 'properties' => array( + 'DefaultPage' => 'TimeTracker.LogTimeEntry', + ), + ), + ), +);
\ No newline at end of file diff --git a/demos/time-tracker/protected/pages/TimeTracker/config.php b/demos/time-tracker/protected/pages/TimeTracker/config.php new file mode 100644 index 00000000..8668ca15 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/config.php @@ -0,0 +1,30 @@ +<?php +return array( + 'modules' => array( + 'users' => array( + 'class' => 'Application.App_Code.UserManager', + ), + 'auth' => array( + 'class' => 'Application.App_Code.TrackerAuthManager', + 'properties' => array( + 'UserManager' => 'users', + 'LoginPage' => 'TimeTracker.Login' + ), + ), + ), + 'authorization' => array( + array('action'=>'allow','pages'=>'ProjectList, ProjectDetails, ReportResource, ReportProject','roles'=>'manager'), + array('action'=>'allow','pages'=>'LogTimeEntry','roles'=>'consultant'), + array('action'=>'allow','pages'=>'UserCrate,Logout,Login','users'=>'*'), + array('action'=>'deny','users'=>'*'), + ), + 'pages' => array( + 'properties' => array( + 'MasterClass' => 'Application.pages.TimeTracker.MainLayout', + 'Theme' => 'TimeTracker', + ), + ), + 'parameters' => array( + 'NewUserRoles' => 'admin,manager,consultant', + ), +);
\ No newline at end of file |