summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2010-02-14 01:22:57 +0000
committergodzilla80@gmx.net <>2010-02-14 01:22:57 +0000
commit94e94e0a8566f23d16658a04c55b0bbfdd6689aa (patch)
tree72ffad82c279080dd9320d45dda26d64ffb4626f /framework/Web
parent966fd66f217911d079c4bd6a87b09f4a0c5c4736 (diff)
Merge Branches & Trunk
/trunk:r2680,2692,2707-2736 /branches/3.1:r2682-2686,2694-2702,2705,2738-2762
Diffstat (limited to 'framework/Web')
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js15
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/activefileupload.js41
-rw-r--r--framework/Web/Javascripts/source/prado/validator/validation3.js5
-rw-r--r--framework/Web/THttpRequest.php6
-rw-r--r--framework/Web/THttpResponse.php29
-rw-r--r--framework/Web/THttpSession.php12
-rwxr-xr-xframework/Web/UI/ActiveControls/TDropContainer.php7
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php3
-rw-r--r--framework/Web/UI/WebControls/TBoundColumn.php2
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php99
-rw-r--r--framework/Web/UI/WebControls/TDataGridColumn.php6
-rw-r--r--framework/Web/UI/WebControls/TJavascriptLogger.php6
-rw-r--r--framework/Web/UI/WebControls/TRegularExpressionValidator.php4
-rw-r--r--framework/Web/UI/WebControls/TTabPanel.php1
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php14
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php17
16 files changed, 183 insertions, 84 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
index 3aacda21..e96b63ec 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
@@ -46,9 +46,9 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
var day = Prado.WebUI.TDatePicker.getDayListControl(this.control);
var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
var year = Prado.WebUI.TDatePicker.getYearListControl(this.control);
- Event.observe (day, "change", this.onDateChanged.bindEvent(this));
- Event.observe (month, "change", this.onDateChanged.bindEvent(this));
- Event.observe (year, "change", this.onDateChanged.bindEvent(this));
+ if (day) Event.observe (day, "change", this.onDateChanged.bindEvent(this));
+ if (month) Event.observe (month, "change", this.onDateChanged.bindEvent(this));
+ if (year) Event.observe (year, "change", this.onDateChanged.bindEvent(this));
}
@@ -66,9 +66,12 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
}
else
{
- var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1;
- var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex;
- var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value;
+ var day = Prado.WebUI.TDatePicker.getDayListControl(this.control);
+ if (day) day=day.selectedIndex+1;
+ var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
+ if (month) month=month.selectedIndex;
+ var year = Prado.WebUI.TDatePicker.getYearListControl(this.control);
+ if (year) year=year.value;
date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this);
}
if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date);
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
index f42a0673..de633c77 100755
--- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
+++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
@@ -46,20 +46,41 @@ Prado.WebUI.TActiveFileUpload = Base.extend(
},
finishUpload : function(options){
+
+ if (this.options.targetID == options.targetID)
+ {
+ this.finishoptions = options;
+ var e = this;
+ var callback =
+ {
+ 'CallbackParameter' : options || '',
+ 'onSuccess' : function() { e.finishCallBack(true); },
+ 'onFailure' : function() { e.finishCallBack(false); }
+ };
+
+ Object.extend(callback, this.options);
+
+ request = new Prado.CallbackRequest(this.options.EventTarget, callback);
+ request.dispatch();
+ }
+ else
+ this.finishCallBack(true);
+
+ },
+
+ finishCallBack : function(success){
// hide the display indicator.
this.flag.value = '';
this.indicator.style.display = 'none';
- if (this.options.targetID == options.targetID){
- // show the complete indicator.
- if (options.errorCode == 0){
- this.complete.style.display = '';
- this.input.value = '';
- } else {
- this.error.style.display = '';
- }
- Prado.Callback(this.options.EventTarget, options, null, this.options);
- }
+ // show the complete indicator.
+ if ((this.finishoptions.errorCode == 0) && (success)) {
+ this.complete.style.display = '';
+ this.input.value = '';
+ } else {
+ this.error.style.display = '';
+ }
}
+
},
{
// class methods
diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js
index ed9493be..b1bf1a03 100644
--- a/framework/Web/Javascripts/source/prado/validator/validation3.js
+++ b/framework/Web/Javascripts/source/prado/validator/validation3.js
@@ -795,7 +795,7 @@ Prado.WebUI.TBaseValidator.prototype =
* Wether the validator is enabled (default true)
* @var {boolean} enabled
*/
- this.enabled = true;
+ this.enabled = options.Enabled;
/**
* Visibility state of validator(default false)
* @var {boolean} visible
@@ -837,6 +837,7 @@ Prado.WebUI.TBaseValidator.prototype =
* @var {element} message
*/
this.message = $(options.ID);
+
Prado.Registry.set(options.ID, this);
if(this.control && this.message)
{
@@ -1706,7 +1707,7 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato
if (value.length <= 0)
return true;
- var rx = new RegExp(this.options.ValidationExpression,this.options.PatternModifiers);
+ var rx = new RegExp('^'+this.options.ValidationExpression+'$',this.options.PatternModifiers);
var matches = rx.exec(value);
return (matches != null && value == matches[0]);
}
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 7100a4c5..c3926d08 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -105,7 +105,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
/**
* @var boolean whether the session ID should be kept in cookie only
*/
- private $_cookieOnly=false;
+ private $_cookieOnly=null;
private $_urlFormat=THttpRequestUrlFormat::Get;
private $_services;
private $_requestResolved=false;
@@ -172,8 +172,6 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
$_SERVER['HTTP_USER_AGENT']='';
}
- $this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
-
// Info about server variables:
// PHP_SELF contains real URI (w/ path info, w/o query string)
// SCRIPT_NAME is the real URI for the requested script (w/o path info and query string)
@@ -568,6 +566,8 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
{
+ if ($this->_cookieOnly===null)
+ $this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
$url=$this->_urlManager->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
if(defined('SID') && SID != '' && !$this->_cookieOnly)
return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index 3222f22f..c15f2836 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -66,6 +66,9 @@ Prado::using('System.Web.THttpResponseAdapter');
*/
class THttpResponse extends TModule implements ITextWriter
{
+ const DEFAULT_CONTENTTYPE = 'text/html';
+ const DEFAULT_CHARSET = 'UTF-8';
+
/**
* @var The differents defined status code by RFC 2616 {@link http://www.faqs.org/rfcs/rfc2616}
*/
@@ -106,7 +109,7 @@ class THttpResponse extends TModule implements ITextWriter
*/
private $_contentType=null;
/**
- * @var string character set, e.g. UTF-8
+ * @var string|boolean character set, e.g. UTF-8 or false if no character set should be send to client
*/
private $_charset='';
/**
@@ -212,7 +215,7 @@ class THttpResponse extends TModule implements ITextWriter
}
/**
- * @return string output charset.
+ * @return string|boolean output charset.
*/
public function getCharset()
{
@@ -220,11 +223,11 @@ class THttpResponse extends TModule implements ITextWriter
}
/**
- * @param string output charset.
+ * @param string|boolean output charset.
*/
public function setCharset($charset)
{
- $this->_charset = $charset;
+ $this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset;
}
/**
@@ -465,20 +468,22 @@ class THttpResponse extends TModule implements ITextWriter
}
/**
- * Sends content type header if charset is not empty.
+ * Sends content type header with optional charset.
*/
protected function sendContentTypeHeader()
{
+ $contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType;
$charset=$this->getCharset();
+ if($charset === false) {
+ $this->appendHeader('Content-Type: '.$contentType);
+ return;
+ }
+
if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
$charset=$globalization->getCharset();
- if($charset!=='')
- {
- $contentType=$this->_contentType===null?'text/html':$this->_contentType;
- $this->appendHeader('Content-Type: '.$contentType.';charset='.$charset);
- }
- else if($this->_contentType!==null)
- $this->appendHeader('Content-Type: '.$this->_contentType.';charset=UTF-8');
+
+ if($charset==='') $charset = self::DEFAULT_CHARSET;
+ $this->appendHeader('Content-Type: '.$contentType.';charset='.$charset);
}
/**
diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php
index 96d70704..e9f815e5 100644
--- a/framework/Web/THttpSession.php
+++ b/framework/Web/THttpSession.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web
@@ -115,7 +115,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar
if($this->_autoStart)
$this->open();
$this->_initialized=true;
- $this->getApplication()->setSession($this);
+ $this->getApplication()->setSession($this);
register_shutdown_function(array($this, "close"));
}
@@ -296,6 +296,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar
{
ini_set('session.use_cookies','1');
ini_set('session.use_only_cookies','1');
+ ini_set('session.use_trans_sid', 0);
}
}
}
@@ -366,7 +367,12 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar
if($this->_started)
throw new TInvalidOperationException('httpsession_transid_unchangeable');
else
- ini_set('session.use_trans_sid',TPropertyValue::ensureBoolean($value)?'1':'0');
+ {
+ $value=TPropertyValue::ensureBoolean($value);
+ if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
+ throw new TInvalidOperationException('httpsession_transid_cookieonly');
+ ini_set('session.use_trans_sid',$value?'1':'0');
+ }
}
/**
diff --git a/framework/Web/UI/ActiveControls/TDropContainer.php b/framework/Web/UI/ActiveControls/TDropContainer.php
index 8f7792f3..9c2e1dd5 100755
--- a/framework/Web/UI/ActiveControls/TDropContainer.php
+++ b/framework/Web/UI/ActiveControls/TDropContainer.php
@@ -62,6 +62,13 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
return $this->getAdapter()->getBaseActiveControl();
}
+ /**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
/**
* Gets the Css class name that this container can accept.
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 6daae4d0..0c71f46d 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -167,6 +167,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$options['ControlCssClass'] = $this->getControlCssClass();
$options['ControlType'] = $this->getClientControlClass($control);
+ $options['Enabled'] = $this->getEnabled(true);
//get date format from date picker target control
if($control instanceof TDatePicker)
@@ -241,7 +242,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$scripts->registerPradoScript('validator');
$scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});");
}
- if($this->getEnableClientScript() & $this->getEnabled(true))
+ if($this->getEnableClientScript())
$this->registerClientScriptValidator();
}
diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php
index 0f48d6e7..fdcde9b2 100644
--- a/framework/Web/UI/WebControls/TBoundColumn.php
+++ b/framework/Web/UI/WebControls/TBoundColumn.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index 742dd18b..c7c9fc98 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -53,7 +53,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
private $_isEnabled;
private $_changedEventRaised=false;
private $_dataChanged=false;
- private $_isValid=true;
+ private $_isValid=true;
/**
* Constructor.
@@ -254,6 +254,31 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
{
return false;
}
+
+ /**
+ * @param boolean whether the control is to be enabled.
+ */
+ public function setEnabled($value)
+ {
+ parent::setEnabled($value);
+ $value = !TPropertyValue::ensureBoolean($value);
+ // if this is an active control,
+ // and it's a callback,
+ // and we can update clientside,
+ // then update the 'disabled' attribute of the items.
+ if(($this instanceof IActiveControl) &&
+ $this->getPage()->getIsCallBack() &&
+ $this->getActiveControl()->canUpdateClientSide())
+ {
+ $items = $this->getItems();
+ $cs = $this->getPage()->getCallbackClient();
+ $baseClientID = $this->getClientID().'_c';
+ foreach($items as $index=>$item)
+ {
+ $cs->setAttribute($baseClientID.$index, 'disabled', $value);
+ }
+ }
+ }
/**
* Returns a style used for rendering items.
@@ -359,16 +384,16 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$page->registerRequiresPostData($this->_repeatedControl);
}
}
-
- /**
- * Wether the list should be rendered inside a span or not
- *
- *@return boolean true if we need a span
- */
- protected function getSpanNeeded ()
- {
- return $this->getRepeatLayout()===TRepeatLayout::Raw;
- }
+
+ /**
+ * Wether the list should be rendered inside a span or not
+ *
+ *@return boolean true if we need a span
+ */
+ protected function getSpanNeeded ()
+ {
+ return $this->getRepeatLayout()===TRepeatLayout::Raw;
+ }
/**
* Renders the checkbox list control.
@@ -379,11 +404,11 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
{
if($this->getItemCount()>0)
{
- if ($needSpan=$this->getSpanNeeded())
- {
- $writer->addAttribute('id', $this->getClientId());
- $writer->renderBeginTag('span');
- }
+ if ($needSpan=$this->getSpanNeeded())
+ {
+ $writer->addAttribute('id', $this->getClientId());
+ $writer->renderBeginTag('span');
+ }
$this->_isEnabled=$this->getEnabled(true);
$repeatInfo=$this->getRepeatInfo();
$accessKey=$this->getAccessKey();
@@ -395,8 +420,8 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$this->setTabIndex(0);
$repeatInfo->renderRepeater($writer,$this);
$this->setAccessKey($accessKey);
- $this->setTabIndex($tabIndex);
- if ($needSpan)
+ $this->setTabIndex($tabIndex);
+ if ($needSpan)
$writer->renderEndTag();
}
//checkbox skipped the client control script in addAttributesToRender
@@ -429,23 +454,23 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
return $this->getSelectedValue();
}
- /**
- * Returns true if this control validated successfully.
- * Defaults to true.
- * @return bool wether this control validated successfully.
- */
- public function getIsValid()
- {
- return $this->_isValid;
- }
- /**
- * @param bool wether this control is valid.
- */
- public function setIsValid($value)
- {
- $this->_isValid=TPropertyValue::ensureBoolean($value);
- }
-
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Gets the name of the javascript class responsible for performing postback for this control.
* This method overrides the parent implementation.
@@ -468,7 +493,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$options['ListName'] = $this->getUniqueID();
$options['ItemCount'] = $this->getItemCount();
return $options;
- }
+ }
}
diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php
index 577c0068..ed53dc88 100644
--- a/framework/Web/UI/WebControls/TDataGridColumn.php
+++ b/framework/Web/UI/WebControls/TDataGridColumn.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -418,6 +418,7 @@ abstract class TDataGridColumn extends TApplicationComponent
if(($classPath=$this->getHeaderRenderer())!=='')
{
$control=Prado::createComponent($classPath);
+ $cell->getControls()->add($control);
if($control instanceof IDataRenderer)
{
if($control instanceof IItemDataRenderer)
@@ -428,7 +429,6 @@ abstract class TDataGridColumn extends TApplicationComponent
}
$control->setData($text);
}
- $cell->getControls()->add($control);
}
else if($this->getAllowSorting())
{
@@ -489,6 +489,7 @@ abstract class TDataGridColumn extends TApplicationComponent
if(($classPath=$this->getFooterRenderer())!=='')
{
$control=Prado::createComponent($classPath);
+ $cell->getControls()->add($control);
if($control instanceof IDataRenderer)
{
if($control instanceof IItemDataRenderer)
@@ -499,7 +500,6 @@ abstract class TDataGridColumn extends TApplicationComponent
}
$control->setData($text);
}
- $cell->getControls()->add($control);
}
else if($text!=='')
$cell->setText($text);
diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php
index 6d49f801..778b6728 100644
--- a/framework/Web/UI/WebControls/TJavascriptLogger.php
+++ b/framework/Web/UI/WebControls/TJavascriptLogger.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -23,7 +23,7 @@
*
* To see the logger and console, press ALT-D (or CTRL-D on OS X).
* More information on the logger can be found at
- * http://gleepglop.com/javascripts/logger/
+ * http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/
*
* @author Wei Zhuo<weizhuo[at]gmail[dot]com>
* @version $Id$
@@ -84,7 +84,7 @@ class TJavascriptLogger extends TWebControl
public function renderContents($writer)
{
$code = strtoupper($this->getToggleKey());
- $info = '(<a href="http://gleepglop.com/javascripts/logger/" target="_blank">more info</a>).';
+ $info = '(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).';
$link = '<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>';
$usage = 'Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to';
$writer->write("{$usage} {$link} {$info}");
diff --git a/framework/Web/UI/WebControls/TRegularExpressionValidator.php b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
index be861e45..6855c6de 100644
--- a/framework/Web/UI/WebControls/TRegularExpressionValidator.php
+++ b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -86,7 +86,7 @@ class TRegularExpressionValidator extends TBaseValidator
{
if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
return true;
- if(($expression=$this->getRegularExpression())!=='')
+ if(($expression=addcslashes($this->getRegularExpression(),"/"))!=='')
{
$mods = $this->getPatternModifiers();
return preg_match("/^$expression\$/{$mods}",$value);
diff --git a/framework/Web/UI/WebControls/TTabPanel.php b/framework/Web/UI/WebControls/TTabPanel.php
index 961d0797..5deced79 100644
--- a/framework/Web/UI/WebControls/TTabPanel.php
+++ b/framework/Web/UI/WebControls/TTabPanel.php
@@ -413,6 +413,7 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler
$cs->registerEndScript("prado:$id", $code);
$cs->registerHiddenField($id.'_1',$this->getActiveViewIndex());
$page->registerRequiresPostData($this);
+ $page->registerRequiresPostData($id."_1");
}
/**
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 4e6a66e9..8ab548a3 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -245,7 +245,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
}
/**
- * Returns true if this control validated successfully.
+ * Returns true if this control validated successfully.
* Defaults to true.
* @return bool wether this control validated successfully.
*/
@@ -299,6 +299,18 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
}
/**
+ * Renders an additional line-break after the opening tag when it
+ * is in MultiLine text mode.
+ * @param THtmlWriter the writer used for the rendering purpose^M
+ */
+ public function renderBeginTag($writer)
+ {
+ parent::renderBeginTag($writer);
+ if($this->getTextMode()==='MultiLine')
+ $writer->write("\n");
+ }
+
+ /**
* @return TTextBoxAutoCompleteType the AutoComplete type of the textbox
*/
public function getAutoCompleteType()
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index ab066f78..4ed2eebe 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -149,6 +149,22 @@ class TValidationSummary extends TWebControl
}
/**
+ * @return boolean whether scroll summary into viewport or not. Defaults to true.
+ */
+ public function getScrollToSummary()
+ {
+ return $this->getViewState('ScrollToSummary',true);
+ }
+
+ /**
+ * @param boolean whether scroll summary into viewport or not.
+ */
+ public function setScrollToSummary($value)
+ {
+ $this->setViewState('ScrollToSummary',TPropertyValue::ensureBoolean($value),true);
+ }
+
+ /**
* @return boolean whether the validation summary should be anchored. Defaults to false.
*/
public function getShowAnchor()
@@ -254,6 +270,7 @@ class TValidationSummary extends TWebControl
if(!$this->getShowSummary())
$options['ShowSummary']=false;
+ $options['ScrollToSummary']=$this->getScrollToSummary();
$options['HeaderText']=$this->getHeaderText();
$options['DisplayMode']=$this->getDisplayMode();