diff options
-rw-r--r-- | .gitattributes | 15 | ||||
-rw-r--r-- | demos/quickstart/index.php | 16 | ||||
-rw-r--r-- | demos/quickstart/protected/.htaccess | 1 | ||||
-rw-r--r-- | demos/quickstart/protected/application.xml | 7 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Construction.page | 5 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/DetailPage.php | 55 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Layout.php | 15 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/Layout.tpl | 32 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/TopicList.php | 8 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/TopicList.tpl | 67 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/chap1/AboutPrado.page | 19 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/chap1/Installation.page | 11 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/chap1/Introduction.page | 7 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/chap1/config.xml | 5 | ||||
-rw-r--r-- | demos/quickstart/protected/pages/config.xml | 8 | ||||
-rw-r--r-- | demos/quickstart/themes/Simple/style.css | 75 |
16 files changed, 346 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index 9fed6ec1..5494b5cb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,6 +19,21 @@ demos/personal/protected/Pages/config.xml -text demos/personal/themes/BlueTheme/buttons.skin -text demos/personal/themes/BlueTheme/icon_profile.gif -text demos/personal/themes/BlueTheme/labels.skin -text +demos/quickstart/index.php -text +demos/quickstart/protected/.htaccess -text +demos/quickstart/protected/application.xml -text +demos/quickstart/protected/pages/Construction.page -text +demos/quickstart/protected/pages/DetailPage.php -text +demos/quickstart/protected/pages/Layout.php -text +demos/quickstart/protected/pages/Layout.tpl -text +demos/quickstart/protected/pages/TopicList.php -text +demos/quickstart/protected/pages/TopicList.tpl -text +demos/quickstart/protected/pages/chap1/AboutPrado.page -text +demos/quickstart/protected/pages/chap1/Installation.page -text +demos/quickstart/protected/pages/chap1/Introduction.page -text +demos/quickstart/protected/pages/chap1/config.xml -text +demos/quickstart/protected/pages/config.xml -text +demos/quickstart/themes/Simple/style.css -text docs/application.xml -text docs/conceptual-structure.vsd -text docs/request-sequence.vsd -text diff --git a/demos/quickstart/index.php b/demos/quickstart/index.php new file mode 100644 index 00000000..174f5d33 --- /dev/null +++ b/demos/quickstart/index.php @@ -0,0 +1,16 @@ +<?php
+
+$basePath=dirname(__FILE__);
+$frameworkPath=$basePath.'/../../framework/prado.php';
+$configPath=$basePath.'/protected/application.xml';
+$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($configPath,true);
+$application->run();
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/.htaccess b/demos/quickstart/protected/.htaccess new file mode 100644 index 00000000..e0198322 --- /dev/null +++ b/demos/quickstart/protected/.htaccess @@ -0,0 +1 @@ +deny from all
diff --git a/demos/quickstart/protected/application.xml b/demos/quickstart/protected/application.xml new file mode 100644 index 00000000..c46b2e13 --- /dev/null +++ b/demos/quickstart/protected/application.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<application id="QuickStart" Mode="Debug">
+ <services>
+ <service id="page" class="TPageService" DefaultPage="chap1.Introduction" />
+ </services>
+</application>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Construction.page b/demos/quickstart/protected/pages/Construction.page new file mode 100644 index 00000000..3eec612e --- /dev/null +++ b/demos/quickstart/protected/pages/Construction.page @@ -0,0 +1,5 @@ +<com:TContent ID="body">
+
+Sorry. This page is still under construction. Please check back later.
+
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/DetailPage.php b/demos/quickstart/protected/pages/DetailPage.php new file mode 100644 index 00000000..afd81272 --- /dev/null +++ b/demos/quickstart/protected/pages/DetailPage.php @@ -0,0 +1,55 @@ +<?php
+
+class DetailPage extends TPage
+{
+ private $_file;
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $isSrc=true;
+ if(($id=$this->Request->Items['src'])===null)
+ $this->_file=$this->determineFile($this->Request->Items['tpl'],false);
+ else
+ $this->_file=$this->determineFile($id,true);
+ }
+
+ protected function determineFile($id,$isSrcFile)
+ {
+ $basePath=dirname(__FILE__).'/controls';
+
+ $xml=new TXmlDocument;
+ $xml->loadFromFile($basePath.'/config.xml');
+ $pages=$xml->getElementByTagName('pages')->getElementsByTagName('page');
+ $fileName='';
+ foreach($pages as $page)
+ {
+ if($page->Attributes['id']===$id)
+ {
+ if($isSrcFile)
+ $fileName=$basePath.'/'.$page->Attributes['class'].'.php';
+ else if($page->Attributes['TemplateFile']!==null)
+ {
+ $fileName=$page->Attributes['TemplateFile'];
+ if(($pos=strrpos($fileName,'.'))!==false)
+ $fileName=substr($fileName,$pos+1);
+ $fileName=$basePath.'/'.$fileName.'.tpl';
+ }
+ else
+ $fileName=$basePath.'/'.$page->Attributes['class'].'.tpl';
+ break;
+ }
+ }
+ if(empty($fileName) || !is_file($fileName))
+ throw new THttpException(500,"File not exists!");
+ return $fileName;
+ }
+
+ protected function render($writer)
+ {
+ $contents=file_get_contents($this->_file);
+ $writer->write(highlight_string($contents,true));
+ }
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Layout.php b/demos/quickstart/protected/pages/Layout.php new file mode 100644 index 00000000..a82d2fff --- /dev/null +++ b/demos/quickstart/protected/pages/Layout.php @@ -0,0 +1,15 @@ +<?php
+
+class Layout extends TTemplateControl
+{
+ public function toggleTopicPanel($sender,$param)
+ {
+ $this->TopicPanel->Visible=!$this->TopicPanel->Visible;
+ if($this->TopicPanel->Visible)
+ $sender->Text="Hide TOC";
+ else
+ $sender->Text="Show TOC";
+ }
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Layout.tpl b/demos/quickstart/protected/pages/Layout.tpl new file mode 100644 index 00000000..2c22adce --- /dev/null +++ b/demos/quickstart/protected/pages/Layout.tpl @@ -0,0 +1,32 @@ +<!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" >
+
+<com:THead Title="PRADO QuickStart Tutorial">
+<meta http-equiv="content-language" content="en"/>
+</com:THead>
+
+<body>
+<com:TForm>
+<div id="header">
+Prado QuickStart Tutorial
+</div>
+
+<div id="menu">
+<a href="?">Home</a> |
+<a href="http://www.pradosoft.com">PradoSoft.com</a> |
+<com:TLinkButton Text="Hide TOC" Click="toggleTopicPanel" />
+</div>
+
+<com:Pages.TopicList ID="TopicPanel" />
+
+<div id="content">
+<com:TContentPlaceHolder ID="body" />
+</div>
+
+<div id="footer">
+Copyright © 2005 <a href="http://www.pradosoft.com">PradoSoft</a>.
+</div>
+
+</com:TForm>
+</body>
+</html>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/TopicList.php b/demos/quickstart/protected/pages/TopicList.php new file mode 100644 index 00000000..ce827cc0 --- /dev/null +++ b/demos/quickstart/protected/pages/TopicList.php @@ -0,0 +1,8 @@ +<?php
+
+class TopicList extends TTemplateControl
+{
+
+}
+
+?>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/TopicList.tpl b/demos/quickstart/protected/pages/TopicList.tpl new file mode 100644 index 00000000..def0f9d7 --- /dev/null +++ b/demos/quickstart/protected/pages/TopicList.tpl @@ -0,0 +1,67 @@ +<div id="toc">
+
+<div class="topic">
+<span>Getting Started</span><br/>
+<a href="?page=chap1.Introduction">Introduction</a><br/>
+<a href="?page=chap1.AboutPrado">What is PRADO?</a><br/>
+<a href="?page=chap1.Installation">Installation</a><br/>
+</div>
+
+<div class="topic">
+<span>Fundamentals</span><br/>
+<a href="?page=Construction">Architecture</a><br/>
+<a href="?page=Construction">Key Concepts</a><br/>
+<a href="?page=Construction">Configurations</a><br/>
+<a href="?page=Construction">Templates</a><br/>
+</div>
+
+<div class="topic">
+<span>Applications</span><br/>
+<a href="?page=chap2.Structure">Directory Structure</a><br/>
+<a href="?page=chap2.Deployment">Application Deployment</a><br/>
+<a href="?page=chap2.HelloWorld">Sample: Hello World</a><br/>
+<a href="?page=chap2.HangmanGame">Sample: Hangman Game</a><br/>
+</div>
+
+<div class="topic">
+<span>Controls</span><br/>
+<a href="?page=Construction">Simple Controls</a><br/>
+<a href="?page=Construction">Validation Controls</a><br/>
+<a href="?page=Construction">List Controls</a><br/>
+<a href="?page=Construction">TRepeater</a><br/>
+<a href="?page=Construction">TDataList</a><br/>
+<a href="?page=Construction">TDataGrid</a><br/>
+<a href="?page=Construction">Active Controls</a><br/>
+<a href="?page=Construction">Authoring New Controls</a><br/>
+</div>
+
+<div class="topic">
+<span>Data Access</span><br/>
+<a href="?page=Construction">DataBinding</a><br/>
+<a href="?page=Construction">Data Bound Controls</a><br/>
+<a href="?page=Construction">Data Source Controls</a><br/>
+</div>
+
+<div class="topic">
+<span>Avanced Features</span><br/>
+<a href="?page=Construction">Overview</a><br/>
+<a href="?page=Construction">Theme and Skin</a><br/>
+<a href="?page=Construction">Asset</a><br/>
+<a href="?page=Construction">Internationalization</a><br/>
+</div>
+
+<div class="topic">
+<span>Security</span><br/>
+<a href="?page=Construction">Overview</a><br/>
+<a href="?page=Construction">Authentication</a><br/>
+<a href="?page=Construction">Authorization</a><br/>
+<a href="?page=Construction">ViewState Protection</a><br/>
+</div>
+
+<div class="topic">
+<span>Performance</span><br/>
+<a href="?page=Construction">Caching</a><br/>
+<a href="?page=Construction">Performance Tuning</a><br/>
+</div>
+
+</div>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/chap1/AboutPrado.page b/demos/quickstart/protected/pages/chap1/AboutPrado.page new file mode 100644 index 00000000..0ffc25d3 --- /dev/null +++ b/demos/quickstart/protected/pages/chap1/AboutPrado.page @@ -0,0 +1,19 @@ +<com:TContent ID="body" >
+<h4>What is PRADO?</h4>
+<p>
+PRADO stands for <b>P</b>HP <b>R</b>apid <b>A</b>pplication <b>D</b>evelopment
+<b>O</b>bject-oriented.
+</p>
+<p>
+PRADO is a component-based and event-driven programming framework for developing Web applications in PHP 5.
+</p>
+<p>
+PRADO stipulates a protocol of writing and using components to construct Web applications. A component is a software unit that is self-contained and can be reused with trivial customization. New components can be developed by either inheriting or composing from existing ones. Component-based programming brings great freedom in teamwork anf offers the ultimate extensibility and maintenability to the code. PRADO implements a set of elementary components that represent commonly used Web elements, such as input field, checkbox, dropdown list, etc.
+</p>
+<p>
+PRADO implements an event-driven programming scheme that allows delegation of extensible behavior to components. End-user activities, such as clicking on a submit button, changing the content in an input field, are captured as server events. Methods or functions may be attached to these events so that when the events happen, they are invoked automatically to respond to the events. Compared with the traditional Web programming in which developers have to deal with the raw POST or GET variables, event-driven programming helps developers better focus on the necessary logic and reduces significantly the low-level repetitive coding.
+</p>
+<p>
+Developing a PRADO Web application mainly involves instantiating prebuilt component types, configuring them by setting their properties, responding to their events by writing handler functions, and composing them into pages for the application. It is very similar to RAD toolkits, such as Borland Delphi and Microsoft Visual Basic, that are used to develop desktop GUI applications.
+</p>
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/chap1/Installation.page b/demos/quickstart/protected/pages/chap1/Installation.page new file mode 100644 index 00000000..5723fcc9 --- /dev/null +++ b/demos/quickstart/protected/pages/chap1/Installation.page @@ -0,0 +1,11 @@ +<com:TContent ID="body" >
+<h4>Installing PRADO</h4>
+<p>
+If you are viewing this page from your own Web server, you are already done
+with the installation. The instructions at the end of this page, however,
+may still be useful for you to troubleshoot issues happened during your
+development based on PRADO.
+</p>
+<p>
+</p>
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/chap1/Introduction.page b/demos/quickstart/protected/pages/chap1/Introduction.page new file mode 100644 index 00000000..b622b0d7 --- /dev/null +++ b/demos/quickstart/protected/pages/chap1/Introduction.page @@ -0,0 +1,7 @@ +<com:TContent ID="body" >
+<h4>Welcome to the PRADO QuickStart Tutorial</h4>
+<p>
+This QuickStart tutorial is meant to get you quickly started to build your
+own Web applications based on PRADO.
+</p>
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/chap1/config.xml b/demos/quickstart/protected/pages/chap1/config.xml new file mode 100644 index 00000000..6806e43a --- /dev/null +++ b/demos/quickstart/protected/pages/chap1/config.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <pages MasterClass="Pages.Layout" Theme="Simple" />
+</configuration>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/config.xml b/demos/quickstart/protected/pages/config.xml new file mode 100644 index 00000000..41d5999d --- /dev/null +++ b/demos/quickstart/protected/pages/config.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <paths>
+ <alias id="Pages" path="." />
+ </paths>
+ <pages MasterClass="Pages.Layout" Theme="Simple" />
+</configuration>
\ No newline at end of file diff --git a/demos/quickstart/themes/Simple/style.css b/demos/quickstart/themes/Simple/style.css new file mode 100644 index 00000000..617d76a0 --- /dev/null +++ b/demos/quickstart/themes/Simple/style.css @@ -0,0 +1,75 @@ +body {
+ font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Helvetica, Arial, sans-serif;
+ font-weight:normal;
+ font-size:10pt;
+ color:black;
+ margin:0px 0px 0px 0px;
+ padding:0px;
+}
+
+#header {
+ font-size:13pt;
+ font-weight:bold;
+ background:#fff;
+ height:40px;
+ padding:5px;
+}
+
+#menu {
+ padding:3px;
+ padding-right:10px;
+ background:#00487D;
+ color:white;
+ text-align:right;
+}
+
+#menu a {
+ color:#BFE4FF;
+ text-decoration:none;
+}
+
+#menu a:hover {
+ color:white;
+}
+
+#toc {
+ background:#BFE4FF;
+ float:right;
+ width:200px;
+ padding:5px;
+}
+
+#content {
+ float:left;
+ background:#fff;
+ padding:5px;
+}
+
+#footer {
+ clear:both;
+ color: gray;
+ font-size:8pt;
+ text-align:center;
+ margin-top:25px;
+ padding:5px;
+}
+
+.topic {
+ font-size: 10pt;
+ padding: 0px 0px 10px 0px;
+}
+
+.topic span {
+ font-size: 11pt;
+ font-weight:bold;
+ color:#00487D;
+}
+
+.topic a {
+ color:#00487D;
+ padding-left:10px;
+}
+
+.topic a:hover{
+ color:red;
+}
\ No newline at end of file |