summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Home.page7
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Interactions.page2
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.page55
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiProgressbar/Home.php14
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Widgets.page28
-rw-r--r--framework/Web/UI/JuiControls/TJuiProgressbar.php137
6 files changed, 238 insertions, 5 deletions
diff --git a/demos/quickstart/protected/pages/JuiControls/Home.page b/demos/quickstart/protected/pages/JuiControls/Home.page
index bc087e73..2573b162 100644
--- a/demos/quickstart/protected/pages/JuiControls/Home.page
+++ b/demos/quickstart/protected/pages/JuiControls/Home.page
@@ -74,12 +74,11 @@ For informations of the specific options of each interaction, follow jQuery-UI I
</li>
</ul>
-<h2>PRADO Jui controls</h2>
+<h2>PRADO Jui widgets controls</h2>
<ul id="u2" class="block-content">
<li>
- <a href="?page=JuiControls.TJuiAutocomplete">TJuiAutocomplete</a>
- displays a textbox where the user can choose from a list of suggestions.
- <com:RunBar PagePath="JuiControls.Samples.TJuiAutocomplete.Home" />
+ <a href="?page=JuiControls.Widgets#TJuiProgressbar">TJuiProgressbar</a>
+ displays a progress bar.
</li>
</ul>
diff --git a/demos/quickstart/protected/pages/JuiControls/Interactions.page b/demos/quickstart/protected/pages/JuiControls/Interactions.page
index 490daec6..2b48da68 100644
--- a/demos/quickstart/protected/pages/JuiControls/Interactions.page
+++ b/demos/quickstart/protected/pages/JuiControls/Interactions.page
@@ -1,7 +1,7 @@
<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 there interactions to a <a href="?page=ActiveControls.ActivePanel">TActivePanel</a>
+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>
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/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/framework/Web/UI/JuiControls/TJuiProgressbar.php b/framework/Web/UI/JuiControls/TJuiProgressbar.php
new file mode 100644
index 00000000..41f3eab4
--- /dev/null
+++ b/framework/Web/UI/JuiControls/TJuiProgressbar.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * TJuiProgressbar class file.
+ *
+ * @author Fabio Bas <ctrlaltca[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2013-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Web.UI.JuiControls
+ */
+
+Prado::using('System.Web.UI.JuiControls.TJuiControlAdapter');
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+
+/**
+ * TJuiProgressbar class.
+ *
+ * TJuiProgressbar is an extension to {@link TActivePanel} based on jQuery-UI's
+ * {@link http://jqueryui.com/progressbar/ Progressbar} widget.
+ *
+ * <code>
+ * <com:TJuiProgressbar
+ * ID="pbar1"
+ * Options.Max="100"
+ * Options.Value="75"
+ * OnChange="pbar1_changed"
+ * />
+ * </code>
+ *
+ * @author Fabio Bas <ctrlaltca[at]gmail[dot]com>
+ * @package System.Web.UI.JuiControls
+ * @since 3.3
+ */
+class TJuiProgressbar extends TActivePanel implements IJuiOptions, ICallbackEventHandler
+{
+ protected $_options;
+
+ /**
+ * Creates a new callback control, sets the adapter to
+ * TActiveControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, by calling this constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setAdapter(new TJuiControlAdapter($this));
+ }
+
+ /**
+ * Object containing defined javascript options
+ * @return TJuiControlOptions
+ */
+ public function getOptions()
+ {
+ if($this->_options===null)
+ $this->_options=new TJuiControlOptions($this);
+ return $this->_options;
+ }
+
+ /**
+ * Array containing valid javascript options
+ * @return array()
+ */
+ public function getValidOptions()
+ {
+ return array('disabled', 'max', 'value');
+ }
+
+ /**
+ * Array containing valid javascript events
+ * @return array()
+ */
+ public function getValidEvents()
+ {
+ return array('change', 'complete', 'create');
+ }
+
+ /**
+ * @return array list of callback options.
+ */
+ protected function getPostBackOptions()
+ {
+ return $this->getOptions()->toArray();
+ }
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+
+ $writer->addAttribute('id',$this->getClientID());
+ $options=TJavascript::encode($this->getPostBackOptions());
+ $cs=$this->getPage()->getClientScript();
+ $code="jQuery('#".$this->getClientId()."').progressbar(".$options.");";
+ $cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
+ }
+
+ /**
+ * Raises callback event. This method is required by the {@link ICallbackEventHandler}
+ * interface.
+ * @param TCallbackEventParameter the parameter associated with the callback event
+ */
+ public function raiseCallbackEvent($param)
+ {
+ $this->getOptions()->raiseCallbackEvent($param);
+ }
+
+ /**
+ * Raises the OnChange event
+ * @param object $params event parameters
+ */
+ public function onChange($params)
+ {
+ $this->raiseEvent('OnChange', $this, $params);
+ }
+
+ /**
+ * Raises the OnComplete event
+ * @param object $params event parameters
+ */
+ public function onComplete($params)
+ {
+ $this->raiseEvent('OnComplete', $this, $params);
+ }
+
+ /**
+ * Raises the OnCreate event
+ * @param object $params event parameters
+ */
+ public function onCreate($params)
+ {
+ $this->raiseEvent('OnCreate', $this, $params);
+ }
+}