summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php5
-rw-r--r--framework/Web/UI/WebControls/TColorPicker.php8
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php14
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php3
-rw-r--r--framework/Web/UI/WebControls/TJavascriptLogger.php2
-rw-r--r--framework/Web/UI/WebControls/TRatingList.php5
-rw-r--r--framework/Web/UI/WebControls/TTextHighlighter.php2
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php3
8 files changed, 17 insertions, 25 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 97ba1a8b..46f031ca 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -156,7 +156,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$scriptKey = "TBaseValidator:$formID";
if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey))
{
- $scripts->registerClientScript('validator');
+ $scripts->registerPradoScript('validator');
$scripts->registerEndScript($scriptKey, "Prado.Validation.AddForm('$formID');");
}
if($this->getEnableClientScript())
@@ -194,8 +194,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$class = get_class($this);
$scriptKey = "prado:".$this->getClientID();
$scripts = $this->getPage()->getClientScript();
- $serializer = new TJavascriptSerializer($this->getClientScriptOptions());
- $options = $serializer->toJavascript();
+ $options = TJavaScript::encode($this->getClientScriptOptions());
$js = "new Prado.Validation(Prado.Validation.{$class}, {$options});";
$scripts->registerEndScript($scriptKey, $js);
}
diff --git a/framework/Web/UI/WebControls/TColorPicker.php b/framework/Web/UI/WebControls/TColorPicker.php
index c0cc3ae7..fda6bced 100644
--- a/framework/Web/UI/WebControls/TColorPicker.php
+++ b/framework/Web/UI/WebControls/TColorPicker.php
@@ -168,8 +168,7 @@ class TColorPicker extends TTextBox
}
$imgs['button.gif'] = $list['button.gif'];
$imgs['background.png'] = $list['background.png'];
- $serializer = new TJavascriptSerializer($imgs);
- $options = $serializer->toJavascript();
+ $options = TJavaScript::encode($imgs);
$code = "Prado.WebUI.TColorPicker.UIImages = {$options};";
$cs->registerEndScript($key, $code);
return $list;
@@ -186,9 +185,8 @@ class TColorPicker extends TTextBox
parent::addAttributesToRender($writer);
$writer->addAttribute('id',$this->getClientID());
$scripts = $this->getPage()->getClientScript();
- $scripts->registerClientScript("colorpicker");
- $serializer = new TJavascriptSerializer($this->getColorPickerOptions());
- $options = $serializer->toJavascript();
+ $scripts->registerPradoScript("colorpicker");
+ $options = TJavaScript::encode($this->getColorPickerOptions());
$id = $this->getClientID();
$code = "Event.OnLoad(function(){ new Prado.WebUI.TColorPicker($options); });";
$scripts->registerEndScript("prado:$id", $code);
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index fd280938..a70e25b3 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -228,7 +228,8 @@ class TDatePicker extends TTextBox
{
$options['Format'] = $this->getDateFormat();
$options['FirstDayOfWeek'] = $this->getFirstDayOfWeek();
- $options['ClassName'] = $this->getCssClass();
+ if(($cssClass=$this->getCssClass())!=='')
+ $options['ClassName'] = $cssClass;
$options['FromYear'] = $this->getFromYear();
$options['UpToYear'] = $this->getUpToYear();
if($this->getMode()!=='Basic')
@@ -252,10 +253,8 @@ class TDatePicker extends TTextBox
Prado::using('System.I18N.core.DateTimeFormatInfo');
$info = Prado::createComponent('System.I18N.core.CultureInfo', $culture);
$date = $info->getDateTimeFormat();
- $serializer = new TJavascriptSerializer($date->getMonthNames());
- $options['MonthNames'] = $serializer->toList();
- $serializer = new TJavascriptSerializer($date->getAbbreviatedDayNames());
- $options['ShortWeekDayNames'] = $serializer->toList();
+ $options['MonthNames'] = TJavaScript::encode($date->getMonthNames(),false);
+ $options['ShortWeekDayNames'] = TJavaScript::encode($date->getAbbreviatedDayNames(),false);
return $options;
}
@@ -367,9 +366,8 @@ class TDatePicker extends TTextBox
if($this->getShowCalendar())
{
$scripts = $this->getPage()->getClientScript();
- $scripts->registerClientScript("datepicker");
- $serializer = new TJavascriptSerializer($this->getDatePickerOptions());
- $options = $serializer->toJavascript();
+ $scripts->registerPradoScript("datepicker");
+ $options = TJavaScript::encode($this->getDatePickerOptions());
$id = $this->getClientID();
$code = "Event.OnLoad(function(){ new Prado.WebUI.TDatePicker('$id', $options); });";
$scripts->registerEndScript("prado:$id", $code);
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index 1801e739..70788e2d 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -262,8 +262,7 @@ class THtmlArea extends TTextBox
$scripts = $this->getPage()->getClientScript();
if(!$scripts->isScriptFileRegistered('prado:THtmlArea'))
$scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl());
- $serializer = new TJavascriptSerializer($this->getEditorOptions());
- $options = $serializer->toJavascript(true);
+ $options = TJavaScript::encode($this->getEditorOptions());
$script = "if(tinyMCE){ tinyMCE.init($options); }";
$scripts->registerEndScript('THtmlArea'.$this->ClientID,$script);
}
diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php
index fa28d2b0..c38f7bc4 100644
--- a/framework/Web/UI/WebControls/TJavascriptLogger.php
+++ b/framework/Web/UI/WebControls/TJavascriptLogger.php
@@ -54,7 +54,7 @@ class TJavascriptLogger extends TWebControl
*/
public function renderContents($writer)
{
- $this->Page->ClientScript->registerClientScript('logger');
+ $this->Page->ClientScript->registerPradoScript('logger');
$info = '(<a href="http://gleepglop.com/javascripts/logger/" target="_blank">more info</a>).';
$usage = 'Press ALT-D (Or CTRL-D on OS X) to toggle the javascript log console';
$writer->write("{$usage} {$info}");
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index 4302c3b3..006391f7 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -106,9 +106,8 @@ class TRatingList extends TRadioButtonList
$this->publishRatingListAssets();
$id = $this->getClientID();
$scripts = $this->getPage()->getClientScript();
- $scripts->registerClientScript('prado');
- $serializer = new TJavascriptSerializer($this->getRatingClientOptions());
- $options = $serializer->toJavascript();
+ $scripts->registerPradoScript('prado');
+ $options = TJavaScript::encode($this->getRatingClientOptions());
$code = "new Prado.WebUI.TRatingList($options);";
$scripts->registerEndScript("prado:$id", $code);
}
diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php
index 4eec7de1..cedc807f 100644
--- a/framework/Web/UI/WebControls/TTextHighlighter.php
+++ b/framework/Web/UI/WebControls/TTextHighlighter.php
@@ -85,7 +85,7 @@ class TTextHighlighter extends TWebControl
{
parent::onPreRender($writer);
$this->registerHighlightStyleSheet();
- $this->getPage()->getClientScript()->registerClientScript('prado');
+ $this->getPage()->getClientScript()->registerPradoScript('prado');
}
/**
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 027a2cee..e7115c99 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -182,8 +182,7 @@ class TValidationSummary extends TWebControl
{
if(!$this->getEnabled(true) || !$this->getEnableClientScript())
return;
- $serializer = new TJavascriptSerializer($this->getClientScriptOptions());
- $options = $serializer->toJavascript();
+ $options=TJavaScript::encode($this->getClientScriptOptions());
$script = "new Prado.Validation.Summary({$options});";
$this->getPage()->getClientScript()->registerEndScript($this->getClientID(), $script);
}