summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
committerctrlaltca@gmail.com <>2011-05-21 18:14:36 +0000
commit0892b27e326f14bd3f6229b55077ef5f9d5280b4 (patch)
tree24039ec47ba8977bf14ba435c058e758e901f185 /framework/Web/UI
parent6f00b28a1d9c7409c956a83866eac48a9493e83c (diff)
branch/3.1: merged bugfixes from trunk/ up to current
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveHyperLink.php4
-rw-r--r--framework/Web/UI/TForm.php6
-rw-r--r--framework/Web/UI/THtmlWriter.php2
-rw-r--r--framework/Web/UI/TPage.php22
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php4
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php102
-rw-r--r--framework/Web/UI/WebControls/TOutputCache.php8
-rw-r--r--framework/Web/UI/WebControls/TSafeHtml.php6
-rw-r--r--framework/Web/UI/WebControls/TTabPanel.php17
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php40
-rw-r--r--framework/Web/UI/WebControls/TTextProcessor.php6
-rw-r--r--framework/Web/UI/WebControls/TWizard.php6
-rw-r--r--framework/Web/UI/WebControls/TXmlTransform.php6
13 files changed, 151 insertions, 78 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveHyperLink.php b/framework/Web/UI/ActiveControls/TActiveHyperLink.php
index 1a42e09c..7d1b02b9 100644
--- a/framework/Web/UI/ActiveControls/TActiveHyperLink.php
+++ b/framework/Web/UI/ActiveControls/TActiveHyperLink.php
@@ -66,8 +66,8 @@ class TActiveHyperLink extends THyperLink implements IActiveControl
parent::setImageUrl($value);
if($this->getActiveControl()->canUpdateClientSide() && $value !== '')
{
- $textWriter = new TTextWriter();
- $renderer = new THtmlWriter($textWriter);
+ $textWriter = new TTextWriter;
+ $renderer = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter);
$this->createImage($value)->renderControl($renderer);
$this->getPage()->getCallbackClient()->update($this, $textWriter->flush());
}
diff --git a/framework/Web/UI/TForm.php b/framework/Web/UI/TForm.php
index 2356a733..ee845ed5 100644
--- a/framework/Web/UI/TForm.php
+++ b/framework/Web/UI/TForm.php
@@ -73,9 +73,9 @@ class TForm extends TControl
{
$page=$this->getPage();
$page->beginFormRender($writer);
- $textWriter=new TTextWriter;
- $this->renderChildren(new THtmlWriter($textWriter));
- $content=$textWriter->flush();
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+ $this->renderChildren( $htmlWriter );
+ $content = $htmlWriter->flush();
$page->endFormRender($writer);
$this->addAttributesToRender($writer);
diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php
index 9713d941..8af52452 100644
--- a/framework/Web/UI/THtmlWriter.php
+++ b/framework/Web/UI/THtmlWriter.php
@@ -184,7 +184,7 @@ class THtmlWriter extends TApplicationComponent implements ITextWriter
*/
public function flush()
{
- $this->_writer->flush();
+ return $this->_writer->flush();
}
/**
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 4a2ea474..320ea3bd 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -84,23 +84,23 @@ class TPage extends TTemplateControl
/**
* @var TMap data post back by user
*/
- private $_postData;
+ protected $_postData;
/**
* @var TMap postback data that is not handled during first invocation of LoadPostData.
*/
- private $_restPostData;
+ protected $_restPostData;
/**
* @var array list of controls whose data have been changed due to the postback
*/
- private $_controlsPostDataChanged=array();
+ protected $_controlsPostDataChanged=array();
/**
* @var array list of controls that need to load post data in the current request
*/
- private $_controlsRequiringPostData=array();
+ protected $_controlsRequiringPostData=array();
/**
* @var array list of controls that need to load post data in the next postback
*/
- private $_controlsRegisteredForPostData=array();
+ protected $_controlsRegisteredForPostData=array();
/**
* @var TControl control that needs to raise postback event
*/
@@ -112,11 +112,11 @@ class TPage extends TTemplateControl
/**
* @var boolean whether the form has been rendered
*/
- private $_formRendered=false;
+ protected $_formRendered=false;
/**
* @var boolean whether the current rendering is within a form
*/
- private $_inFormRender=false;
+ protected $_inFormRender=false;
/**
* @var TControl|string the control or the ID of the element on the page to be focused when the page is sent back to user
*/
@@ -157,11 +157,11 @@ class TPage extends TTemplateControl
/**
* @var array post data loader IDs.
*/
- private $_postDataLoaders=array();
+ protected $_postDataLoaders=array();
/**
* @var boolean true if loading post data.
*/
- private $_isLoadingPostData=false;
+ protected $_isLoadingPostData=false;
/**
* @var boolean whether client supports javascript
*/
@@ -914,7 +914,7 @@ class TPage extends TTemplateControl
/**
* Raises OnPostDataChangedEvent for controls whose data have been changed due to the postback.
*/
- private function raiseChangedEvents()
+ protected function raiseChangedEvents()
{
foreach($this->_controlsPostDataChanged as $control)
$control->raisePostDataChangedEvent();
@@ -923,7 +923,7 @@ class TPage extends TTemplateControl
/**
* Raises PostBack event.
*/
- private function raisePostBackEvent()
+ protected function raisePostBackEvent()
{
if(($postBackHandler=$this->getPostBackEventTarget())===null)
$this->validate();
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index c81d8bc1..1bac5a1c 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -803,7 +803,9 @@ class TDatePicker extends TTextBox
$writer->addAttribute('class', $this->getCssClass().' TDatePickerImageButton');
if(!$this->getEnabled(true))
$writer->addAttribute('disabled', 'disabled');
- $writer->renderBeginTag('img');
+ $writer->addAttribute('type', 'image');
+ $writer->addAttribute('onclick', 'return false;');
+ $writer->renderBeginTag('input');
$writer->renderEndTag();
}
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index 8d55c074..efdea8a3 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -83,71 +83,127 @@ class THtmlArea extends TTextBox
*/
private static $_langs = array(
'ar' => 'ar',
+ 'az' => 'az',
+ 'be' => 'be',
+ 'bg' => 'bg',
+ 'bn' => 'bn',
+ 'br' => 'br',
+ 'bs' => 'bs',
'ca' => 'ca',
+ 'ch' => 'ch',
+ 'cn' => 'cn',
'cs' => 'cs',
- 'cy' => 'cy', //available since 3.0.7
+ 'cy' => 'cy',
'da' => 'da',
'de' => 'de',
+ 'dv' => 'dv',
'el' => 'el',
'en' => 'en',
+ 'eo' => 'eo',
'es' => 'es',
+ 'et' => 'et',
+ 'eu' => 'eu',
'fa' => 'fa',
'fi' => 'fi',
'fr' => 'fr',
- 'fr_CA' => 'fr_ca',
+ 'gl' => 'gl',
+ 'gu' => 'gu',
'he' => 'he',
+ 'hi' => 'hi',
+ 'hr' => 'hr',
'hu' => 'hu',
+ 'hy' => 'hy',
+ 'ia' => 'ia',
+ 'id' => 'id',
'is' => 'is',
'it' => 'it',
- 'ja' => 'ja_utf-8',
+ 'ja' => 'ja',
+ 'ka' => 'ka',
+ 'kl' => 'kl',
+ 'km' => 'km',
'ko' => 'ko',
+ 'lb' => 'lb',
+ 'lt' => 'lt',
+ 'lv' => 'lv',
+ 'mk' => 'mk',
+ 'ml' => 'ml',
+ 'mn' => 'mn',
+ 'ms' => 'ms',
+ 'my' => 'my',
'nb' => 'nb',
'nl' => 'nl',
'nn' => 'nn',
+ 'no' => 'no',
'pl' => 'pl',
+ 'ps' => 'ps',
'pt' => 'pt',
- 'pt_BR' => 'pt_br',
'ro' => 'ro',
'ru' => 'ru',
+ 'sc' => 'sc',
+ 'se' => 'se',
'si' => 'si',
'sk' => 'sk',
+ 'sl' => 'sl',
'sq' => 'sq',
'sr' => 'sr',
- 'sv' => 'sv_utf8',
+ 'sv' => 'sv',
+ 'ta' => 'ta',
+ 'te' => 'te',
'th' => 'th',
+ 'tn' => 'tn',
'tr' => 'tr',
+ 'tt' => 'tt',
+ 'tw' => 'tw',
+ 'uk' => 'vi',
+ 'ur' => 'vi',
'vi' => 'vi',
- 'zh' => 'zh_cn_utf8',
- 'zh_CN' => 'zh_cn_utf8',
- //'zh_HK' => 'zh_tw_utf8', removed from 3.0.7
- 'zh_TW' => 'zh_tw_utf8'
+ 'zh_CN' => 'zh-cn',
+ 'zh_TW' => 'zh-tw',
+ 'zh' => 'zh',
+ 'zu' => 'zu',
);
/**
* @var array list of default plugins to load, override using getAvailablePlugins();
*/
private static $_plugins = array(
- 'style',
- 'layer',
- 'table',
- 'save',
'advhr',
-// 'advimage',
-// 'advlink',
+ 'advimage',
+ 'advlink',
+ 'advlist',
+ 'autolink',
+ 'autoresize',
+ 'autosave',
+ 'bbcode',
+ 'contextmenu',
+ 'directionality',
'emotions',
+ 'example',
+ 'fullpage',
+ 'fullscreen',
'iespell',
+ 'inlinepopups',
'insertdatetime',
- 'preview',
+ 'layer',
+ 'legacyoutput',
+ 'lists',
'media',
- 'searchreplace',
- 'print',
- 'contextmenu',
- 'paste',
- 'directionality',
- 'fullscreen',
+ 'nonbreaking',
'noneditable',
+ 'pagebreak',
+ 'paste',
+ 'preview',
+ 'print',
+ 'save',
+ 'searchreplace',
+ 'spellchecker',
+ 'style',
+ 'tabfocus',
+ 'table',
+ 'template',
'visualchars',
- 'nonbreaking',
+ 'wordc',
+ 'wordcount',
'xhtmlxtras'
);
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php
index c0747a11..294519da 100644
--- a/framework/Web/UI/WebControls/TOutputCache.php
+++ b/framework/Web/UI/WebControls/TOutputCache.php
@@ -478,14 +478,14 @@ class TOutputCache extends TControl implements INamingContainer
$writer->write($this->_contents);
else if($this->_cacheAvailable)
{
- $textWriter=new TTextWriter;
-
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+
$stack=$this->getPage()->getCachingStack();
$stack->push($this);
- parent::render(new THtmlWriter($textWriter));
+ parent::render($htmlWriter);
$stack->pop();
- $content=$textWriter->flush();
+ $content=$htmlWriter->flush();
$data=array($content,$this->_state,$this->_actions,time());
$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
$writer->write($content);
diff --git a/framework/Web/UI/WebControls/TSafeHtml.php b/framework/Web/UI/WebControls/TSafeHtml.php
index d6829f8b..dba513c5 100644
--- a/framework/Web/UI/WebControls/TSafeHtml.php
+++ b/framework/Web/UI/WebControls/TSafeHtml.php
@@ -45,9 +45,9 @@ class TSafeHtml extends TControl
*/
public function render($writer)
{
- $textWriter=new TTextWriter;
- parent::render(new THtmlWriter($textWriter));
- $writer->write($this->parseSafeHtml($textWriter->flush()));
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+ parent::render($htmlWriter);
+ $writer->write($this->parseSafeHtml($htmlWriter->flush()));
}
/**
diff --git a/framework/Web/UI/WebControls/TTabPanel.php b/framework/Web/UI/WebControls/TTabPanel.php
index 63710e56..e17008ba 100644
--- a/framework/Web/UI/WebControls/TTabPanel.php
+++ b/framework/Web/UI/WebControls/TTabPanel.php
@@ -412,7 +412,11 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$cs->registerPradoScript('tabpanel');
$code="new $className($options);";
$cs->registerEndScript("prado:$id", $code);
- $cs->registerHiddenField($id.'_1',$this->getActiveViewIndex());
+ // ensure an item is always active and visible
+ $index = $this->getActiveViewIndex();
+ if(!$this->getViews()->itemAt($index)->Visible)
+ $index=0;
+ $cs->registerHiddenField($id.'_1', $index);
$page->registerRequiresPostData($this);
$page->registerRequiresPostData($id."_1");
}
@@ -435,13 +439,16 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$options['ID']=$this->getClientID();
$options['ActiveCssClass']=$this->getActiveTabCssClass();
$options['NormalCssClass']=$this->getTabCssClass();
- $viewIDs=array();
+ $views='';
foreach($this->getViews() as $view)
{
- if($view->getVisible())
- $viewIDs[]=$view->getClientID();
+ if($views!='')
+ $views.=', ';
+ $views.= '"'.$view->getClientID().'":'.($view->getVisible() ? '1': '0' );
}
- $options['Views']='[\''.implode('\',\'',$viewIDs).'\']';
+
+ $options['Views']='{'.$views.='}';
+ $viewIDs=array();
return $options;
}
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 8ab548a3..46e7f551 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -122,25 +122,6 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
$writer->addAttribute('type','text');
if(($text=$this->getText())!=='')
$writer->addAttribute('value',$text);
- if(($act=$this->getAutoCompleteType())!=='None')
- {
- if($act==='Disabled')
- $writer->addAttribute('autocomplete','off');
- else if($act==='Search')
- $writer->addAttribute('vcard_name','search');
- else if($act==='HomeCountryRegion')
- $writer->addAttribute('vcard_name','HomeCountry');
- else if($act==='BusinessCountryRegion')
- $writer->addAttribute('vcard_name','BusinessCountry');
- else
- {
- if(strpos($act,'Business')===0)
- $act='Business'.'.'.substr($act,8);
- else if(strpos($act,'Home')===0)
- $act='Home'.'.'.substr($act,4);
- $writer->addAttribute('vcard_name','vCard.'.$act);
- }
- }
}
else
{
@@ -148,6 +129,27 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
$writer->addAttribute('value',$text);
$writer->addAttribute('type','password');
}
+
+ if(($act=$this->getAutoCompleteType())!=='None')
+ {
+ if($act==='Disabled')
+ $writer->addAttribute('autocomplete','off');
+ else if($act==='Search')
+ $writer->addAttribute('vcard_name','search');
+ else if($act==='HomeCountryRegion')
+ $writer->addAttribute('vcard_name','HomeCountry');
+ else if($act==='BusinessCountryRegion')
+ $writer->addAttribute('vcard_name','BusinessCountry');
+ else
+ {
+ if(strpos($act,'Business')===0)
+ $act='Business'.'.'.substr($act,8);
+ else if(strpos($act,'Home')===0)
+ $act='Home'.'.'.substr($act,4);
+ $writer->addAttribute('vcard_name','vCard.'.$act);
+ }
+ }
+
if(($cols=$this->getColumns())>0)
$writer->addAttribute('size',"$cols");
if(($maxLength=$this->getMaxLength())>0)
diff --git a/framework/Web/UI/WebControls/TTextProcessor.php b/framework/Web/UI/WebControls/TTextProcessor.php
index 26dab754..3d900054 100644
--- a/framework/Web/UI/WebControls/TTextProcessor.php
+++ b/framework/Web/UI/WebControls/TTextProcessor.php
@@ -75,9 +75,9 @@ abstract class TTextProcessor extends TWebControl
{
if(($text=$this->getText())==='' && $this->getHasControls())
{
- $textWriter=new TTextWriter;
- parent::renderContents(new THtmlWriter($textWriter));
- $text=$textWriter->flush();
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+ parent::renderContents($htmlWriter);
+ $text=$htmlWriter->flush();
}
if($text!=='')
$writer->write($this->processText($text));
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 774096f7..a9268b2b 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -954,6 +954,8 @@ class TWizard extends TWebControl implements INamingContainer
if($buttonStyle!==null)
$style->mergeWith($buttonStyle);
$style->apply($button);
+ if($activeStepType===TWizardStepType::Start)
+ $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
}
// apply styles to finish navigation buttons
@@ -977,6 +979,8 @@ class TWizard extends TWebControl implements INamingContainer
if($buttonStyle!==null)
$style->mergeWith($buttonStyle);
$style->apply($button);
+ if($activeStepType===TWizardStepType::Finish)
+ $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
}
// apply styles to step navigation buttons
@@ -1000,6 +1004,8 @@ class TWizard extends TWebControl implements INamingContainer
if($buttonStyle!==null)
$style->mergeWith($buttonStyle);
$style->apply($button);
+ if($activeStepType===TWizardStepType::Step)
+ $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
}
}
diff --git a/framework/Web/UI/WebControls/TXmlTransform.php b/framework/Web/UI/WebControls/TXmlTransform.php
index 991aed39..c1a372e1 100644
--- a/framework/Web/UI/WebControls/TXmlTransform.php
+++ b/framework/Web/UI/WebControls/TXmlTransform.php
@@ -168,10 +168,10 @@ class TXmlTransform extends TControl {
*/
public function render($writer) {
if(($document=$this->getSourceXmlDocument()) === null) {
- $textWriter = new TTextWriter();
- parent::render(new THtmlWriter($textWriter));
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+ parent::render($htmlWriter);
$document = new DOMDocument();
- $document->loadXML($textWriter->flush());
+ $document->loadXML($htmlWriter->flush());
}
$stylesheet = $this->getTransformXmlDocument();