summaryrefslogtreecommitdiff
path: root/demos/composer/protected/pages
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/composer/protected/pages
parentdc26c8808c55c60dec31a87d52e028cfa9fea46c (diff)
Fixed many issues with DataBoundControls. Added Prado Composer Demo (not done yet).
Diffstat (limited to 'demos/composer/protected/pages')
-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
4 files changed, 234 insertions, 0 deletions
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