summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages
diff options
context:
space:
mode:
authorxue <>2006-06-02 18:27:02 +0000
committerxue <>2006-06-02 18:27:02 +0000
commit0f3a577bed4d828472469675e90fcab032e33f44 (patch)
tree3ca817247b8006563900d5fb8995d6a6f0627a2b /demos/quickstart/protected/pages
parent067ab51fbd9b2f18f63fc80895476e5b0e2f9bfb (diff)
merge from 3.0 branch till 1133.
Diffstat (limited to 'demos/quickstart/protected/pages')
-rw-r--r--demos/quickstart/protected/pages/Advanced/I18N.page6
-rw-r--r--demos/quickstart/protected/pages/Comments.page46
-rw-r--r--demos/quickstart/protected/pages/Comments.php76
3 files changed, 126 insertions, 2 deletions
diff --git a/demos/quickstart/protected/pages/Advanced/I18N.page b/demos/quickstart/protected/pages/Advanced/I18N.page
index 5b1fafa0..6c86a6c9 100644
--- a/demos/quickstart/protected/pages/Advanced/I18N.page
+++ b/demos/quickstart/protected/pages/Advanced/I18N.page
@@ -148,9 +148,11 @@ To translate a message or string in the template, use <tt>TTranslate</tt>.</p>
&lt;com:TTranslate Text="Goodbye" /&gt;
</com:TTextHighlighter>
-<p><tt>TTranslate</tt> can also perform string substitution. Any attributes of <tt>TTranslate</tt> will be substituted with <tt>{attribute name}</tt> in the translation. E.g.</p>
+<p><tt>TTranslate</tt> can also perform string substitution.
+The <tt>Parameters</tt> property can be use to add name values pairs for substitution. Substrings in the translation enclosed with "{" and "}" are consider as the
+ parameter names during substitution lookup. The following example will substitute the substring "{time}" with the value of the parameter attribute "<tt>Parameters.time=&lt;%= time() %&gt;</tt>".
<com:TTextHighlighter Language="prado" CssClass="source">
-&lt;com:TTranslate time="late"&gt;
+&lt;com:TTranslate Parameters.time=&lt;%= time() %&gt; &gt;
The time is {time}.
&lt;/com:TTranslate&gt;
</com:TTextHighlighter>
diff --git a/demos/quickstart/protected/pages/Comments.page b/demos/quickstart/protected/pages/Comments.page
new file mode 100644
index 00000000..32c7bcae
--- /dev/null
+++ b/demos/quickstart/protected/pages/Comments.page
@@ -0,0 +1,46 @@
+<com:TContent ID="body">
+ <com:TDataList
+ ID="comments"
+ DataKeyField="id"
+ OnEditCommand="editComment"
+ OnCancelCommand="cancelEdit"
+ OnUpdateCommand="updateComment"
+ OnDeleteCommand="deleteComment"
+ OnSelectedIndexChanged="approveComment"
+ ItemStyle.BackColor="#BFCFFF"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ EditItemStyle.BackColor="lightgreen">
+
+ <prop:HeaderTemplate>
+ Comments awaiting approval
+ </prop:HeaderTemplate>
+
+ <prop:ItemTemplate>
+ <span class="page"><%# $this->DataItem['page'] %></span>
+ <span class="date">
+ <com:TDateFormat Value=<%# intval($this->DataItem['date_added']) %> />
+ </span>
+ <span class="email">
+ <%# $this->DataItem['email'] %>
+ </span>
+ <div class="comment">
+ <com:TSafeHtml>
+ <%# $this->DataItem['comment']%>
+ </com:TSafeHtml>
+ </div>
+ <com:TLinkButton Text="Edit" CommandName="edit" />
+ <com:TLinkButton Text="Delete" CommandName="delete"
+ Attributes.onclick="if(!confirm('Are you sure?')) return false;" />
+ <com:TLinkButton Text="Approve" CommandName="select" />
+ </prop:ItemTemplate>
+
+ <prop:EditItemTemplate>
+ <com:TTextBox ID="email" Text=<%# $this->DataItem['email'] %> />
+ <com:TTextBox ID="page" Text=<%# $this->DataItem['page'] %> />
+ <com:TTextBox ID="content" Text=<%# $this->DataItem['comment'] %> TextMode="MultiLine"/>
+ <com:TLinkButton Text="Save" CommandName="update" />
+ <com:TLinkButton Text="Cancel" CommandName="cancel" />
+ </prop:EditItemTemplate>
+
+ </com:TDataList>
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Comments.php b/demos/quickstart/protected/pages/Comments.php
new file mode 100644
index 00000000..7af70ece
--- /dev/null
+++ b/demos/quickstart/protected/pages/Comments.php
@@ -0,0 +1,76 @@
+<?php
+
+Prado::using('System.I18N.*');
+
+/**
+ * Comments class.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version : $ Sat May 27 20:23:00 AZOST 2006 $
+ * @package Demo.Quickstart
+ * @since 3.0
+ */
+class Comments extends TPage
+{
+ private $_quickstart;
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $this->_quickstart = new QuickStartComments;
+ if(!$this->getIsPostBack())
+ $this->refreshData();
+ }
+
+ protected function refreshData()
+ {
+ $this->comments->setDataSource($this->_quickstart->getQuequedComments());
+ $this->comments->dataBind();
+ }
+
+ public function approveComment($sender, $param)
+ {
+ $ID = $this->comments->DataKeys[$this->comments->SelectedItemIndex];
+ $this->_quickstart->approveComment($ID);
+ $this->refreshData();
+ $this->comments->SelectedItemIndex=-1;
+ }
+
+ public function editComment($sender, $param)
+ {
+ $this->comments->SelectedItemIndex=-1;
+ $this->comments->EditItemIndex=$param->Item->ItemIndex;
+ $this->refreshData();
+ }
+
+ public function cancelEdit($sender, $param)
+ {
+ $this->comments->SelectedItemIndex=-1;
+ $this->comments->EditItemIndex=-1;
+ $this->refreshData();
+ }
+
+ public function deleteComment($sender, $param)
+ {
+ $ID = $this->comments->DataKeys[$param->Item->ItemIndex];
+ $this->_quickstart->deleteComment($ID);
+ $this->comments->SelectedItemIndex=-1;
+ $this->comments->EditItemIndex=-1;
+ $this->refreshData();
+ }
+
+ public function updateComment($sender, $param)
+ {
+ $item=$param->Item;
+ $this->_quickstart->updateComment(
+ $this->comments->DataKeys[$item->ItemIndex],
+ $item->page->Text,
+ $item->email->Text,
+ $item->content->Text);
+
+ $this->comments->EditItemIndex=-1;
+ $this->refreshData();
+ }
+}
+
+?> \ No newline at end of file