diff options
Diffstat (limited to 'demos/quickstart')
93 files changed, 2302 insertions, 874 deletions
diff --git a/demos/quickstart/protected/controls/Layout.tpl b/demos/quickstart/protected/controls/Layout.tpl index b9e36e40..c3e67272 100755 --- a/demos/quickstart/protected/controls/Layout.tpl +++ b/demos/quickstart/protected/controls/Layout.tpl @@ -50,7 +50,7 @@ </table>
<div id="footer">
-Copyright © 2005-2013 <a href="http://www.pradosoft.com">PradoSoft</a>.
+Copyright © 2005-2014 <a href="http://www.pradosoft.com">PradoSoft</a>.
<br/><br/>
<%= Prado::poweredByPrado() %>
<a href="http://validator.w3.org/check?uri=referer"><img border="0" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
diff --git a/demos/quickstart/protected/controls/SampleLayout.tpl b/demos/quickstart/protected/controls/SampleLayout.tpl index 5a5ca898..ba286f0f 100755 --- a/demos/quickstart/protected/controls/SampleLayout.tpl +++ b/demos/quickstart/protected/controls/SampleLayout.tpl @@ -19,7 +19,7 @@ </div>
<div class="samplemenu">
<div class="copyright">
- Copyright © 2005-2013 <a href="http://www.pradosoft.com">PradoSoft</a>
+ Copyright © 2005-2014 <a href="http://www.pradosoft.com">PradoSoft</a>
</div>
</div>
diff --git a/demos/quickstart/protected/controls/TopicList.tpl b/demos/quickstart/protected/controls/TopicList.tpl index adcdff4a..b8563c50 100755..100644 --- a/demos/quickstart/protected/controls/TopicList.tpl +++ b/demos/quickstart/protected/controls/TopicList.tpl @@ -8,6 +8,9 @@ <li><a href="?page=GettingStarted.Installation">Installation</a></li>
<li><a href="?page=GettingStarted.NewFeatures">New Features</a></li>
<li><a href="?page=GettingStarted.Upgrading">Upgrading from v2.x and v1.x</a></li>
+ <li><a href="?page=GettingStarted.Upgrading32">Upgrading from v3.2</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,9 +20,7 @@ <li><a href="?page=GettingStarted.HelloWorld">Creating First PRADO Application</a></li>
<li><a href="?page=Fundamentals.Hangman">Sample: Hangman Game</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Currency Converter</a></li>
- <li><a href="?page=Tutorial.AddressBook">Address Book</a></li>
- <li><a href="?page=Tutorial.AjaxChat">AJAX Chat Client</a></li>
- <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">AJAX Chat Client</a></li>
</ul>
</div>
@@ -27,7 +28,8 @@ <div>Fundamentals</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">Architecture</a></li>
- <li><a href="?page=Fundamentals.Components">Components</a></li>
+ <li><a href="?page=Fundamentals.Components1">Components: Part I</a></li>
+ <li><a href="?page=Fundamentals.Components2">Components: Part II</a></li>
<li><a href="?page=Fundamentals.Controls">Controls</a></li>
<li><a href="?page=Fundamentals.Pages">Pages</a></li>
<li><a href="?page=Fundamentals.Modules">Modules</a></li>
@@ -56,7 +58,9 @@ <li><a href="?page=Controls.Validation">Validation Controls</a></li>
<li><a href="?page=Controls.List">List Controls</a></li>
<li><a href="?page=Controls.Data">Data Controls</a></li>
+ <li><a href="?page=ActiveControls.Introduction">AJAX: Introduction</a></li>
<li><a href="?page=ActiveControls.Home">Active Controls (AJAX)</a></li>
+ <li><a href="?page=JuiControls.Home">Jui Controls (jQuery UI)</a></li>
<li><a href="?page=Controls.NewControl">Writing New Controls</a></li>
</ul>
</div>
diff --git a/demos/quickstart/protected/controls/es/SampleLayout.tpl b/demos/quickstart/protected/controls/es/SampleLayout.tpl index 24f0575a..d6d4d9b4 100755 --- a/demos/quickstart/protected/controls/es/SampleLayout.tpl +++ b/demos/quickstart/protected/controls/es/SampleLayout.tpl @@ -19,7 +19,7 @@ </div>
<div class="samplemenu">
<div class="copyright">
- Copyright © 2005-2013 <a href="http://www.pradosoft.com">PradoSoft</a>
+ Copyright © 2005-2014 <a href="http://www.pradosoft.com">PradoSoft</a>
</div>
</div>
diff --git a/demos/quickstart/protected/controls/es/TopicList.tpl b/demos/quickstart/protected/controls/es/TopicList.tpl index be4be752..b0129826 100755..100644 --- a/demos/quickstart/protected/controls/es/TopicList.tpl +++ b/demos/quickstart/protected/controls/es/TopicList.tpl @@ -1,13 +1,15 @@ <div id="toc">
<div class="topic">
-<div>Comenzar</div>
+<div>Comenzar</div>
<ul>
<li><a href="?page=GettingStarted.Introduction">Introducción</a></li>
<li><a href="?page=GettingStarted.AboutPrado">¿Que es PRADO?</a></li>
<li><a href="?page=GettingStarted.Installation">Instalación</a></li>
<li><a href="?page=GettingStarted.NewFeatures">Nuevas Funcionalidades</a></li>
<li><a href="?page=GettingStarted.Upgrading">Actualizar desde la version v2.x y v1.x</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,9 +19,8 @@ <li><a href="?page=GettingStarted.HelloWorld">Crear la primera aplicacion en PRADO</a></li>
<li><a href="?page=Fundamentals.Hangman">Ejemplo: El ahorcado</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Convertidor de Monedas</a></li>
- <li><a href="?page=Tutorial.AddressBook">Libreta de direcciones</a></li>
- <li><a href="?page=Tutorial.AjaxChat">Cliente Chat en AJAX </a></li>
- <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
+ <li><a href="?page=Tutorial.AddressBook">Libreta de direcciones</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">Cliente Chat en AJAX </a></li>
</ul>
</div>
@@ -27,7 +28,7 @@ <div>Básicos</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">Arquitectura</a></li>
- <li><a href="?page=Fundamentals.Components">Componentes</a></li>
+ <li><a href="?page=Fundamentals.Components1">Componentes</a></li>
<li><a href="?page=Fundamentals.Controls">Controles</a></li>
<li><a href="?page=Fundamentals.Pages">Páginas</a></li>
<li><a href="?page=Fundamentals.Modules">Mádulos</a></li>
diff --git a/demos/quickstart/protected/controls/fr/SampleLayout.tpl b/demos/quickstart/protected/controls/fr/SampleLayout.tpl index e421604c..e6fd2347 100755 --- a/demos/quickstart/protected/controls/fr/SampleLayout.tpl +++ b/demos/quickstart/protected/controls/fr/SampleLayout.tpl @@ -19,7 +19,7 @@ </div>
<div class="samplemenu">
<div class="copyright">
- Copyright © 2005-2013 <a href="http://www.pradosoft.com">PradoSoft</a>
+ Copyright © 2005-2014 <a href="http://www.pradosoft.com">PradoSoft</a>
</div>
</div>
diff --git a/demos/quickstart/protected/controls/fr/TopicList.tpl b/demos/quickstart/protected/controls/fr/TopicList.tpl index 44bb0b16..f7bd5f5a 100755..100644 --- a/demos/quickstart/protected/controls/fr/TopicList.tpl +++ b/demos/quickstart/protected/controls/fr/TopicList.tpl @@ -8,6 +8,8 @@ <li><a href="?page=GettingStarted.Installation">Installation</a></li>
<li><a href="?page=GettingStarted.NewFeatures">Nouvelles fonctionnalités</a></li>
<li><a href="?page=GettingStarted.Upgrading">Mise à jour de v2.x et v1.x</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,8 +19,7 @@ <li><a href="?page=GettingStarted.HelloWorld">Créer sa première application PRADO</a></li>
<li><a href="?page=Fundamentals.Hangman">Exemple : Jeu du pendu</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Convertisseur monétaire</a></li>
- <li><a href="?page=Tutorial.AjaxChat">Chat AJAX</a></li>
- <li><a href="?page=GettingStarted.CommandLine">Outil en ligne de commande</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">Chat AJAX</a></li>
</ul>
</div>
@@ -26,7 +27,7 @@ <div>Fundamentaux</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">Architecture</a></li>
- <li><a href="?page=Fundamentals.Components">Composants</a></li>
+ <li><a href="?page=Fundamentals.Components1">Composants</a></li>
<li><a href="?page=Fundamentals.Controls">Contrôles</a></li>
<li><a href="?page=Fundamentals.Pages">Pages</a></li>
<li><a href="?page=Fundamentals.Modules">Modules</a></li>
diff --git a/demos/quickstart/protected/controls/id/TopicList.tpl b/demos/quickstart/protected/controls/id/TopicList.tpl index bfc6ed64..bedf6c6f 100755..100644 --- a/demos/quickstart/protected/controls/id/TopicList.tpl +++ b/demos/quickstart/protected/controls/id/TopicList.tpl @@ -8,6 +8,8 @@ <li><a href="?page=GettingStarted.Installation">Instalasi</a></li>
<li><a href="?page=GettingStarted.NewFeatures">Fitur Baru</a></li>
<li><a href="?page=GettingStarted.Upgrading">Meningkatkan dari v2.x dan v1.x</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,9 +19,8 @@ <li><a href="?page=GettingStarted.HelloWorld">Membuat Aplikasi PRADO Pertama</a></li>
<li><a href="?page=Fundamentals.Hangman">Contoh: Permainan Hangman</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Pengubah Kurs</a></li>
- <li><a href="?page=Tutorial.AddressBook">Buku Alamat</a></li>
- <li><a href="?page=Tutorial.AjaxChat">Klient Obrolan AJAX</a></li>
- <li><a href="?page=GettingStarted.CommandLine">Piranti Baris Perintah</a></li>
+ <li><a href="?page=Tutorial.AddressBook">Buku Alamat</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">Klient Obrolan AJAX</a></li>
</ul>
</div>
@@ -27,7 +28,7 @@ <div>Fundamental</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">Arsitektur</a></li>
- <li><a href="?page=Fundamentals.Components">Komponen</a></li>
+ <li><a href="?page=Fundamentals.Components1">Komponen</a></li>
<li><a href="?page=Fundamentals.Controls">Kontrol</a></li>
<li><a href="?page=Fundamentals.Pages">Halaman</a></li>
<li><a href="?page=Fundamentals.Modules">Modul</a></li>
diff --git a/demos/quickstart/protected/controls/ja/TopicList.tpl b/demos/quickstart/protected/controls/ja/TopicList.tpl index ccaf5c63..456e13c4 100755..100644 --- a/demos/quickstart/protected/controls/ja/TopicList.tpl +++ b/demos/quickstart/protected/controls/ja/TopicList.tpl @@ -8,6 +8,8 @@ <li><a href="?page=GettingStarted.Installation">インストール</a></li>
<li><a href="?page=GettingStarted.NewFeatures">新機能</a></li>
<li><a href="?page=GettingStarted.Upgrading">v2.x v1.x からのバージョンアップ</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,9 +19,8 @@ <li><a href="?page=GettingStarted.HelloWorld">初めての PRADO アプリケーション</a></li>
<li><a href="?page=Fundamentals.Hangman">Hangman ゲームサンプル</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">通貨コンバーター</a></li>
- <li><a href="?page=Tutorial.AddressBook">アドレス帳</a></li>
- <li><a href="?page=Tutorial.AjaxChat">Ajax チャット</a></li>
- <li><a href="?page=GettingStarted.CommandLine">コマンドラインツール</a></li>
+ <li><a href="?page=Tutorial.AddressBook">アドレス帳</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">Ajax チャット</a></li>
</ul>
</div>
@@ -27,7 +28,7 @@ <div>動作原理</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">アーキテクチャ</a></li>
- <li><a href="?page=Fundamentals.Components">コンポーネント</a></li>
+ <li><a href="?page=Fundamentals.Components1">コンポーネント</a></li>
<li><a href="?page=Fundamentals.Controls">コントロール</a></li>
<li><a href="?page=Fundamentals.Pages">ページ</a></li>
<li><a href="?page=Fundamentals.Modules">モジュール</a></li>
diff --git a/demos/quickstart/protected/controls/pl/TopicList.tpl b/demos/quickstart/protected/controls/pl/TopicList.tpl index 93052b36..c57cba76 100755..100644 --- a/demos/quickstart/protected/controls/pl/TopicList.tpl +++ b/demos/quickstart/protected/controls/pl/TopicList.tpl @@ -8,6 +8,8 @@ <li><a href="?page=GettingStarted.Installation">Instalacja</a></li>
<li><a href="?page=GettingStarted.NewFeatures">Nowe możliwości</a></li>
<li><a href="?page=GettingStarted.Upgrading">Aktualizacja z wersji 2.x oraz 1.x</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,9 +19,8 @@ <li><a href="?page=GettingStarted.HelloWorld">Tworzenie pierwszej aplikacji PRADO</a></li>
<li><a href="?page=Fundamentals.Hangman">Przykład: gra wisielec</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">Konwenter walut</a></li>
- <li><a href="?page=Tutorial.AddressBook">Książka adresowa</a></li>
- <li><a href="?page=Tutorial.AjaxChat">AJAX-owy klient czat</a></li>
- <li><a href="?page=GettingStarted.CommandLine">Narzędzie linii poleceń</a></li>
+ <li><a href="?page=Tutorial.AddressBook">Książka adresowa</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">AJAX-owy klient czat</a></li>
</ul>
</div>
@@ -27,7 +28,7 @@ <div>Postawy</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">Architektura</a></li>
- <li><a href="?page=Fundamentals.Components">Komponenty</a></li>
+ <li><a href="?page=Fundamentals.Components1">Komponenty</a></li>
<li><a href="?page=Fundamentals.Controls">Kontrolki</a></li>
<li><a href="?page=Fundamentals.Pages">Strony</a></li>
<li><a href="?page=Fundamentals.Modules">Moduły</a></li>
diff --git a/demos/quickstart/protected/controls/zh/TopicList.tpl b/demos/quickstart/protected/controls/zh/TopicList.tpl index 00fa2280..160455b4 100755..100644 --- a/demos/quickstart/protected/controls/zh/TopicList.tpl +++ b/demos/quickstart/protected/controls/zh/TopicList.tpl @@ -8,6 +8,8 @@ <li><a href="?page=GettingStarted.Installation">安装</a></li>
<li><a href="?page=GettingStarted.NewFeatures">版本新功能</a></li>
<li><a href="?page=GettingStarted.Upgrading">从v2.x和v1.x升级</a></li>
+ <li><a href="?page=GettingStarted.Wsat">Web Site Administration Tool</a></li>
+ <li><a href="?page=GettingStarted.CommandLine">Command Line Tool</a></li>
</ul>
</div>
@@ -17,8 +19,7 @@ <li><a href="?page=GettingStarted.HelloWorld">创建第一个PRADO应用</a></li>
<li><a href="?page=Fundamentals.Hangman">Hangman游戏</a></li>
<li><a href="?page=Tutorial.CurrencyConverter">货币转换程序</a></li>
- <li><a href="?page=Tutorial.AjaxChat">AJAX聊天程序</a></li>
- <li><a href="?page=GettingStarted.CommandLine">命令行工具</a></li>
+ <li><a href="?page=Tutorial.AjaxChat">AJAX聊天程序</a></li>
</ul>
</div>
@@ -26,7 +27,7 @@ <div>基础概念</div>
<ul>
<li><a href="?page=Fundamentals.Architecture">框架结构</a></li>
- <li><a href="?page=Fundamentals.Components">部件</a></li>
+ <li><a href="?page=Fundamentals.Components1">部件</a></li>
<li><a href="?page=Fundamentals.Controls">控件</a></li>
<li><a href="?page=Fundamentals.Pages">页面</a></li>
<li><a href="?page=Fundamentals.Modules">模块</a></li>
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page index d4167f6e..6385b658 100755 --- a/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page @@ -24,70 +24,4 @@ events of an <tt>TActiveButton</tt>.</p> <com:RunBar PagePath="ActiveControls.Samples.TActiveButton.Home" />
-<h2 id="122027">TActiveButton Class Diagram</h2>
-<p id="610414" class="block-content">The class diagram for <tt>TActiveButton</tt> is illustrated in the figure below.
-Most active control that can perform callback request have a similar structure.
-</p>
-
-<img src=<%~ TActiveButtonClass.png %> class="figure"
- alt="TActiveButton class diagram" title="TActiveButton class diagram" />
-
-<p id="610415" class="block-content"><tt>TActiveButton</tt> is an extension of <a href="?page=Controls.Button">TButton</a>
-and implements two additional interfaces <tt>ICallbackEventHandler</tt> and
-<tt>IActiveControl</tt>. The <tt>TActiveButton</tt> contains an instance of
-<a href="?page=ActiveControls.BaseActiveControl">TBaseActiveCallbackControl</a>
-available through the <tt>ActiveControl</tt> property of <tt>TActiveButton</tt>.
-The following example set the callback parameter of the <tt>TActiveButton</tt> when
-a callback request is dispatched.
-</p>
-<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code1">
-<com:TActiveButton
- Text="Click Me"
- OnCallback="button_callback"
- ActiveControl.CallbackParameter="value" />
-</com:TTextHighlighter>
-<p id="610416" class="block-content">In the <tt>OnCallback</tt> event handler method, the <tt>CallbackParameter</tt>
-is available in the <tt>$param</tt> object.</p>
-<com:TTextHighlighter Language="php" CssClass="source block-content" id="code2">
-public function button_callback($sender, $param)
-{
- echo $param->CallbackParameter; //outputs "value"
-}
-</com:TTextHighlighter>
-
-<h2 id="122028">Adding Client Side Behaviour</h2>
-
-<p id="610417" class="block-content">With in the <tt>ActiveControl</tt> property is an instance of
-<a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> available
-as a property <tt>ClientSide</tt> of <tt>TActiveButton</tt>.
-The <tt>ClientSide</tt> property contains sub-properties, such as <tt>RequestTimeOut</tt>,
-and client-side javascript event handler, such as <tt>OnLoading</tt>,
-that are used by the client-side when making a callback request.
-The following example demonstrates the toggling of a "loading" indicator
-when the client-side is making a callback request.
-</p>
-
-<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code3">
-<com:TClientScript PradoScripts="effects" />
-<span id="callback_status">Loading...</span>
-
-<com:TActiveButton
- Text="Click Me"
- OnCallback="button_callback"
- ActiveControl.CallbackParameter="value" >
- <prop:ClientSide
- OnLoading="Element.show('callback_status')"
- OnComplete="Element.hide('callback_status')" />
-</com:TActiveButton>
-</com:TTextHighlighter>
-
-<p id="610418" class="block-content">The example loads the "effects" javascript library using the
-<a href="?page=Controls.ClientScript">TClientScript</a> component.
-The <tt>ClientSide.OnLoading</tt> property value contains
-javascript statement that uses the "effects" library to show the "Loading..."
-span tag. Similarly, <tt>ClientSide.OnComplete</tt> property
-value contains the javascript statement that hides the "Loading..." span tag.
-See <a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> for
-further details on client-side property details.
-</p>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveRatingList.page b/demos/quickstart/protected/pages/ActiveControls/ActiveRatingList.page new file mode 100644 index 00000000..7b6fb83d --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveRatingList.page @@ -0,0 +1,32 @@ +<com:TContent ID="body" > + +<h1>TActiveRatingList</h1> +<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveRatingList" /> + +<p class="block-content"> +<tt>TActiveRatingList</tt> is the active counterpart to the original <tt>TRatingList</tt> control. +</p> + +<p class="block-content"> +The <tt>AutoPostBack</tt> property is set to true by default. +Thus, when a radio button is clicked a <tt>OnCallback</tt> event is +raised after <tt>OnSelectedIndexChanged</tt> event. +</p> + +<p class="block-content"> +With <tt>ActiveControl.EnableUpdate</tt> +set to true (default is true), changes to the selection will be updated +on the client side. +</p> + +<p class="block-content"> +List items can <b>not</b> be changed dynamically during a callback request. +</p> + +<p class="block-content"> +Please refer to the original documentation of <a href="?page=Controls.List">TRatingList</a> for usage. +</p> + +<com:RunBar PagePath="ActiveControls.Samples.TActiveRatingList.Home" /> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index 9586f421..25590089 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -1,15 +1,8 @@ <com:TContent ID="body" >
<h1 id="128031">Active Controls (AJAX enabled Controls)</h1>
-<p id="640423" class="block-content">See the <a href="?page=ActiveControls.Introduction">Introduction</a>
+<p id="640423" class="block-content">
+Active controls extends standard PRADO controls adding the ability to automatically update themselves on callbacks without the need of ad-hoc javascript calls. See the <a href="?page=ActiveControls.Introduction">Introduction</a>
for a quick overview of the concept behind active controls (AJAX enabled controls).
-Most active controls have a property of
-<a href="?page=ActiveControls.BaseActiveControl">ActiveControl</a> and
-a sub-property <a href="?page=ActiveControls.CallbackClientSide">ClientSide</a>
-that provides many properties to customize the controls. The
-<a href="?page=TCallbackClientScript">CallbackClient</a> property of the
-<tt>TPage</tt> class provides many methods to update and alter the client-side content
-during a callback request. Active controls is reliant on a collection
-of <a href="?page=ActiveControl.ClientSideJavascript">javascript classes</a>.
</p>
<p id="640424" class="block-content">For a quick demo of active controls, try the <a href="?page=ActiveControls.ActiveButton">
@@ -104,11 +97,6 @@ TActiveButton</a> control. See also the later part of the <a href="?page=Tutoria </li>
<li>
- <a href="">TActiveRatingList</a>
- is an EXPERIMENTAL class that displays clickable images that represent a TRadioButtonList.
- </li>
-
- <li>
<a href="?page=ActiveControls.ActiveTextBox">TActiveTextBox</a>
represents a text input field on a Web page.
It can collect single-line, multi-line or password text input from users.
@@ -144,6 +132,11 @@ TActiveButton</a> control. See also the later part of the <a href="?page=Tutoria TActiveRadioButtonList displays a group of radiobuttons. Each radio button
can perform a callback request.
</li>
+
+ <li>
+ <a href="?page=ActiveControls.ActiveRatingList">TActiveRatingList</a>
+ is an EXPERIMENTAL class that displays clickable images that represent a TRadioButtonList.
+ </li>
</ul>
<h2 id="134001">Active Data Controls</h2>
@@ -201,9 +194,9 @@ TActiveButton</a> control. See also the later part of the <a href="?page=Tutoria monitors (using a timer) an attribute of an HTML element and triggers a callback request
when the attribute value changes.
</li>
-
+
<li>
- <a href="?page=ActiveControls.DragDrop">TDropContainer & TDraggable</a> represents drag and drop containers.
+ <a href="?page=ActiveControls.DragDrop">TDropContainer & TDraggable</a> represents drag and drop containers.
The former will make its child controls "draggable" while the latter will raise a callback when a draggable
control is dropped on it.
</li>
@@ -357,7 +350,7 @@ if Javascript was disabled on the client's browser.</p> </td>
<td>Yes</td><td>No</td>
</tr>
-
+
<tr><td>
<a href="?page=ActiveControls.DragDrop">TDropContainer</a>
</td>
@@ -370,95 +363,7 @@ if Javascript was disabled on the client's browser.</p> <td>No</td><td>No</td>
</tr>
-
-</table>
-
-<h2 id="128036">Active Control Basic Infrastructure Classes</h2>
-<p id="640427" class="block-content">The following classes provide the basic infrastructure classes required to
-realize the active controls. They can be useful to develop new active controls, but Prado users tipically don't need
-to use them.</p>
-<ul id="u4" class="block-content">
- <li>
- <h3 id="190038">TActiveControlAdapter</h3>
- <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveControlAdapter" />
- <p class="block-content">
- <tt>TActiveControlAdapter</tt> customizes the parent TControl class for active control classes.
- It tracks changes in the viewstate values of the control and update
- differences of the client-side HTML element attributes.
- </p>
- </li>
-
- <li>
- <h3 id="190039">TActiveListControlAdapter</h3>
- <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveListControlAdapter" />
- <p class="block-content">
- <tt>TActiveListControlAdapter</tt> allows the adapted list controls to change the selections
- on the client-side during a callback request.
- </p>
- </li>
-
- <li>
- <h3 id="190040">TActivePageAdapter</h3>
- <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActivePageAdapter" />
- <p class="block-content">
- <tt>TActivePageAdapter</tt> process the page life-cycle for callback requests.
- </p>
- </li>
-
- <li>
- <h3 id="190041">TBaseActiveControl</h3>
- <com:DocLink ClassPath="System.Web.UI.ActiveControls.TBaseActiveControl" />
- <p class="block-content">
- <tt>TBaseActiveControl</tt> class provided additional basic properties common for every
- active control. An instance of <tt>TBaseActiveControl</tt> or its decendent
- <tt>TBaseActiveCallbackControl</tt> is created by <tt>TActiveControlAdapter::getBaseActiveControl()</tt>
- method.
- The <tt>EnableUpdate</tt> property determines wether the active
- control is allowed to update the contents of the client-side when the callback
- response returns.
- </p>
- </li>
-
- <li>
- <h3 id="190042">TCallbackResponseAdapter</h3>
- <com:DocLink ClassPath="System.Web.UI.ActiveControls.TCallbackResponseAdapter" />
- <p class="block-content">
- <tt>TCallbackResponseAdapter</tt> alters the <tt>THttpResponse</tt>'s outputs.
- A <tt>TCallbackResponseWriter</tt> is used instead of the <tt>TTextWrite</tt> when
- <tt>createHtmlWriter</tt> is called. Each call to createHtmlWriter will create
- a new <tt>TCallbackResponseWriter</tt>. When <tt>flushContent()</tt> is called each
- instance of <tt>TCallbackResponseWriter</tt>'s content is flushed.
- The callback response data can be set using the <tt>ResponseData</tt> property.
- </p>
- </li>
-
-</ul>
-
-<h2 id="190037">Active Control Infrastructure Advanced Classes</h2>
-<p class="block-content">The following classes provide advanced properties and events needed to realize the active controls.
-A Prado user can use them to customize active controls behaviour and interact directly with the client side during a callback.
-</p>
-<ul class="block-content">
- <li>
- <a href="?page=ActiveControls.CallbackClientScript">TCallbackClientScript</a>
- methods to manipulate the client-side HTML elements, also includes methods
- to invoke javascript Effects on HTML elements.
- </li>
- <li>
- <a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a>
- is used to specify client-side callback request options and client-side event handlers.
- </li>
-
- <li>
- <a href="?page=ActiveControls.CallbackEventParameter">TCallbackEventParameter</a>
- provides the parameter passed during the callback request.
- </li>
-
- <li>
- <a href="?page=ActiveControls.CallbackOptions">TCallbackOptions</a>
- allows a common set of callback client-side options to be attached to one or more active controls.
- </li>
-</ul>
+</table>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Introduction.page b/demos/quickstart/protected/pages/ActiveControls/Introduction.page index 70cb9cbf..edc0b5bc 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Introduction.page +++ b/demos/quickstart/protected/pages/ActiveControls/Introduction.page @@ -1,7 +1,204 @@ <com:TContent ID="body">
-<h1 id="130037">Overview of Active Controls</h1>
-
-TODO:
+<h1 id="130037">AJAX: Introduction</h1>
+<p class="block-content">
+A classic webpage can only transfer data back to the server using an http postback request that requires a full page reload. This is a problem for web applications, since a synchronous page reload breaks the user interaction: the user must wait for the response to arrive and the page will lose its current status (the scrolling position, the currently focused control, etc..).
+</p>
<img src=<%~ postback-callback.png %> class="figure" />
+<p class="block-content">
+A common solution to this problem is the use of AJAX (Asynchronous JavaScript and XML) callbacks. After the first full page load, the web application can make subsequents requests using javascript. The callback requests are asynchronous, so the user can continue to interact with the page while the response is loading. The response contains a list of changes that will be applied to the page "on the fly", like replacing existing elements with new content or add some css style to an existing element.
+</p>
+
+<h2>Interacting with a page on callback</h2>
+
+<p class="block-content">
+PRADO has builtin support for AJAX callbacks in the form of <i>Active Controls</i>. These controls can trigger a callback request and have their properties (value, css style, attributes, ..) updated during a callback.
+Before digging inside the list of Active Controls, it's good to have a look to how a page can be aware if the current request is a callback and how to interact with the page rendered on the client browser.
+<br/>
+The <tt>IsCallBack</tt> property of the <tt>TPage</tt> class exposes whether the current request being handled is the consequence of a callback, and the <a href="?page=ActiveControls.CallbackClientScript">CallbackClient</a> property provides many methods to update and alter the client-side content during a callback request.
+</p>
+
+<com:TTextHighlighter CssClass="source block-content">
+public function onClick($sender, $param)
+{
+ if($this->IsCallback)
+ {
+ $this->getCallbackClient()->hide($this->TextBox1);
+ }
+}
+</com:TTextHighlighter>
+
+<h1>Active Controls (AJAX enabled Controls)</h1>
+<p class="block-content">
+Active controls extends standard PRADO controls adding the ability to automatically update themselves on callbacks without the need of ad-hoc javascript calls. Active controls are reliant on a collection of javascript classes that gets added to the page automatically when needed.
+</p>
+
+<p class="block-content">
+Most active controls have a <tt>ActiveControl.EnableUpdate</tt> property that determines whether the active control is allowed to update the contents of the client-side when the callback response returns. Depending on the control different properties can be updated.
+</p>
+
+<p class="block-content">
+Some active controls can trigger a callback as a consequence of a clientside event (a button click, a checkbox being checked, a DOM event). The callback will first raise the normal serverside event associated to the control (eg: OnClick for a <tt>TButton</tt> or OnSelectedIndexChanged for a <tt>TRadioButtonList</tt>) and then the <tt>OnCallBack</tt> event.
+The <tt>AutoPostBack</tt> property typically defaults to true for these controls.
+</p>
+</p>
+
+<p class="block-content">
+Active controls have a <a href="?page=ActiveControls.CallbackClientSide">ClientSide</a> property that provides many subproperties to customize the controls and to hook some javascript code to the callback lifecycle, like showing a "Loading" logo at the start of a callback and hide it at the end.
+</p>
+
+<h2 id="122027">TActiveButton Class Diagram</h2>
+<p id="610414" class="block-content">The class diagram for <tt>TActiveButton</tt> is illustrated in the figure below.
+Most active control that can perform callback request have a similar structure.
+</p>
+
+<img src=<%~ TActiveButtonClass.png %> class="figure"
+ alt="TActiveButton class diagram" title="TActiveButton class diagram" />
+
+<p id="610415" class="block-content"><tt>TActiveButton</tt> is an extension of <a href="?page=Controls.Button">TButton</a>
+and implements two additional interfaces <tt>ICallbackEventHandler</tt> and
+<tt>IActiveControl</tt>. The <tt>TActiveButton</tt> contains an instance of
+<a href="?page=ActiveControls.BaseActiveControl">TBaseActiveCallbackControl</a>
+available through the <tt>ActiveControl</tt> property of <tt>TActiveButton</tt>.
+The following example set the callback parameter of the <tt>TActiveButton</tt> when
+a callback request is dispatched.
+</p>
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code1">
+<com:TActiveButton
+ Text="Click Me"
+ OnCallback="button_callback"
+ ActiveControl.CallbackParameter="value" />
+</com:TTextHighlighter>
+<p id="610416" class="block-content">In the <tt>OnCallback</tt> event handler method, the <tt>CallbackParameter</tt>
+is available in the <tt>$param</tt> object.</p>
+<com:TTextHighlighter Language="php" CssClass="source block-content" id="code2">
+public function button_callback($sender, $param)
+{
+ echo $param->CallbackParameter; //outputs "value"
+}
+</com:TTextHighlighter>
+
+<h2 id="122028">Adding Client Side Behaviour</h2>
+
+<p id="610417" class="block-content">With in the <tt>ActiveControl</tt> property is an instance of
+<a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> available
+as a property <tt>ClientSide</tt> of <tt>TActiveButton</tt>.
+The <tt>ClientSide</tt> property contains sub-properties, such as <tt>RequestTimeOut</tt>,
+and client-side javascript event handler, such as <tt>OnLoading</tt>,
+that are used by the client-side when making a callback request.
+The following example demonstrates the toggling of a "loading" indicator
+when the client-side is making a callback request.
+</p>
+
+<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code3">
+<com:TClientScript PradoScripts="effects" />
+<span id="callback_status">Loading...</span>
+
+<com:TActiveButton
+ Text="Click Me"
+ OnCallback="button_callback"
+ ActiveControl.CallbackParameter="value" >
+ <prop:ClientSide
+ OnLoading="Element.show('callback_status')"
+ OnComplete="Element.hide('callback_status')" />
+</com:TActiveButton>
+</com:TTextHighlighter>
+
+<p id="610418" class="block-content">The example loads the "effects" javascript library using the
+<a href="?page=Controls.ClientScript">TClientScript</a> component.
+The <tt>ClientSide.OnLoading</tt> property value contains
+javascript statement that uses the "effects" library to show the "Loading..."
+span tag. Similarly, <tt>ClientSide.OnComplete</tt> property
+value contains the javascript statement that hides the "Loading..." span tag.
+See <a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a> for
+further details on client-side property details.
+</p>
+
+<h2 id="128036">Active Control Basic Infrastructure Classes</h2>
+<p id="640427" class="block-content">The following classes provide the basic infrastructure classes required to
+realize the active controls. They can be useful to develop new active controls, but Prado users tipically don't need
+to use them.</p>
+<ul id="u4" class="block-content">
+ <li>
+ <h3 id="190038">TActiveControlAdapter</h3>
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveControlAdapter" />
+ <p class="block-content">
+ <tt>TActiveControlAdapter</tt> customizes the parent TControl class for active control classes.
+ It tracks changes in the viewstate values of the control and update
+ differences of the client-side HTML element attributes.
+ </p>
+ </li>
+
+ <li>
+ <h3 id="190039">TActiveListControlAdapter</h3>
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveListControlAdapter" />
+ <p class="block-content">
+ <tt>TActiveListControlAdapter</tt> allows the adapted list controls to change the selections
+ on the client-side during a callback request.
+ </p>
+ </li>
+
+ <li>
+ <h3 id="190040">TActivePageAdapter</h3>
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActivePageAdapter" />
+ <p class="block-content">
+ <tt>TActivePageAdapter</tt> process the page life-cycle for callback requests.
+ </p>
+ </li>
+
+ <li>
+ <h3 id="190041">TBaseActiveControl</h3>
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TBaseActiveControl" />
+ <p class="block-content">
+ <tt>TBaseActiveControl</tt> class provided additional basic properties common for every
+ active control. An instance of <tt>TBaseActiveControl</tt> or its decendent
+ <tt>TBaseActiveCallbackControl</tt> is created by <tt>TActiveControlAdapter::getBaseActiveControl()</tt>
+ method.
+ The <tt>EnableUpdate</tt> property determines wether the active
+ control is allowed to update the contents of the client-side when the callback
+ response returns.
+ </p>
+ </li>
+
+ <li>
+ <h3 id="190042">TCallbackResponseAdapter</h3>
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TCallbackResponseAdapter" />
+ <p class="block-content">
+ <tt>TCallbackResponseAdapter</tt> alters the <tt>THttpResponse</tt>'s outputs.
+ A <tt>TCallbackResponseWriter</tt> is used instead of the <tt>TTextWrite</tt> when
+ <tt>createHtmlWriter</tt> is called. Each call to createHtmlWriter will create
+ a new <tt>TCallbackResponseWriter</tt>. When <tt>flushContent()</tt> is called each
+ instance of <tt>TCallbackResponseWriter</tt>'s content is flushed.
+ The callback response data can be set using the <tt>ResponseData</tt> property.
+ </p>
+ </li>
+
+</ul>
+
+<h2 id="190037">Active Control Infrastructure Advanced Classes</h2>
+<p class="block-content">The following classes provide advanced properties and events needed to realize the active controls.
+A Prado user can use them to customize active controls behaviour and interact directly with the client side during a callback.
+</p>
+<ul class="block-content">
+ <li>
+ <a href="?page=ActiveControls.CallbackClientScript">TCallbackClientScript</a>
+ methods to manipulate the client-side HTML elements, also includes methods
+ to invoke javascript Effects on HTML elements.
+ </li>
+
+ <li>
+ <a href="?page=ActiveControls.CallbackClientSide">TCallbackClientSide</a>
+ is used to specify client-side callback request options and client-side event handlers.
+ </li>
+
+ <li>
+ <a href="?page=ActiveControls.CallbackEventParameter">TCallbackEventParameter</a>
+ provides the parameter passed during the callback request.
+ </li>
+
+ <li>
+ <a href="?page=ActiveControls.CallbackOptions">TCallbackOptions</a>
+ allows a common set of callback client-side options to be attached to one or more active controls.
+ </li>
+</ul>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php index 30ef750b..7d3163dc 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php @@ -9,12 +9,12 @@ class Home extends TPage parent::onInit($param); if (!$this->getIsPostBack() && !$this->getIsCallBack()) { - + $this->populateProductList(); $this->populateShoppingList(); } } - + private function getProductData () { return array ( @@ -30,38 +30,41 @@ class Home extends TPage ) ); } - + private function getProduct ($key) { foreach ($this->getProductData() as $product) if ($product['ProductId']==$key) return $product; - return null; + return null; } - + protected function populateProductList () { $this->ProductList->DataSource=$this->getProductData(); $this->ProductList->Databind(); } - + protected function populateShoppingList () { $this->ShoppingList->DataSource=$this->getShoppingListData(); $this->ShoppingList->Databind(); - + } - - + + public function getShoppingListData () { + $a=$this->getViewState('ShoppingList', array ()); + var_export($a); return $this->getViewState('ShoppingList', array ()); } - + public function setShoppingListData ($value) { + var_export($value); $this->setViewState('ShoppingList', TPropertyValue::ensureArray($value), array ()); } - + public function addItemToCart ($sender, $param) { $control=$param->getDroppedControl(); @@ -82,9 +85,9 @@ class Home extends TPage $shoppingList[$key]['ProductCount']=1; } $this->setShoppingListData($shoppingList); - + } - + public function removeItemFromCart ($sender, $param) { $control=$param->getDroppedControl(); @@ -99,13 +102,13 @@ class Home extends TPage unset($shoppingList[$key]); } $this->setShoppingListData($shoppingList); - + } - + public function redrawCart ($sender, $param) { $this->populateShoppingList(); $this->cart->render($param->NewWriter); - + } } diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page index 1e030102..8482ae14 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page @@ -43,5 +43,4 @@ A button causing validation with <tt>OnCallback</tt>: </table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.page index 139306f6..89543ef0 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.page @@ -71,6 +71,5 @@ A checkbox validated by a required field validator: </table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.page index 8ef69a9a..1d16235e 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.page @@ -16,6 +16,5 @@ Custom validator using callbacks: </td></tr>
</table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page index a3f10613..a7767e2d 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page @@ -66,5 +66,4 @@ Body contents </tr>
</table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePager/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePager/Home.page index e38486d1..866847d4 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePager/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePager/Home.page @@ -15,10 +15,10 @@ Go to page: OnCallBack="RenderCallback" > <prop:ClientSide.OnLoading> - Element.show('wait') + jQuery('#wait').show() </prop:ClientSide.OnLoading> <prop:ClientSide.OnComplete> - Element.hide('wait') + jQuery('#wait').hide() </prop:ClientSide.OnComplete> </com:TActivePager> <span id="wait" style="display: none;color: red">Please Wait...</span> @@ -77,11 +77,11 @@ Total <%# $this->Parent->PageCount %> pages. OnPageIndexChanged="pageChanged" OnCallBack="RenderCallback" > -<prop:ClientSide.OnLoading> - Element.show('wait') + <prop:ClientSide.OnLoading> + jQuery('#wait').show() </prop:ClientSide.OnLoading> <prop:ClientSide.OnComplete> - Element.hide('wait') + jQuery('#wait').hide() </prop:ClientSide.OnComplete> </com:TActivePager> <br/> @@ -92,12 +92,28 @@ Choose page: OnPageIndexChanged="pageChanged" OnCallBack="RenderCallback" > -<prop:ClientSide.OnLoading> - Element.show('wait') + <prop:ClientSide.OnLoading> + jQuery('#wait').show() </prop:ClientSide.OnLoading> <prop:ClientSide.OnComplete> - Element.hide('wait') + jQuery('#wait').hide() </prop:ClientSide.OnComplete> </com:TActivePager> -<com:TJavascriptLogger/> +<br/> +Use of a css class for buttons: +<com:TStyleSheet> +.greenbold_button { + background-color: #0f0; + font-weight: bold; +} +</com:TStyleSheet> +<com:TActivePager ID="Pager4" + ControlToPaginate="DataList" + PageButtonCount="3" + Mode="Numeric" + ButtonType="PushButton" + OnPageIndexChanged="pageChanged" + OnCallBack="RenderCallback" + ButtonCssClass="greenbold_button" + /> </com:TContent> diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.page index 360b6b0f..f3bfe843 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.page @@ -20,5 +20,4 @@ anyway since they are placed inside the active panel. </com:TActivePanel>
</td></tr>
</table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.page new file mode 100644 index 00000000..332ccb63 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.page @@ -0,0 +1,71 @@ +<com:TContent ID="body"> +<h1>TActiveRatingList Samples</h1> + +<table class="sampletable"> + +<tr><td class="samplenote"> +A simple TActiveRatingList and its caption: +</td><td class="sampleaction"> + +<com:TLabel ID="label1" Text="Rate it:" /> +<com:TActiveRatingList CaptionID="label1"> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> +</com:TActiveRatingList> + +</td></tr> + +<tr><td class="samplenote"> +TActiveRatingList in vertical mode, SelectedIndex=2 +</td><td class="sampleaction"> + +<com:TLabel ID="label2" Text="Rate it:" /> +<com:TActiveRatingList CaptionID="label2" SelectedIndex="2" RepeatDirection="Vertical" Style="caption-side: right;"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TActiveRatingList> + +</td></tr> + +<tr><td class="samplenote"> +TActiveRatingList with RatingStyle=blocks, AutoPostback=true, SelectedValue=Good +</td><td class="sampleaction"> + +<com:TLabel ID="label3" Text="Rate it:" /> +<com:TActiveRatingList ID="Rating3" CaptionID="label3" RatingStyle="blocks" SelectedValue="Good" AutoPostBack="true" OnSelectedIndexChanged="rating3_selectionChanged"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TActiveRatingList> +<br/> +A label to check callback results: <com:TActiveLabel ID="labelResult3" /> + +</td></tr> + +<tr><td class="samplenote"> +TActiveRatingList with AllowInput=false, Rating=4.6 +</td><td class="sampleaction"> + +<com:TLabel ID="label4" Text="Rate it:" /> +<com:TActiveRatingList CaptionID="label4" AllowInput="false" Rating="4.6"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TActiveRatingList> + +</td></tr> + +</table> +</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.php new file mode 100644 index 00000000..5e8ed1bd --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRatingList/Home.php @@ -0,0 +1,9 @@ +<?php + +class Home extends TPage +{ + protected function rating3_selectionChanged($sender, $param) + { + $this->labelResult3->Text=$this->Rating3->SelectedValue; + } +}
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.page index 0b3f84fb..49b5bcb6 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.page @@ -14,6 +14,5 @@ </com:TTable>
<com:TActiveLabel id="lblResult"/>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page index 85c0e69f..3790d74b 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.page @@ -51,6 +51,4 @@ Autocompleter with multiple selection: </table>
-<com:TJavascriptLogger />
-
-</com:TContent>
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php index 2f74bd37..a3b9529b 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php @@ -7,7 +7,7 @@ class Home extends TPage $token=$param->getToken(); // Sender is the Suggestions repeater $sender->DataSource=$this->getDummyData($token); - $sender->dataBind(); + $sender->dataBind(); } public function suggestionSelected1($sender,$param) { diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page index 04781438..6be81e96 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page @@ -39,7 +39,7 @@ The third parameter is taken from the textbox; {
var request = <%= $this->callback2->ActiveControl->Javascript %>;
var param2 = 'value 2';
- var param3 = $('<%= $this->txt1->ClientID %>').value;
+ var param3 = $('#<%= $this->txt1->ClientID %>').val();
request.setCallbackParameter({'Param1':param1, 'Param2':param2, 'Param3':param3});
request.dispatch();
}
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page index 539909a9..84521acb 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page @@ -7,12 +7,37 @@ </p>
<h2>Actions</h2>
-<com:TRadioButtonList ID="radio1">
+<com:TClientScript PradoScripts="jqueryui" />
+<com:TStyleSheet>
+ .red_background {
+ background-color: red;
+ }
+</com:TStyleSheet>
+
+<com:TRadioButtonList ID="radio1" RepeatColumns="2">
<com:TListItem Value="1" Text="alert() me of something" />
<com:TListItem Value="2" Text="toggle Checkbox 1" />
<com:TListItem Value="3" Text="hide Label 1" />
<com:TListItem Value="4" Text="show Label 1" />
- <com:TListItem Value="5" Text="focus TextBox 1" />
+ <com:TListItem Value="5" Text="toggle Label 1 visibility" />
+ <com:TListItem Value="6" Text="toggle Label 1 (fade)" />
+ <com:TListItem Value="7" Text="toggle Label 1 (slide)" />
+ <com:TListItem Value="8" Text="highlight Label 1 (requires jQuery UI)" />
+ <com:TListItem Value="9" Text="focus TextBox 1" />
+ <com:TListItem Value="10" Text="scroll to CheckBox 1" />
+ <com:TListItem Value="11" Text="add red_background class to TextBox 1" />
+ <com:TListItem Value="12" Text="remove red_background class from TextBox 1" />
+ <com:TListItem Value="13" Text="animated resize TextBox 1" />
+ <com:TListItem Value="14" Text="set the 'disable' attribute on TextBox 1" />
+ <com:TListItem Value="15" Text="change the background color of Panel 1" />
+ <com:TListItem Value="16" Text="prepend and append some content inside Panel 1" />
+ <com:TListItem Value="17" Text="prepend and append some content outside Panel 1" />
+ <com:TListItem Value="18" Text="replace Panel 1 with some plain text" />
+ <com:TListItem Value="19" Text="remove TextBox 1" />
+ <com:TListItem Value="20" Text="fade out TextBox 1" />
+ <com:TListItem Value="21" Text="fade in TextBox 1" />
+ <com:TListItem Value="22" Text="trigger a click event on Panel 1" />
+ <com:TListItem Value="23" Text="call a specific effect on TextBox 1 (toggle)" />
</com:TRadioButtonList>
<br/><com:TActiveButton ID="button1" OnCallback="buttonCallback" Text="callback!" />
@@ -32,8 +57,17 @@ <td>TextBox 1:</td>
<td><com:TTextBox ID="txt1" Text="Sample text" /></td>
</tr>
+ <tr>
+ <td>Panel 1:</td>
+ <td>
+ <com:TPanel ID="pan1" Style="width:100px;height:100px;background:green" Attributes.OnClick="alert('clicked on Panel1')" >
+ Panel contents
+ </com:TPanel>
+ </td>
+ </tr>
</table>
-<com:TJavascriptLogger />
-
+<div style="height:900px">
+Thw following space is intentionally left blank for the scrolling test
+</div>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php index eeacb660..50a69911 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php @@ -8,7 +8,7 @@ class Home extends TPage switch($this->radio1->SelectedValue) { case 1: - $this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>"); + $this->getCallbackClient()->evaluateScript("alert('something');"); break; case 2: $this->getCallbackClient()->check($this->check1, !$this->check1->Checked); @@ -20,8 +20,74 @@ class Home extends TPage $this->getCallbackClient()->show($this->label1); break; case 5: + $this->getCallbackClient()->toggle($this->label1); + break; + case 6: + $this->getCallbackClient()->toggle($this->label1, 'fade'); + break; + case 7: + $this->getCallbackClient()->toggle($this->label1, 'slide'); + break; + case 8: + $this->getCallbackClient()->highlight($this->label1); + break; + case 9: $this->getCallbackClient()->focus($this->txt1); break; + case 10: + $this->getCallbackClient()->scrollTo($this->check1, array('duration' => 1000, 'offset' => 10)); + break; + case 11: + $this->getCallbackClient()->addCssClass($this->txt1, 'red_background'); + break; + case 12: + $this->getCallbackClient()->removeCssClass($this->txt1, 'red_background'); + break; + case 13: + $this->getCallbackClient()->jQuery($this->txt1, 'animate', array( + array( 'width' => '+=100', + 'height' => '+=50' + ), + array( + 'duration' => 1000, + ) + )); + break; + case 14: + $this->getCallbackClient()->setAttribute($this->txt1, 'disabled', true); + break; + case 15: + $this->getCallbackClient()->setStyle($this->pan1, array('background-color' => 'blue')); + break; + case 16: + $this->getCallbackClient()->prependContent($this->pan1, 'prepend<br/>'); + $this->getCallbackClient()->appendContent($this->pan1, '<br/>append'); + break; + case 17: + $this->getCallbackClient()->insertContentBefore($this->pan1, 'before'); + $this->getCallbackClient()->insertContentAfter($this->pan1, 'after'); + break; + case 18: + $this->getCallbackClient()->replaceContent($this->pan1, 'No more Panel 1'); + break; + case 19: + $this->getCallbackClient()->remove($this->txt1); + break; + case 20: + $this->getCallbackClient()->fadeOut($this->txt1); + break; + case 21: + $this->getCallbackClient()->fadeIn($this->txt1); + break; + case 22: + $this->getCallbackClient()->click($this->pan1); + // alternative + // $this->getCallbackClient()->raiseClientEvent($this->pan1, 'click'); + break; + case 23: + $this->getCallbackClient()->jQuery($this->txt1, 'toggle'); + break; + } } } diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page index 0d13bb90..0f94fd79 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page @@ -68,6 +68,5 @@ connection error has occured. </table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page index cfb041ea..8c6ccd02 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page @@ -72,6 +72,5 @@ The same TCallbackOptions can be shared among different controls, even of differ </td></tr>
</table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Advanced/Error.page b/demos/quickstart/protected/pages/Advanced/Error.page index 24c7ead0..391997fb 100755 --- a/demos/quickstart/protected/pages/Advanced/Error.page +++ b/demos/quickstart/protected/pages/Advanced/Error.page @@ -71,7 +71,7 @@ The naming convention for the template files used for all other exceptions is as Again, if the preferred language is not found, PRADO will try to use <tt>exception.html</tt>, instead.
</p>
<div class="note">
-<b class="tip">CAUTION:</b> When saving a template file, please make sure the file is saved using UTF-8 encoding. On Windows, you may use <tt>Notepad.exe</tt> to accomplish such saving.
+<b class="tip">CAUTION:</b> When saving a template file, please make sure the file is saved using UTF-8 encoding. On Windows, you may use <tt>Notepad++</tt> to accomplish such saving.
</div>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php index 4eba37ee..0fea7ac2 100755 --- a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php +++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php @@ -2,17 +2,15 @@ /** * Language List * @author $Author: weizhuo $ - * @version $Id: LanguageList.php 3189 2012-07-12 12:16:21Z ctrlaltca $ * @package prado.examples */ /** * * @author $Author: weizhuo $ - * @version $Id: LanguageList.php 3189 2012-07-12 12:16:21Z ctrlaltca $ */ -class LanguageList extends TTemplateControl +class LanguageList extends TTemplateControl { - + } diff --git a/demos/quickstart/protected/pages/Configurations/Templates1.page b/demos/quickstart/protected/pages/Configurations/Templates1.page index 22b693a6..6c2870f2 100755 --- a/demos/quickstart/protected/pages/Configurations/Templates1.page +++ b/demos/quickstart/protected/pages/Configurations/Templates1.page @@ -3,7 +3,7 @@ <p id="180166" class="block-content">
Templates are used to specify the presentational layout of controls. A template can contain static text, components, or controls that contribute to the ultimate presentation of the associated control. By default, an instance of <tt>TTemplateControl</tt> or its subclass may automatically load and instantiate a template from a file whose name is the same as the control class name. For page templates, the file name suffix must be <tt>.page</tt>; for other regular template controls, the suffix is <tt>.tpl</tt>.
</p>
-<p id="180167" class="block-content">The template format is like HTML, with a few PRADO-specifc tags, including <a href="#ct">component tags</a>, <a href="#tct">template control tags</a>, <a href="#cot">comment tags</a>, <a href="?page=Configurations.Templates2#dct">dynamic content tags</a>, and <a href="?page=Configurations.Templates3#dpt">dynamic property tags</a>. .
+<p id="180167" class="block-content">The template format is like HTML, with a few PRADO-specifc tags, including <a href="#ct">component tags</a>, <a href="#tct">template control tags</a>, <a href="#cot">comment tags</a>, <a href="?page=Configurations.Templates2#dct">dynamic content tags</a>, and <a href="?page=Configurations.Templates3#dpt">dynamic property tags</a>.
</p>
<a name="ct"></a>
diff --git a/demos/quickstart/protected/pages/Controls/Data.page b/demos/quickstart/protected/pages/Controls/Data.page index 3843b332..829a4ef5 100755 --- a/demos/quickstart/protected/pages/Controls/Data.page +++ b/demos/quickstart/protected/pages/Controls/Data.page @@ -2,6 +2,12 @@ <h1 id="5001">Data Controls</h1>
+<p class="block-content">
+Data controls are used to display a repeated content like a list or a table. The content is generated from a collection of items containing the data, called the <tt>DataSource</tt>, and a template describing the appearance, called <tt>Renderer</tt>.
+<br/>
+The process of assigning a DataSource to a Data control and render the template for each item is called <tt>data binding</tt>.
+</p>
+
<ul id="u1" class="block-content">
<li>
<a href="?page=Controls.DataList">TDataList</a> is used to display or modify a list of data items.
diff --git a/demos/quickstart/protected/pages/Controls/List.page b/demos/quickstart/protected/pages/Controls/List.page index ae8d86bf..5e78bb13 100755 --- a/demos/quickstart/protected/pages/Controls/List.page +++ b/demos/quickstart/protected/pages/Controls/List.page @@ -108,4 +108,6 @@ Since v3.1.1, <tt>TDropDownList</tt> starts to support prompt text (something li This is an EXPERIMENTAL class that displays clickable images that represent a TRadioButtonList.
</p>
+<com:RunBar PagePath="Controls.Samples.TRatingList.Home" />
+
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Controls/Markdown.page b/demos/quickstart/protected/pages/Controls/Markdown.page new file mode 100644 index 00000000..d7cc00c6 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Markdown.page @@ -0,0 +1,40 @@ +<com:TContent ID="body" > + +<h1>TMarkdown</h1> +<com:DocLink ClassPath="System.Web.UI.WebControls.TMarkdown" /> + +<p class="block-content"> +<tt>TMarkdown</tt> is a text formatter that produces html content from plain text. The formatter follows the <a href="http://www.wikipedia.org/wiki/Markdown">Markdown</a> syntax and the <a href="https://help.github.com/articles/github-flavored-markdown">GFM</a> (GitHub Flavored Markdown) extension. +</p> +<p class="block-content"> +Any content in the body of <tt>TMarkdown</tt>, including both static text and the rendering results of its child controls, is first converted using the Markdown syntax. Then, to any code block found in the html, syntax highlighting is applied. The code being highlighted follows the syntax of the specified <tt>Language</tt>, which can be 'php' (default), 'prado', 'css', 'html', etc. Here, 'prado' stands for the syntax of PRADO control templates. If the language is not specified in the <tt>Language</tt> property, it can be evinced from the Markdown syntax. +</p> +<p class="block-content"> +If line numbers are desired in front of each line, set <tt>ShowLineNumbers</tt> to true. +</p> +<p class="block-content"> +To use <tt>TMarkdown</tt>, simply enclose the contents to be formatted within the body of a <tt>TMarkdown</tt> control. The following example formats some text and piece of PHP code, +</p> +<com:TTextHighlighter Language="prado" CssClass="source block-content" > +<com:TMarkdown ShowLineNumbers="true" > +PRADO Markdown Test +=================== + +Some text and a list: +* item 1 +* item 2 + +Now, some code: + +```php +public function test() { + // comment + echo "look me i'm colorful"; +} +``` +</com:TMarkdown> +</com:TTextHighlighter> + +<com:RunBar PagePath="Controls.Samples.TMarkdown.Home" /> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/Controls/NewControl.page b/demos/quickstart/protected/pages/Controls/NewControl.page index 10c789db..9a680f43 100755 --- a/demos/quickstart/protected/pages/Controls/NewControl.page +++ b/demos/quickstart/protected/pages/Controls/NewControl.page @@ -10,7 +10,7 @@ In general, there are two ways of writing new controls: composition of existing <h2 id="5402">Composition of Existing Controls</h2>
<p id="660430" class="block-content">
-Composition is the easiest way of creating new controls. It mainly involves instantiating existing controls, configuring them and making them the constituent components. The properties of the constituent components are exposed through <a href="?page=Fundamentals.Components">subproperties</a>.
+Composition is the easiest way of creating new controls. It mainly involves instantiating existing controls, configuring them and making them the constituent components. The properties of the constituent components are exposed through <a href="?page=Fundamentals.Components1">subproperties</a>.
</p>
<p id="660431" class="block-content">
One can compose a new control in two ways. One is to extend <tt>TCompositeControl</tt> and override the <tt>TControl::createChildControls()</tt> method. The other is to extend <tt>TTemplateControl</tt> (or its child classes) and write a control template. The latter is easier to use and can organize the layout constituent components more intuitively, while the former is more efficient because it does not require parsing of the template.
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page index 06ed6295..f7d03ea2 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page @@ -1,6 +1,11 @@ <com:TContent ID="body">
<h1>Conditional Validation (client-side + server side)</h1>
+<com:TStyleSheet>
+.required {
+ background-color: #E77471;
+}
+</com:TStyleSheet>
<table class="sampletable">
<tr>
<td class="samplenote">
@@ -22,7 +27,7 @@ Check "optional" to validate both textboxes ErrorMessage="*"
ControlCssClass="required">
<prop:ClientSide.OnValidate>
- sender.enabled = $('<%= $this->check1->ClientID %>').checked;
+ sender.enabled = jQuery('#<%= $this->check1->ClientID %>').get(0).checked;
</prop:ClientSide.OnValidate>
</com:TRequiredFieldValidator>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page index 5150922f..5f01c07e 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page @@ -29,7 +29,7 @@ THtmlArea with manually set options </td></tr>
<tr><td class="samplenote">
-THtmlArea with visual editting disabled:
+THtmlArea with visual editing disabled:
</td><td class="sampleaction">
<com:THtmlArea ID="HtmlArea3" EnableVisualEdit="false" />
<br/>
@@ -38,6 +38,12 @@ THtmlArea with visual editting disabled: <com:TLiteral Encode="true" ID="Result3" />
</td></tr>
+<tr><td class="samplenote">
+Read-only THtmlArea:
+</td><td class="sampleaction">
+<com:THtmlArea ID="HtmlArea4" ReadOnly="true" Text="Sample html text: <b>bold</b> <i>italic</i>" />
+</td></tr>
+
</table>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea4/Home.page b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea4/Home.page index 6bb6449c..2b6c7a7a 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea4/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea4/Home.page @@ -29,7 +29,7 @@ THtmlArea4 with manually set options </td></tr> <tr><td class="samplenote"> -THtmlArea4 with visual editting disabled: +THtmlArea4 with visual editing disabled: </td><td class="sampleaction"> <com:THtmlArea4 ID="HtmlArea3" EnableVisualEdit="false" /> <br/> @@ -38,6 +38,12 @@ THtmlArea4 with visual editting disabled: <com:TLiteral Encode="true" ID="Result3" /> </td></tr> +<tr><td class="samplenote"> +Read-only THtmlArea: +</td><td class="sampleaction"> +<com:THtmlArea4 ID="HtmlArea4" ReadOnly="true" Text="Sample html text: <b>bold</b> <i>italic</i>" /> +</td></tr> + </table> </com:TContent> diff --git a/demos/quickstart/protected/pages/Controls/Samples/TMarkdown/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TMarkdown/Home.page new file mode 100755 index 00000000..4cd0f86b --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TMarkdown/Home.page @@ -0,0 +1,31 @@ +<com:TContent ID="body"> + +<h1>TMarkdown Samples</h1> + +<table class="sampletable"> + +<tr><td class="samplenote"> +Formatting text and code: +</td><td class="sampleaction"> +<com:TMarkdown ShowLineNumbers="true"> +PRADO Markdown Test +=================== + +Some text and a list: +* item 1 +* item 2 + +Now, some code: + +```php +public function test() { + // comment + echo "look me i'm colorful"; +} +``` +</com:TMarkdown> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.page index de419172..6e6cb54d 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.page @@ -67,6 +67,5 @@ will be clicked because it is set as the default button of the panel. </com:TPanel>
</td></tr>
</table>
-<com:TJavascriptLogger />
</com:TContent>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.page new file mode 100644 index 00000000..5790f840 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.page @@ -0,0 +1,71 @@ +<com:TContent ID="body"> +<h1>TRatingList Samples</h1> + +<table class="sampletable"> + +<tr><td class="samplenote"> +A simple TRatingList and its caption: +</td><td class="sampleaction"> + +<com:TLabel ID="label1" Text="Rate it:" /> +<com:TRatingList CaptionID="label1"> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> +</com:TRatingList> + +</td></tr> + +<tr><td class="samplenote"> +TRatingList in vertical mode, SelectedIndex=2 +</td><td class="sampleaction"> + +<com:TLabel ID="label2" Text="Rate it:" /> +<com:TRatingList CaptionID="label2" SelectedIndex="2" RepeatDirection="Vertical" Style="caption-side: right;"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TRatingList> + +</td></tr> + +<tr><td class="samplenote"> +TRatingList with RatingStyle=blocks, AutoPostback=true, SelectedValue=Good +</td><td class="sampleaction"> + +<com:TLabel ID="label3" Text="Rate it:" /> +<com:TRatingList ID="Rating3" CaptionID="label3" RatingStyle="blocks" SelectedValue="Good" AutoPostBack="true" OnSelectedIndexChanged="rating3_selectionChanged"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TRatingList> +<br/> +A label to check postback results: <com:TLabel ID="labelResult3" /> + +</td></tr> + +<tr><td class="samplenote"> +TRatingList with AllowInput=false, Rating=4.6 +</td><td class="sampleaction"> + +<com:TLabel ID="label4" Text="Rate it:" /> +<com:TRatingList CaptionID="label4" AllowInput="false" Rating="4.6"> + <com:TListItem Text="Poor" /> + <com:TListItem Text="Fair" /> + <com:TListItem Text="Average" /> + <com:TListItem Text="Good" /> + <com:TListItem Text="Excellent" /> + <com:TListItem Text="Super" /> +</com:TRatingList> + +</td></tr> + +</table> +</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.php new file mode 100644 index 00000000..5e8ed1bd --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TRatingList/Home.php @@ -0,0 +1,9 @@ +<?php + +class Home extends TPage +{ + protected function rating3_selectionChanged($sender, $param) + { + $this->labelResult3->Text=$this->Rating3->SelectedValue; + } +}
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.page index bfbbe8e3..6c79fae4 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.page @@ -16,7 +16,7 @@ Horizontal slider from -50 to 50, Javascript 'onSlide' handler, ServerSide 'onS </td><td class="sampleaction"> <com:TSlider id="slider2" AutoPostBack="true" Direction="Horizontal" Value="0" Enabled="true" MinValue="-50" MaxValue="50" OnValueChanged="slider2Changed"> <prop:ClientSide.onSlide> - $('slider2value').innerHTML = value; + $('#slider2value').get(0).innerHTML = value; </prop:ClientSide.onSlide> </com:TSlider> Value : <span id="slider2value"><%=$this->slider2->value%></span> @@ -28,14 +28,14 @@ Vertical slider from 0 to 1, Javascript 'onSlide' handler, ServerSide 'onSliderC </td><td class="sampleaction"> <com:TSlider id="slider3" AutoPostBack="false" Direction="Vertical" Enabled="true" MinValue="0" MaxValue="1" StepSize="0.1" OnValueChanged="slider3Changed"> <prop:ClientSide.onSlide> - $('slider3value').innerHTML = value; + $('#slider3value').get(0).innerHTML = value; </prop:ClientSide.onSlide> </com:TSlider> Value : <span id="slider3value"><%=$this->slider3->value%></span> </td><td class="sampleaction"> <com:TButton Text="Submit"/> <com:TLabel id="slider3Result"/> -</td></tr>
-</table>
+</td></tr> +</table> </com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTextHighlighter/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TTextHighlighter/Home.page index 9bd86078..c7506c67 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TTextHighlighter/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TTextHighlighter/Home.page @@ -12,7 +12,6 @@ Highlighting PHP statements: $str = 'one|two|three|four';
// will output an array
print_r(explode('|', $str, 2));
-?>
</com:TTextHighlighter>
</td></tr>
diff --git a/demos/quickstart/protected/pages/Controls/Standard.page b/demos/quickstart/protected/pages/Controls/Standard.page index 463f90a5..43fecfb3 100755 --- a/demos/quickstart/protected/pages/Controls/Standard.page +++ b/demos/quickstart/protected/pages/Controls/Standard.page @@ -1,7 +1,9 @@ <com:TContent ID="body" >
<h1 id="52001">Standard Controls</h1>
-<p id="260001" class="block-content">* the tutorial for this control is not completed yet.</p>
+<p class="block-content">
+ Standard controls are the most basic controls in PRADO. They can represent a simple html tag like an <input> or even more comple controls like a date picker or a WYSIWYG text area. Standard controls are in the <tt>System.Web.UI.WebControls</tt> namespace.
+</p>
<ul id="u1" class="block-content">
<li>
<a href="?page=Controls.Accordion">TAccordion</a> displays an accordion consisting of multiple views. At any time, only one view is visible.
@@ -104,6 +106,10 @@ </li>
<li>
+ <a href="?page=Controls.Markdown">TMarkdown</a> formats its body content following the <a href="http://www.wikipedia.org/wiki/Markdown">Markdown</a> syntax.
+ </li>
+
+ <li>
<a href="?page=Controls.MultiView">TMultiView</a> represents a container for a group of <tt>TView</tt> controls, each of which is container for other controls. At any time, at most one <tt>TView</tt> is visible.
</li>
diff --git a/demos/quickstart/protected/pages/Controls/TextHighlighter.page b/demos/quickstart/protected/pages/Controls/TextHighlighter.page index 1babbb33..5d3428f9 100755 --- a/demos/quickstart/protected/pages/Controls/TextHighlighter.page +++ b/demos/quickstart/protected/pages/Controls/TextHighlighter.page @@ -17,7 +17,6 @@ To use <tt>TTextHighlighter</tt>, simply enclose the contents to be syntax highl <?php
$str = 'one|two|three|four';
print_r(explode('|', $str, 2)); // will output an array
-?>
</com:TTextHighlighter>
</com:TTextHighlighter>
diff --git a/demos/quickstart/protected/pages/Controls/id/NewControl.page b/demos/quickstart/protected/pages/Controls/id/NewControl.page index ea083f6c..85c6eff0 100755 --- a/demos/quickstart/protected/pages/Controls/id/NewControl.page +++ b/demos/quickstart/protected/pages/Controls/id/NewControl.page @@ -10,7 +10,7 @@ Secara umum, ada dua cara penulisan kontrol baru: komposisi kontrol yang sudah a <h2 id="5402">Komposisi Kontrol yang Sudah Ada</h2>
<p id="660430" class="block-content">
-Komposisi adalah cara termudah membuat kontrol baru. Ia melibatkan terutama penurunan kontrol yang sudah ada, mengkonfigurasinya dan menjadikannya unsur komponen. Properti dari unsur komponen diperlihatkan melalui <a href="?page=Fundamentals.Components">subproperti</a>.
+Komposisi adalah cara termudah membuat kontrol baru. Ia melibatkan terutama penurunan kontrol yang sudah ada, mengkonfigurasinya dan menjadikannya unsur komponen. Properti dari unsur komponen diperlihatkan melalui <a href="?page=Fundamentals.Components1">subproperti</a>.
</p>
<p id="660431" class="block-content">
Seseorang dapat menciptakan sebuah kontrol baru dalam dua cara. Pertama adalah memperluas <tt>TCompositeControl</tt> dan mengganti metode <tt>TControl::createChildControls()</tt>. Kedua adalah memperluas <tt>TTemplateControl</tt> (atau kelas anaknya) dan menulis template kontrol. Yang terakhir lebih mudah digunakan dan bisa mengatur tata letak unsur komponen lebih intuitif, sementara pembentuk lebih efisien karena ia tidak perlu menguraikan template.
diff --git a/demos/quickstart/protected/pages/Controls/id/TextHighlighter.page b/demos/quickstart/protected/pages/Controls/id/TextHighlighter.page index b2b500b0..b1bb4ce7 100755 --- a/demos/quickstart/protected/pages/Controls/id/TextHighlighter.page +++ b/demos/quickstart/protected/pages/Controls/id/TextHighlighter.page @@ -17,7 +17,6 @@ Untuk menggunakan <tt>TTextHighlighter</tt>, cukup kurung konten yang sintaksnya <?php
$str = 'one|two|three|four';
print_r(explode('|', $str, 2)); // akan mengeluarkan array
-?>
</com:TTextHighlighter>
</com:TTextHighlighter>
diff --git a/demos/quickstart/protected/pages/Database/ActiveRecord.page b/demos/quickstart/protected/pages/Database/ActiveRecord.page index 537c65e0..cf1485bd 100755 --- a/demos/quickstart/protected/pages/Database/ActiveRecord.page +++ b/demos/quickstart/protected/pages/Database/ActiveRecord.page @@ -129,7 +129,7 @@ You may specify qualified table names. E.g. for MySQL, <tt>TABLE = "`database1`. </div> <div class="note"><b class="note">Note:</b> -Since version <b>3.1.3</b> you can also use a method <tt>table()</tt> to define the table name. +Since version <b>3.1.3</b> you can also use a method <tt>table()</tt> to define the table name. This allows you to dynamically specify which table should be used by the ActiveRecord. <com:TTextHighlighter Language="php" CssClass="source block-content"> class TeamRecord extends TActiveRecord @@ -159,7 +159,7 @@ class UserRecord extends TActiveRecord { } } </com:TTextHighlighter> -<p id="710010" class="block-content">More details regarding TComponent can be found in the <a href="?page=Fundamentals.Components">Components documentation</a>. +<p id="710010" class="block-content">More details regarding TComponent can be found in the <a href="?page=Fundamentals.Components1">Components documentation</a>. Later we shall use the getter/setters to allow for lazy loading of relationship objects. </p> @@ -1128,7 +1128,7 @@ class PlayerRecord extends BaseFkRecord <p id="710046" class="block-content">We first need to change the <tt>$skills=array()</tt> declaration to a private property <tt>$_skills</tt> (notice the underscore) and set it to null instead. This allows us to define the <tt>skills</tt> property using getter/setter methods -(see <a href="?page=Fundamentals.Components">Components</a> for details). The <tt>getSkills()</tt> +(see <a href="?page=Fundamentals.Components1">Components</a> for details). The <tt>getSkills()</tt> getter method for the <tt>skills</tt> property will lazy load the corresponding skills foreign record when it is used as follows. Notice that we only do a lazy load when its <tt>$player_id</tt> is not null (that is, when the record is already fetched from the database or player id was already set). diff --git a/demos/quickstart/protected/pages/Database/id/ActiveRecord.page b/demos/quickstart/protected/pages/Database/id/ActiveRecord.page index 454aa3f9..8e81678e 100755 --- a/demos/quickstart/protected/pages/Database/id/ActiveRecord.page +++ b/demos/quickstart/protected/pages/Database/id/ActiveRecord.page @@ -3,7 +3,7 @@ <com:SinceVersion Version="3.1a" /> <p id="690478" class="block-content">Rekaman Aktif adalah obyek yang melapisi baris dalam tabel atau view database, melindungi akses database dan menambahkan logika domain pada data tersebut. - Dasar dari Rekaman Aktif adalah kelas bisnis, sebagai contoh, kelas + Dasar dari Rekaman Aktif adalah kelas bisnis, sebagai contoh, kelas <tt>Products</tt>, yang hampir menyamai struktur rekaman dari tabel database dibawahnya. Setiap Rekaman Aktif akan bertanggung jawab atas penyimpanan dan pengambilan data ke dan dari database. </p> @@ -14,22 +14,22 @@ </div> <h2 id="138047">Kapan Menggunakannya</h2> -<p id="690479" class="block-content">Rekaman Aktif adalah pilihan yang baik untuk logika domain yang tidak terlalu rumit, +<p id="690479" class="block-content">Rekaman Aktif adalah pilihan yang baik untuk logika domain yang tidak terlalu rumit, seperti membuat, membaca, memutakhirkan, dan menghapus. Derivasi dan validasi didasarkan pada satu rekaman yang bekerja denga baik dalam struktur ini. Rekaman Aktif mempunyai kuntungan utama dalam hal kesederhanaan. Mudah untuk membangun Rekaman Aktif, dan mudah untuk dimengerti.</p> <p id="690480" class="block-content">Akan tetapi, seiring dengan perkembangan logika bisnis Anda dalm hal kompleksitas, Anda akan segera ingin menggunakan hubungan langsung obyek Anda, koleksi, turunan, dan seterusnya. Ini tidak mudah diterapkan ke dalam Rekaman Aktif, dan menambahkannya sedikit demi sedikit menjadi sangat kacau. Argumen lain terhadap Rekaman Aktif adalah kenyataan bahwa ia menyandingkan desin obyek ke desain database. Ini menjadikannya lebih sulit untuk merefraktorisasi karena proyek terus berjalan.</p> - - <p id="690481" class="block-content">Alternatifnya adalah menggunakan Pemeta Data yang yang memisahkan aturan dari obyek bisnis dan bagaimana obyek ini disimpan. + + <p id="690481" class="block-content">Alternatifnya adalah menggunakan Pemeta Data yang yang memisahkan aturan dari obyek bisnis dan bagaimana obyek ini disimpan. Prado menyediakan pilihan tambahan antara Rekaman Aktif dan - <a href="?page=Database.SqlMap">Pemeta Data SqlMap</a>. - Pemeta Data SqlMap bisa dipakai untuk mengambil obyek Rekaman Aktif, hasilnya; obyek Rekaman Aktif ini bisa dipakai untuk memutakhirkan database. + <a href="?page=Database.SqlMap">Pemeta Data SqlMap</a>. + Pemeta Data SqlMap bisa dipakai untuk mengambil obyek Rekaman Aktif, hasilnya; obyek Rekaman Aktif ini bisa dipakai untuk memutakhirkan database. "Hubungan" antara Rekaman Aktif dan <a href="?page=Database.SqlMap">SqlMap</a> digambarkan dalam diagram berikut. Lebih rinci mengenai Pemeta Data SqlMap dapat ditemukan dalam <a href="http://www.pradosoft.com/demos/sqlmap/">Manual SqlMap</a>. <img src=<%~ sqlmap_active_record.png %> alt="Rekaman Aktif dan SqlMap DataMapper" id="fig:diagram.png" class="figure"/> </p> - + <p id="690482" class="block-content"> Kelas Rekaman Aktif berfungsi untuk melakukan tugas-tugas berikut. </p> @@ -41,22 +41,22 @@ </ul> <h2>Implikasi Desain</h2> <p> -Implementasi Prado terhadap Rekaman Aktif tidak memelihara identitas referensial. Setiap obyek diperoleh menggunakan Rekaman Aktif pada data dalam database. Sebagai contoh, jika Anda meminta kustomer tertentu dan mendapatkan kembali obyek <tt>Customer</tt>, kali berikutnya Anda meminta kustomer itu, Anda akan kembali mendapatkan turunan lain dari obyek <tt>Customer</tt>. Ini berarti bahwa perbandingan tepat (misalnya menggunakan <tt>===</tt>) akan mengembalikan false, sementara perbandingan bebas (misalnya menggunakan <tt>==</tt>) akan mengembalikan true jika nilai obyek sama menurut perbandingan bebas. +Implementasi Prado terhadap Rekaman Aktif tidak memelihara identitas referensial. Setiap obyek diperoleh menggunakan Rekaman Aktif pada data dalam database. Sebagai contoh, jika Anda meminta kustomer tertentu dan mendapatkan kembali obyek <tt>Customer</tt>, kali berikutnya Anda meminta kustomer itu, Anda akan kembali mendapatkan turunan lain dari obyek <tt>Customer</tt>. Ini berarti bahwa perbandingan tepat (misalnya menggunakan <tt>===</tt>) akan mengembalikan false, sementara perbandingan bebas (misalnya menggunakan <tt>==</tt>) akan mengembalikan true jika nilai obyek sama menurut perbandingan bebas. <p> <p> Implikasi desain ini terkait dengan pertanyaan berikut. -<i>"Anda pikir kustomer sebagai obyek, di mana hanya satu, +<i>"Anda pikir kustomer sebagai obyek, di mana hanya satu, atau Anda pikir obyek yang Anda operasikan sebagai <b>duplikat</b> dari database?"</i> -Pemetaan O/R lain akan mengartikan bahwa hanya ada satu obyek Kustomer dengan custID 100, dan secara literal ia adalah kustomer. -Jika Anda mendapatkan kustomer dan mengubah field-nya, maka Anda sekarang telah mengubah kustomer itu. -<i>"Itu berbatasan dengan: Anda telah mengubah duplikat kustomer ini, tapi bukan pada duplikat itu. +Pemetaan O/R lain akan mengartikan bahwa hanya ada satu obyek Kustomer dengan custID 100, dan secara literal ia adalah kustomer. +Jika Anda mendapatkan kustomer dan mengubah field-nya, maka Anda sekarang telah mengubah kustomer itu. +<i>"Itu berbatasan dengan: Anda telah mengubah duplikat kustomer ini, tapi bukan pada duplikat itu. Dan jika dua orang memutakhirkan kustomer pada dua duplikat obyek, siapapun yang memutakhirkan pertama kali, atau mungkin yang terakhir yang menang."</i> [A. Hejlsberg 2003] </p> <h2 id="142010">Database yang Didukung</h2> <p id="p1" class="block-content"> -Implementasi Rekaman Aktif memanfaatkan kelas <a href="?page=Database.DAO">Prado DAO</a> untuk akses data. -Implementasi Rekaman Aktif saat ini mendukung database sebagai berikut. +Implementasi Rekaman Aktif memanfaatkan kelas <a href="?page=Database.DAO">Prado DAO</a> untuk akses data. +Implementasi Rekaman Aktif saat ini mendukung database sebagai berikut. </p> <ul> <li><a href="http://www.mysql.com">MySQL 4.1 atau lebih tinggi</a></li> @@ -69,8 +69,8 @@ Implementasi Rekaman Aktif saat ini mendukung database sebagai berikut. <h1 id="138048">Mendefinisikan Rekaman Aktif</h1> <p id="690483" class="block-content">Mari kita anggap tabel - "<tt>users</tt>" berikut yang berisi dua kolom bernama "<tt>username</tt>" dan "<tt>email</tt>", - di mana "<tt>username</tt>" juga merupakan kunci primer. + "<tt>users</tt>" berikut yang berisi dua kolom bernama "<tt>username</tt>" dan "<tt>email</tt>", + di mana "<tt>username</tt>" juga merupakan kunci primer. <com:TTextHighlighter Language="sql" CssClass="source block-content" id="code_690147"> CREATE TABLE users ( @@ -88,7 +88,7 @@ class UserRecord extends TActiveRecord public $username; //kolom bernama "username" dalam tabel "users" public $email; - + /** * @return TActiveRecord active record finder instance */ @@ -116,7 +116,7 @@ Anda dapat menetapkan nama-nama tabel yang memenuhi syarat. Contohnya untuk MySQ <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690149"> class UserRecord extends TActiveRecord { ... //definisi yang sudah ada seprti di atas - + private $_level; public function setLevel($value) { $this->_level=TPropertyValue::ensureInteger($value,0); @@ -126,18 +126,18 @@ class UserRecord extends TActiveRecord { } } </com:TTextHighlighter> -<p id="710010" class="block-content">Lebih jelas mengenai TComponent dapat ditemukan dalam <a href="?page=Fundamentals.Components">Dokumentasi komponen</a>. +<p id="710010" class="block-content">Lebih jelas mengenai TComponent dapat ditemukan dalam <a href="?page=Fundamentals.Components1">Dokumentasi komponen</a>. Nantinya kita harus dapat menggunakan pengambil/penyetel guna membolehkan pengambilan malas atas obyek yang berhubungan. </p> <div class="info"><b class="note">Info:</b> <tt>TActiveRecord</tt> juga dapat bekerja dengan view database dengan menetapkan konstan <tt>TABLE</tt> terkait ke nama view. Akan tetapi, obyek yang dikembalikan dari view hanya-baca, memanggil metode -<tt>save()</tt> atau <tt>delete()</tt> akan memunculkan eksepsi. +<tt>save()</tt> atau <tt>delete()</tt> akan memunculkan eksepsi. </div> <p id="690486" class="block-content"> - Metode statis <tt>finder()</tt> mengembalilkan turunan <tt>UserRecord</tt> + Metode statis <tt>finder()</tt> mengembalilkan turunan <tt>UserRecord</tt> yang dapat dipakai untuk mengambil rekaman dari database. Pengambilan rekaman menggunakan metode finder akan didiskusikan nanti. Metode statis <tt>TActiveRecord::finder()</tt> mengambil nama kelas Rekaman Aktif sebagai parameter. </p> @@ -152,7 +152,7 @@ obyek yang dikembalikan dari view hanya-baca, memanggil metode $dsn = 'pgsql:host=localhost;dbname=test'; //Postgres SQL $conn = new TDbConnection($dsn, 'dbuser','dbpass'); TActiveRecordManager::getInstance()->setDbConnection($conn); -</com:TTextHighlighter> +</com:TTextHighlighter> <p id="710011" class="block-content">Alternatifnya, Anda dapat membuat basis kelas dan mengganti metode <tt>getDbConnection()</tt> untuk mengembalikan koneksi database. Ini adalah cara sederhana untuk mengijinkan koneksi database multipel. Kode berikut mendemonstrasikan penetapan koneksi database dalam sebuah basis kelas (tidak perlu menyetel koneksi DB di manapun juga). @@ -178,13 +178,13 @@ class MyDb2Record extends TActiveRecord return $conn; } } -</com:TTextHighlighter> +</com:TTextHighlighter> <h3 class="prado-specific">Menggunakan <tt>application.xml</tt> di dalam Kerangka Kerja Prado</h3> <div class="prado-specific"> <p id="690488" class="block-content"> - Koneksi database standar dapat juga dikonfigurasi menggunakan tag <tt><module></tt> dalam <a href="?page=Configurations.AppConfig">application.xml</a> + Koneksi database standar dapat juga dikonfigurasi menggunakan tag <tt><module></tt> dalam <a href="?page=Configurations.AppConfig">application.xml</a> atau <a href="?page=Configurations.PageConfig">config.xml</a> seperti berikut. <com:TTextHighlighter Language="xml" CssClass="source block-content" id="code_690151"> <modules> @@ -192,8 +192,8 @@ class MyDb2Record extends TActiveRecord <database ConnectionString="pgsql:host=localhost;dbname=test" Username="dbuser" Password="dbpass" /> </module> -</modules> -</com:TTextHighlighter> +</modules> +</com:TTextHighlighter> <div class="tip"><b class="note">Tip:</b> Atribut <tt>EnableCache</tt> ketika disetel ke "true" akan melakukan cache meta data tabel, yakni nama kolom tabel, indeks dan batasan yang disimpan dalam cache dan dipakai ulang. Anda harus membersihkan atau mematikan cache jika Anda ingin melihat perubahan terhadap definisi tabel Anda. <a href="?page=Advanced.Performance#6402">Modul cache</a> juga harus didefinisikan agar cache berfungsi. </div> @@ -207,13 +207,13 @@ class MyDb2Record extends TActiveRecord Username="dbuser" Password="dbpass" /> </module> - <module class="System.Data.ActiveRecord.TActiveRecordConfig" + <module class="System.Data.ActiveRecord.TActiveRecordConfig" ConnectionID="db1" EnableCache="true" /> <module class="System.Data.SqlMap.TSqlMapConfig" ConnectionID="db1" ... /> -</modules> -</com:TTextHighlighter> +</modules> +</com:TTextHighlighter> </p> </div> @@ -299,10 +299,10 @@ $criteria->Offset = 20; <div class="note"><b class="note">Catatan:</b> Untuk MSSQL dan saat <tt>Limit</tt> serta <tt>Offset</tt> berisi nilai integer positif. Query aktual yang dijalankan diubah oleh kelas -<com:DocLink ClassPath="System.Data.ActiveRecord.Common.Mssql.TMssqlCommandBuilder" +<com:DocLink ClassPath="System.Data.ActiveRecord.Common.Mssql.TMssqlCommandBuilder" Text="TMssqlCommandBuilder" /> -berdasarkan pada +berdasarkan pada <a href="http://troels.arvin.dk/db/rdbms/#select-limit-offset">http://troels.arvin.dk/db/rdbms/</a> untuk mengemulasikan kondisi <tt>Limit</tt> dan <tt>Offset</tt>. </div> @@ -332,11 +332,11 @@ $finder->find('Username = ? AND Password = ?', $name, $pass); $finder->findAllByAge($age); $finder->findAll('Age = ?', $age); </com:TTextHighlighter> - + <div class="tip"><b class="note">Tip:</b> Anda juga dapat menggunakan kombinasi <tt>AND</tt> dan <tt>OR</tt> sebagai kondisi dalam metode dinamis. </div> - + <h3 id="138060"><tt>findBySql()</tt> dan <tt>findAllBySql()</tt></h3> <p id="690497" class="block-content">Mencari rekaman menggunakan SQL penuh di mana <tt>findBySql()</tt> mengembalikan Rekaman Aktif dan <tt>findAllBySql()</tt>mengembalikan array obyek rekaman. Untuk setiap kolom yang dikembalikan, kelas Rekaman Aktif terkait harus mendefinisikan variabel atau properti untuk setiap nama kolom terkait. @@ -371,7 +371,7 @@ Obyek dimutakhirkan dengan kunci primer dari tabel itu yang berisi definisi yang Sebagai contoh, jika Anda menyisipkan sebuah rekaman baru ke dalam tabel MySQL yang kolomnya didefinisikan dengan "autoincrement", obyek Rekaman Aktif akan dimutakhirkan dengan nilai yang ditambahkan.</div> <p id="690500" class="block-content"> -Untuk memutakhirkan rekaman dalam database, cukup ubah satu atau lebih properti obyek Rekaman Aktif yang sudah diambil dari database dan kemudian panggil metode <tt>save()</tt>. +Untuk memutakhirkan rekaman dalam database, cukup ubah satu atau lebih properti obyek Rekaman Aktif yang sudah diambil dari database dan kemudian panggil metode <tt>save()</tt>. <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690162"> $user = UserRecord::finder()->findByName('admin'); @@ -392,7 +392,7 @@ Kapan saja Anda memanggil metode <tt>save()</tt> pada obyek TActiveRecord, obyek <h2 id="138052">Menghapus rekaman yang sudah ada</h2> <p id="690502" class="block-content"> Untuk menghapus rekaman yang sudah ada dan diambil, cukup panggil metode <tt>delete()</tt>. - Anda juga dapat menghapus rekaman dalam database dengan kunci primer tanpa mengambil rekaman apapun menggunakan metode <tt>deleteByPk()</tt> (dan metode yang sama <tt>deleteAllByPks()</tt>). + Anda juga dapat menghapus rekaman dalam database dengan kunci primer tanpa mengambil rekaman apapun menggunakan metode <tt>deleteByPk()</tt> (dan metode yang sama <tt>deleteAllByPks()</tt>). Sebagai contoh, untuk menghapus satu atau beberapa rekaman dengan menggunakan satu atau lebih kunci primer. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690163"> @@ -457,8 +457,8 @@ TActiveRecord menawarkan dua event, <tt>OnCreateCommand</tt> dan <tt>OnExecuteCo </p> <p id="710015" class="block-content"> -Event <tt>OnExecuteCommand</tt> dimunculkan ketika perintah dijalankan dan hasil dari database dikembalikan. Obyek parameter <tt>TDataGatewayResultEventParameter</tt> -dari properti <tt>Result</tt> berisi data yang dikembalikan dari database. +Event <tt>OnExecuteCommand</tt> dimunculkan ketika perintah dijalankan dan hasil dari database dikembalikan. Obyek parameter <tt>TDataGatewayResultEventParameter</tt> +dari properti <tt>Result</tt> berisi data yang dikembalikan dari database. Data yang dikembalikan dapat diubah dengan setelan properti <tt>Result</tt>. </p> @@ -491,7 +491,7 @@ function logger($sender,$param) } TActiveRecord::finder('MyRecord')->OnExecuteCommand[] = 'logger'; $obj->OnExecuteCommand[] = array($logger, 'log'); //setiap PHP callback yg benar. -</com:TTextHighlighter> +</com:TTextHighlighter> <h1 id="ar_relations">Hubungan Rekaman Aktif</h1> <com:SinceVersion Version="3.1rc1" /> @@ -507,7 +507,7 @@ Dalam bagian berikut kita akan menganggap hubungan tabel antara <img src=<%~ ar_relations.png %> class="figure" /> -<p id="710018" class="block-content">Tujuannya adalah untuk mendapatkan model obyek yang mewakili ke beberapa derajat hubungan entitas dalam gambar di atas. +<p id="710018" class="block-content">Tujuannya adalah untuk mendapatkan model obyek yang mewakili ke beberapa derajat hubungan entitas dalam gambar di atas. </p> <img src=<%~ ar_objects.png %> class="figure" /> @@ -534,7 +534,7 @@ CREATE TABLE bar </div> <h2 id="142012">Pemetaan Kunci Asing</h2> -<p class="block-content">Hubungan entitas antara tabel <tt>Teams</tt> dan <tt>Players</tt> adalah apa yang dikenal sebagai hubungan 1-M. Yaitu, satu Tim dapat berisi 0 atau lebih Pemain. Dalam batasan hubungan obyek, kita katakan bahwa obyek <tt>TeamRecord</tt> <b>memiliki banyak</b> obyek <tt>PlayerRecord</tt>. +<p class="block-content">Hubungan entitas antara tabel <tt>Teams</tt> dan <tt>Players</tt> adalah apa yang dikenal sebagai hubungan 1-M. Yaitu, satu Tim dapat berisi 0 atau lebih Pemain. Dalam batasan hubungan obyek, kita katakan bahwa obyek <tt>TeamRecord</tt> <b>memiliki banyak</b> obyek <tt>PlayerRecord</tt>. (Perhatikan kebalikan dari arah hubungan antara tabel dan obyek.) <p id="710019" class="block-content"> @@ -548,7 +548,7 @@ class TeamRecord extends TActiveRecord const TABLE='Teams'; public $name; public $location; - + public $players=array(); // deklarasi ini tidak diperlukan lagi sejak v3.1.2 //mendefinisikan anggota $player yang memiliki hubungan banyak dengan PlayerRecord @@ -616,7 +616,7 @@ Metode <tt>with_xxx()</tt> (di mana <tt>xxx</tt> adalah nama properti hubungan, <div class="note"><b class="note">Catatan:</b> Penting untuk dimengerti bahwa obyek terkait diambil menggunakan query tambahan. Query pertama mengambil obyek sumber, misalnya <tt>TeamRecord</tt> dalam contoh kode di atas. -Query kedua dipakai untuk mengambil obyek <tt>PlayerRecord</tt> terkait. +Query kedua dipakai untuk mengambil obyek <tt>PlayerRecord</tt> terkait. Penggunaan dua query mirip dengan query tunggal menggunakan Left-Outer join dengan eksepsi bahwa hasil null pada tabel kanan tidak dikembalikan. Konsekuensi pemakaian dua tau lebih query adalah kondisi agregat dan join tidak layak menggunakan Rekaman Aktif. Untuk query di luar lingkup Rekaman Aktif, <a href="?page=Database.SqlMap">Pemeta Data SqlMap</a> diapat dupertimbangkan. </div> @@ -634,9 +634,9 @@ Kode berikut mendefinisikan kelas <tt>PlayerRecord</tt> lengkap dengan 3 hubunga class PlayerRecord extends TActiveRecord { const TABLE='Players'; - public $player_id; - public $age; - public $team_name; + public $player_id; + public $age; + public $team_name; public $team; // deklarasi ini tidak diperlukan lagi sejak v3.1.2 public $skills=array(); // deklarasi ini tidak diperlukan lagi sejak v3.1.2 @@ -656,9 +656,9 @@ class PlayerRecord extends TActiveRecord } </com:TTextHighlighter> <p id="710026" class="block-content"> -Properti <tt>$RELATIONS</tt> dari <tt>PlayerRecord</tt> mendefinisikan properti <tt>$team</tt> <b>milik</b> <tt>TeamRecord</tt>. -Array <tt>$RELATIONS</tt> juga mendefinisikan dua hubungan lainnya yang nanti akan kita uji dalam seksi di bawah ini. -Dalam <tt>array(self::BELONGS_TO, 'TeamRecord')</tt>, elemen pertama mendefinisikan tipe hubungan, dalam hal ini <strong><tt>self::BELONGS_TO</tt></strong> dan +Properti <tt>$RELATIONS</tt> dari <tt>PlayerRecord</tt> mendefinisikan properti <tt>$team</tt> <b>milik</b> <tt>TeamRecord</tt>. +Array <tt>$RELATIONS</tt> juga mendefinisikan dua hubungan lainnya yang nanti akan kita uji dalam seksi di bawah ini. +Dalam <tt>array(self::BELONGS_TO, 'TeamRecord')</tt>, elemen pertama mendefinisikan tipe hubungan, dalam hal ini <strong><tt>self::BELONGS_TO</tt></strong> dan elemen kedua adalah string <tt>'TeamRecord'</tt> yang terkait ke nama kelas dari kelas <tt>TeamRecord</tt>. Obyek pemain dengan obyek tim terkait dapat diambil serperti berikut. </p> @@ -703,7 +703,7 @@ class ProfileRecord extends TActiveRecord <p id="710029" class="block-content">Intinya, ada hubungan "<b>belongs to</b>" untuk obyek yang mengaitkan entitas yang memmpunyai kolom yakni kunci asing. Dalam keadaan tertentu, kita melihat bahwa tabel <tt>Profiles</tt> mempunyai batasan kunci asing pada kolom <tt>player_id</tt> yang terkait ke tabel <tt>Players</tt> kolom <tt>player_id</tt>. Selanjutnya, obyek <tt>ProfileRecord</tt> memiliki properti (<tt>$player</tt>) yang adalah <b>milik</b> obyek <tt>PlayerRecord</tt>. -Demikian juga, tabel <tt>Players</tt> mempunyai batasan kunci asing pada kolom <tt>team_name</tt> yang terkait ke tabel <tt>Teams</tt> kolom <tt>name</tt>. +Demikian juga, tabel <tt>Players</tt> mempunyai batasan kunci asing pada kolom <tt>team_name</tt> yang terkait ke tabel <tt>Teams</tt> kolom <tt>name</tt>. Kemudian, obyek <tt>PlayerRecord</tt> mempunyai properti (<tt>$team</tt>) yang adalah <b>milik</b> obyek <tt>TeamRecord</tt>. </p> @@ -756,13 +756,13 @@ dua elemen tambahan ini mirip seperti parameter yang dikirimkan ke metode <tt>fi Obyek dapat dengan mudah menangani field multi nilai dengan menggunakan koleksi sebagai nilai field. Database relasional tidak memiliki fitur ini dan dibatasi hanya ke field nilai-tunggal. Ketika Anda memetakan asosiasi satu-ke-banyak, Anda bisa menangani ini menggunakan hubungan <b>has many</b>, intinya menggunakan kunci asing untuk nilai-tunggal akhir dari asosiasi. Tapi asosiasi banyak-ke-banyak tidak bisa melakukan ini karena tidak ada nilai-tunggal akhir ke kunci asing yang dipegangnya. </p> <p id="710033" class="block-content"> -Jawabannya adalah resolusi klasik yang telah dipakai oleh orang selama dekade ini yakni: buat tabel ekstra (tabel asosiasi) untuk merekam asosiasi. +Jawabannya adalah resolusi klasik yang telah dipakai oleh orang selama dekade ini yakni: buat tabel ekstra (tabel asosiasi) untuk merekam asosiasi. Ide dasarnya adalah menggunakan tabel asosiasi untuk menyimpan asosiasi. Tabel ini memiliki ID kunci asing untuk dua tabel yang dikaitkan bersama, masing-masing memiliki pasangan dari obyek yang diasosiasikan. </p> <p id="710034" class="block-content"> Tabel asosiasi tidak mempunyai kaitan obyek dalam-memori dan kunci primernya adalah gabungan dari dua kunci primer dari tabel yang diasosiasikan. -Dalam batasan yang sederhana, tuntuk mengambil data dari tabel asosiasi, Anda melakukan dua query (secara umum, ini juga bisa dicapai menggunakan satu query yang terdiri dari join). -Anggap pengambilan koleksi <tt>SkillRecord</tt> untuk daftar obyek <tt>PlayerRecord</tt>. +Dalam batasan yang sederhana, tuntuk mengambil data dari tabel asosiasi, Anda melakukan dua query (secara umum, ini juga bisa dicapai menggunakan satu query yang terdiri dari join). +Anggap pengambilan koleksi <tt>SkillRecord</tt> untuk daftar obyek <tt>PlayerRecord</tt>. Dalam hal ini, Anda melakukan query dalam dua tahap. Tahap pertama meng-query tabel <tt>Players</tt> untuk mencari seluruh baris dari pemain yang Anda inginkan. Tahap kedua mencari obyek <tt>SkillRecord</tt> ID pemain terkait untuk setiap barisnya dalam tabel asosiasi <tt>Player_Skills</tt> menggunakan sebuah inner join. </p> @@ -794,7 +794,7 @@ class SkillRecord extends TActiveRecord <p id="710036" class="block-content"> Properti statis <tt>$RELATIONS</tt> dari SkillRecord mendefinisikan bahwa properti <tt>$players</tt> memiliki banyak <tt>PlayerRecord</tt>s melalui tabel asosiasi '<tt>Player_Skills</tt>'. Dalam <tt>array(self::MANY_TO_MANY, 'PlayerRecord', 'Player_Skills')</tt>, elemen pertama mendefinisikan tipe hubungan, dalam hal ini <strong><tt>self::HAS_MANY</tt></strong>, -elemen kedua adalah string <tt>'PlayerRecord'</tt> yang terkait ke nama kelas dari kelas <tt>PlayerRecord</tt>, dan elemen ketiga adalah nama dari nama tabel asosiasi. +elemen kedua adalah string <tt>'PlayerRecord'</tt> yang terkait ke nama kelas dari kelas <tt>PlayerRecord</tt>, dan elemen ketiga adalah nama dari nama tabel asosiasi. </p> <div class="note"><b class="note">Catatan:</b> @@ -815,22 +815,22 @@ Metode <tt>with_xxx()</tt> (di mana <tt>xxx</tt> adalah nama properti hubungan, <p id="710039" class="block-content"> Untuk tabel asosiasi yang mererefensi dirinya sendiri, yaitu titik asosiasi ke tabel yang sama. Sebagai contoh, anggap tabel <tt>items</tt> dengan item terkait M-N melalui tabel asosiasi <tt>related_items</tt>. Sintaks dalam contoh berikut adalah benar untuk database PostgreSQL. Untuk database lain, lihat dokumentasinya masing-masing untuk mendefinisikan batasan kunci asing. <com:TTextHighlighter Language="sql" CssClass="source block-content"> -CREATE TABLE items +CREATE TABLE items ( - "item_id" SERIAL, + "item_id" SERIAL, "name" VARCHAR(128) NOT NULL, PRIMARY KEY("item_id") ); -CREATE TABLE "related_items" +CREATE TABLE "related_items" ( - "item_id" INTEGER NOT NULL, - "related_item_id" INTEGER NOT NULL, - CONSTRAINT "related_items_pkey" PRIMARY KEY("item_id", "related_item_id"), + "item_id" INTEGER NOT NULL, + "related_item_id" INTEGER NOT NULL, + CONSTRAINT "related_items_pkey" PRIMARY KEY("item_id", "related_item_id"), CONSTRAINT "related_items_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "items"("item_id") ON DELETE CASCADE ON UPDATE NO ACTION - NOT DEFERRABLE, + NOT DEFERRABLE, CONSTRAINT "related_items_related_item_id_fkey" FOREIGN KEY ("related_item_id") REFERENCES "items"("item_id") ON DELETE CASCADE @@ -839,7 +839,7 @@ CREATE TABLE "related_items" ); </com:TTextHighlighter> -<p id="710040" class="block-content">Nama tabel asosiasi dalam elemen ketiga dari array hubungan dapat berisi nama kolom tabel asing. Kolom yang didefinisikan dalam tabel asosiasi harus juga didefinisikan dalam kelas rekaman (contohnya properti <tt>$related_item_id</tt> terkait ke kolom <tt>related_item_id</tt> dalam tabel <tt>related_items</tt>). +<p id="710040" class="block-content">Nama tabel asosiasi dalam elemen ketiga dari array hubungan dapat berisi nama kolom tabel asing. Kolom yang didefinisikan dalam tabel asosiasi harus juga didefinisikan dalam kelas rekaman (contohnya properti <tt>$related_item_id</tt> terkait ke kolom <tt>related_item_id</tt> dalam tabel <tt>related_items</tt>). </p> <com:TTextHighlighter Language="php" CssClass="source block-content"> class Item extends TActiveRecord @@ -849,18 +849,18 @@ class Item extends TActiveRecord public $details; //id item asing tambahan didefinisikan dalam tabel asosiasi - public $related_item_id; + public $related_item_id; public $related_items=array(); // deklarasi ini tidak diperlukan lagi sejak v3.1.2 public static $RELATIONS=array ( - 'related_items' => array(self::MANY_TO_MANY, + 'related_items' => array(self::MANY_TO_MANY, 'Item', 'related_items.related_item_id'), ); } </com:TTextHighlighter> <div class="tip"><b class="note">Tip:</b> -Kunci gabungan dalam tabel asing dapat ditetapkan sebagai nilai dipisahkan koma diantara kurung buka/tutup. Contohnya <tt>'related_items.(id1,id2)'</tt>. +Kunci gabungan dalam tabel asing dapat ditetapkan sebagai nilai dipisahkan koma diantara kurung buka/tutup. Contohnya <tt>'related_items.(id1,id2)'</tt>. </div> <!--- @@ -882,7 +882,7 @@ Karena kelas <tt>TeamRecord</tt> berisi hubungan <b>has many</b> dengan <tt>Play </p> <p id="710043" class="block-content">Untuk menghapus obyek asing tertentu (atau setiap obyek Rekaman Aktif), cukup panggil metode obyek <tt>delete()</tt>. Anda dapat menyiapkan batas kunci asing tabel database seperti saat menghapus data tertentu dalam database ia akan menghapus data yang direferensi juga (ia juga dapat dicapai dengan menggunakan pemicu database). Contohnya seperti mempunyai batasan "<tt>ON DELETE CASCADE</tt>". -Menghapus kunci obyek asing dengan menyetel nilai properti ke null atau menghapus obyek dari array <b>TIDAK</b> akan menghapus data terkait dalam database. +Menghapus kunci obyek asing dengan menyetel nilai properti ke null atau menghapus obyek dari array <b>TIDAK</b> akan menghapus data terkait dalam database. </p> <p id="710044" class="block-content">Untuk menghapus asosiasi hubungan banyak-ke-banyak melalui tabel asosiasi, Rekaman Aktif yang terkait tabel asosiasi yang bisas dipakai. Kemudian asosiasi dapat dihapus dengan memanggil metode <tt>deleteByPk()</tt>, sebagai contoh: @@ -908,7 +908,7 @@ class PlayerRecord extends BaseFkRecord //... properti dan metode lainnya seperti sebelumnya private $_skills; //ubah ke private dan standar sebagai null - + public function getSkills() { if($this->_skills===null && $this->player_id !==null) @@ -932,7 +932,7 @@ class PlayerRecord extends BaseFkRecord } </com:TTextHighlighter> <p id="710046" class="block-content">Pertama kita perlu mengubah deklarasi <tt>$skills=array()</tt> ke properti private <tt>$_skills</tt> (perhatikan garis bawah) dan sebaliknya setel ke null. Ini membolehkan kita untuk mendefinisikan properti <tt>skills</tt> menggunakan metode pengambil/penyetel -(lihat <a href="?page=Fundamentals.Components">Komponen</a> untuk lebih jelasnya). Metode pengambil <tt>getSkills()</tt> untuk properti <tt>skills</tt> akan mengambil malas rekaman skill terkait saat ia dipakai sebagai berikut. Catatan bahwa kita hanya melakukan pengambilan malas ketika <tt>$player_id</tt> tidak null (yakni, ketika rekaman sudah diambil dari database ataau id player sudah disetel). +(lihat <a href="?page=Fundamentals.Components1">Komponen</a> untuk lebih jelasnya). Metode pengambil <tt>getSkills()</tt> untuk properti <tt>skills</tt> akan mengambil malas rekaman skill terkait saat ia dipakai sebagai berikut. Catatan bahwa kita hanya melakukan pengambilan malas ketika <tt>$player_id</tt> tidak null (yakni, ketika rekaman sudah diambil dari database ataau id player sudah disetel). </p> <com:TTextHighlighter Language="php" CssClass="source block-content"> $player = PlayerRecord::finder()->findByPk(1); @@ -943,13 +943,13 @@ $player->skills[] = new SkillRecord(); //menambah skill <p id="710047" class="block-content">The <tt>setSkills()</tt> memastikan bahwa properti <tt>skills</tt> akan selalu berupa TList. Menggunakan TList yang membolehkan kita untuk menyetel elemen properti <tt>skills</tt> seolah-olah mereka -sebuah array. Contohnya <tt>$player->skills[] = new SkillRecord()</tt>. Jika <tt>array</tt> dipakai, kesalahan PHP -akan dikeluarkan. +sebuah array. Contohnya <tt>$player->skills[] = new SkillRecord()</tt>. Jika <tt>array</tt> dipakai, kesalahan PHP +akan dikeluarkan. </p> <h2>Pemetaan Kolom</h2> <p> -Sejak v3.1.1, Rekaman Aktif mulai mendukung pemetaan kolom. Pemetaan kolom membolehkan para +Sejak v3.1.1, Rekaman Aktif mulai mendukung pemetaan kolom. Pemetaan kolom membolehkan para pengembang untuk mengalamatkan kolom dalam Rekaman Aktif menggunakan konvensi penamaan lebih konsisten. Dalam keadaan tertentu, menggunakan pemetaan kolom, seseorang dapat mengakses kolom menggunakan apapun namanya yang disukainya, daripada nama terbatas yang didefinisikan dalam diff --git a/demos/quickstart/protected/pages/Database/pl/ActiveRecord.page b/demos/quickstart/protected/pages/Database/pl/ActiveRecord.page index 97a054fe..3a073e57 100755 --- a/demos/quickstart/protected/pages/Database/pl/ActiveRecord.page +++ b/demos/quickstart/protected/pages/Database/pl/ActiveRecord.page @@ -2,7 +2,7 @@ <h1 id="138046">Rekord Aktywny (ang. Active Record)</h1> <com:SinceVersion Version="3.1a" /> <p id="690478" class="block-content">Rekordy Aktywne są obiektami, które opakowują wiersz w bazie danych lub widoku, - obudowują (ang. encapsulate) dostęp do bazy danych oraz dziedziny logiki dla tych danych. + obudowują (ang. encapsulate) dostęp do bazy danych oraz dziedziny logiki dla tych danych. Podstawą Rekordu Aktywnego są klasy biznesowe np. klasa <tt>Produkty</tt>, które są bardzo podobne do struktury rekordu należącego do bazy danych. Każdy Rekord Aktywny jest odpowiedzialny za zapisywanie i łądowanie danych do i z bazy danych.</p> @@ -13,18 +13,18 @@ <h2 id="138047">Kiedy używać?</h2> <p id="690479" class="block-content">Rekord Aktywne jest dobrym wyborem dla dziedziny logiki, która nie jest zbyt złożona, tak jak tworzenie, odczyty, aktualizacje oraz usuwanie. - Pochocne (ang. derivations) oraz sprawdzenia bazujące na pojedyńczym rekordzie sprawdzają się dobrze w tej konstrukcji. + Pochocne (ang. derivations) oraz sprawdzenia bazujące na pojedyńczym rekordzie sprawdzają się dobrze w tej konstrukcji. Rekord Aktywne ma podstawową zaletę, którą jest prostota. Łatwo jest stworzyć Rekord Aktywny, łatwo go również zrozuieć. </p> - <p id="690480" class="block-content">Jednakże, jeśli twoja logika biznesowa staje się coraz bardziej złożona, wkrótce będziesz chciał + <p id="690480" class="block-content">Jednakże, jeśli twoja logika biznesowa staje się coraz bardziej złożona, wkrótce będziesz chciał używać bezpośrednich relacji, zbiorów, dziedziczenia twojego obiektu i tak dalej. Nie da się tego łatwo odwzorować za pomocą Rekordu Aktywnego, a dodawanie ich po kawałku staje się bardzo kłopotliwe. Innym argumentem przeciw Rekordowi Aktywnemu jest fakt, że łączy model obiektowy z modelem baz danych. To czyni trudniejszym refaktoring, gdy projekt idzie naprzód. </p> <p id="690481" class="block-content">Alternatywą jest używanie wzorca Data Mapper (mapa danych), który odseparowuje role obiektu biznesowego od tego jak te obiekty są przechowywane. - Prado dostarcza + Prado dostarcza Prado provides a darmowy wybór pomiędzy rekordem aktywnym a <a href="?page=Database.SqlMap">SqlMap Data Mapper</a>. SqlMap Data Mapper może być uzywany do wczytania obiektów Rekordu Aktywnego, i na odwrót, te Rekordy Aktywne mogą zostać użyte do aktualizacji bazy danych. Związek pomiędzy Rekordem Aktywnym a <a href="?page=Database.SqlMap">SqlMap</a> przedstawiony jest na kolejnym diagramie. Więcej informacji związanych z SqlMap Data Mapper można znaleźć w @@ -33,7 +33,7 @@ </p> <p id="690482" class="block-content"> - Klasa Rekordu aktywnego posiada funkcjonalność do przeprowadzenia następujących zadań: + Klasa Rekordu aktywnego posiada funkcjonalność do przeprowadzenia następujących zadań: </p> <ul id="u1" class="block-content"> <li>Tworzenie, zwracanie, aktualizowani i usuwanie recordów (CRUD)</li> @@ -51,16 +51,16 @@ zwróci fałsz, natomiast luźne porównianie (np. używając <tt>==</tt>) zwró <p> Jest to implikacja modelu wynikająca z następującego pytania: <i>"Czy myślisz o kliencie jako o obiekcie, którego któy jest tylko jeden, czy też myślisz o obiekcie na którym działasz jako o <b>kopii</b> bazy danych.</i> -Inne mapowania O/R implikują, że istnieje tylko jeden obiekt Klienta z KlientID 100 +Inne mapowania O/R implikują, że istnieje tylko jeden obiekt Klienta z KlientID 100 Other O/R mappings will imply that there is only one Customer object with custID 100 i to dosłownie jest ten klient. -Jeśli pobierzesz klienta i zmienisz pole w nim, wtedy masz zmienionego tego klienta. +Jeśli pobierzesz klienta i zmienisz pole w nim, wtedy masz zmienionego tego klienta. <i>"To kontroastuje z: zmieniłeś tą kopię klienta ale nie tamtą kopię. Jeśli dwóch ludzi zaktualizuje kleinta z dwóch kopii obiektu, kto zaktualizuje pierwszy lub być może ostanie wygrywa."</i> [A. Hejlsberg 2003] </p> <h2 id="142010">Wspierane bazy danych</h2> <p id="p1" class="block-content"> -Implementacja Aktywnego Rekordu wykorzystuje kalsy <a href="?page=Database.DAO">Prado DAO</a> by uzyskać dostęp do danych. Aktualna implementacja Aktywnego Rekordu wspiera następujace bazy danych +Implementacja Aktywnego Rekordu wykorzystuje kalsy <a href="?page=Database.DAO">Prado DAO</a> by uzyskać dostęp do danych. Aktualna implementacja Aktywnego Rekordu wspiera następujace bazy danych </p> <ul> <li><a href="http://www.mysql.com">MySQL 4.1 i wyższe</a></li> @@ -104,7 +104,7 @@ class UserRecord extends TActiveRecord </p> <p id="690485" class="block-content">Każda kolumna tablicy "<tt>users</tt>" musi posiadać odpowiadającą jej właściwość o tej samej nazwie co kolumna w tablicy w klasie <tt>UserRecord</tt>. Oczywiście, możesz zdefiniować dodatkowe zmienne lub właściwości, które nie istnieją w strukturze tablicy. - Stała <tt>TABLE</tt> jest opcjonalna w klasie , kiedy nazwa klasy jest taka sama jak nazwa tablicy w bazie danych, w przeciwnym przypadku <tt>TABLE</tt> + Stała <tt>TABLE</tt> jest opcjonalna w klasie , kiedy nazwa klasy jest taka sama jak nazwa tablicy w bazie danych, w przeciwnym przypadku <tt>TABLE</tt> musi określać nazwę tablicy, która odpowiada klasie Rekordu Aktywnego. </p> @@ -114,7 +114,7 @@ Możesz określić kwalifikowane (ang. qualified) nazwy tablic np dla MySQL, <tt <p class="block-content" id="ar_as_component"> Odkąd <tt>TActiveRecord</tt> rozszerza <tt>TComponent</tt>, metody setter i getter mogą zostać zdefiniowane - by umożliwić kontrolę nad tym jak zmienne są ustawiane i zwracane. Na przykłąd dodanie właściwości <tt>$level</tt> + by umożliwić kontrolę nad tym jak zmienne są ustawiane i zwracane. Na przykłąd dodanie właściwości <tt>$level</tt> do klasy UserRecord: </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690149"> @@ -130,13 +130,13 @@ class UserRecord extends TActiveRecord { } } </com:TTextHighlighter> -<p id="710010" class="block-content">Więcej szczegółów dotyczących TComponent można znaleźć <a href="?page=Fundamentals.Components">dokumentacji komponentów</a>. +<p id="710010" class="block-content">Więcej szczegółów dotyczących TComponent można znaleźć <a href="?page=Fundamentals.Components1">dokumentacji komponentów</a>. Później użyjemy metod getter/setters by umożliwić opóźnione ładowanie (ang. lazy loading) obiektów relacji. </p> <div class="info"><b class="note">Info:</b> <tt>TActiveRecord</tt> może również działać z widokami poprzez przypisanie do stałej <tt>TABLE</tt> - odpowiedniej nazwy widoku. Jednakże obiektu zwracane przez widoki są tylko do odczytu, wywołanie metod <tt>save()</tt> lub <tt>delete()</tt> + odpowiedniej nazwy widoku. Jednakże obiektu zwracane przez widoki są tylko do odczytu, wywołanie metod <tt>save()</tt> lub <tt>delete()</tt> spowoduje wywołanie wyjątku. </div> @@ -149,7 +149,7 @@ spowoduje wywołanie wyjątku. <h2 id="138049">Ustanawianie połączenia z bazą danych</h2> <p id="690487" class="block-content"> Domyślne połączenie z bazą dla Rekordu Aktywnego może zostać ustawione następujaco. - Zobacz <a href="?page=Database.DAO">Ustanawianie połączenia z bazą</a> + Zobacz <a href="?page=Database.DAO">Ustanawianie połączenia z bazą</a> by uzyskać ogólnie dalsze szczegóły odnośnie tworzenia połączenia z bazą danych. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690150"> @@ -160,7 +160,7 @@ TActiveRecordManager::getInstance()->setDbConnection($conn); </com:TTextHighlighter> <p id="710011" class="block-content">Alternatywnie, możesz stworzyć klasę bazową i nadpisać metodę <tt>getDbConnection()</tt> -do zwracania połączenia z bazą. To jest prosty spodób, by umożliwić wielkokrotne połączenia do wielu baz danych. +do zwracania połączenia z bazą. To jest prosty spodób, by umożliwić wielkokrotne połączenia do wielu baz danych. Następujący kod demonstruje definiowanie połączenia z bazą danych w klasie bazowej (nie ma potrzeby by ustawiać połączenie DB gdziekolwiek indziej). </p> <com:TTextHighlighter Language="php" CssClass="source block-content"> @@ -203,7 +203,7 @@ class MyDb2Record extends TActiveRecord </com:TTextHighlighter> <div class="tip"><b class="note">Wskazówka:</b> Atrybut <tt>EnableCache</tt> gdy ustawiony na "true" będzie keszował metadane tablicy, to oznacza, że nazwy kolumn, indeksy i ograniczenia (ang. constraints) - są zapisywane w keszu i używane ponownie. Musisz wyczyścić lub wyłączyć kesz jeśli chcesz zobaczyć wprowadzone zmiany do definicji twoich tablic. + są zapisywane w keszu i używane ponownie. Musisz wyczyścić lub wyłączyć kesz jeśli chcesz zobaczyć wprowadzone zmiany do definicji twoich tablic. <a href="?page=Advanced.Performance#6402">Moduł keszowania</a> musi być również zdefiniowany dla keszu by zadziałał. </div> </p> @@ -229,14 +229,14 @@ class MyDb2Record extends TActiveRecord <h2 id="138050">Ładowanie danych z tablicy</h2> <p id="690490" class="block-content"> - Klasa <tt>TActiveRecord</tt> dostarcza wielu wygodnych metod do wyszukiwania rekordów z bazy danych. + Klasa <tt>TActiveRecord</tt> dostarcza wielu wygodnych metod do wyszukiwania rekordów z bazy danych. Najprostszym jest znajdowanie jednego rekordu poprzez dopasowanie klucza głównego lub klucza złożonego (ang. composite key) (klucz główny skłądający się z wielu kolumn). Zobacz <com:DocLink ClassPath="System.Data.ActiveRecord.TActiveRecord" /> by dowiedzieć się więcej. </p> <div class="info"><b class="note">Info:</b> -Wszystkie metody wyszukujące, które mogą zwrócić tylko 1 rekord zwrócą <tt>null</tt> jeśli nie znajdą pasujących danych. +Wszystkie metody wyszukujące, które mogą zwrócić tylko 1 rekord zwrócą <tt>null</tt> jeśli nie znajdą pasujących danych. Wszystkie metody wyszukujące, które zwracają tablicę rekordów zwrócą pustą tablicęm jeśli nie znajdą pasujących danych. </div> @@ -352,8 +352,8 @@ Możesz również użyć połączenia <tt>AND</tt> oraz <tt>OR</tt> jako warunek </div> <h3 id="138060"><tt>findBySql()</tt> oraz <tt>findAllBySql()</tt></h3> -<p id="690497" class="block-content">Znajdują rekordy używając pełnego zapytania SQL z tym, że <tt>findBySql()</tt> -zwraca Rekord Aktywny a <tt>findAllBySql()</tt>zwraca tablicę obiektów rekordów. +<p id="690497" class="block-content">Znajdują rekordy używając pełnego zapytania SQL z tym, że <tt>findBySql()</tt> +zwraca Rekord Aktywny a <tt>findAllBySql()</tt>zwraca tablicę obiektów rekordów. Dla każdej zwróconej kolumny, odpowiadająca klasa Rekordu Aktywnego musi posiadać zdefiniowaną zmienną lub właściwość odpowiadającą nazwie kolumny. <com:TTextHighlighter Language="php" CssClass="source block-content"> class UserRecord2 extends UserRecord @@ -382,7 +382,7 @@ $user2 = new UserRecord($data); //stwórz przekazując istniejące dane $user2->save(); //wstaw nowy rekord </com:TTextHighlighter> <div class="tip"><b class="note">Wskazówka:</b> -Obiekty są aktualizowe automatycznie o wartość klucza głównego dla tych tablic, które zawierają definicję +Obiekty są aktualizowe automatycznie o wartość klucza głównego dla tych tablic, które zawierają definicję określającą automatyczne tworzenie klucza głównego dla nowo tworzonych rekordów (przyp. tłum. autoincrement). Na przykład jeśli wstawiasz nowy rekord do tablicy MySQL która posiada kolumnę zdefiniowaną jako to obiekt Rekordu Aktywnego zostanie zaktualizowant o nową zwiększoną wartość.</div> @@ -403,10 +403,10 @@ Obiekt Rekordu Aktywnego posiada prosty cykl życia zilustrowany następujący d <img src=<%~ object_states.png %> alt="Active Records Life Cycle" id="fig:cycle.png" class="figure"/> <p id="690501" class="block-content"> Widzimy, że nowe obiekty Rekordu Aktywnego są tworzone zarówno przez jedną z metod <tt>find*()</tt> -lub poprzez stworzenie nowej instancji poprzez użycie polecenia PHP <tt>new</tt>. Obiekty stworzone przez metodę <tt>find*()</tt> +lub poprzez stworzenie nowej instancji poprzez użycie polecenia PHP <tt>new</tt>. Obiekty stworzone przez metodę <tt>find*()</tt> zaczynają ze stanem <tt>czysty (ang. clean)</tt>. Nowa instancja TActiveRecord stworzona inaczej niż za pomocą metod <tt>find*()</tt> zaczyna ze stanem <tt>nowy (ang. new)</tt>. -Kiedykolwiek wywołasz metodę <tt>save()</tt> na obiekcie TActiveRecord, obiekt przyjmuje stan <tt>czysty</tt>. -Obiekty będące <tt>czystymi</tt> stają się <tt>brudne (ang. dirty)</tt> kiedy jeden lub więcej ze stwoich wewnętrznych stanów ulegnie zmianie. +Kiedykolwiek wywołasz metodę <tt>save()</tt> na obiekcie TActiveRecord, obiekt przyjmuje stan <tt>czysty</tt>. +Obiekty będące <tt>czystymi</tt> stają się <tt>brudne (ang. dirty)</tt> kiedy jeden lub więcej ze stwoich wewnętrznych stanów ulegnie zmianie. Wywoałanie metody <tt>delete()</tt> obiektu kończy cykl życia, żadne inne akcje nie mogą być wywołane na obiekcie. </p> @@ -451,7 +451,7 @@ $finder->deleteBy_Username_And_Password($name,$pass); </com:TTextHighlighter> <h2 id="138053">Tranzakcje</h2> -<p id="690504" class="block-content">Wszystkie obiekkty Rekordu Aktywnego zawierają właściwość <tt>DbConnection</tt>, +<p id="690504" class="block-content">Wszystkie obiekkty Rekordu Aktywnego zawierają właściwość <tt>DbConnection</tt>, która może być używana by uzyskać obiekt tranzakcyjny. <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690165"> $finder = UserRecord::finder(); @@ -486,8 +486,8 @@ Zdarzenie <tt>OnExecuteCommand</tt> jest wywoływane kiedy polecenie jest wykona </p> <h3 id="142016">Przykład z logowaniem</h3> -<p id="710016" class="block-content">Używając <tt>OnExecuteCommand</tt> możemy przypiąć uchwyt zdarzenia by logować całe -zapytanie SQL wwywoływane dla danej instancji lub klasy TActiveRecord. Na przykład definiujemy klasę bazową i nadpisujemy +<p id="710016" class="block-content">Używając <tt>OnExecuteCommand</tt> możemy przypiąć uchwyt zdarzenia by logować całe +zapytanie SQL wwywoływane dla danej instancji lub klasy TActiveRecord. Na przykład definiujemy klasę bazową i nadpisujemy metodę <tt>getDbConnection()</tt> lub konstruktor. </p> @@ -537,12 +537,12 @@ W następnych sekcjach będziemy rozważać nastepujące relacje pomiędzy tabel <img src=<%~ ar_objects.png %> class="figure" /> <p class="block-content"> -Istnieje rozbieżność pomiędzy relacjami w obiektach i relacjami w tablicach. +Istnieje rozbieżność pomiędzy relacjami w obiektach i relacjami w tablicach. Po pierwsze jest różnica w reprezentacji. Obiekty trzymają powiązanie poprzez przechowywanie referencji, które są trzymane poprzez zarządzające pamięcią środowiko uruchomieniowe. Bazy relacyjne trzymają powiązanie poprzez utworzenie klucza do innej tablicy. - Po drugie, obiekty mogą łatwo uzywać kolekcji by trzymać wielokrotnie referencje z jednego pola, -to handle multiple references from a single field, gdyż normalizacja zmusza wszystkie powiązania relacji encji by były pojedyńczymi wartościami. -To prowadzi do odwrócenia struktury danych pomiędzy obiektami i tablicami. + Po drugie, obiekty mogą łatwo uzywać kolekcji by trzymać wielokrotnie referencje z jednego pola, +to handle multiple references from a single field, gdyż normalizacja zmusza wszystkie powiązania relacji encji by były pojedyńczymi wartościami. +To prowadzi do odwrócenia struktury danych pomiędzy obiektami i tablicami. Podejście zastosowane w modelu Rekordu Aktywnego Prado uzywa ograniczeń kluczów obcych tablicy do wyprowadzenia relacji obiektów. To implikuje fakt wspierania ograniczeń kluczów obcych dla bazy danych. </p> @@ -564,8 +564,8 @@ CREATE TABLE bar </com:TTextHighlighter> </div> -<h2 id="142012">Mapowanie kluczów obcych</h2> -<p class="block-content">Relacja pól pomiędzy tablicami <tt>Teams</tt> and <tt>Players</tt> jest znana jako relacja jeden-do-wielu (ang. 1-M). Oznacza to, że jeden Team moze zawierać zero lub więcej Players. Z punktu widzenia relacji obiektów +<h2 id="142012">Mapowanie kluczów obcych</h2> +<p class="block-content">Relacja pól pomiędzy tablicami <tt>Teams</tt> and <tt>Players</tt> jest znana jako relacja jeden-do-wielu (ang. 1-M). Oznacza to, że jeden Team moze zawierać zero lub więcej Players. Z punktu widzenia relacji obiektów powiemy, że obiekt <tt>TeamRecord</tt> <b>posiada wiele</b> (ang. has many) obiektów <tt>PlayerRecord</tt>. (Zauważ odwrócenie kierunku relacji pomiędzy tablicami a obiektami) </p> @@ -1074,7 +1074,7 @@ class PlayerRecord extends BaseFkRecord <p id="710046" class="block-content">We first need to change the <tt>$skills=array()</tt> declaration to a private property <tt>$_skills</tt> (notice the underscore) and set it to null instead. This allows us to define the <tt>skills</tt> property using getter/setter methods -(see <a href="?page=Fundamentals.Components">Components</a> for details). The <tt>getSkills()</tt> +(see <a href="?page=Fundamentals.Components1">Components</a> for details). The <tt>getSkills()</tt> getter method for the <tt>skills</tt> property will lazy load the corresponding skills foreign record when it is used as follows. Notice that we only do a lazy load when its <tt>$player_id</tt> is not null (that is, when the record is already fetched from the database or player id was already set). diff --git a/demos/quickstart/protected/pages/Fundamentals/Applications.page b/demos/quickstart/protected/pages/Fundamentals/Applications.page index 8e0b9e9a..71901170 100755 --- a/demos/quickstart/protected/pages/Fundamentals/Applications.page +++ b/demos/quickstart/protected/pages/Fundamentals/Applications.page @@ -7,7 +7,11 @@ An application is an instance of <tt>TApplication</tt> or its derived class. It <p id="160158" class="block-content">
Applications are configured via <a href="?page=Configurations.AppConfig">application configurations</a>. They are usually created in entry scripts like the following,
<com:TTextHighlighter CssClass="source block-content" id="code_160071">
+// load the prado entry script
require_once('/path/to/prado.php');
+// or, if using composer:
+require_once('vendor/autoload.php');
+
$application = new TApplication;
$application->run();
</com:TTextHighlighter>
diff --git a/demos/quickstart/protected/pages/Fundamentals/Architecture.page b/demos/quickstart/protected/pages/Fundamentals/Architecture.page index 10f16c3f..c6bee7de 100755 --- a/demos/quickstart/protected/pages/Fundamentals/Architecture.page +++ b/demos/quickstart/protected/pages/Fundamentals/Architecture.page @@ -2,12 +2,31 @@ <h1 id="601">Architecture</h1>
<p id="100111" class="block-content">
-PRADO is primarily a presentational framework, although it is not limited to be so. The framework focuses on making Web programming, which deals most of the time with user interactions, to be component-based and event-driven so that developers can be more productive. The following class tree depicts some of the major classes provided by PRADO,
+PRADO is primarily a presentational framework, although it is not limited to be so. The framework focuses on making Web programming, which deals most of the time with user interactions, to be component-based and event-driven so that developers can be more productive. The following class tree depicts some of the major classes provided by PRADO:
</p>
<img src="<%~classtree.gif%>" />
<p id="100112" class="block-content">
-When a PRADO application is processing a page request, its static object diagram can be shown as follows,
+When a PRADO application is processing a page request, its static object diagram can be shown as follows:
</p>
<img src="<%~objectdiagram.gif%>" />
-</com:TContent>
+
+<p class="block-content">
+Once the main <tt>Application</tt> object gets created, it load the <a href="?page=Configurations.AppConfig">application configuration</a>.
+The minimal configuration defines a set of basic <a href="?page=Fundamentals.Modules">modules</a> to parse the <tt>Request</tt>, create a proper <tt>Response</tt>, mantain the user <tt>Session</tt>, handle any <tt>Error</tt> and publish the needed <tt>Assets</tt> (images, css, javascript, etc). These helpers module will be available from anywhere inside the application code.
+<br/>
+Additionally, any 3rd-party or <tt>custom module</tt> can be loaded, and external <tt>Parameters</tt> can be loaded from external configurations.
+</p>
+
+<p class="block-content">
+Once the basic infrastructure has been set up, the <tt>Request</tt> module parses the request trying to identify the requested route. Different routes can be handled by different services, but the default route for http requests is the <tt>Page Service</tt>.
+<br/>
+The <a href="?page=Configurations.AppConfig">Page Service</a>'s role is to instanciate the requested <tt>Page</tt>, run it, apply any defined <tt>Theme</tt> and grab the result in order to build the <tt>Response</tt>.
+</p>
+
+<p class="block-content">
+A <a href="?page=Fundamentals.Pages">Page</a> can be a simple script (.php), a <tt>Template</tt> (.page), or both. PRADO uses a very powerful <a href="?page=Configurations.Templates1">template engine</a> where <tt>Controls</tt> can be instanciated directly.
+<br/>
+A <a href="?page=Fundamentals.Controls">Control</a> is an self-contained widget that fullfills a specific task; they can be a simple script (.php), a <tt>Template</tt> (.page), or both.
+</p>
+</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Components.page b/demos/quickstart/protected/pages/Fundamentals/Components.page deleted file mode 100755 index 11235b56..00000000 --- a/demos/quickstart/protected/pages/Fundamentals/Components.page +++ /dev/null @@ -1,360 +0,0 @@ -<com:TContent ID="body" >
-<h1 id="701">Components</h1>
-<p id="110113" class="block-content">
-A component is an instance of <tt>TComponent</tt> or its child class. The base class <tt>TComponent</tt> implements the mechanism of component properties and events.
-</p>
-
-<h2 id="702">Component Properties</h2>
-<p id="110114" class="block-content">
-A component property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method in the component class. For example, in <tt>TControl</tt>, we define its <tt>ID</tt> property using the following getter and setter methods,
-<com:TTextHighlighter CssClass="source block-content" id="code_110056">
-class TControl extends TComponent {
- public function getID() {
- ...
- }
- public function setID($value) {
- ...
- }
-}
-</com:TTextHighlighter>
-</p>
-<p id="110115" class="block-content">
-To get or set the <tt>ID</tt> property, do as follows, just like working with a variable,
-<com:TTextHighlighter CssClass="source block-content" id="code_110057">
-$id = $component->ID;
-$component->ID = $id;
-</com:TTextHighlighter>
-This is equivalent to the following,
-<com:TTextHighlighter CssClass="source block-content" id="code_110058">
-$id = $component->getID();
-$component->setID( $id );
-</com:TTextHighlighter>
-</p>
-<p id="110116" class="block-content">
-A property is read-only if it has a getter method but no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. A component class inherits all its ancestor classes' properties.
-</p>
-
-<h3 id="706">Subproperties</h3>
-<p id="110117" class="block-content">
-A subproperty is a property of some object-typed property. For example, <tt>TWebControl</tt> has a <tt>Font</tt> property which is of <tt>TFont</tt> type. Then the <tt>Name</tt> property of <tt>Font</tt> is referred to as a subproperty (with respect to <tt>TWebControl</tt>).
-</p>
-<p id="110118" class="block-content">
-To get or set the <tt>Name</tt> subproperty, use the following method,
-<com:TTextHighlighter CssClass="source block-content" id="code_110059">
-$name = $component->getSubProperty('Font.Name');
-$component->setSubProperty('Font.Name', $name);
-</com:TTextHighlighter>
-This is equivalent to the following,
-<com:TTextHighlighter CssClass="source block-content" id="code_110060">
-$name = $component->getFont()->getName();
-$component->getFont()->setName( $name );
-</com:TTextHighlighter>
-</p>
-
-<h3 id="26001">Js-friendly properties</h3>
-<p class="block-content">
-A JavaScript-friendly property is a property that can accept both simple strings and raw javascript.
-Prado automatically encodes all properties sent clientside inside javascript blocks to avoid security problems (like injections or cross site scripting).
-If a property is known to always contain only safe javascript code and its value needs to bypass this encoding, that property can be defined in a special way that will make Prado mark its value as "safe".
-Js-friendly properties are identified by their name starting with 'js' (case insensitive):
-<com:TTextHighlighter CssClass="source block-content">
-// getter, defines a readable property 'Text'
-function getJsText() { … }
-// setter, defines a writable property 'Text', with $value being the value to be set to the property
-function setJsText(TJavaScriptLiteral $value) { … }
-</com:TTextHighlighter>
-Js-friendly properties can be accessed using both their Js-less name and their Js-enabled name:
-<com:TTextHighlighter CssClass="source block-content">
-// set some simple text as property value
-$component->Text = 'text';
-// set some javascript code as property value
-$component->JsText = 'raw javascript';
-</com:TTextHighlighter>
-In the first case, the property value will automatically gets encoded when sent clientside inside a javascript block.
-In the second case, the property will be 'marked' as being a safe javascript statement and will not be encoded when rendered inside a javascript block.
-This special handling makes use of the <tt>TJavaScriptLiteral</tt> class.
-</p>
-
-
-<h2 id="703">Component Events</h2>
-<p id="110119" class="block-content">
-Component events are special properties that take method names as their values. Attaching (setting) a method to an event will hook up the method to the places at which the event is raised. Therefore, the behavior of a component can be modified in a way that may not be foreseen during the development of the component.
-</p>
-<p id="110120" class="block-content">
-A component event is defined by the existence of a method whose name starts with the word <tt>on</tt>. The event name is the method name and is thus case-insensitve. For example, in <tt>TButton</tt>, we have
-<com:TTextHighlighter CssClass="source block-content" id="code_110061">
-class TButton extends TWebControl {
- public function onClick( $param ) {
- ...
- }
-}
-</com:TTextHighlighter>
-This defines an event named <tt>OnClick</tt>, and a handler can be attached to the event using one of the following ways,
-<com:TTextHighlighter CssClass="source block-content" id="code_110062">
-$button->OnClick = $callback;
-$button->OnClick->add( $callback );
-$button->OnClick[] = $callback;
-$button->attachEventHandler( 'OnClick' , $callback );
-</com:TTextHighlighter>
-</p>
- The variable <tt>$callback</tt> contains the definition of the event handler that can be either a string referring to a global function name, or an array whose first element refers to an object and second element a method name/path that is reachable by the object, e.g.
- </p>
-<ul>
-<li>'buttonClicked' : buttonClicked($sender,$param);</li>
-<li>array($object,'buttonClicked') : $object->buttonClicked($sender,$param);</li>
-<li>array($object,'MainContent.SubmitButton.buttonClicked') : $object->MainContent->SubmitButton->buttonClicked($sender,$param);</li>
-</ul>
-<com:SinceVersion Version="3.2.3" />
-<h2 id="26001">Global events</h2>
-<p id="130001" class="block-content">
-With the addition of behaviors, a more expansive event model is needed. There
-are two new event types (global and dynamic events) as well as a more comprehensive
-behavior model that includes class wide behaviors.
-</p>
-<p id="130002" class="block-content">
-A global event is defined by all events whose name starts with 'fx'.
-The event name is potentially a method name and is thus case-insensitive. All 'fx' events
-are valid as the whole 'fx' event/method space is global in nature. Any object may patch into
-any global event by defining that event as a method. Global events have priorities
-just like 'on' events; so as to be able to order the event execution. Due to the
-nature of all events which start with 'fx' being valid, in effect, every object
-has every 'fx' global event. It is simply an issue of tapping into the desired
-global event.
-</p>
-<p id="130003" class="block-content">
-A global event that starts with 'fx' can be called even if the object does not
-implement the method of the global event. A call to a non-existing 'fx' method
-will, at minimal, function and return null. If a method argument list has a first
-parameter, it will be returned instead of null. This allows filtering and chaining.
-'fx' methods do not automatically install and uninstall. To install and uninstall an
-object's global event listeners, call the object's <tt>listen</tt> and
-<tt>unlisten</tt> methods, respectively. An object may auto-install its global event
-during <tt>__construct</tt> by overriding <tt>getAutoGlobalListen</tt> and returning true.
-</p>
-<p id="130004" class="block-content">
-As of PHP version 5.3, nulled objects without code references will still continue to persist
-in the global event queue because <tt>__destruct</tt> is not automatically called. In the common
-__destruct method, if an object is listening to global events, then <tt>unlisten</tt> is called.
-<tt>unlisten</tt> is required to be manually called before an object is
-left without references if it is currently listening to any global events. This includes
-class wide behaviors.
-</p>
-<p id="130005" class="block-content">
-An object that contains a method that starts with 'fx' will have those functions
-automatically receive those events of the same name after <tt>listen</tt> is called on the object.
-</p>
-<p id="130006" class="block-content">
-An object may listen to a global event without defining an 'fx' method of the same name by
-adding an object method to the global event list. For example
-</p>
-<com:TTextHighlighter CssClass="source block-content">
-$component->fxGlobalCheck=$callback; // or $component->OnClick->add($callback);
-$component->attachEventHandler('fxGlobalCheck',array($object, 'someMethod'));
-</com:TTextHighlighter>
-<h2 id="26002">Events between Objects and their behaviors, Dynamic Events</h2>
-<p id="130007" class="block-content">
-An intra-object/behavior event is defined by methods that start with 'dy'. Just as with
-'fx' global events, every object has every dynamic event. Any call to a method that
-starts with 'dy' will be handled, regardless of whether it is implemented. These
-events are for communicating with attached behaviors.
-</p>
-<p id="130008" class="block-content">
-Dynamic events can be used in a variety of ways. They can be used to tell behaviors
-when a non-behavior method is called. Dynamic events could be used as data filters.
-They could also be used to specify when a piece of code is to be run, eg. should the
-loop process be performed on a particular piece of data. In this way, some control
-is handed to the behaviors over the process and/or data.
-</p>
-<p id="130009" class="block-content">
-If there are no handlers for an 'fx' or 'dy' event, it will return the first
-parameter of the argument list. If there are no arguments, these events
-will return null. If there are handlers an 'fx' method will be called directly
-within the object. Global 'fx' events are triggered by calling <tt>raiseEvent</tt>.
-For dynamic events where there are behaviors that respond to the dynamic events, a
-<tt>TCallChain</tt> is developed. A call chain allows the behavior dynamic event
-implementations to call further implementing behaviors within a chain.
-</p>
-<p id="130010" class="block-content">
-If an object implements <tt>IDynamicMethods</tt>, all global and object dynamic
-events will be sent to <tt>__dycall</tt>. In the case of global events, all
-global events will trigger this method. In the case of behaviors, all undefined
-dynamic events which are called will be passed through to this method.
-</p>
-<p id="130011" class="block-content">
-<h2 id="26003">Behaviors</h2>
-<p id="130012" class="block-content">
-There are two types of behaviors. There are individual object behaviors and
-there are class wide behaviors. Class behaviors depend upon object behaviors.
-</p>
-<p id="130013" class="block-content">
-When a new class implements <tt>IBehavior</tt> or <tt>IClassBehavior</tt> or
-extends <tt>TBehavior</tt> or <tt>TClassBehavior</tt>, it may be added to an
-object by calling the object's <tt>attachBehavior</tt>. The behaviors associated
-name can then be used to <tt>enableBehavior</tt> or <tt>disableBehavior</tt>
-the specific behavior.
-</p>
-<p id="130014" class="block-content">
-All behaviors may be turned on and off via <tt>enableBehaviors</tt> and
-<tt>disableBehaviors</tt>, respectively. To check if behaviors are on or off
-a call to <tt>getBehaviorsEnabled</tt> will provide the variable.
-</p>
-<p id="130015" class="block-content">
-Attaching and detaching whole sets of behaviors is done using
-<tt>attachBehaviors</tt> and <tt>detachBehaviors</tt>. <tt>clearBehaviors</tt>
-removes all of an object's behaviors.
-</p>
-<p id="130016" class="block-content">
-<tt>asa</tt> returns a behavior of a specific name. <tt>isa</tt> is the
-behavior inclusive function that acts as the PHP operator <tt>instanceof</tt>.
-A behavior could provide the functionality of a specific class thus causing
-the host object to act similarly to a completely different class. A behavior
-would then implement <tt>IInstanceCheck</tt> to provide the identity of the
-different class.
-</p>
-<p id="130017" class="block-content">
-Class behaviors are similar to object behaviors except that the class behavior
-is the implementation for all instances of the class. A class behavior
-will have the object upon which is being called be prepended to the parameter
-list. This way the object is known across the class behavior implementation.
-</p>
-<p id="130018" class="block-content">
-Class behaviors are attached using <tt>attachClassBehavior</tt> and detached
-using <tt>detachClassBehavior</tt>. Class behaviors are important in that
-they will be applied to all new instances of a particular class. In this way
-class behaviors become default behaviors to a new instances of a class in
-<tt>__construct</tt>. Detaching a class behavior will remove the behavior
-from the default set of behaviors created for an object when the object
-is instanced.
-</p>
-<p id="130019" class="block-content">
-Class behaviors are also added to all existing instances via the global 'fx'
-event mechanism. When a new class behavior is added, the event
-<tt>fxAttachClassBehavior</tt> is raised and all existing instances that are
-listening to this global event (primarily after <tt>listen</tt> is called)
-will have this new behavior attached. A similar process is used when
-detaching class behaviors. Any objects listening to the global 'fx' event
-<tt>fxDetachClassBehavior</tt> will have a class behavior removed.
-</p>
-<h2 id="26004">Dynamic Intra-Object Events</h2>
-<p id="130020" class="block-content">
-Dynamic events start with 'dy'. This mechanism is used to allow objects
-to communicate with their behaviors directly. The entire 'dy' event space
-is valid. All attached, enabled behaviors that implement a dynamic event
-are called when the host object calls the dynamic event. If there is no
-implementation or behaviors, this returns null when no parameters are
-supplied and will return the first parameter when there is at least one
-parameter in the dynamic event.
-</p>
-<com:TTextHighlighter CssClass="source block-content">
- null == $this->dyBehaviorEvent();
- 5 == $this->dyBehaviorEvent(5); //when no behaviors implement this dynamic event
-</com:TTextHighlighter>
-<p id="130021" class="block-content">
-Dynamic events can be chained together within behaviors to allow for data
-filtering. Dynamic events are implemented within behaviors by defining the
-event as a method.
-</p>
-<com:TTextHighlighter CssClass="source block-content">
-class TObjectBehavior extends TBehavior {
- public function dyBehaviorEvent($param1, $callchain) {
- //Do something, eg: $param1 += 13;
- return $callchain->dyBehaviorEvent($param1);
- }
-}
-</com:TTextHighlighter>
-<p id="130022" class="block-content">
-This implementation of a behavior and dynamic event will flow through to the
-next behavior implementing the dynamic event. The first parameter is always
-return when it is supplied. Otherwise a dynamic event returns null.
-</p>
-<p id="130023" class="block-content">
-In the case of a class behavior, the object is also prepended to the dynamic
-event.
-</p>
-<com:TTextHighlighter CssClass="source block-content">
-class TObjectClassBehavior extends TClassBehavior {
- public function dyBehaviorEvent($hostobject, $param1, $callchain) {
- //Do something, eg: $param1 += $hostobject->getNumber();
- return $callchain->dyBehaviorEvent($param1);
- }
-}
-</com:TTextHighlighter>
-</p>
-<p id="130024" class="block-content">
-When calling a dynamic event, only the parameters are passed. The host object
-and the call chain are built into the framework.
-</p>
-
-<h2 id="26005">Global Event and Dynamic event catching</h2>
-
-<p id="130025" class="block-content">
-Given that all global 'fx' events and dynamic 'dy' events are valid and
-operational, there is a mechanism for catching events called that are not
-implemented (similar to the built-in PHP method <tt>__call</tt>). When
-a dynamic or global event is called but a behavior does not implement it,
-yet desires to know when an undefined dynamic event is run, the behavior
-implements the interface <tt>IDynamicMethods</tt> and method <tt>__dycall</tt>.
-</p>
-<p id="130026" class="block-content">
-In the case of dynamic events, <tt>__dycall</tt> is supplied with the method
-name and its parameters. When a global event is raised, via <tt>raiseEvent</tt>,
-the method is the event name and the parameters are supplied.
-</p>
-<p id="130027" class="block-content">
-When implemented, this catch-all mechanism is called for event global event event
-when implemented outside of a behavior. Within a behavior, it will also be called
-when the object to which the behavior is attached calls any unimplemented dynamic
-event. This is the fall-back mechanism for informing a class and/or behavior
-of when an global and/or undefined dynamic event is executed.
-</p>
-
-<h2 id="704">Namespaces</h2>
-<p id="110121" class="block-content">
-A namespace refers to a logical grouping of some class names so that they can be differentiated from other class names even if their names are the same. Since PHP does not support namespace intrinsically, you cannot create instances of two classes who have the same name but with different definitions. To differentiate from user defined classes, all PRADO classes are prefixed with a letter 'T' (meaning 'Type'). Users are advised not to name their classes like this. Instead, they may prefix their class names with any other letter(s).
-</p>
-<p id="110122" class="block-content">
-A namespace in PRADO is considered as a directory containing one or several class files. A class may be specified without ambiguity using such a namespace followed by the class name. Each namespace in PRADO is specified in the following format,
-<div class="source">
-PathAlias.Dir1.Dir2
-</div>
-where <tt>PathAlias</tt> is an alias of some directory, while <tt>Dir1</tt> and <tt>Dir2</tt> are subdirectories under that directory. A class named <tt>MyClass</tt> defined under <tt>Dir2</tt> may now be fully qualified as <tt>PathAlias.Dir1.Dir2.MyClass</tt>.
-</p>
-<p id="110123" class="block-content">
-To use a namespace in code, do as follows,
-<com:TTextHighlighter CssClass="source block-content" id="code_110063">
-Prado::using('PathAlias.Dir1.Dir2.*');
-</com:TTextHighlighter>
-which appends the directory referred to by <tt>PathAlias.Dir1.Dir2</tt> into PHP include path so that classes defined under that directory may be instantiated without the namespace prefix. You may also include an individual class definition by
-<com:TTextHighlighter CssClass="source block-content" id="code_110064">
-Prado::using('PathAlias.Dir1.Dir2.MyClass');
-</com:TTextHighlighter>
-which will include the class file if <tt>MyClass</tt> is not defined.
-</p>
-<p id="110124" class="block-content">
-For more details about defining path aliases, see <a href="?page=Configurations.AppConfig">application configuration</a> section.
-</p>
-
-<h2 id="705">Component Instantiation</h2>
-<p id="110125" class="block-content">
-Component instantiation means creating instances of component classes. There are two types of component instantation: static instantiation and dynamic instantiation. The created components are called static components and dynamic components, respectively.
-</p>
-
-<h3 id="707">Dynamic Component Instantiation</h3>
-<p id="110126" class="block-content">
-Dynamic component instantiation means creating component instances in PHP code. It is the same as the commonly referred object creation in PHP. A component can be dynamically created using one of the following two methods in PHP,
-<com:TTextHighlighter CssClass="source block-content" id="code_110065">
-$component = new ComponentClassName;
-$component = Prado::createComponent('ComponentType');
-</com:TTextHighlighter>
-where <tt>ComponentType</tt> refers to a class name or a type name in namespace format (e.g. <tt>System.Web.UI.TControl</tt>). The second approach is introduced to compensate for the lack of namespace support in PHP.
-</p>
-
-<h3 id="708">Static Component Instantiation</h3>
-<p id="110127" class="block-content">
-Static component instantiation is about creating components via <a href="?page=Configurations.Overview">configurations</a>. The actual creation work is done by the PRADO framework. For example, in an <a href="?page=Configurations.AppConfig">application configuration</a>, one can configure a module to be loaded when the application runs. The module is thus a static component created by the framework. Static component instantiation is more commonly used in <a href="?page=Configurations.Templates1">templates</a>. Every component tag in a template specifies a component that will be automatically created by the framework when the template is loaded. For example, in a page template, the following tag will lead to the creation of a <tt>TButton</tt> component on the page,
-<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_110066">
-<com:TButton Text="Register" />
-</com:TTextHighlighter>
-</p>
-
-</com:TContent>
diff --git a/demos/quickstart/protected/pages/Fundamentals/Components1.page b/demos/quickstart/protected/pages/Fundamentals/Components1.page new file mode 100755 index 00000000..a610045d --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Components1.page @@ -0,0 +1,157 @@ +<com:TContent ID="body" > +<h1 id="701">Components: Part I</h1> +<p id="110113" class="block-content"> +A component is an instance of <tt>TComponent</tt> or its child class. The base class <tt>TComponent</tt> implements the mechanism of component properties and events. +</p> + +<h2 id="702">Component Properties</h2> +<p id="110114" class="block-content"> +A component property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method in the component class. For example, in <tt>TControl</tt>, we define its <tt>ID</tt> property using the following getter and setter methods, +<com:TTextHighlighter CssClass="source block-content" id="code_110056"> +class TControl extends TComponent { + public function getID() { + ... + } + public function setID($value) { + ... + } +} +</com:TTextHighlighter> +</p> +<p id="110115" class="block-content"> +To get or set the <tt>ID</tt> property, do as follows, just like working with a variable, +<com:TTextHighlighter CssClass="source block-content" id="code_110057"> +$id = $component->ID; +$component->ID = $id; +</com:TTextHighlighter> +This is equivalent to the following, +<com:TTextHighlighter CssClass="source block-content" id="code_110058"> +$id = $component->getID(); +$component->setID( $id ); +</com:TTextHighlighter> +</p> +<p id="110116" class="block-content"> +A property is read-only if it has a getter method but no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. A component class inherits all its ancestor classes' properties. +</p> + +<h3 id="706">Subproperties</h3> +<p id="110117" class="block-content"> +A subproperty is a property of some object-typed property. For example, <tt>TWebControl</tt> has a <tt>Font</tt> property which is of <tt>TFont</tt> type. Then the <tt>Name</tt> property of <tt>Font</tt> is referred to as a subproperty (with respect to <tt>TWebControl</tt>). +</p> +<p id="110118" class="block-content"> +To get or set the <tt>Name</tt> subproperty, use the following method, +<com:TTextHighlighter CssClass="source block-content" id="code_110059"> +$name = $component->getSubProperty('Font.Name'); +$component->setSubProperty('Font.Name', $name); +</com:TTextHighlighter> +This is equivalent to the following, +<com:TTextHighlighter CssClass="source block-content" id="code_110060"> +$name = $component->getFont()->getName(); +$component->getFont()->setName( $name ); +</com:TTextHighlighter> +</p> + +<h3 id="26001">Js-friendly properties</h3> +<p class="block-content"> +A JavaScript-friendly property is a property that can accept both simple strings and raw javascript. +Prado automatically encodes all properties sent clientside inside javascript blocks to avoid security problems (like injections or cross site scripting). +If a property is known to always contain only safe javascript code and its value needs to bypass this encoding, that property can be defined in a special way that will make Prado mark its value as "safe". +Js-friendly properties are identified by their name starting with 'js' (case insensitive): +<com:TTextHighlighter CssClass="source block-content"> +// getter, defines a readable property 'Text' +function getJsText() { … } +// setter, defines a writable property 'Text', with $value being the value to be set to the property +function setJsText(TJavaScriptLiteral $value) { … } +</com:TTextHighlighter> +Js-friendly properties can be accessed using both their Js-less name and their Js-enabled name: +<com:TTextHighlighter CssClass="source block-content"> +// set some simple text as property value +$component->Text = 'text'; +// set some javascript code as property value +$component->JsText = 'raw javascript'; +</com:TTextHighlighter> +In the first case, the property value will automatically gets encoded when sent clientside inside a javascript block. +In the second case, the property will be 'marked' as being a safe javascript statement and will not be encoded when rendered inside a javascript block. +This special handling makes use of the <tt>TJavaScriptLiteral</tt> class. +</p> + + +<h2 id="703">Component Events</h2> +<p id="110119" class="block-content"> +Component events are special properties that take method names as their values. Attaching (setting) a method to an event will hook up the method to the places at which the event is raised. Therefore, the behavior of a component can be modified in a way that may not be foreseen during the development of the component. +</p> +<p id="110120" class="block-content"> +A component event is defined by the existence of a method whose name starts with the word <tt>on</tt>. The event name is the method name and is thus case-insensitve. For example, in <tt>TButton</tt>, we have +<com:TTextHighlighter CssClass="source block-content" id="code_110061"> +class TButton extends TWebControl { + public function onClick( $param ) { + ... + } +} +</com:TTextHighlighter> +This defines an event named <tt>OnClick</tt>, and a handler can be attached to the event using one of the following ways, +<com:TTextHighlighter CssClass="source block-content" id="code_110062"> +$button->OnClick = $callback; +$button->OnClick->add( $callback ); +$button->OnClick[] = $callback; +$button->attachEventHandler( 'OnClick' , $callback ); +</com:TTextHighlighter> +</p> + The variable <tt>$callback</tt> contains the definition of the event handler that can be either a string referring to a global function name, or an array whose first element refers to an object and second element a method name/path that is reachable by the object, e.g. + </p> +<ul> +<li>'buttonClicked' : buttonClicked($sender,$param);</li> +<li>array($object,'buttonClicked') : $object->buttonClicked($sender,$param);</li> +<li>array($object,'MainContent.SubmitButton.buttonClicked') : $object->MainContent->SubmitButton->buttonClicked($sender,$param);</li> +</ul> + +<h2 id="704">Namespaces</h2> +<p id="110121" class="block-content"> +A namespace refers to a logical grouping of some class names so that they can be differentiated from other class names even if their names are the same. Since PHP does not support namespace intrinsically, you cannot create instances of two classes who have the same name but with different definitions. To differentiate from user defined classes, all PRADO classes are prefixed with a letter 'T' (meaning 'Type'). Users are advised not to name their classes like this. Instead, they may prefix their class names with any other letter(s). +</p> +<p id="110122" class="block-content"> +A namespace in PRADO is considered as a directory containing one or several class files. A class may be specified without ambiguity using such a namespace followed by the class name. Each namespace in PRADO is specified in the following format, +<div class="source"> +PathAlias.Dir1.Dir2 +</div> +where <tt>PathAlias</tt> is an alias of some directory, while <tt>Dir1</tt> and <tt>Dir2</tt> are subdirectories under that directory. A class named <tt>MyClass</tt> defined under <tt>Dir2</tt> may now be fully qualified as <tt>PathAlias.Dir1.Dir2.MyClass</tt>. +</p> +<p id="110123" class="block-content"> +To use a namespace in code, do as follows, +<com:TTextHighlighter CssClass="source block-content" id="code_110063"> +Prado::using('PathAlias.Dir1.Dir2.*'); +</com:TTextHighlighter> +which appends the directory referred to by <tt>PathAlias.Dir1.Dir2</tt> into PHP include path so that classes defined under that directory may be instantiated without the namespace prefix. You may also include an individual class definition by +<com:TTextHighlighter CssClass="source block-content" id="code_110064"> +Prado::using('PathAlias.Dir1.Dir2.MyClass'); +</com:TTextHighlighter> +which will include the class file if <tt>MyClass</tt> is not defined. +</p> +<p id="110124" class="block-content"> +For more details about defining path aliases, see <a href="?page=Configurations.AppConfig">application configuration</a> section. +</p> + +<h2 id="705">Component Instantiation</h2> +<p id="110125" class="block-content"> +Component instantiation means creating instances of component classes. There are two types of component instantation: static instantiation and dynamic instantiation. The created components are called static components and dynamic components, respectively. +</p> + +<h3 id="707">Dynamic Component Instantiation</h3> +<p id="110126" class="block-content"> +Dynamic component instantiation means creating component instances in PHP code. It is the same as the commonly referred object creation in PHP. A component can be dynamically created using one of the following two methods in PHP, +<com:TTextHighlighter CssClass="source block-content" id="code_110065"> +$component = new ComponentClassName; +$component = Prado::createComponent('ComponentType'); +</com:TTextHighlighter> +where <tt>ComponentType</tt> refers to a class name or a type name in namespace format (e.g. <tt>System.Web.UI.TControl</tt>). The second approach is introduced to compensate for the lack of namespace support in PHP. +</p> + +<h3 id="708">Static Component Instantiation</h3> +<p id="110127" class="block-content"> +Static component instantiation is about creating components via <a href="?page=Configurations.Overview">configurations</a>. The actual creation work is done by the PRADO framework. For example, in an <a href="?page=Configurations.AppConfig">application configuration</a>, one can configure a module to be loaded when the application runs. The module is thus a static component created by the framework. Static component instantiation is more commonly used in <a href="?page=Configurations.Templates1">templates</a>. Every component tag in a template specifies a component that will be automatically created by the framework when the template is loaded. For example, in a page template, the following tag will lead to the creation of a <tt>TButton</tt> component on the page, +<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_110066"> +<com:TButton Text="Register" /> +</com:TTextHighlighter> +</p> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/Fundamentals/Components2.page b/demos/quickstart/protected/pages/Fundamentals/Components2.page new file mode 100644 index 00000000..7fc3e010 --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Components2.page @@ -0,0 +1,207 @@ +<com:TContent ID="body" > +<h1 id="701">Components: Part II</h1> +<com:SinceVersion Version="3.2.3" /> +<h2 id="26001">Global events</h2> +<p id="130001" class="block-content"> +With the addition of behaviors, a more expansive event model is needed. There +are two new event types (global and dynamic events) as well as a more comprehensive +behavior model that includes class wide behaviors. +</p> +<p id="130002" class="block-content"> +A global event is defined by all events whose name starts with 'fx'. +The event name is potentially a method name and is thus case-insensitive. All 'fx' events +are valid as the whole 'fx' event/method space is global in nature. Any object may patch into +any global event by defining that event as a method. Global events have priorities +just like 'on' events; so as to be able to order the event execution. Due to the +nature of all events which start with 'fx' being valid, in effect, every object +has every 'fx' global event. It is simply an issue of tapping into the desired +global event. +</p> +<p id="130003" class="block-content"> +A global event that starts with 'fx' can be called even if the object does not +implement the method of the global event. A call to a non-existing 'fx' method +will, at minimal, function and return null. If a method argument list has a first +parameter, it will be returned instead of null. This allows filtering and chaining. +'fx' methods do not automatically install and uninstall. To install and uninstall an +object's global event listeners, call the object's <tt>listen</tt> and +<tt>unlisten</tt> methods, respectively. An object may auto-install its global event +during <tt>__construct</tt> by overriding <tt>getAutoGlobalListen</tt> and returning true. +</p> +<p id="130004" class="block-content"> +As of PHP version 5.3, nulled objects without code references will still continue to persist +in the global event queue because <tt>__destruct</tt> is not automatically called. In the common +__destruct method, if an object is listening to global events, then <tt>unlisten</tt> is called. +<tt>unlisten</tt> is required to be manually called before an object is +left without references if it is currently listening to any global events. This includes +class wide behaviors. +</p> +<p id="130005" class="block-content"> +An object that contains a method that starts with 'fx' will have those functions +automatically receive those events of the same name after <tt>listen</tt> is called on the object. +</p> +<p id="130006" class="block-content"> +An object may listen to a global event without defining an 'fx' method of the same name by +adding an object method to the global event list. For example +</p> +<com:TTextHighlighter CssClass="source block-content"> +$component->fxGlobalCheck=$callback; // or $component->OnClick->add($callback); +$component->attachEventHandler('fxGlobalCheck',array($object, 'someMethod')); +</com:TTextHighlighter> +<h2 id="26002">Events between Objects and their behaviors, Dynamic Events</h2> +<p id="130007" class="block-content"> +An intra-object/behavior event is defined by methods that start with 'dy'. Just as with +'fx' global events, every object has every dynamic event. Any call to a method that +starts with 'dy' will be handled, regardless of whether it is implemented. These +events are for communicating with attached behaviors. +</p> +<p id="130008" class="block-content"> +Dynamic events can be used in a variety of ways. They can be used to tell behaviors +when a non-behavior method is called. Dynamic events could be used as data filters. +They could also be used to specify when a piece of code is to be run, eg. should the +loop process be performed on a particular piece of data. In this way, some control +is handed to the behaviors over the process and/or data. +</p> +<p id="130009" class="block-content"> +If there are no handlers for an 'fx' or 'dy' event, it will return the first +parameter of the argument list. If there are no arguments, these events +will return null. If there are handlers an 'fx' method will be called directly +within the object. Global 'fx' events are triggered by calling <tt>raiseEvent</tt>. +For dynamic events where there are behaviors that respond to the dynamic events, a +<tt>TCallChain</tt> is developed. A call chain allows the behavior dynamic event +implementations to call further implementing behaviors within a chain. +</p> +<p id="130010" class="block-content"> +If an object implements <tt>IDynamicMethods</tt>, all global and object dynamic +events will be sent to <tt>__dycall</tt>. In the case of global events, all +global events will trigger this method. In the case of behaviors, all undefined +dynamic events which are called will be passed through to this method. +</p> +<p id="130011" class="block-content"> +<h2 id="26003">Behaviors</h2> +<p id="130012" class="block-content"> +There are two types of behaviors. There are individual object behaviors and +there are class wide behaviors. Class behaviors depend upon object behaviors. +</p> +<p id="130013" class="block-content"> +When a new class implements <tt>IBehavior</tt> or <tt>IClassBehavior</tt> or +extends <tt>TBehavior</tt> or <tt>TClassBehavior</tt>, it may be added to an +object by calling the object's <tt>attachBehavior</tt>. The behaviors associated +name can then be used to <tt>enableBehavior</tt> or <tt>disableBehavior</tt> +the specific behavior. +</p> +<p id="130014" class="block-content"> +All behaviors may be turned on and off via <tt>enableBehaviors</tt> and +<tt>disableBehaviors</tt>, respectively. To check if behaviors are on or off +a call to <tt>getBehaviorsEnabled</tt> will provide the variable. +</p> +<p id="130015" class="block-content"> +Attaching and detaching whole sets of behaviors is done using +<tt>attachBehaviors</tt> and <tt>detachBehaviors</tt>. <tt>clearBehaviors</tt> +removes all of an object's behaviors. +</p> +<p id="130016" class="block-content"> +<tt>asa</tt> returns a behavior of a specific name. <tt>isa</tt> is the +behavior inclusive function that acts as the PHP operator <tt>instanceof</tt>. +A behavior could provide the functionality of a specific class thus causing +the host object to act similarly to a completely different class. A behavior +would then implement <tt>IInstanceCheck</tt> to provide the identity of the +different class. +</p> +<p id="130017" class="block-content"> +Class behaviors are similar to object behaviors except that the class behavior +is the implementation for all instances of the class. A class behavior +will have the object upon which is being called be prepended to the parameter +list. This way the object is known across the class behavior implementation. +</p> +<p id="130018" class="block-content"> +Class behaviors are attached using <tt>attachClassBehavior</tt> and detached +using <tt>detachClassBehavior</tt>. Class behaviors are important in that +they will be applied to all new instances of a particular class. In this way +class behaviors become default behaviors to a new instances of a class in +<tt>__construct</tt>. Detaching a class behavior will remove the behavior +from the default set of behaviors created for an object when the object +is instanced. +</p> +<p id="130019" class="block-content"> +Class behaviors are also added to all existing instances via the global 'fx' +event mechanism. When a new class behavior is added, the event +<tt>fxAttachClassBehavior</tt> is raised and all existing instances that are +listening to this global event (primarily after <tt>listen</tt> is called) +will have this new behavior attached. A similar process is used when +detaching class behaviors. Any objects listening to the global 'fx' event +<tt>fxDetachClassBehavior</tt> will have a class behavior removed. +</p> +<h2 id="26004">Dynamic Intra-Object Events</h2> +<p id="130020" class="block-content"> +Dynamic events start with 'dy'. This mechanism is used to allow objects +to communicate with their behaviors directly. The entire 'dy' event space +is valid. All attached, enabled behaviors that implement a dynamic event +are called when the host object calls the dynamic event. If there is no +implementation or behaviors, this returns null when no parameters are +supplied and will return the first parameter when there is at least one +parameter in the dynamic event. +</p> +<com:TTextHighlighter CssClass="source block-content"> + null == $this->dyBehaviorEvent(); + 5 == $this->dyBehaviorEvent(5); //when no behaviors implement this dynamic event +</com:TTextHighlighter> +<p id="130021" class="block-content"> +Dynamic events can be chained together within behaviors to allow for data +filtering. Dynamic events are implemented within behaviors by defining the +event as a method. +</p> +<com:TTextHighlighter CssClass="source block-content"> +class TObjectBehavior extends TBehavior { + public function dyBehaviorEvent($param1, $callchain) { + //Do something, eg: $param1 += 13; + return $callchain->dyBehaviorEvent($param1); + } +} +</com:TTextHighlighter> +<p id="130022" class="block-content"> +This implementation of a behavior and dynamic event will flow through to the +next behavior implementing the dynamic event. The first parameter is always +return when it is supplied. Otherwise a dynamic event returns null. +</p> +<p id="130023" class="block-content"> +In the case of a class behavior, the object is also prepended to the dynamic +event. +</p> +<com:TTextHighlighter CssClass="source block-content"> +class TObjectClassBehavior extends TClassBehavior { + public function dyBehaviorEvent($hostobject, $param1, $callchain) { + //Do something, eg: $param1 += $hostobject->getNumber(); + return $callchain->dyBehaviorEvent($param1); + } +} +</com:TTextHighlighter> +</p> +<p id="130024" class="block-content"> +When calling a dynamic event, only the parameters are passed. The host object +and the call chain are built into the framework. +</p> + +<h2 id="26005">Global Event and Dynamic event catching</h2> + +<p id="130025" class="block-content"> +Given that all global 'fx' events and dynamic 'dy' events are valid and +operational, there is a mechanism for catching events called that are not +implemented (similar to the built-in PHP method <tt>__call</tt>). When +a dynamic or global event is called but a behavior does not implement it, +yet desires to know when an undefined dynamic event is run, the behavior +implements the interface <tt>IDynamicMethods</tt> and method <tt>__dycall</tt>. +</p> +<p id="130026" class="block-content"> +In the case of dynamic events, <tt>__dycall</tt> is supplied with the method +name and its parameters. When a global event is raised, via <tt>raiseEvent</tt>, +the method is the event name and the parameters are supplied. +</p> +<p id="130027" class="block-content"> +When implemented, this catch-all mechanism is called for event global event event +when implemented outside of a behavior. Within a behavior, it will also be called +when the object to which the behavior is attached calls any unimplemented dynamic +event. This is the fall-back mechanism for informing a class and/or behavior +of when an global and/or undefined dynamic event is executed. +</p> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/Fundamentals/Pages.page b/demos/quickstart/protected/pages/Fundamentals/Pages.page index 19900937..58f4f06d 100755 --- a/demos/quickstart/protected/pages/Fundamentals/Pages.page +++ b/demos/quickstart/protected/pages/Fundamentals/Pages.page @@ -5,13 +5,27 @@ Pages are top-most controls that have no parent. The presentation of pages are directly displayed to end-users. Users access pages by sending page service requests.
</p>
<p id="130138" class="block-content">
-Each page must have a <a href="?page=Configurations.Templates1">template</a> file. The file name suffix must be <tt>.page</tt>. The file name (without suffix) is the page name. PRADO will try to locate a page class file under the directory containing the page template file. Such a page class file must have the same file name (suffixed with <tt>.php</tt>) as the template file. If the class file is not found, the page will take class <tt>TPage</tt>.
+Each page can have a <a href="?page=Configurations.Templates1">template</a> file. The file name suffix must be <tt>.page</tt>. The file name (without suffix) is the page name. PRADO will try to locate a page class file under the directory containing the page template file. Such a page class file must have the same file name (suffixed with <tt>.php</tt>) as the template file. If the class file is not found, the page will take class <tt>TPage</tt>.
</p>
<h2 id="902">PostBack</h2>
<p id="130139" class="block-content">
A form submission is called <i>postback</i> if the submission is made to the page containing the form. Postback can be considered an event happened on the client side, raised by the user. PRADO will try to identify which control on the server side is responsible for a postback event. If one is determined, for example, a <tt>TButton</tt>, we call it the postback event sender which will translate the postback event into some specific server-side event (e.g. <tt>OnClick</tt> and <tt>OnCommand</tt> events for <tt>TButton</tt>).
+<br/>
+<tt>TPage</tt> has a <tt>IsPostBack</tt> property exposing whether the current request being handled is the first request for this page or the consequence of a postback.
+</p>
+<h2>CallBack</h2>
+<p class="block-content">
+A <i>callback</i> is a special form submission that, instead of requiring a full page reload on the browser, gets executed in the background through an ajax call. So, a callback is considered a postback too, but not vice versa.
+<br/>
+A callback is handled as a normal postback but, instead of re-rendering the entire page, only the specific changes occured on the page gets sent back to the client and merged with the current browser page. A typical callback response consists of:
+<ol>
+ <li>one or more pieces of html code that will replace existing content on the page;</li>
+ <li>the javascript instructions needed to update the page;</li>
+ <li>some specific fields used by prado to mantain the pagestate and add the needed external resources (stylesheets, javascript files, etc..).</li>
+</ol>
+<tt>TPage</tt> has a <tt>IsCallBack</tt> property exposing whether the current request being handled is the consequence of a callback. Since a callback is also a postback, both <tt>IsPostBack</tt> and <tt>IsCallBack</tt> are true during callback requests.
</p>
<h2 id="903">Page Lifecycles</h2>
diff --git a/demos/quickstart/protected/pages/Fundamentals/Services.page b/demos/quickstart/protected/pages/Fundamentals/Services.page index 5e5889df..ee19a159 100755 --- a/demos/quickstart/protected/pages/Fundamentals/Services.page +++ b/demos/quickstart/protected/pages/Fundamentals/Services.page @@ -16,7 +16,7 @@ Developers may implement additional services for their applications. To make a s <h2 id="1102">Page Service</h2>
<p id="150154" class="block-content">
-PRADO implements <tt>TPageService</tt> to process users' page requests. Pages are stored under a directory specified by the <tt>BasePath</tt> property of the page service. The property defaults to <tt>pages</tt> directory under the application base path. You may change this default by configuring the service in the application configuration.
+PRADO implements <tt>TPageService</tt> to process users' page requests. Pages are stored under a directory specified by the <tt>BasePath</tt> property of the page service. The property defaults to <tt>Pages</tt> directory under the application base path. You may change this default by configuring the service in the application configuration.
</p>
<p id="150155" class="block-content">
Pages may be organized into subdirectories under the <tt>BasePath</tt>. In each directory, there may be a page configuration file named <tt>config.xml</tt>, which contains configurations effective only when a page under that directory or a sub-directory is requested. For more details, see the <a href="?page=Configurations.PageConfig">page configuration</a> section.
@@ -30,5 +30,8 @@ http://hostname/index.php?page=Users.Register </com:TTextHighlighter>
where the first example takes advantage of the fact that the page service is the default service and <tt>Home</tt> is the default page.
</p>
+<p class="block-content">
+More advanced url routes, like masking real page names and permitting the use of dynamic parameters can be created using the <a href="?page=Configurations.UrlMapping">Url mapping</a> module.
+</p>
</com:TContent>
diff --git a/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page index 22437158..1a416a32 100755 --- a/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page +++ b/demos/quickstart/protected/pages/GettingStarted/AboutPrado.page @@ -51,12 +51,12 @@ Most PHP frameworks mainly focuses on separating presentation and logic and prom <h2 id="4004">Is PRADO Stable Enough?</h2>
<p id="20004" class="block-content">
-Yes. PRADO was initially released in August 2004. Many test suites have been written and conducted frequently to ensure its quality. It has been used by thousands of developers and many Web applications have been developed based on it. Bugs and feature requests are managed through TRAC system and we have a great user community and development team to ensure all questions are answered in a timely fashion.
+Yes. PRADO was initially released in August 2004. Many test suites have been written and conducted frequently to ensure its quality. It has been used by thousands of developers and many Web applications have been developed based on it. Bugs and feature requests are managed through GitHub and we have a great user community and development team to ensure all questions are answered in a timely fashion.
</p>
<h2 id="205">History of PRADO</h2>
<p id="20014" class="block-content">
-The very original inspiration of PRADO came from Apache Tapestry. During the design and implementation, I borrowed many ideas from Borland Delphi and Microsoft ASP.NET. The first version of PRADO came out in June 2004 and was written in PHP 4. Driven by the Zend PHP 5 coding contest, I rewrote PRADO in PHP 5, which proved to be a wise move, thanks to the new object model provided by PHP 5. PRADO won the grand prize in the Zend contest, earning the highest votes from both the public and the judges' panel.
+The very original inspiration of PRADO came from Apache Tapestry. During the design and implementation, Qiang Xue borrowed many ideas from Borland Delphi and Microsoft ASP.NET. The first version of PRADO came out in June 2004 and was written in PHP 4. Driven by the Zend PHP 5 coding contest, Qiang rewrote PRADO in PHP 5, which proved to be a wise move, thanks to the new object model provided by PHP 5. PRADO won the grand prize in the Zend contest, earning the highest votes from both the public and the judges' panel.
</p>
<p id="20015" class="block-content">
In August 2004, PRADO started to be hosted on SourceForge as an open source project. Soon after, the project site <a href="http://www.xisc.com/">xisc.com</a> was announced to public. With the fantastic support of PRADO developer team and PRADO users, PRADO evolved to version 2.0 in mid 2005. In this version, Wei Zhuo contributed to PRADO with the excellent I18N and L10N support.
@@ -64,6 +64,12 @@ In August 2004, PRADO started to be hosted on SourceForge as an open source proj <p id="20016" class="block-content">
In May 2005, we decided to completely rewrite the PRADO framework to resolve a few fundamental issues found in version 2.0 and to catch up with some cool features available in Microsoft ASP.NET 2.0. After nearly a year's hard work with over 50,000 lines of new code, version 3.0 was finally made available in April 2006.
</p>
+<p class="block-content">
+In October 2008, the original development team released a new framework called <a href="http://www.yiiframework.com/">Yii</a>. Inheriting most of the PRADO code, Yii left the pages/events concept, focusing on a pure MVC design pattern. Since 2009 a lot of people contributed to PRADO fixing issues, developing new features or backporting them from Yii.
+</p>
+<p class="block-content">
+To promote a model of community-driven development, the project repositories were moved first on <a href="http://code.google.com/p/prado3/">Google Code</a> and then, in September 2013, on <a href="http://github.com/pradosoft/prado">GitHub</a>.
+</p>
<p id="20017" class="block-content">
Starting from version 3.0, significant efforts are allocated to ensure the quality and stability of PRADO. If we say PRADO v2.x and v1.x are proof-of-concept work, we can say PRADO 3.x has grown up to a project that is suitable for serious business application development.
</p>
diff --git a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page index 5f5dacb9..3619d3d9 100755..100644 --- a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page +++ b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page @@ -1,6 +1,12 @@ <com:TContent ID="body" >
<h1 id="501">Command Line Tool</h1>
-<p id="70046" class="block-content">The optional <tt>prado-cli.php</tt> PHP script file in the <tt>framework</tt>
+
+<div class="Note">
+<b class="tip">Note:</b> With Prado version 3.2.3 prado-cli.php location changed from framework
+to bin directory. If you're using Prado 3.2.2 or earlier, replace bin with framework in examples below.
+</div>
+
+<p id="70046" class="block-content">The optional <tt>prado-cli.php</tt> PHP script file in the <tt>bin</tt>
directory provides command line tools to perform various tedious takes in Prado.
The <tt>prado-cli.php</tt> can be used to create Prado project skeletons, create
initial test fixtures, and access to an interactive PHP shell.
@@ -14,8 +20,8 @@ the command line. <h2 id="503">Usage</h2>
<p id="70048" class="block-content">
-If you type <tt>php path/to/framework/prado-cli.php</tt>, you should see
-the following information. Alternatively, if you are not on Windows,
+If you type <tt>php path/to/bin/prado-cli.php</tt>, you should see
+the following information. Alternatively, if you are not on Windows,
you may try to change the <tt>prado-cli.php</tt> into an executable
and execute it as a script</p>
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70006">
@@ -43,9 +49,9 @@ are optional parameters. </p> <p id="70050" class="block-content">To create a Prado project skeleton, do the following:</p>
<ol>
<li>Change to the directory where you want to create the project skeleton.</li>
- <li>Type, <tt>php ../prado/framework/prado-cli.php -c helloworld</tt>, where
+ <li>Type, <tt>php ../prado/bin/prado-cli.php -c helloworld</tt>, where
<tt>helloworld</tt> is the directory name that you want to create the project skeleton files.</li>
- <li>Type, <tt>php ../prado/framework/prado-cli.php <b>-t</b> helloworld</tt> to create
+ <li>Type, <tt>php ../prado/bin/prado-cli.php <b>-t</b> helloworld</tt> to create
the test fixtures for the <tt>helloworld</tt> project.</li>
</ol>
@@ -58,7 +64,7 @@ command line is in the <tt>prado</tt> distribution directory and you type. </p>
<p id="70052" class="block-content">
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70007">
-$: php framework/prado-cli.php shell demos/blog
+$: php bin/prado-cli.php shell demos/blog
</com:TTextHighlighter>
The output should be
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70008">
@@ -85,7 +91,7 @@ we <b>leave out the semicolon</b> to show the results. <com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70010">
>> $db->queryPostByID(1)
</com:TTextHighlighter>
-There should not be any errors and you should see the following.
+There should not be any errors and you should see the following.
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70011">
PostRecord#1
(
@@ -103,4 +109,34 @@ PostRecord#1 )
</com:TTextHighlighter>
</p>
+
+<h2>Creating Active Record Classes</h2>
+<p>
+In the blog demo project, we need to create two <a href="?page=Database.ActiveRecord">Active Record</a> classes, <tt>UserRecord</tt> and <tt>PostRecord</tt>, to represent data records in the <tt>users</tt> and <tt>posts</tt> tables, respectively. Active Record classes must extend from the base class <tt>ActiveRecord</tt>, and must define property names that matches with the field names of the corresponding table.
+</p>
+
+<p>
+To better organize our directories, we create a new directory <tt>protected/database</tt> to hold the class files. We also modify our application configuration by inserting the following lines. It is equivalent to adding the directory <tt>protected/database</tt> to PHP include_path, which allows us to use the classes without explicitly including them.
+</p>
+
+<com:TTextHighlighter CssClass="source" Language="xml">
+<paths>
+ <using namespace="Application.database.*" />
+</paths>
+</com:TTextHighlighter>
+
+<p>
+At the prompt, enter the following two commands to create <tt>UserRecord</tt> and <tt>PostRecord</tt> classes:
+</p>
+
+<com:TTextHighlighter CssClass="source cli" Language="text">
+>> generate users Application.database.UserRecord
+
+>> generate posts Application.database.PostRecord
+</com:TTextHighlighter>
+
+<p>
+Here we used the <a href="?page=Fundamentals.Components1">namespace format</a> again to specify the classes to be created. The path <tt>Application.database.UserRecord</tt> indicates that we want the <tt>UserRecord</tt> class file to be <tt>protected/database/UserRecord.php</tt>.
+</p>
+
</com:TContent>
diff --git a/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page b/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page index 557aa46d..d65cf7f8 100755 --- a/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page +++ b/demos/quickstart/protected/pages/GettingStarted/HelloWorld.page @@ -29,7 +29,7 @@ where each directory is explained as follows. Note, the above directory structur </ul>
<div class="tip">
-<b class="tip">Tip:</b>You may also use the <tt>framework/prado-cli.php</tt>
+<b class="tip">Tip:</b>You may also use the <tt>bin/prado-cli.php (framework/prado-cli.php for Prado < 3.2.3)</tt>
<a href="?page=GettingStarted.CommandLine">command line script</a>
to create the Prado project directory structure. For example, type the command
<tt>php path/to/prado-cli.php -c helloworld</tt> in the directory
diff --git a/demos/quickstart/protected/pages/GettingStarted/Installation.page b/demos/quickstart/protected/pages/GettingStarted/Installation.page index 7919e733..956f53c2 100755 --- a/demos/quickstart/protected/pages/GettingStarted/Installation.page +++ b/demos/quickstart/protected/pages/GettingStarted/Installation.page @@ -5,16 +5,17 @@ If you are viewing this page from your own Web server, you are already done with the installation.
</p>
<p id="30019">
-The minimum requirement by PRADO is that the Web server support PHP 5.2. PRADO has been tested with Apache Web server on Windows and Linux. Highly possibly it may also run on other platforms with other Web servers, as long as PHP 5.2 is supported.
+The minimum requirement by PRADO is that the Web server support PHP 5.3.3. PRADO has been tested with Apache Web server on Windows, MacOSX and various Linux distro. Highly possibly it may also run on other platforms with other Web servers, as long as PHP 5.3.3 is supported.
</p>
</div>
-<div id="install-steps" class="block-content">
<p id="30020">
-Installation of PRADO mainly involves downloading and unpacking.
+PRADO can be installed as a standalone package or using <a href="http://getcomposer.org/">composer</a>
</p>
+<div id="install-steps" class="block-content">
+<h3>Standalone package</h3>
<ol>
-<li>Go to <a href="http://www.pradosoft.com/">pradosoft.com</a> to grab the latest version of PRADO.</li>
+<li>Go to <a href="http://www.pradosoft.com/download/">pradosoft.com</a> to grab the latest version of PRADO.</li>
<li>Unpack the PRADO release file to a Web-accessible directory.
</ol>
</div>
@@ -25,5 +26,37 @@ Your installation of PRADO is done and you can start to play with the demo appli <p id="30022">
If you encounter any problems with the demo applications, please use the PRADO requirement checker script, accessible via <tt>http://web-server-address/prado/requirements/index.php</tt>, to check first if your server configuration fulfills the conditions required by PRADO.
</p>
+
+<div id="install-steps" class="block-content">
+<h3>Composer install</h3>
+<ol>
+<li>If you don't have installed composer already, install it globally:
+<com:TTextHighlighter CssClass="source block-content">
+$ curl -s http://getcomposer.org/installer | php
+$ php composer.phar install
+</com:TTextHighlighter>
+</li>
+<li>Create a composer.json file for your project:
+<com:TTextHighlighter CssClass="source block-content">
+{
+ "require": {
+ "pradosoft/prado": "~3.2"
+ }
+}
+</com:TTextHighlighter>
+</li>
+<li>Now run the actual installation:
+<com:TTextHighlighter CssClass="source block-content">
+$ composer install
+</com:TTextHighlighter>
+</li>
+<li>In your project include the autoloader, and you will have access to the library classes:
+<com:TTextHighlighter CssClass="source block-content">
+<?php
+require_once('vendor/autoload.php');
+</com:TTextHighlighter>
+</li>
+</ol>
</div>
+
</com:TContent>
diff --git a/demos/quickstart/protected/pages/GettingStarted/Upgrading32.page b/demos/quickstart/protected/pages/GettingStarted/Upgrading32.page new file mode 100644 index 00000000..e2378ed5 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/Upgrading32.page @@ -0,0 +1,239 @@ +<com:TContent ID="body" > + +<h1>Upgrading from v3.2</h1> + +<div class="block-content"> +<p class="block-content"> +Since version 3.3, PRADO uses <a href="http://jquery.com/">jQuery</a> as its default javascript framework. +Previously, up to version 3.2, PRADO used <a href="http://prototypejs.org/">Prototype</a> and <a href="http://script.aculo.us/">Scriptaculous</a> as its default javascript framework. +</p> +<p class="block-content"> +PRADO relies a lot on clientside javascript code to implement its <a href="?page=Controls.Standard">standard controls</a>, to handle clientside <a href="?page=Controls.Validation">validators</a>, and to create a seamless <a href="?page=ActiveControls.Introduction">ajax</a> experience using <a href="?page=ActiveControls.Home">active controls</a>. +All this javascript code, originally developed on Prototype, has been rewritten in order to use jQuery instead. The choice was mainly driven by the lack of development and decline of the Prototype community, while jQuery has become the de-facto standard library for javascript. +</p> +<p class="block-content"> +While the PRADO javascript code is ready to work with jQuery, legacy javascript code in existing applications can require some porting to make it work properly. +We summarize in the following the most significant changes in v3.3 to help developers upgrade their v3.2 PRADO applications more easily, if needed. +</p> +</div> + +<h2>Basic Prototype to jQuery javascript porting</h2> +<p class="block-content"> +The number one rule on writing jQuery javascript code is to read the <a href="http://api.jquery.com/">jQuery documentation</a>. Porting code from Prototype to jQuery needs some effort: here's a basic lookup table to port existing code: +</p> +<table class="tabular"> + <tr> + <th></th> + <th>Prototype (OLD)</th> + <th>jQuery (NEW)</th> + </tr> + <tr> + <td>Get element by id</td> + <td>$('element_id')</td> + <td>// get the base DOM element + <br/>$('#element_id').get(0) + <br/>// get the the extended element + <br/>$('#element_id').eq(0) + </td> + </tr> + <tr> + <td>Get element by css selector</td> + <td>$$('.class')</td> + <td>$('.class')</td> + </tr> + <tr> + <td>Apply a function to multiple elements</td> + <td>$$('.class').each(Element.remove)</td> + <td>$('.class').remove()</td> + </tr> + <tr> + <td>Create or extend a class</td> + <td>Class.create(Prado.WebUI.Control, { ... }) + <br/>Class.extend(Prado.WebUI.Control, { ... }) + </td> + <td>jQuery.klass(Prado.WebUI.Control, { ... })</td> + </tr> + <tr> + <td>Extend an object</td> + <td>Object.extend(...)</td> + <td>jQuery.extend(...)</td> + </tr> + <tr> + <td>Bind an event to a callback event handler</td> + <td>Event.observe(element, 'click', callback)</td> + <td>$(element).on('click', callback)</td> + </tr> + <tr> + <td>Unbind an event from a callback event handler</td> + <td>Event.stopObserving(element, 'click', callback)</td> + <td>$(element).off('click', callback)</td> + </tr> + <tr> + <td>Stop event propagation</td> + <td>Event.stop(event)</td> + <td>// stop event bubbling chain + <br/>event.stopPropagation() + <br/>// prevent form submit + <br/>event.preventDefault() + </td> + </tr> + <tr> + <td>Detect keypress event</td> + <td>if(kc == Event.KEY_RETURN || + <br/>kc == Event.KEY_SPACEBAR || + <br/>kc == Event.KEY_TAB)</td> + <td>// use the numeric codes + <br/>if(kc == 13 || + <br/>kc == 32 || + <br/>kc == 9) + </td> + </tr> + <tr> + <td>Execute a function when the page has finished loading</td> + <td>document.observe("dom:loaded", function(event) { ... })</td> + <td>$( document ).ready(function() { ... })</td> + </tr> + <tr> + <td>Create an animation effect with a "finish" callback</td> + <td>new Effect.Fade(element, { + <br/>duration: 400, + <br/>afterFinish: function() { + <br/>// Animation complete. + <br/>});</td> + <td>$(element).fadeOut( 400, function() { + <br/>// Animation complete. + <br/>});</td> + </tr> + <tr> + <td>Declare a function to be used as event handler binding its "this" property</td> + <td>this.functionName.bindAsEventListener(this)</td> + <td>this.functionName.bind(this)</td> + </tr> + <tr> + <td>Css class functions (add, remove, test for css class)</td> + <td>addClassName() + <br/>removeClassName() + <br/>hasClassName() + </td> + <td>addClass() + <br/>removeClass() + <br/>hasClass() + </td> + </tr> + <tr> + <td>Get event target inside an event handler</td> + <td>Event.element(event)</td> + <td>event.target</td> + </tr> + <tr> + <td>Get event mouse position</td> + <td>Event.pointerX(event) + <br/>Event.pointerY(event) + </td> + <td>event.pageX + <br/>event.pageY + </td> + </tr> + <tr> + <td>Fire events</td> + <td>Event.fireEvent(this.control, "change")</td> + <td>$(element).trigger("change")</td> + </tr> + <tr> + <td>Get element size</td> + <td>element.getWidth() + <br/>element.getHeight() + </td> + <td>element.width + <br/>element.height + </td> + </tr> + <tr> + <td>Change element contents</td> + <td>$('div1').innerHTML='new content'</td> + <td>$('#div1').html('new content')</td> + </tr> + <tr> + <td>Hook on ajax events</td> + <td>Ajax.Responders.register({ + <br/>"onLoading" : my_function + <br/>}); + <br/>Ajax.Responders.register({ + <br/>"onSuccess" : my_function + <br/>}); + </td> + <td>$( document ).ajaxSend(my_function); + <br/>$( document ).ajaxSuccess(my_function); + </td> + </tr> +</table> + +<h2>PRADO specific code changes</h2> +<p class="block-content"> +PRADO +Porting prado to jQuery some method signatures has changed, or have been adapted: +</p> +<table class="tabular"> + <tr> + <th></th> + <th>Prototype (OLD)</th> + <th>jQuery (NEW)</th> + </tr> + <tr> + <td>Implementing the postback handler for a PostBackControl; + <br/>the function signature has changed (parameters are inverted):</td> + <td>onPostBack : function(event, options)</td> + <td>onPostBack : function(options, event)</td> + </tr> + <tr> + <td>Execute a postback</td> + <td>Prado.PostBack(options, event);</td> + <td>// Create a new object + <br/>new Prado.PostBack(options, event); + </td> + </tr> + <tr> + <td>Test browser software method has been removed</td> + <td>Prado.Browser().ie</td> + <td>// Test for browser support for specific capabilities instead + <br/>jQuery.support + <br/>// or, better, use <a href="http://modernizr.com/">Modernizr</a> + </td> + </tr> + <tr> + <td>Get a PRADO object from an object ID</td> + <td>Prado.Registry.get('id')</td> + <td>Prado.Registry.['id']</td> + </tr> +</table> + +<h2>Specific controls changes</h2> +<p class="block-content"> +Some Prado controls were based on specific extensions of the Prototype + Scriptaculous javascript framework, and they have been deprecated now that jQuery has become the primary js framework in PRADO. +PRADO 3.3 introduces jQuery-based counterpart for these controls and encourage everyone to port their code to the new controls, but the old controls are still supposed to work with some minor annoyance: +<ul> + <li>Prototype and Scriptaculous will be loaded along jQuery</li> + <li>jQuery will execute in "no conflict" mode, so the $() helper won't call anymore jQuery but Prototype.</li> +</ul> +Following is the list of deprecated controls: +</p> + +<h4>TAutoComplete</h4> +<p class="block-content"> +<tt>TAutoComplete</tt> is deprecated, use <tt>TJuiAutoComplete</tt> instead. Main changes in porting existing code using TAutoComplete to TJuiAutoComplete: +<ul> + <li>the <tt>Frequency</tt> property doesn't exists anymore</li> + <li>the <tt>minChars</tt> property is called <tt>minLength</tt></li> + <li>only the <tt>ItemTemplate</tt> is supported for the <tt>Suggestions</tt> repeater (no HeaderTemplate, FooterTemplate, etc..)</li> + <li><tt>ItemTemplate</tt> doesn't need to render the <li> tag anymore, but only the content itself</li> + <li>multiple selections are not supported</li> +</ul> +</p> + +<h4>TDraggable and TDropContainer</h4> +<p class="block-content"> +<tt>TDraggable</tt> and <tt>TDropContainer</tt> have been deprecated and replaced respectively by <tt>TJuiDraggable</tt> and <tt>TJuiDroppable</tt>. +The options for the new controls are available at <a href="http://api.jqueryui.com/">jQueryUI's API documentation</a>. +</p> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/GettingStarted/Wsat.page b/demos/quickstart/protected/pages/GettingStarted/Wsat.page new file mode 100644 index 00000000..3d07e6f2 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/Wsat.page @@ -0,0 +1,64 @@ +<com:TContent ID="body"> + <h1>Web Site Administration Tool</h1> + <p class="block-content"> + Web Site Administration Tool (WSAT) is a development tool which allows you to perform several + tedious tasks of a PRADO project in a GUI fashion. Its inspired in both Asp.Net - Web Site Administration Tool and Yii's Gii. + WSAT will continue gaining new features along the time, at the moment it bring you the followings: + + <ul> + <li>Generate one or all <a href="?page=Database.ActiveRecord">Active Record Classes.</a></li> + <li>Optionally generate all relationships in Active Record Classes.</li> + <li>Generate the magic __toString() method in all AR Classes.</li> + </ul> + </p> + + <h2>Requirements</h2> + <p class="block-content"> + To use WSAT, you need to add in your project configuration file: <tt>application.xml</tt>, + in the services section the wsat service like follows: + +<com:TTextHighlighter CssClass="source" Language="xml"> +<services> + ... + <service id="wsat" class="System.Wsat.TWsatService" Password="my_secret_password" /> +</services> +</com:TTextHighlighter> + </p> + + <h2>Usage</h2> + <p class="block-content"> + Then you are ready to go to: http://localhost/yoursite/index.php?wsat=TWsatLogin and doing so you should see + the following page: + </p> + <img src="<%~wsat_login.png%>" style="width: 700px;" /> + <p class="block-content"> + Where in the text field you need to type the password previosly specified in the service inclusion. This + is part of a basic security system to avoid undesirable persons to use this tool. + </p> + + <h2>Active Record classes generation</h2> + <p class="block-content"> + In order to generate AR classes you need to go to: http://localhost/divermania/index.php?wsat=TWsatGenerateAR + by clicking the proper links in the welcome page. Then you should see the following page: + </p> + <img src="<%~wsat_generate_ar.png%>" style="width: 700px;" /> + <p class="block-content"> + In which you can find a basic usage documentation in a light green panel + and then some proper fields in order to generate active record classes. These fields are: + </p> + + <ul> + <li><b>Table Name: </b> refers to the table name in your database for which you want to generate an AR class. + Let it as come by default with an * to generate them all.</li> + <li><b>Output Folder: </b> refers to the folder where you want to save your generated classes. + It only accepts namespace format which means that you need to specify your path separated with points in between. + It default value is: "Application.App_Data.AR_Classes" which references the protected/App_Data/AR_Classes + file of your project, if you haven't created them yet and you want to, don't bother, WSAT will do it for you.</li> + <li><b>Class Prefix: </b> refers to the prefix that you whish to specify in front of every class name. + Clear the field to specify no prefix.</li> + <li><b>Class Suffix: </b> refers to the suffix that you whish to specify at the end of every class name. + Clear the field to specify no suffix.</li> + <li><b>Build Relations: </b> whether or not you want to add relationships to AR classes generation.</li> + </ul> + +</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/GettingStarted/wsat_generate_ar.png b/demos/quickstart/protected/pages/GettingStarted/wsat_generate_ar.png Binary files differnew file mode 100644 index 00000000..8f0f59e7 --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/wsat_generate_ar.png diff --git a/demos/quickstart/protected/pages/GettingStarted/wsat_login.png b/demos/quickstart/protected/pages/GettingStarted/wsat_login.png Binary files differnew file mode 100644 index 00000000..dbe1ad8b --- /dev/null +++ b/demos/quickstart/protected/pages/GettingStarted/wsat_login.png diff --git a/demos/quickstart/protected/pages/JuiControls/Home.page b/demos/quickstart/protected/pages/JuiControls/Home.page new file mode 100644 index 00000000..2573b162 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Home.page @@ -0,0 +1,85 @@ +<com:TContent ID="body" > +<h1>Jui Controls (jQuery UI)</h1> +<p class="block-content"> +Jui controls are the PRADO port of the standard <a href="http://jqueryui.com/">jQuery UI</a> widgets. They can be used as standard <a href="?page=ActiveControls.Introduction">Active Controls</a>, but will automatically load the needed jQuery-UI javascript libraries. +</p> +<h3>Options</h3> +<p class="block-content"> +The <tt>Options</tt> property of PRADO Jui controls is used to pass options to the underlying javascript object. Each subproperty set on <tt>Options</tt> will be translated to a javascript property added to the object. The complete list of options available for each widget is availble at jQuery-UI's API Documentation. +</p> + +<h4>Example</h4> +<p class="block-content"> +jQuery-UI's <a href="http://jqueryui.com/resizable/">Resizable</a> adds an handle to a target element making it resizable. Its PRADO counterpart is <a href="?page=JuiControls.Interactions#TJuiResizable">TJuiResizable</a>. Resizable offers an <a href="http://api.jqueryui.com/resizable/#option-aspectRatio">aspectRatio</a> property to constrain the aspect ratio of the target element. The same property can be applied to TJuiResizable as a subproperty of the <tt>Options</tt> property: +</p> +<com:TTextHighlighter Language="php" CssClass="source block-content"> + <com:TJuiResizable + ID="resize1" + Options.aspectRatio="true" + // Additional options being set + Options.maxHeight="250" + Options.maxWidth="350" + Options.minHeight="150" + Options.minWidth="200" + /> +</com:TTextHighlighter> + +<h3>Events</h3> +<p class="block-content"> +jQuery-UI widgets offers a lot of events that PRADO can hook up and trasmit to the serverside using a <a href="?page=ActiveControls.Introduction">callback request</a>. Event available for PRADO Jui controls inherits their names from their jQuery-UI counterparts, prefixed with "On". +Jui controls doesn't make use of the AutoPostback property anymore, but only triggers a callback when an event handler is associated to the corresponding event. +</p> + +<h4>Example</h4> +<p class="block-content"> +jQuery's <a href="http://jqueryui.com/draggable/">Draggable</a> allows a target element to the moved using the mouse. Its PRADO counterpart is <a href="?page=JuiControls.Interactions#TJuiDraggable">TJuiDraggable</a>. Draggable exposes two useful events: <a href="http://api.jqueryui.com/draggable/#event-start">start</a> and <a href="http://api.jqueryui.com/draggable/#event-stop">stop</a>, that gets triggered respectively when the element starts to move and when the movement stops. TJuiDraggable exposes these same events: +</p> +<com:TTextHighlighter Language="php" CssClass="source block-content"> + <com:TJuiDraggable + ID="drag1" + OnStart="drag1_start" + OnStop="drag1_stop" + /> +</com:TTextHighlighter> + +<h2>PRADO Jui interactions controls</h2> +<p class="block-content"> +Jui interactions adds basic mouse-based interactions to elements like moving, resizing or sorting. PRADO Jui interactions controls applies there interactions to a <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> +For informations of the specific options of each interaction, follow jQuery-UI Interaction <a href="http://api.jqueryui.com/category/interactions/">API Documentation</a> for the specific interaction. +</p> +<ul id="u1" class="block-content"> + <li> + <a href="?page=JuiControls.Interactions#TJuiDraggable">TJuiDraggable</a> + is an element that can be moved using the mouse. + </li> + + <li> + <a href="?page=JuiControls.Interactions#TJuiDroppable">TJuiDroppable</a> + is an area where TJuiDraggable elements can be released. + </li> + + <li> + <a href="?page=JuiControls.Interactions#TJuiResizable">TJuiResizable</a> + is an element that cna be resized using the mouse. + </li> + + <li> + <a href="?page=JuiControls.Interactions#TJuiSelectable">TJuiSelectable</a> + displays a list of elements that can be selected individually. + </li> + + <li> + <a href="?page=JuiControls.Interactions#TJuiSortable">TJuiSortable</a> + displays a list of elements that can be selected individually. + </li> +</ul> + +<h2>PRADO Jui widgets controls</h2> +<ul id="u2" class="block-content"> + <li> + <a href="?page=JuiControls.Widgets#TJuiProgressbar">TJuiProgressbar</a> + displays a progress bar. + </li> +</ul> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Interactions.page b/demos/quickstart/protected/pages/JuiControls/Interactions.page new file mode 100644 index 00000000..2b48da68 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Interactions.page @@ -0,0 +1,83 @@ +<com:TContent ID="body"> +<h1>Jui interactions controls</h1> +<p class="block-content"> +Jui interactions adds basic mouse-based interactions to elements like moving, resizing or sorting. PRADO Jui interactions controls applies these interactions to a <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> +For informations of the specific options of each interaction, follow jQuery-UI Interaction <a href="http://api.jqueryui.com/category/interactions/">API Documentation</a> for the specific interaction. +</p> + +<a name="TJuiDraggable"></a> +<h2>TJuiDraggable</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiDraggable" /> - <a href="http://api.jqueryui.com/draggable/">jQuery UI API</a> + +<p class="block-content"> +<tt>TJuiDraggable</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/draggable/">Draggable</a> interaction. +</p> + +<p class="block-content"> +The panel can be moved using the mouse, and eventually dropped over a <a href="?page=JuiControls.Interactions#TJuiDroppable">TJuiDroppable</a>. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiDraggable.Home" /> +<br/> + + +<a name="TJuiDroppable"></a> +<h2>TJuiDroppable</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiDroppable" /> - <a href="http://api.jqueryui.com/droppable/">jQuery UI API</a> + +<p class="block-content"> +<tt>TJuiDroppable</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/draggable/">Draggable</a> interaction. +</p> + +<p class="block-content"> +When a <a href="?page=JuiControls.Interactions#TJuiDroppable">TJuiDraggable</a> is dropped over a <tt>TJuiDroppable panel</tt>, the <tt>OnDrop</tt> event will be triggered. The event hanler will receive a <tt>TJuiEventParameter</tt> object containing a reference to the dropped control in the <tt>DraggableControl</tt> property. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiDroppable.Home" /> +<br/> + +<a name="TJuiResizable"></a> +<h2>TJuiResizable</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiResizable" /> - <a href="http://api.jqueryui.com/resizable/">jQuery UI API</a> +<p class="block-content"> +<tt>TJuiResizable</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/resizable/">Resizable</a> interaction. +</p> + +<p class="block-content"> +A small handle is shown on the bottom right corner of the panel, that permits the panel to be resized using the mouse. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiResizable.Home" /> +<br/> + + +<a name="TJuiSelectable"></a> +<h2>TJuiSelectable</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiSelectable" /> - <a href="http://api.jqueryui.com/selectable/">jQuery UI API</a> +<p class="block-content"> +<tt>TJuiSelectable</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/selectable/">Selectable</a> interaction. +</p> + +<p class="block-content"> +<tt>TJuiSelectable</tt> can be feed a <tt>DataSource</tt> and will interally render a <a href="?page=Controls.Repeater">TRepeater</a> that displays items in an unordered list. Items can be selected by clicking on them, individually or in a group. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiSelectable.Home" /> +<br/> + + +<a name="TJuiSortable"></a> +<h2>TJuiSortable</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiSortable" /> - <a href="http://api.jqueryui.com/sortable/">jQuery UI API</a> +<p class="block-content"> +<tt>TJuiSortable</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/sortable/">Sortable</a> interaction. +</p> + +<p class="block-content"> +<tt>TJuiSortable</tt> can be feed a <tt>DataSource</tt> and will interally render a <a href="?page=Controls.Repeater">TRepeater</a> that displays items in an unordered list. Items can be sortered dragging and dropping them. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiSortable.Home" /> +<br/> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page new file mode 100644 index 00000000..349922cb --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page @@ -0,0 +1,29 @@ +<com:TContent ID="body"> +<h1>TJuiDraggable Samples</h1> + +<com:TStyleSheet> + .ui-draggable { + width: 100px; + height:100px; + background-color: lime; + border: 1px solid black; + padding: 1em; + } +</com:TStyleSheet> +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options with a little css applied: +</td><td class="sampleaction" style="height:600px"> + <com:TJuiDraggable + OnStart="drag1_start" + OnStop="drag1_stop" + > + Drag me around + </com:TJuiDraggable> + <com:TActiveLabel ID="label1" Text="Waiting.." /> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php new file mode 100644 index 00000000..348eea55 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php @@ -0,0 +1,16 @@ +<?php + +class Home extends TPage +{ + protected function drag1_start($sender, $param) + { + $offset=$param->getCallbackParameter()->offset; + $this->label1->Text.="<br/>Start drag at (".$offset->left.",".$offset->top.")"; + } + + protected function drag1_stop($sender, $param) + { + $offset=$param->getCallbackParameter()->offset; + $this->label1->Text.="<br/>Stop drop at (".$offset->left.",".$offset->top.")"; + } +}
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page new file mode 100644 index 00000000..6059fe60 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page @@ -0,0 +1,48 @@ +<com:TContent ID="body"> +<h1>TJuiDroppable Samples</h1> + +<com:TStyleSheet> + .ui-draggable { + width: 100px; + height:100px; + background-color: lime; + border: 1px solid black; + padding: 1em; + } + .ui-droppable { + width: 150px; + height:150px; + border: 1px solid black; + padding: 1em; + margin: 1em; + } + .drop-yellow { + background-color: yellow; + } + .drop-red { + background-color: red; + } +</com:TStyleSheet> +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options with a little css applied: +</td><td class="sampleaction" style="height:600px"> + <com:TJuiDraggable ID="drag1"> + Drag me around + </com:TJuiDraggable> + + <com:TJuiDroppable OnDrop="drop1_ondrop" CssClass="drop-yellow"> + Drop it here! + <br/><com:TActiveLabel ID="label1" /> + </com:TJuiDroppable> + + <com:TJuiDroppable OnDrop="drop2_ondrop" CssClass="drop-red"> + Drop it here! + <br/><com:TActiveLabel ID="label2" /> + </com:TJuiDroppable> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php new file mode 100644 index 00000000..c59d035c --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php @@ -0,0 +1,30 @@ +<?php + +class Home extends TPage +{ + public function drop1_ondrop($sender, $param) + { + $draggable=$param->DraggableControl; + /* Equals to: + * $draggable=$param->getControl($param->getCallbackParameter()->draggable); + */ + $offset=$param->getCallbackParameter()->offset; + $target=$param->getCallbackParameter()->target->offset; + $top=$offset->top - $target->top; + $left=$offset->left - $target->left; + $this->label1->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left; + } + + public function drop2_ondrop($sender, $param) + { + $draggable=$param->DraggableControl; + /* Equals to: + * $draggable=$param->getControl($param->getCallbackParameter()->draggable); + */ + $offset=$param->getCallbackParameter()->offset; + $target=$param->getCallbackParameter()->target->offset; + $top=$offset->top - $target->top; + $left=$offset->left - $target->left; + $this->label2->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left; + } +} diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.page new file mode 100644 index 00000000..63436516 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.page @@ -0,0 +1,55 @@ +<com:TContent ID="body"> +<h1>TJuiProgressbar Samples</h1> + +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options, Max=100, Value=50: +</td><td class="sampleaction"> + <com:TJuiProgressbar + Options.Max="100" + Options.Value="50" + /> +</td></tr> + +<tr><td class="samplenote"> +Undefined progressbar, Value=false: +</td><td class="sampleaction"> + <com:TJuiProgressbar + Options.Value="false" + /> +</td></tr> + +<tr><td class="samplenote"> +Undefined progresbar, value changed from javascript: +</td><td class="sampleaction"> + <com:TJuiProgressbar + ID="pbar1" + Options.Max="100" + Options.Value="false" + OnChange="pbar1_changed" + OnComplete="pbar1_complete" + /> + <com:TActiveLabel ID="label1" Text="Waiting.." /> + <com:TButton ID="button1" Text="Start example" Attributes.OnClick="startExample1(); return false" /> + <com:TClientScript> + function progress() { + var pbar = $('#<%= $this->pbar1->ClientID %>'); + var val = pbar.progressbar('value') || 0; + pbar.progressbar('value', val + 10); + if (val < 99) { + setTimeout(progress, 500); + } + } + + function startExample1() + { + $('#<%= $this->pbar1->ClientID %>').progressbar('value', false) + progress(); + } + </com:TClientScript/> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.php new file mode 100644 index 00000000..8f6d9ec6 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.php @@ -0,0 +1,14 @@ +<?php + +class Home extends TPage +{ + public function pbar1_complete($sender,$param) + { + $this->label1->Text="Progressbar complete!"; + } + + public function pbar1_changed($sender,$param) + { + $this->label1->Text="Progressbar changed."; + } +}
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.page new file mode 100644 index 00000000..6c61f7df --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.page @@ -0,0 +1,29 @@ +<com:TContent ID="body"> +<h1>TJuiResizable Samples</h1> + +<com:TStyleSheet> + .resizable { + width: 150px; + height: 150px; + padding: 0.5em; + background: #fff; + border: 1px solid #000; + } + </com:TStyleSheet> +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options with a little css applied: +</td><td class="sampleaction"> + <com:TJuiResizable + CssClass="resizable" + OnStart="resize1_start" + OnStop="resize1_stop" + > + <com:TActiveLabel ID="label1" Text="Resize me!" /> + </com:TJuiResizable> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.php new file mode 100644 index 00000000..435b8a9b --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiResizable/Home.php @@ -0,0 +1,16 @@ +<?php + +class Home extends TPage +{ + protected function resize1_start($sender, $param) + { + $size=$param->getCallbackParameter()->size; + $this->label1->Text.="<br/>Start: ".intval($size->width)." x ".intval($size->height); + } + + protected function resize1_stop($sender, $param) + { + $size=$param->getCallbackParameter()->size; + $this->label1->Text.="<br/>Stop: ".intval($size->width)." x ".intval($size->height); + } +}
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.page new file mode 100644 index 00000000..cd778625 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.page @@ -0,0 +1,41 @@ +<com:TContent ID="body"> +<h1>TJuiSelectable Samples</h1> + +<com:TStyleSheet> + .ui-selectable { + list-style: none; + cursor: pointer; + } + .ui-selectable li { + border: 1px solid transparent; + padding: 3px; + border-radius:3px; + } + + .ui-selectable li:hover { + background: #FECA40; + border: 1px solid black; + } + + .ui-selecting { + background: #FECA40; + } + .ui-selected { + background: #F39814; color: white; + } +</com:TStyleSheet> +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options with a little css applied: +</td><td class="sampleaction"> + <com:TJuiSelectable + ID="repeater1" + OnStop="repeater1_onStop" + /> + <com:TActiveLabel ID="label1" /> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.php new file mode 100644 index 00000000..ada38408 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSelectable/Home.php @@ -0,0 +1,32 @@ +<?php + +class Home extends TPage +{ + protected $data = array( + 'PRADO', + 'quickstart', + 'tutorial', + 'sample', + 'for the', + 'TJuiSortable', + 'control', + ); + + public function onLoad($param) + { + if(!$this->IsPostback) + { + $this->repeater1->DataSource=$this->data; + $this->repeater1->dataBind(); + } + } + + public function repeater1_onStop($sender, $param) + { + $this->label1->Text="Selected items:"; + $items = $param->getCallbackParameter()->index; + + foreach($items as $index) + $this->label1->Text.=' '.$this->data[$index]; + } +} diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.page new file mode 100644 index 00000000..cbb1465b --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.page @@ -0,0 +1,35 @@ +<com:TContent ID="body"> +<h1>TJuiSortable Samples</h1> + +<com:TStyleSheet> + .ui-sortable { + list-style: none; + cursor: pointer; + } + + .ui-sortable li { + border: 1px solid transparent; + padding: 3px; + border-radius:3px; + } + + .ui-sortable li:hover { + background: lime; + border: 1px solid black; + } +</com:TStyleSheet> +<table class="sampletable"> + +<tr><td class="samplenote"> +Default options with a little css applied: +</td><td class="sampleaction"> + <com:TJuiSortable + ID="repeater1" + onStop="repeater1_onStop" + /> + <com:TActiveLabel ID="label1" /> +</td></tr> + +</table> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.php new file mode 100644 index 00000000..d96df302 --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiSortable/Home.php @@ -0,0 +1,31 @@ +<?php + +class Home extends TPage +{ + protected $data = array( + 'PRADO', + 'quickstart', + 'tutorial', + 'sample', + 'for the', + 'TJuiSortable', + 'control', + ); + + public function onLoad($param) + { + if(!$this->IsPostback) + { + $this->repeater1->DataSource=$this->data; + $this->repeater1->dataBind(); + } + } + + public function repeater1_onStop($sender, $param) + { + $this->label1->Text="Items order:"; + $order = $param->getCallbackParameter()->index; + foreach($order as $index) + $this->label1->Text.=' '.$this->data[$index]; + } +} diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/config.xml b/demos/quickstart/protected/pages/JuiControls/Samples/config.xml new file mode 100644 index 00000000..315e42af --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Samples/config.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Id: config.xml 1405 2006-09-10 01:03:56Z wei $ --> +<configuration> + <paths> + <using namespace="System.Web.UI.JuiControls.*" /> + </paths> + <pages MasterClass="SampleLayout" /> +</configuration>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/JuiControls/Widgets.page b/demos/quickstart/protected/pages/JuiControls/Widgets.page new file mode 100644 index 00000000..cf72d41d --- /dev/null +++ b/demos/quickstart/protected/pages/JuiControls/Widgets.page @@ -0,0 +1,28 @@ +<com:TContent ID="body"> +<h1>Jui widgets controls</h1> +<p class="block-content"> +Jui widgets are complex controls built on the foundations of jQuery effects and jQueryUI interactions. +PRADO Jui widgets controls can be divided in two groups: +<ol> + <li>Standard Widgets, extend a control affecting its aspect and functionality: eg. <tt>TJuiProgressbar</tt> transforms an <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> into a Progressbar</li> + <li>List Widgets, take a repeated list of items and relayout their presentation: eg. ... +</ol> +For informations of the specific options of each widget, follow jQuery-UI Widget <a href="http://api.jqueryui.com/category/widgets/">API Documentation</a> for the specific interaction. +</p> + +<a name="TJuiProgressbar"></a> +<h2>TJuiProgressbar</h2> +<com:DocLink ClassPath="System.Web.UI.JuiControls.TJuiProgressbar" /> - <a href="http://api.jqueryui.com/progressbar/">jQuery UI API</a> + +<p class="block-content"> +<tt>TJuiProgressbar</tt> is an extension to <a href="?page=ActiveControls.ActivePanel">TActivePanel</a> based on jQuery-UI's <a href="http://jqueryui.com/progressbar/">Progressbar</a> widget. +</p> + +<p class="block-content"> +The panel takes the aspect of a progressbar ranging from a value of 0 to the value of the <tt>Max</tt> property. The current value can be set using the <tt>Value</tt> property; setting it to <tt>false</tt> will create an undefined progressbar. +</p> + +<com:RunBar PagePath="JuiControls.Samples.TJuiProgressbar.Home" /> +<br/> + +</com:TContent> diff --git a/demos/quickstart/protected/pages/Tutorial/AddressBook.page b/demos/quickstart/protected/pages/Tutorial/AddressBook.page deleted file mode 100755 index f028a636..00000000 --- a/demos/quickstart/protected/pages/Tutorial/AddressBook.page +++ /dev/null @@ -1,9 +0,0 @@ -<com:TContent ID="body">
- <h1 id="22007">A Simple Address Book</h1>
- <p id="110006" class="block-content">This tutorial introduces the basics of connecting to a database
- using <a href="?page=Database.ActiveRecord">ActiveRecord</a>
- and using <a href="?page=Database.Scaffold">Active Record scaffolds </a>to quickly
- build a simple address book.
- </p>
-
-</com:TContent>
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page index d94dfa89..92118720 100755 --- a/demos/quickstart/protected/pages/Tutorial/AjaxChat.page +++ b/demos/quickstart/protected/pages/Tutorial/AjaxChat.page @@ -59,7 +59,6 @@ php prado/framework/prado-cli.php -c chat class Login extends TPage { } -?> </com:TTextHighlighter> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_90029"> <!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -170,7 +169,7 @@ as <tt>App_Code/chat.db</tt>. class ChatUserRecord extends TActiveRecord { const TABLE='chat_users'; - + public $username; public $last_activity; @@ -431,7 +430,6 @@ and a button to send the message. Text="Send" /> </div> </com:TForm> -<com:TJavascriptLogger /> </body> </html> </com:TTextHighlighter> @@ -572,7 +570,7 @@ public function getUserMessages($user) $content = ''; foreach($this->findAll('for_user = ?', $user) as $message) $content .= $this->formatMessage($message); - $this->deleteAll('for_user = ? OR created_on < ?',
+ $this->deleteAll('for_user = ? OR created_on < ?', $user, time() - 300); //5 min inactivity return $content; } @@ -581,7 +579,7 @@ protected function formatMessage($message) { $user = htmlspecialchars($message->from_user); $content = htmlspecialchars($message->message); - return "<div class=\"message\"><strong>{$user}:</strong>"
+ return "<div class=\"message\"><strong>{$user}:</strong>" ." <span>{$content}</span></div>"; } </com:TTextHighlighter> diff --git a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page index 4bec2a28..1abd68b9 100755 --- a/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page +++ b/demos/quickstart/protected/pages/Tutorial/CurrencyConverter.page @@ -34,9 +34,9 @@ <tt>currency-converter</tt> in your current working directory. You may need to change to the appropriate directory first. - See the <a href="?page=GettingStarted.CommandLine">Command Line Tool</a>
- for more details.
- </p>
+ See the <a href="?page=GettingStarted.CommandLine">Command Line Tool</a> + for more details. + </p> <com:TTextHighlighter Language="text" CssClass="source block-content" id="code111"> php prado/framework/prado-cli.php -c currency-converter </com:TTextHighlighter> @@ -52,7 +52,7 @@ php prado/framework/prado-cli.php -c currency-converter <p id="80058" class="block-content">We start by editing the <tt>Home.page</tt> file found in the <tt>currency-converter/protected/pages/</tt> directory. Files ending with ".page" are page templates that contains HTML and Prado controls. - We simply add two textboxes, three labels and one button as follows.
+ We simply add two textboxes, three labels and one button as follows. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="form1"> <com:TForm> @@ -75,7 +75,7 @@ php prado/framework/prado-cli.php -c currency-converter </div> </fieldset> </com:TForm> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="refresh" class="block-content"> If you refresh the page, you should see something similar to the following figure. It may not look very pretty or orderly, but we shall change that later using CSS. @@ -125,7 +125,7 @@ php prado/framework/prado-cli.php -c currency-converter to add a "Home.php" to where "Home.page" is. The <tt>Home</tt> class should extends the <com:DocLink ClassPath="System.Web.UI.TPage" Text="TPage" />, the default base - class for all Prado pages.
+ class for all Prado pages. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code3"> <?php @@ -133,8 +133,7 @@ class Home extends TPage { } -?> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1111" class="block-content"> Prado uses PHP's <tt>__autoload</tt> method to load classes. The convention is to use the class name with ".php" extension as filename. @@ -151,15 +150,15 @@ class Home extends TPage the converted total. To handle the user clicking of the "Convert" button we simply add an <tt>OnClick</tt> property to the "Convert" button in the "Home.page" template and add a corresponding event handler method - in the "Home.php".
+ in the "Home.php". </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code4"> <com:TButton Text="Convert" OnClick="convert_clicked" /> </com:TTextHighlighter> - <p id="222" class="block-content">
+ <p id="222" class="block-content"> The value of the <tt>OnClick</tt>, "<tt>convert_clicked</tt>", will be the method name in the "Home.php" that will called when the user clicks on the - "Convert" button.
+ "Convert" button. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code5"> class Home extends TPage @@ -171,8 +170,8 @@ class Home extends TPage $this->total->Text = $rate * $dollars; } } -</com:TTextHighlighter>
-<div id="3332" class="block-content">
+</com:TTextHighlighter> +<div id="3332" class="block-content"> <p id="333"> If you run the application in your web browser, enter some values and click the "Convert" button then you should see that calculated value displayed next @@ -186,24 +185,24 @@ class Home extends TPage </p> <p id="80067">We shall now examine, the three lines that implements the simply currency - conversion in the "<tt>convert_clicked</tt>" method.
- </p>
+ conversion in the "<tt>convert_clicked</tt>" method. + </p> </div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code6" > $rate = floatval($this->currencyRate->Text); -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="444" class="block-content"> The statement <tt>$this->currencyRate</tt> corresponds to the <tt>TTextBox</tt> component with <tt>ID</tt> value "currencyRate" in the "Home.page" template. The <tt>Text</tt> property of the <tt>TTextBox</tt> contains the value that the user entered. So, we obtain this value by <tt>$this->currencyRate->Text</tt> which we convert the - value to a float value.
+ value to a float value. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code7"> $dollars = floatval($this->dollars->Text); -</com:TTextHighlighter>
-<div id="5551" class="block-content">
+</com:TTextHighlighter> +<div id="5551" class="block-content"> <p id="555"> The next line does a similar things, it takes the user value from the <tt>TTextBox</tt> with <tt>ID</tt> value "dollars and converts it to @@ -212,9 +211,9 @@ $dollars = floatval($this->dollars->Text); <p id="80068">The third line calculates the new amount and set this value in the <tt>Text</tt> property of the <tt>TLabel</tt> with <tt>ID="total"</tt>. - Thus, we display the new amount to the user in the label.
+ Thus, we display the new amount to the user in the label. </p> -</div>
+</div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code8"> $this->total->Text = $rate * $dollars; </com:TTextHighlighter> @@ -233,14 +232,14 @@ $this->total->Text = $rate * $dollars; <li>the user enters a value,</li> <li>the currency rate is a valid number,</li> <li>the currency rate is positive.</li> - </ol>
+ </ol> <p id="666" class="block-content"> To ensure 1 we add one <com:DocLink ClassPath="System.Web.UI.WebControls.TRequiredFieldValidator" Text="TRequiredFieldValidator" />. To ensure 2 and 3, we add one <com:DocLink ClassPath="System.Web.UI.WebControls.TCompareValidator" Text="TCompareValidator" />. We may add these validators any where within the "Home.page" template. Further details regarding these validator and other validators can be found in the - <a href="?page=Controls.Validation">Validation Controls</a> page.
+ <a href="?page=Controls.Validation">Validation Controls</a> page. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9"> <com:TRequiredFieldValidator @@ -258,12 +257,12 @@ $this->total->Text = $rate * $dollars; <ol id="o222" class="block-content"> <li>the user enters a value,</li> <li>the value is a valid number (not including any currency or dollar signs).</li> - </ol>
+ </ol> <p id="777" class="block-content"> To ensure 1 we just add another <tt>TRequiredFieldValidator</tt>, for 2 we could use a <com:DocLink ClassPath="System.Web.UI.WebControls.TDataTypeValidator" Text="TDataTypeValidator" />. For simplicity we only allow the user to enter - a number for the amount they wish to convert.
+ a number for the amount they wish to convert. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9a"> <com:TRequiredFieldValidator @@ -283,7 +282,7 @@ $this->total->Text = $rate * $dollars; using both javascript and server side. The server side validation is <b>always performed</b>. For the server side, we should skip the calculation if the validators are not satisfied. This can - done as follows.
+ done as follows. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code10" > public function convert_clicked($sender, $param) @@ -313,7 +312,7 @@ public function convert_clicked($sender, $param) In addition, we can change the "totals" <tt>TLabel</tt> with the Active Control counter part, <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveLabel" Text="TActiveLabel" />, such that the server side can update the browser without - reloading the page.
+ reloading the page. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code11"> <div class="total-field"> @@ -323,11 +322,11 @@ public function convert_clicked($sender, $param) <div class="convert-button"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" /> </div> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1232" class="block-content"> The server side logic remains the same, we just need to import the Active Controls name space as they are not included by default. We - add the following line to the begin of "Home.php".
+ add the following line to the begin of "Home.php". </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code12"> Prado::using('System.Web.UI.ActiveControls.*'); @@ -345,7 +344,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <p id="80076" class="block-content">To indicate that the calculation is in progress, we can change the text of the "total" label as follows. We add a <tt>ClientSide.OnLoading</tt> property to the "Convert" button (since this button is responsible for requesting - the calculation).
+ the calculation). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code13"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" > @@ -383,7 +382,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <p id="80080" class="block-content">We simply create a CSS file named "common.css" and save it in the <tt>themes/Basic</tt> directory. Then we add the following code - to the beginning of "Home.page" (we add a little more HTML as well).
+ to the beginning of "Home.page" (we add a little more HTML as well). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code14"> <%@ Theme="Basic" %> @@ -392,7 +391,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <com:THead Title="Currency Converter" /> <body> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="4334" class="block-content"> The first line <tt><%@ Theme="Basic" %></tt> defines the theme to be used for this page. The diff --git a/demos/quickstart/protected/pages/Tutorial/fr/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/fr/AjaxChat.page index 66bb0e43..568e920f 100755 --- a/demos/quickstart/protected/pages/Tutorial/fr/AjaxChat.page +++ b/demos/quickstart/protected/pages/Tutorial/fr/AjaxChat.page @@ -58,7 +58,6 @@ php prado/framework/prado-cli.php -c chat class Login extends TPage { } -?> </com:TTextHighlighter> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_90029"> <!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -430,7 +429,6 @@ and a button to send the message. Text="Send" /> </div> </com:TForm> -<com:TJavascriptLogger /> </body> </html> </com:TTextHighlighter> @@ -571,7 +569,7 @@ public function getUserMessages($user) $content = ''; foreach($this->findAll('for_user = ?', $user) as $message) $content .= $this->formatMessage($message); - $this->deleteAll('for_user = ? OR created_on < ?',
+ $this->deleteAll('for_user = ? OR created_on < ?', $user, time() - 300); //5 min inactivity return $content; } @@ -580,7 +578,7 @@ protected function formatMessage($message) { $user = htmlspecialchars($message->from_user); $content = htmlspecialchars($message->message); - return "<div class=\"message\"><strong>{$user}:</strong>"
+ return "<div class=\"message\"><strong>{$user}:</strong>" ." <span>{$content}</span></div>"; } </com:TTextHighlighter> diff --git a/demos/quickstart/protected/pages/Tutorial/fr/CurrencyConverter.page b/demos/quickstart/protected/pages/Tutorial/fr/CurrencyConverter.page index 2cce2336..6b8c7bc3 100755 --- a/demos/quickstart/protected/pages/Tutorial/fr/CurrencyConverter.page +++ b/demos/quickstart/protected/pages/Tutorial/fr/CurrencyConverter.page @@ -34,9 +34,9 @@ <tt>currency-converter</tt> in your current working directory. You may need to change to the appropriate directory first. - See the <a href="?page=GettingStarted.CommandLine">Command Line Tool</a>
- for more details.
- </p>
+ See the <a href="?page=GettingStarted.CommandLine">Command Line Tool</a> + for more details. + </p> <com:TTextHighlighter Language="text" CssClass="source block-content" id="code111"> php prado/framework/prado-cli.php -c currency-converter </com:TTextHighlighter> @@ -52,7 +52,7 @@ php prado/framework/prado-cli.php -c currency-converter <p id="80058" class="block-content">We start by editing the <tt>Home.page</tt> file found in the <tt>currency-converter/protected/pages/</tt> directory. Files ending with ".page" are page templates that contains HTML and Prado controls. - We simply add two textboxes, three labels and one button as follows.
+ We simply add two textboxes, three labels and one button as follows. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="form1"> <com:TForm> @@ -75,7 +75,7 @@ php prado/framework/prado-cli.php -c currency-converter </div> </fieldset> </com:TForm> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="refresh" class="block-content"> If you refresh the page, you should see something similar to the following figure. It may not look very pretty or orderly, but we shall change that later using CSS. @@ -125,7 +125,7 @@ php prado/framework/prado-cli.php -c currency-converter to add a "Home.php" to where "Home.page" is. The <tt>Home</tt> class should extends the <com:DocLink ClassPath="System.Web.UI.TPage" Text="TPage" />, the default base - class for all Prado pages.
+ class for all Prado pages. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code3"> <?php @@ -133,8 +133,7 @@ class Home extends TPage { } -?> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1111" class="block-content"> Prado uses PHP's <tt>__autoload</tt> method to load classes. The convention is to use the class name with ".php" extension as filename. @@ -151,15 +150,15 @@ class Home extends TPage the converted total. To handle the user clicking of the "Convert" button we simply add an <tt>OnClick</tt> property to the "Convert" button in the "Home.page" template and add a corresponding event handler method - in the "Home.php".
+ in the "Home.php". </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code4"> <com:TButton Text="Convert" OnClick="convert_clicked" /> </com:TTextHighlighter> - <p id="222" class="block-content">
+ <p id="222" class="block-content"> The value of the <tt>OnClick</tt>, "<tt>convert_clicked</tt>", will be the method name in the "Home.php" that will called when the user clicks on the - "Convert" button.
+ "Convert" button. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code5"> class Home extends TPage @@ -171,8 +170,8 @@ class Home extends TPage $this->total->Text = $rate * $dollars; } } -</com:TTextHighlighter>
-<div id="3332" class="block-content">
+</com:TTextHighlighter> +<div id="3332" class="block-content"> <p id="333"> If you run the application in your web browser, enter some values and click the "Convert" button then you should see that calculated value displayed next @@ -186,24 +185,24 @@ class Home extends TPage </p> <p id="80067">We shall now examine, the three lines that implements the simply currency - conversion in the "<tt>convert_clicked</tt>" method.
- </p>
+ conversion in the "<tt>convert_clicked</tt>" method. + </p> </div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code6" > $rate = floatval($this->currencyRate->Text); -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="444" class="block-content"> The statement <tt>$this->currencyRate</tt> corresponds to the <tt>TTextBox</tt> component with <tt>ID</tt> value "currencyRate" in the "Home.page" template. The <tt>Text</tt> property of the <tt>TTextBox</tt> contains the value that the user entered. So, we obtain this value by <tt>$this->currencyRate->Text</tt> which we convert the - value to a float value.
+ value to a float value. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code7"> $dollars = floatval($this->dollars->Text); -</com:TTextHighlighter>
-<div id="5551" class="block-content">
+</com:TTextHighlighter> +<div id="5551" class="block-content"> <p id="555"> The next line does a similar things, it takes the user value from the <tt>TTextBox</tt> with <tt>ID</tt> value "dollars and converts it to @@ -212,9 +211,9 @@ $dollars = floatval($this->dollars->Text); <p id="80068">The third line calculates the new amount and set this value in the <tt>Text</tt> property of the <tt>TLabel</tt> with <tt>ID="total"</tt>. - Thus, we display the new amount to the user in the label.
+ Thus, we display the new amount to the user in the label. </p> -</div>
+</div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code8"> $this->total->Text = $rate * $dollars; </com:TTextHighlighter> @@ -233,14 +232,14 @@ $this->total->Text = $rate * $dollars; <li>the user enters a value,</li> <li>the currency rate is a valid number,</li> <li>the currency rate is positive.</li> - </ol>
+ </ol> <p id="666" class="block-content"> To ensure 1 we add one <com:DocLink ClassPath="System.Web.UI.WebControls.TRequiredFieldValidator" Text="TRequiredFieldValidator" />. To ensure 2 and 3, we add one <com:DocLink ClassPath="System.Web.UI.WebControls.TCompareValidator" Text="TCompareValidator" />. We may add these validators any where within the "Home.page" template. Further details regarding these validator and other validators can be found in the - <a href="?page=Controls.Validation">Validation Controls</a> page.
+ <a href="?page=Controls.Validation">Validation Controls</a> page. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9"> <com:TRequiredFieldValidator @@ -258,12 +257,12 @@ $this->total->Text = $rate * $dollars; <ol id="o222" class="block-content"> <li>the user enters a value,</li> <li>the value is a valid number (not including any currency or dollar signs).</li> - </ol>
+ </ol> <p id="777" class="block-content"> To ensure 1 we just add another <tt>TRequiredFieldValidator</tt>, for 2 we could use a <com:DocLink ClassPath="System.Web.UI.WebControls.TDataTypeValidator" Text="TDataTypeValidator" />. For simplicity we only allow the user to enter - a number for the amount they wish to convert.
+ a number for the amount they wish to convert. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9a"> <com:TRequiredFieldValidator @@ -283,7 +282,7 @@ $this->total->Text = $rate * $dollars; using both javascript and server side. The server side validation is <b>always performed</b>. For the server side, we should skip the calculation if the validators are not satisfied. This can - done as follows.
+ done as follows. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code10" > public function convert_clicked($sender, $param) @@ -310,7 +309,7 @@ public function convert_clicked($sender, $param) In addition, we can change the "totals" <tt>TLabel</tt> with the Active Control counter part, <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveLabel" Text="TActiveLabel" />, such that the server side can update the browser without - reloading the page.
+ reloading the page. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code11"> <div class="total-field"> @@ -320,11 +319,11 @@ public function convert_clicked($sender, $param) <div class="convert-button"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" /> </div> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1232" class="block-content"> The server side logic remains the same, we just need to import the Active Controls name space as they are not included by default. We - add the following line to the begin of "Home.php".
+ add the following line to the begin of "Home.php". </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code12"> Prado::using('System.Web.UI.ActiveControls.*'); @@ -342,7 +341,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <p id="80076" class="block-content">To indicate that the calculation is in progress, we can change the text of the "total" label as follows. We add a <tt>ClientSide.OnLoading</tt> property to the "Convert" button (since this button is responsible for requesting - the calculation).
+ the calculation). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code13"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" > @@ -380,7 +379,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <p id="80080" class="block-content">We simply create a CSS file named "common.css" and save it in the <tt>themes/Basic</tt> directory. Then we add the following code - to the beginning of "Home.page" (we add a little more HTML as well).
+ to the beginning of "Home.page" (we add a little more HTML as well). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code14"> <%@ Theme="Basic" %> @@ -389,7 +388,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <com:THead Title="Currency Converter" /> <body> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="4334" class="block-content"> The first line <tt><%@ Theme="Basic" %></tt> defines the theme to be used for this page. The diff --git a/demos/quickstart/protected/pages/Tutorial/id/AjaxChat.page b/demos/quickstart/protected/pages/Tutorial/id/AjaxChat.page index 00222bca..50759868 100755 --- a/demos/quickstart/protected/pages/Tutorial/id/AjaxChat.page +++ b/demos/quickstart/protected/pages/Tutorial/id/AjaxChat.page @@ -55,7 +55,6 @@ php prado/framework/prado-cli.php -c chat class Login extends TPage
{
}
-?>
</com:TTextHighlighter>
<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_90029">
<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN"
diff --git a/demos/quickstart/protected/pages/Tutorial/id/CurrencyConverter.page b/demos/quickstart/protected/pages/Tutorial/id/CurrencyConverter.page index d8f8e2b4..c1eae035 100755 --- a/demos/quickstart/protected/pages/Tutorial/id/CurrencyConverter.page +++ b/demos/quickstart/protected/pages/Tutorial/id/CurrencyConverter.page @@ -1,8 +1,8 @@ <com:TContent ID="body"> <h1 id="16001">Membangun Pengubah Kurs Sederhana</h1> <p id="80053" class="block-content">Tutorial ini memperkenalkan kerangka kerja aplikasi web Prado dan mengajarkan Anda bagaimana untuk - membangun aplikasi web sederhana dalam beberapa langkah sederhana. Tutorial - ini menganggap bahwa Anda terbiasa dengan PHP dan Anda telah mengakses + membangun aplikasi web sederhana dalam beberapa langkah sederhana. Tutorial + ini menganggap bahwa Anda terbiasa dengan PHP dan Anda telah mengakses server web yang dapat melayani naskah PHP5. </p> @@ -25,9 +25,9 @@ <p id="80056" class="block-content">Cara tercepat dan termudah untuk membuat aplikasi web Prado baru adalah menggunakan piranti perintah <tt>prado-cli.php</tt> yang ditemukan dalam direktori <tt>framework</tt> pada distribusi Prado. Kita membuat aplikasi baru dengan menjalankan perintah berikut dalam prompt perintah atau konsol Anda. Perintah membuat direktori baru bernama <tt>currency-converter</tt> dalam direktori kerja Anda saat ini. Anda perlu mengubahnya ke direktori yang benar terlebih dahulu. - Lihat <a href="?page=GettingStarted.CommandLine">Piranti Baris Perintah</a>
- untuk lebih jelasnya.
- </p>
+ Lihat <a href="?page=GettingStarted.CommandLine">Piranti Baris Perintah</a> + untuk lebih jelasnya. + </p> <com:TTextHighlighter Language="text" CssClass="source block-content" id="code111"> php prado/framework/prado-cli.php -c currency-converter </com:TTextHighlighter> @@ -39,7 +39,7 @@ php prado/framework/prado-cli.php -c currency-converter <h1 id="16003">Membuat Antarmuka Pengguna Pengubah Kurs</h1> <p id="80058" class="block-content">Kita mulai dengan mengedit file <tt>Home.page</tt> yang ditemukan dalam direktori <tt>currency-converter/protected/pages/</tt>. File yang berakhiran dengan ".page" adalah template halaman yang berisi HTML dan kontrol Prado. - Kita cukup menambah dua kotak teks, tiga label dan satu tombol seperti berikut.
+ Kita cukup menambah dua kotak teks, tiga label dan satu tombol seperti berikut. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="form1"> <com:TForm> @@ -62,7 +62,7 @@ php prado/framework/prado-cli.php -c currency-converter </div> </fieldset> </com:TForm> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="refresh" class="block-content"> Jika Anda menyegarkan halaman, Anda akan melihat sesuatu mirip dengan gambar berikut. Ia mungkin terlihat tidak cukup bagus atau berurut, tapi kita akan mengubahnya nanti dengan menggunakan CSS. @@ -82,7 +82,7 @@ php prado/framework/prado-cli.php -c currency-converter <com:DocLink ClassPath="System.Web.UI.WebControls.TTextBox" Text="TTextBox" /> yang pada dasarnya mendefinisikan sebuah label dan kotak teks bagi pengguna aplikasi untuk memasukan nilai pertukaran kurs. - Nilai properti <tt>ForControl</tt> property menentukan komponen mana label + Nilai properti <tt>ForControl</tt> property menentukan komponen mana label diperuntukan. Ini membolehkan pengguna aplikasi mengklik pada label untuk memfokuskan pada field (hal yang baik). Anda mungkin telah menggunakan elemen biasa HTML <tt><label></tt> untuk melakukan hal yang sama, tapi @@ -109,7 +109,7 @@ php prado/framework/prado-cli.php -c currency-converter <p id="80063" class="block-content">Jika Anda mencoba mengklik pada tombol "Convert" kemudian halaman akan menyegarkan dan tidak melakukan apapun. Agar tombol melakukan beberapa pekerjaan, kita perlu menambahkan "Home.php" ke di mana "Home.page" berada. Kelas <tt>Home</tt> harus - memperluas <com:DocLink ClassPath="System.Web.UI.TPage" Text="TPage" />, basis kelas standar untuk semua halaman Prado.
+ memperluas <com:DocLink ClassPath="System.Web.UI.TPage" Text="TPage" />, basis kelas standar untuk semua halaman Prado. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code3"> <?php @@ -117,8 +117,7 @@ class Home extends TPage { } -?> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1111" class="block-content"> Prado menggunakan metode PHP <tt>__autoload</tt> untuk mengambil kelas. Konvensi adalah untuk menggunakan nama kelas dengan ekstensi ".php" sebagai nama file. @@ -134,14 +133,14 @@ class Home extends TPage nilai dalam kotak teks, melakukan beberapa perhitungan dan menyajikan kepada pengguna dengan total nilai yang dikonversi. Untuk menangani pengguna mengklik pada tombo "Convert", kita cukup menambahkan sebuah properti <tt>OnClick</tt> ke tombol "Convert" dalam - template "Home.page" dan menambahkan metode pengendali event terkait dalam "Home.php".
+ template "Home.page" dan menambahkan metode pengendali event terkait dalam "Home.php". </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code4"> <com:TButton Text="Convert" OnClick="convert_clicked" /> </com:TTextHighlighter> - <p id="222" class="block-content">
+ <p id="222" class="block-content"> Nilai dari <tt>OnClick</tt>, "<tt>convert_clicked</tt>", akan menjadi nama metode - dalam "Home.php" yang akan dipanggil saat pengguna mengklik tombol "Convert".
+ dalam "Home.php" yang akan dipanggil saat pengguna mengklik tombol "Convert". </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code5"> class Home extends TPage @@ -153,8 +152,8 @@ class Home extends TPage $this->total->Text = $rate * $dollars; } } -</com:TTextHighlighter>
-<div id="3332" class="block-content">
+</com:TTextHighlighter> +<div id="3332" class="block-content"> <p id="333"> Jika Anda menjalankan aplikasi dalam web browser Anda, masukkan beberapa nilai dan klik tombol "Convert" kemudian Anda akan melihat nilai yang dihitung ditampilkan @@ -168,24 +167,24 @@ class Home extends TPage </p> <p id="80067">Sekarang kita akan memeriksa, tiga baris yang mengimplementasikan konversi - kurs sederhana dalam metode "<tt>convert_clicked</tt>".
- </p>
+ kurs sederhana dalam metode "<tt>convert_clicked</tt>". + </p> </div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code6" > $rate = floatval($this->currencyRate->Text); -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="444" class="block-content"> Pernyataan <tt>$this->currencyRate</tt> berhubungan dengan komponen <tt>TTextBox</tt> dengan nilai <tt>ID</tt> "currencyRate" dalam template "Home.page". Properti <tt>Text</tt> dari <tt>TTextBox</tt> berisi nilai yang dimasukan oleh pengguna. Maka kita memperoleh nilai ini dengan <tt>$this->currencyRate->Text</tt> yang kita konversi nilainya ke nilai - pecahan.
+ pecahan. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code7"> $dollars = floatval($this->dollars->Text); -</com:TTextHighlighter>
-<div id="5551" class="block-content">
+</com:TTextHighlighter> +<div id="5551" class="block-content"> <p id="555"> Baris berikutnya melakukan hal yang mirip, ia mengambil nilai pengguna dari <tt>TTextBox</tt> dengan nilai <tt>ID</tt> "dollars dang mengubahnya @@ -194,9 +193,9 @@ $dollars = floatval($this->dollars->Text); <p id="80068">Baris ketiga menghitung jumlah baru dan menyetel nilai ini dalam properti <tt>Text</tt> dari <tt>TLabel</tt> dengan <tt>ID="total"</tt>. - Selanjutnya, kita tampilkan jumlah baru ke pengguna dalam label.
+ Selanjutnya, kita tampilkan jumlah baru ke pengguna dalam label. </p> -</div>
+</div> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code8"> $this->total->Text = $rate * $dollars; </com:TTextHighlighter> @@ -210,11 +209,11 @@ $this->total->Text = $rate * $dollars; <li>pengguna memasukan sebuah nilai,</li> <li>kurs mata uang adalah angka yang benar,</li> <li>kurs mata uang adalah positif.</li> - </ol>
+ </ol> <p id="666" class="block-content"> Untuk memastikan poin 1 kita menambahkan satu <com:DocLink ClassPath="System.Web.UI.WebControls.TRequiredFieldValidator" Text="TRequiredFieldValidator" />. Untuk memastikan poin 2 dan 3, kita menambahkan satu <com:DocLink ClassPath="System.Web.UI.WebControls.TCompareValidator" Text="TCompareValidator" />. Kita dapat menambahkan validator ini di mana saja di dalam template "Home.page". Perincian selanjutnya mengenai validator ini dan validator lainnya dapat ditemukan dalam halaman - <a href="?page=Controls.Validation">Validation Controls</a>.
+ <a href="?page=Controls.Validation">Validation Controls</a>. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9"> <com:TRequiredFieldValidator @@ -232,11 +231,11 @@ $this->total->Text = $rate * $dollars; <ol id="o222" class="block-content"> <li>pengguna memasukan sebuah nilai,</li> <li>nilai adalah angka yang benar (tidak menyertakan tanda kurs atau dolar).</li> - </ol>
+ </ol> <p id="777" class="block-content"> Untuk memastikan 1 kita cukup menambahkan <tt>TRequiredFieldValidator</tt> lainnya, untuk 2 kita dapat menggunakan - <com:DocLink ClassPath="System.Web.UI.WebControls.TDataTypeValidator" Text="TDataTypeValidator" />. Untuk memudahkan kita hanya membolehkan pengguna untuk memasukan sebuah angka untuk jumlah yang ingin mereka ubah.
+ <com:DocLink ClassPath="System.Web.UI.WebControls.TDataTypeValidator" Text="TDataTypeValidator" />. Untuk memudahkan kita hanya membolehkan pengguna untuk memasukan sebuah angka untuk jumlah yang ingin mereka ubah. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code9a"> <com:TRequiredFieldValidator @@ -249,8 +248,8 @@ $this->total->Text = $rate * $dollars; </com:TTextHighlighter> </p> - <p id="80072" class="block-content">Sekarang jika Anda mencoba memasukan beberapa data tidak benar dalam aplikasi atau membiarkan field kosong - validators akan diaktifkan dan menyajikan pesan kesalahan kepada pengguna. Catatan bahwa pesan kesalahan disajikan tanpa mengambil ulang halaman. Validator Prado standarnya memvalidasi javascript dan di dalam server. Validasi di dalam server <b>selalu dilakukan</b>. Untuk sisi server, kita harus melewati perhitungan jika validator tidak memuaskan. Ini dapat dilakukan seperti berikut.
+ <p id="80072" class="block-content">Sekarang jika Anda mencoba memasukan beberapa data tidak benar dalam aplikasi atau membiarkan field kosong + validators akan diaktifkan dan menyajikan pesan kesalahan kepada pengguna. Catatan bahwa pesan kesalahan disajikan tanpa mengambil ulang halaman. Validator Prado standarnya memvalidasi javascript dan di dalam server. Validasi di dalam server <b>selalu dilakukan</b>. Untuk sisi server, kita harus melewati perhitungan jika validator tidak memuaskan. Ini dapat dilakukan seperti berikut. </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code10" > public function convert_clicked($sender, $param) @@ -276,7 +275,7 @@ memperbaiki pengalaman pengguna dengan meningkatkan tanggapan aplikasi. Satu car <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveButton" Text="TActiveButton" />, yang dapat memicu event klik di dalam server tanpa mengambil ulang halaman. Sebagai tambahan, kita dapat mengubah "total" <tt>TLabel</tt> dengan pasangan Kontrol Aktif, - <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveLabel" Text="TActiveLabel" />, dengan demikian di dalam server dapat memutakhirkan browser tanpa mengambil ulang halaman.
+ <com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveLabel" Text="TActiveLabel" />, dengan demikian di dalam server dapat memutakhirkan browser tanpa mengambil ulang halaman. </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code11"> <div class="total-field"> @@ -286,10 +285,10 @@ memperbaiki pengalaman pengguna dengan meningkatkan tanggapan aplikasi. Satu car <div class="convert-button"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" /> </div> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="1232" class="block-content"> Logika di dalam server tetap sama, kita hanya perlu mengimpor - ruang nama Kontrol Aktif karena secara standar tidak disertakan. Kita menambahkan baris berikut ke awal "Home.php".
+ ruang nama Kontrol Aktif karena secara standar tidak disertakan. Kita menambahkan baris berikut ke awal "Home.php". </p> <com:TTextHighlighter Language="php" CssClass="source block-content" id="code12"> Prado::using('System.Web.UI.ActiveControls.*'); @@ -300,7 +299,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); Selanjutnya kita bisa memperbaiki pengalaman pengguna dengan mengunah label teks "total" menjadi "calculating..." saat pengguna mengklik tombol "Convert". Label teks "total" masih dimutakhirkan dengan jumlah perhitungan baru seperti sebelumnya. </p> - <p id="80076" class="block-content">Untuk mengindikasikan bahwa perhitungan sedang berlangsung, kita dapat mengubah label teks "total" sebagai berikut. Kita menambahkan properti <tt>ClientSide.OnLoading</tt> ke tombol "Convert" (karena tombol ini bertanggung jawab terhadap permintaan perhitungan).
+ <p id="80076" class="block-content">Untuk mengindikasikan bahwa perhitungan sedang berlangsung, kita dapat mengubah label teks "total" sebagai berikut. Kita menambahkan properti <tt>ClientSide.OnLoading</tt> ke tombol "Convert" (karena tombol ini bertanggung jawab terhadap permintaan perhitungan). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code13"> <com:TActiveButton Text="Convert" OnClick="convert_clicked" > @@ -325,7 +324,7 @@ Prado::using('System.Web.UI.ActiveControls.*'); </p> <p id="80080" class="block-content">Kita cukup dengan membuat file CSS bernama "common.css" dan menyimpannya dalam direktori - <tt>themes/Basic</tt>. Kemudian kita menambahkan kode berikut ke awal "Home.page" (kita menambahkan sedikit kode HTML juga).
+ <tt>themes/Basic</tt>. Kemudian kita menambahkan kode berikut ke awal "Home.page" (kita menambahkan sedikit kode HTML juga). </p> <com:TTextHighlighter Language="prado" CssClass="source block-content" id="code14"> <%@ Theme="Basic" %> @@ -334,10 +333,10 @@ Prado::using('System.Web.UI.ActiveControls.*'); <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <com:THead Title="Currency Converter" /> <body> -</com:TTextHighlighter>
+</com:TTextHighlighter> <p id="4334" class="block-content"> Baris pertama <tt><%@ Theme="Basic" %></tt> mendefinisikan tema - yang dipakai untuk halaman ini. + yang dipakai untuk halaman ini. <com:DocLink ClassPath="System.Web.UI.WebControls.THead" Text="THead" /> merujuk ke elemen HTML <tt><head></tt>. Sebagai tambahan terhadap tampilan properti <tt>Title</tt> pada <tt>THead</tt>, semua file CSS |