summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorxue <>2006-01-11 05:35:34 +0000
committerxue <>2006-01-11 05:35:34 +0000
commitc2981557f2112fbf93267058ad7f9c361bf2f180 (patch)
treefaaa67bcc9d093f839457fb91e59c2bcbbaeb22f /demos
parentdc26c8808c55c60dec31a87d52e028cfa9fea46c (diff)
Fixed many issues with DataBoundControls. Added Prado Composer Demo (not done yet).
Diffstat (limited to 'demos')
-rw-r--r--demos/composer/index.php15
-rw-r--r--demos/composer/protected/pages/Home.page75
-rw-r--r--demos/composer/protected/pages/Home.php120
-rw-r--r--demos/composer/protected/pages/Layout.php15
-rw-r--r--demos/composer/protected/pages/Layout.tpl24
-rw-r--r--demos/composer/themes/Simple/style.css204
6 files changed, 453 insertions, 0 deletions
diff --git a/demos/composer/index.php b/demos/composer/index.php
new file mode 100644
index 00000000..04695b16
--- /dev/null
+++ b/demos/composer/index.php
@@ -0,0 +1,15 @@
+<?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;
+$application->run();
+
+?> \ No newline at end of file
diff --git a/demos/composer/protected/pages/Home.page b/demos/composer/protected/pages/Home.page
new file mode 100644
index 00000000..648bec21
--- /dev/null
+++ b/demos/composer/protected/pages/Home.page
@@ -0,0 +1,75 @@
+<%@ MasterClass="Application.pages.Layout" Theme="Simple" %>
+<com:TContent ID="body" >
+
+<com:TPanel GroupingText="Class Information">
+class <com:TTextBox ID="ClassName" CssClass="slTextBox"/>
+extends <com:TTextBox ID="ParentClass" CssClass="slTextBox"/>
+implements <com:TTextBox ID="Interfaces" CssClass="slTextBox"/>
+<br/>
+Author Name: <com:TTextBox ID="AuthorName" CssClass="slTextBox"/>
+Author Email: <com:TTextBox ID="AuthorEmail" CssClass="slTextBox"/>
+<br/>
+Comments: <com:TTextBox ID="Comments" TextMode="MultiLine"/>
+</com:TPanel>
+
+<com:TPanel GroupingText="Property Definitions">
+<table>
+<tr>
+ <th>Accessibility</th>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Default Value</th>
+ <th>Storage Mode</th>
+ <th>Comments</th>
+ <th>Actions</th>
+</tr>
+<com:TRepeater ID="Repeater">
+<prop:ItemTemplate>
+<tr>
+ <td>
+ <com:TCheckBox ID="IsProtected" Text="protected" Checked=<%# $this->Parent->DataItem->IsProtected %> />
+ <com:TCheckBox ID="ReadOnly" Text="read-only" Checked=<%# $this->Parent->DataItem->ReadOnly %> />
+ </td>
+ <td>
+ <com:TTextBox ID="PropertyName" Text=<%# $this->Parent->DataItem->Name %> CssClass="slTextBox"/>
+ </td>
+ <td>
+ <com:TDropDownList ID="PropertyType" SelectedValue=<%# $this->Parent->DataItem->Type %> >
+ <com:TListItem Text="string" />
+ <com:TListItem Text="integer" />
+ <com:TListItem Text="boolean" />
+ <com:TListItem Text="enumerable" />
+ <com:TListItem Text="mixed" />
+ </com:TDropDownList>
+ </td>
+ <td>
+ <com:TTextBox ID="DefaultValue" Text=<%# $this->Parent->DataItem->DefaultValue %> CssClass="slTextBox"/>
+ </td>
+ <td>
+ <com:TDropDownList ID="Storage" SelectedValue=<%# $this->Parent->DataItem->Storage %> >
+ <com:TListItem Text="ViewState" />
+ <com:TListItem Text="ControlState" />
+ <com:TListItem Text="Memory" />
+ </com:TDropDownList>
+ </td>
+ <td>
+ <com:TTextBox ID="Comments" Text=<%# $this->Parent->DataItem->Comments %> CssClass="slTextBox"/>
+ </td>
+ <td>
+ <com:TButton Text="Add" />
+ <com:TButton Text="Remove" />
+ </td>
+</tr>
+</prop:ItemTemplate>
+</com:TRepeater>
+</table>
+</com:TPanel>
+<com:TPanel GroupingText="Event Definitions">
+Event Definitions:
+</com:TPanel>
+<com:TButton Text="Generate Code" Click="generateCode" />
+<pre>
+<com:TLiteral ID="SourceCode" />
+</pre>
+
+</com:TContent>
diff --git a/demos/composer/protected/pages/Home.php b/demos/composer/protected/pages/Home.php
new file mode 100644
index 00000000..a2281828
--- /dev/null
+++ b/demos/composer/protected/pages/Home.php
@@ -0,0 +1,120 @@
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->setDataSource($this->getInitialProperties());
+ $this->Repeater->dataBind();
+ }
+ else
+ $this->Repeater->ensureChildControls();
+ }
+
+ protected function getInitialProperties()
+ {
+ return array(
+ new PropertyDefinition,
+ new PropertyDefinition,
+ new PropertyDefinition,
+ new PropertyDefinition,
+ );
+ }
+
+ public function generateCode($sender,$param)
+ {
+ $code="<?php\n\n";
+ $code.="class ".$this->ClassName->Text." extends ".$this->ParentClass->Text."implements ".$this->Interfaces->Text;
+ $code.="\n";
+ $code.="{\n";
+ $code.="}\n";
+ $code.="?>";
+ $this->SourceCode->Text=htmlentities($code);
+ }
+}
+
+class PropertyDefinition extends TComponent
+{
+ private $_name='';
+ private $_type='string';
+ private $_default='';
+ private $_readOnly=false;
+ private $_protected=false;
+ private $_storage='ViewState';
+ private $_comments='';
+
+ public function getName()
+ {
+ return $this->_name;
+ }
+
+ public function setName($value)
+ {
+ $this->_name=$value;
+ }
+
+ public function getType()
+ {
+ return $this->_type;
+ }
+
+ public function setType($value)
+ {
+ $this->_type=$value;
+ }
+
+ public function getDefaultValue()
+ {
+ return $this->_default;
+ }
+
+ public function setDefaultValue($value)
+ {
+ $this->_default=$value;
+ }
+
+ public function getReadOnly()
+ {
+ return $this->_readOnly;
+ }
+
+ public function setReadOnly($value)
+ {
+ $this->_readOnly=TPropertyValue::ensureBoolean($value);
+ }
+
+ public function getIsProtected()
+ {
+ return $this->_protected;
+ }
+
+ public function setIsProtected($value)
+ {
+ $this->_protected=TPropertyValue::ensureBoolean($value);
+ }
+
+ public function getStorage()
+ {
+ return $this->_storage;
+ }
+
+ public function setStorage($value)
+ {
+ $this->_storage=$value;
+ }
+
+ public function getComments()
+ {
+ return $this->_comments;
+ }
+
+ public function setComments($value)
+ {
+ $this->_comments=$value;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/composer/protected/pages/Layout.php b/demos/composer/protected/pages/Layout.php
new file mode 100644
index 00000000..a82d2fff
--- /dev/null
+++ b/demos/composer/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/composer/protected/pages/Layout.tpl b/demos/composer/protected/pages/Layout.tpl
new file mode 100644
index 00000000..b72e8959
--- /dev/null
+++ b/demos/composer/protected/pages/Layout.tpl
@@ -0,0 +1,24 @@
+<!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 Composer">
+<meta http-equiv="content-language" content="en"/>
+</com:THead>
+
+<body>
+<com:TForm>
+<div id="header">
+Prado Composer (Component Writer)
+</div>
+
+<div id="content" width="100%">
+<com:TContentPlaceHolder ID="body" />
+</div>
+
+<div id="footer">
+Copyright &copy; 2006 <a href="http://www.pradosoft.com">PradoSoft</a>.
+</div>
+
+</com:TForm>
+</body>
+</html> \ No newline at end of file
diff --git a/demos/composer/themes/Simple/style.css b/demos/composer/themes/Simple/style.css
new file mode 100644
index 00000000..b036d56d
--- /dev/null
+++ b/demos/composer/themes/Simple/style.css
@@ -0,0 +1,204 @@
+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;
+}
+
+h1 {
+ font-size:13pt;
+}
+
+h2 {
+ font-size:12pt;
+}
+
+h3 {
+ font-size:10pt;
+ font-weight:bold;
+}
+
+.slTextBox {
+ border: 0px;
+ border-bottom: 1px solid silver;
+ text-align:center;
+}
+
+#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;
+ width:200px;
+ padding:5px;
+}
+
+#content {
+ background:#fff;
+ padding:10px;
+}
+
+#footer {
+ clear:both;
+ color: gray;
+ font-size:8pt;
+ text-align:center;
+ margin-top:25px;
+ padding:10px;
+}
+
+.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;
+}
+
+.source {
+ padding: 0.5em;
+ border-style:dotted;
+ border-width:1px;
+ border-color:#cccccc;
+ background-color:#ffffee;
+ font-family: "Courier New", Courier, mono;
+ margin-top: 0.2em;
+ margin-bottom: 0.5em;
+}
+
+.source pre {
+ font-family: "Courier New", Courier, mono;
+ margin: 0;
+}
+
+.runbar a:link, .runbar a:visited {
+ background-color:#BFE4FF;
+ font-size: 12px;
+ font-weight: bold;
+ padding: 3px;
+ padding-left: 6px;
+ padding-right: 6px;
+ border-top: 1px solid white;
+ border-left: 1px solid white;
+ border-bottom: 1px solid #aaaaaa;
+ border-right: 1px solid #aaaaaa;
+ text-decoration: none;
+}
+
+.runbar a:link.active, .runbar a:visited.active, .runbar a:hover {
+ background-color:#BFE4FF;
+ font-size: 12px;
+ font-weight: bold;
+ padding: 3px;
+ padding-left: 6px;
+ padding-right: 6px;
+ border-top: 1px solid #aaaaaa;
+ border-left: 1px solid #aaaaaa;
+ border-bottom: 1px solid white;
+ border-right: 1px solid white;
+}
+
+#sourceList {
+ background-color:#BFE4FF;
+ margin:10px 10px 0px 10px;
+ padding:10px;
+ border:1px solid silver;
+}
+
+#sourceView {
+ font-family: "Courier New", Courier, mono;
+ background-color:#ffffee;
+ margin:5px 10px 10px 10px;
+ border:1px solid silver;
+ padding:10px;
+}
+
+code {
+ font-family: "Courier New", Courier, mono;
+}
+
+tt {
+ font-family: "Courier New", Courier, mono;
+ border-bottom: 1px dotted silver;
+}
+
+.sampleheader {
+ background:#00487D;
+ color:white;
+ padding:3px;
+}
+
+.sampleheader a {
+ color:white;
+}
+
+.samplepanel {
+ margin: 0px;
+ border: 1px solid silver;
+ padding: 10px;
+ margin-bottom:10px;
+}
+
+.sampletitle {
+ width: 100%;
+ border-bottom:1px solid silver;
+ font-weight:bold;
+ margin-bottom:5px;
+}
+
+.sampletable {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+td.samplenote {
+ width: 300px;
+ text-align: right;
+ background: #BFE4FF;
+ border: 1px solid silver;
+ padding: 5px;
+ vertical-align: top;
+}
+
+td.sampleaction {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 5px;
+ vertical-align: top;
+}