summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/Javascripts/TJavaScript.php14
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php6
3 files changed, 12 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 7721884c..e375408f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,5 +1,6 @@
Version 3.1.5 (to be released)
BUG: URL wildcard patterns didn't work with subfolders
+BUG: Issue#87 - TinyMCE : empty string disapears after encoding JS, that's a problem! (Christophe)
BUG: Issue#96 - THttpResponse::redirect don't send status code (Christophe)
BUG: Issue#107 - typo in TDbConnection::getCharset() (Christophe)
ENH: Issue#115 - Registry for Prado generated clientside counterparts of serverside controls (Yves Berkholz)
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index 9c4741a4..2134c2d1 100644
--- a/framework/Web/Javascripts/TJavaScript.php
+++ b/framework/Web/Javascripts/TJavaScript.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.Javascripts
@@ -130,9 +130,11 @@ class TJavaScript
*
* @param mixed PHP variable to be encoded
* @param boolean whether the output is a map or a list.
+ * @since 3.1.5
+ * @param boolean wether to encode empty strings too. Default to false for BC.
* @return string the encoded string
*/
- public static function encode($value,$toMap=true)
+ public static function encode($value,$toMap=true,$encodeEmptyStrings=false)
{
if(is_string($value))
{
@@ -158,11 +160,11 @@ class TJavaScript
{
foreach($value as $k=>$v)
{
- if($v!=='')
+ if($v!=='' || $encodeEmptyStrings)
{
if($results!=='')
$results.=',';
- $results.="'$k':".self::encode($v,$toMap);
+ $results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings);
}
}
return '{'.$results.'}';
@@ -171,11 +173,11 @@ class TJavaScript
{
foreach($value as $v)
{
- if($v!=='')
+ if($v!=='' || $encodeEmptyStrings)
{
if($results!=='')
$results.=',';
- $results.=self::encode($v,$toMap);
+ $results.=self::encode($v,$toMap, $encodeEmptyStrings);
}
}
return '['.$results.']';
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index 7fea5862..5d65c8b2 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.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
@@ -334,7 +334,7 @@ class THtmlArea extends TTextBox
$options['languages'] = $this->getLanguageSuffix($this->getCulture());
$options['disk_cache'] = true;
$options['debug'] = false;
- $js = TJavaScript::encode($options);
+ $js = TJavaScript::encode($options,true,true);
$script = "if(typeof(tinyMCE_GZ)!='undefined'){ tinyMCE_GZ.init({$js}); }";
$scripts->registerBeginScript($key, $script);
}
@@ -353,7 +353,7 @@ class THtmlArea extends TTextBox
protected function registerEditorClientScript($writer)
{
$scripts = $this->getPage()->getClientScript();
- $options = TJavaScript::encode($this->getEditorOptions());
+ $options = TJavaScript::encode($this->getEditorOptions(),true,true); // Force encoding of empty strings
$script = "if(typeof(tinyMCE)!='undefined'){ tinyMCE.init($options); }";
$scripts->registerEndScript('prado:THtmlArea'.$this->ClientID,$script);
}