summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-25 09:08:40 +0000
committerctrlaltca@gmail.com <>2011-06-25 09:08:40 +0000
commitcda44920115f2aadd7c3fbe2df13cb48a2cbc0c5 (patch)
treeb367d872dcf3cec40497f4d6755ce7bb47312058
parent87e7366d4d9d3de79772b851f8772a4011d6227d (diff)
applied further "progressive rendering" patches (#235)
added TFlushOutput component fixed THtmlarea quickstart demo
-rw-r--r--.gitattributes1
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page24
-rw-r--r--framework/Web/Javascripts/source/packages.php4
-rw-r--r--framework/Web/THttpResponse.php10
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveDatePicker.php8
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveFileUpload.php4
-rwxr-xr-xframework/Web/UI/ActiveControls/TDraggable.php2
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php14
-rw-r--r--framework/Web/UI/WebControls/TFlushOutput.php86
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php2
-rw-r--r--framework/Web/UI/WebControls/TPanel.php30
11 files changed, 138 insertions, 47 deletions
diff --git a/.gitattributes b/.gitattributes
index f76c026f..fea7181d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2955,6 +2955,7 @@ framework/Web/UI/WebControls/TEditCommandColumn.php -text
framework/Web/UI/WebControls/TEmailAddressValidator.php -text
framework/Web/UI/WebControls/TExpression.php -text
framework/Web/UI/WebControls/TFileUpload.php -text
+framework/Web/UI/WebControls/TFlushOutput.php -text
framework/Web/UI/WebControls/TFont.php -text
framework/Web/UI/WebControls/THead.php -text
framework/Web/UI/WebControls/THeader1.php -text
diff --git a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
index b290ce98..5150922f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
@@ -14,33 +14,13 @@ THtmlArea with default settings:
</td></tr>
<tr><td class="samplenote">
-Full featured THtmlArea example
+THtmlArea with manually set options
</td><td class="sampleaction">
<com:THtmlArea ID="HtmlArea2" Width="670px" Height="300px">
<prop:Options>
theme : "advanced",
- plugins : "devkit,style,layer,table,save,advhr,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
- theme_advanced_buttons1_add_before : "save,newdocument,separator,styleselect",
- theme_advanced_buttons1_add : "separator,insertdate,inserttime,preview,separator,advsearchreplace",
- theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
- theme_advanced_buttons3 : "tablecontrols,separator,emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
- theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "left",
- theme_advanced_path_location : "bottom",
- content_css : "example_full.css",
- plugin_insertdate_dateFormat : "%Y-%m-%d",
- plugin_insertdate_timeFormat : "%H:%M:%S",
- extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
- external_link_list_url : "example_link_list.js",
- external_image_list_url : "example_image_list.js",
- flash_external_list_url : "example_flash_list.js",
- media_external_list_url : "example_media_list.js",
- file_browser_callback : "fileBrowserCallBack",
theme_advanced_resize_horizontal : false,
- theme_advanced_resizing : true,
- nonbreaking_force_tab : true,
- apply_source_formatting : true
+ theme_advanced_resizing : true
</prop:Options>
</com:THtmlArea>
<com:TButton Text="Submit" OnClick="button2Clicked" />
diff --git a/framework/Web/Javascripts/source/packages.php b/framework/Web/Javascripts/source/packages.php
index 5dfbe2c5..a8484820 100644
--- a/framework/Web/Javascripts/source/packages.php
+++ b/framework/Web/Javascripts/source/packages.php
@@ -94,8 +94,8 @@ $dependencies = array(
'slider' => array('prado', 'slider'),
'keyboard' => array('prado', 'keyboard'),
'tabpanel' => array('prado', 'tabpanel'),
- 'activedatepicker' => array('datepicker', 'ajax', 'activedatepicker'),
- 'activefileupload' => array('prado', 'ajax', 'activefileupload'),
+ 'activedatepicker' => array('prado', 'datepicker', 'ajax', 'activedatepicker'),
+ 'activefileupload' => array('prado', 'effects', 'ajax', 'activefileupload'),
'dragdropextra' => array('prado', 'effects', 'ajax', 'dragdrop','dragdropextra'),
'accordion' => array('prado', 'effects', 'accordion'),
);
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index 07d11a2c..1f314dda 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -482,12 +482,12 @@ class THttpResponse extends TModule implements ITextWriter
if (ob_get_length()>0)
{
if (!$continueBuffering)
- {
- $this->_bufferOutput = false;
- ob_end_flush();
- }
+ {
+ $this->_bufferOutput = false;
+ ob_end_flush();
+ }
else
- ob_flush();
+ ob_flush();
flush();
}
}
diff --git a/framework/Web/UI/ActiveControls/TActiveDatePicker.php b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
index 3d803664..38796a5e 100755
--- a/framework/Web/UI/ActiveControls/TActiveDatePicker.php
+++ b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
@@ -107,12 +107,16 @@ class TActiveDatePicker extends TDatePicker implements ICallbackEventHandler, I
/**
* Registers the javascript code to initialize the date picker.
*/
- protected function registerCalendarClientScript()
+
+ protected function registerCalendarClientScriptPre()
{
-
$cs = $this->getPage()->getClientScript();
$cs->registerPradoScript("activedatepicker");
+ }
+ protected function registerCalendarClientScriptPost()
+ {
+ $cs = $this->getPage()->getClientScript();
if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
{
$spacer = $this->getAssetUrl('spacer.gif');
diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
index 7820312d..1eaad5d9 100755
--- a/framework/Web/UI/ActiveControls/TActiveFileUpload.php
+++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
@@ -204,9 +204,9 @@ EOS;
/**
* Publish the javascript
*/
- public function onPreRender($param){
+ public function onPreRender($param)
+ {
parent::onPreRender($param);
- $this->getPage()->getClientScript()->registerPradoScript('effects');
$this->getPage()->getClientScript()->registerPradoScript('activefileupload');
if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
diff --git a/framework/Web/UI/ActiveControls/TDraggable.php b/framework/Web/UI/ActiveControls/TDraggable.php
index 10e78b9b..10ecf5a5 100755
--- a/framework/Web/UI/ActiveControls/TDraggable.php
+++ b/framework/Web/UI/ActiveControls/TDraggable.php
@@ -145,6 +145,7 @@ class TDraggable extends TPanel
public function onPreRender($param)
{
parent::onPreRender($param);
+ $cs=$this->getPage()->getClientScript();
if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting)
$cs->registerPradoScript('dragdropextra');
else
@@ -158,6 +159,7 @@ class TDraggable extends TPanel
protected function addAttributesToRender($writer)
{
parent::addAttributesToRender($writer);
+ $cs=$this->getPage()->getClientScript();
$writer->addAttribute('id',$this->getClientID());
$options=TJavascript::encode($this->getPostBackOptions());
$class=$this->getClientClassName();
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 2f9758d1..1dabb7ce 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -407,6 +407,7 @@ class TDatePicker extends TTextBox
$page->registerPostDataLoader($uniqueID.TControl::ID_SEPARATOR.'year');
}
$this->publishCalendarStyle();
+ $this->registerCalendarClientScriptPre();
}
/**
@@ -427,7 +428,7 @@ class TDatePicker extends TTextBox
$this->renderDropDownListCalendar($writer);
if($this->hasDayPattern())
{
- $this->registerCalendarClientScript();
+ $this->registerCalendarClientScriptPost();
$this->renderDatePickerButtons($writer);
}
}
@@ -840,20 +841,27 @@ class TDatePicker extends TTextBox
{
parent::addAttributesToRender($writer);
$writer->addAttribute('id',$this->getClientID());
- $this->registerCalendarClientScript();
+ $this->registerCalendarClientScriptPost();
}
/**
* Registers the javascript code to initialize the date picker.
*/
- protected function registerCalendarClientScript()
+ protected function registerCalendarClientScriptPre()
{
if($this->getShowCalendar())
{
$cs = $this->getPage()->getClientScript();
$cs->registerPradoScript("datepicker");
+ }
+ }
+ protected function registerCalendarClientScriptPost()
+ {
+ if($this->getShowCalendar())
+ {
+ $cs = $this->getPage()->getClientScript();
if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
{
$spacer = $this->getAssetUrl('spacer.gif');
diff --git a/framework/Web/UI/WebControls/TFlushOutput.php b/framework/Web/UI/WebControls/TFlushOutput.php
new file mode 100644
index 00000000..ab79fe0b
--- /dev/null
+++ b/framework/Web/UI/WebControls/TFlushOutput.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * TFlushOutput class file
+ *
+ * @author Berczi Gabor <gabor.berczi@devworx.hu>
+ * @link http://www.pradosoft.com/
+ * @license http://www.pradosoft.com/license/
+ * @version $Id: TFlushOutput.php $
+ * @package System.Web.UI.WebControls
+ */
+
+/**
+ * TFlushOutput class.
+ *
+ * TFlushOutput enables forced flushing of the current output buffer
+ * at (a) certain point(s) in the page, after rendering of all previous
+ * controls has been completed.
+ *
+ * To use TFlushOutput, simply place it in a template where you want
+ * the have the output buffered between the start of the page or the
+ * last TFlushOutput to be sent to the client immediately
+ * <code>
+ * <com:TFlushOutput />
+ * </code>
+ *
+ * You can specify whether you want to keep buffering of the output
+ * (if it was enabled) till the next occourence of a <com: TFlushOutput />
+ * or the end of the page rendering, or stop buffering, by using the
+ * {@link setContinueBuffering ContinueBuffering}.
+ *
+ * @author Berczi Gabor <gabor.berczi@devworx.hu>
+ * @version $Id: TFlushOutput.php $
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TFlushOutput extends TControl
+{
+ /**
+ * @var boolean whether to continue buffering of output
+ */
+ private $_continueBuffering=true;
+
+
+ /**
+ * Constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->EnableViewState = false;
+ }
+
+ /**
+ * @return Tells whether buffering of output can continue after this point
+ */
+ public function getContinueBuffering()
+ {
+ return $this->_continueBuffering;
+ }
+
+ /**
+ * @param boolean sets whether buffering of output can continue after this point
+ */
+ public function setContinueBuffering($value)
+ {
+ $this->_continueBuffering = TPropertyValue::ensureBoolean($value);
+ }
+
+ /**
+ * Flushes the output of all completely rendered controls to the client.
+ * @param THtmlWriter writer for the rendering purpose
+ */
+ public function render($writer)
+ {
+$writer->write('<!-- flush -->');
+ // ajax responses can't be parsed by the client side before loaded and returned completely,
+ // so don't bother with flushing output somewhere mid-page if refreshing in a callback
+ if (!$this->Page->IsCallback)
+ {
+ $this->Page->flushWriter();
+// $this->Application->flushOutput($this->ContinueBuffering);
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index b11778bd..2411f8f3 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -402,7 +402,7 @@ class THtmlArea extends TTextBox
$options['debug'] = false;
$js = TJavaScript::encode($options,true,true);
$script = "if(typeof(tinyMCE_GZ)!='undefined'){ tinyMCE_GZ.init({$js}); }";
- $scripts->registerBeginScript($key, $script);
+ $scripts->registerEndScript($key, $script);
}
}
diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php
index cf21eeef..227a9a3e 100644
--- a/framework/Web/UI/WebControls/TPanel.php
+++ b/framework/Web/UI/WebControls/TPanel.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2011 PradoSoft
+ * @copyright Copyright &copy; 2005-2011 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -73,15 +73,7 @@ class TPanel extends TWebControl
{
parent::addAttributesToRender($writer);
if(($butt=$this->getDefaultButton())!=='')
- {
- if(($button=$this->findControl($butt))===null)
- throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
- else
- {
- $writer->addAttribute('id',$this->getClientID());
- $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
- }
- }
+ $writer->addAttribute('id',$this->getClientID());
}
/**
@@ -232,5 +224,23 @@ class TPanel extends TWebControl
$writer->renderEndTag();
parent::renderEndTag($writer);
}
+
+ public function render($writer)
+ {
+ parent::render($writer);
+
+ if(($butt=$this->getDefaultButton())!=='')
+ {
+ $buttons = $this->findControlsByID($butt);
+ if (count($buttons)>0)
+ $button = reset($buttons);
+ else
+ $buttons = null;
+ if($button===null)
+ throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
+ else
+ $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
+ }
+ }
}