diff options
author | wei <> | 2007-05-09 02:51:02 +0000 |
---|---|---|
committer | wei <> | 2007-05-09 02:51:02 +0000 |
commit | e2614a35a70f609bccc1d65df6f1b92ff1fef5ef (patch) | |
tree | e50ba7375212d2275cc2d866d220adca254eadf1 /framework | |
parent | 733cc375da74f9bf0fd3d71989bb20d503dbbb7b (diff) |
Add compact db demo, add THtmlArea::EnableCompression, add ClientSide options for TColorPicker
Diffstat (limited to 'framework')
4 files changed, 90 insertions, 22 deletions
diff --git a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js index 746a0caf..557b4b51 100644 --- a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js +++ b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js @@ -461,6 +461,8 @@ Object.extend(Prado.WebUI.TColorPicker.prototype, this.button.style.backgroundColor = color.toString();
if(typeof(this.onChange) == "function")
this.onChange(color);
+ if(this.options.OnColorSelected)
+ this.options.OnColorSelected(this,color);
},
getFullPickerContainer : function(pickerID)
diff --git a/framework/Web/Javascripts/source/prado/colorpicker/default.css b/framework/Web/Javascripts/source/prado/colorpicker/default.css index 67235c08..7bbc08d5 100644 --- a/framework/Web/Javascripts/source/prado/colorpicker/default.css +++ b/framework/Web/Javascripts/source/prado/colorpicker/default.css @@ -3,8 +3,6 @@ .TColorPicker_button
{
- border: 1px solid #919EA9;
- background-color: #fff;
}
.TColorPicker
@@ -49,23 +47,16 @@ }
/** UI **/
-.TColorPicker_button
-{
- position: absolute;
- font-size: 0;
- padding: 1px;
- margin-left: 1px;
-}
-
.TColorPicker_button img
{
- width: 18px;
- height: 18px;
-}
-
-* html .TColorPicker_button
-{
- margin-top: 1px;
+ border: 2px ridge ActiveBorder;
+ background-color: #fff;
+ padding: 1px;
+ height: 16px;
+ width: 16px;
+ margin: 1px;
+ margin-bottom: -6px;
+ margin-bottom: expression(-4); /** IE hack **/
}
.TColorPicker
diff --git a/framework/Web/UI/WebControls/TColorPicker.php b/framework/Web/UI/WebControls/TColorPicker.php index 5f0c0b03..51e51ec3 100644 --- a/framework/Web/UI/WebControls/TColorPicker.php +++ b/framework/Web/UI/WebControls/TColorPicker.php @@ -24,6 +24,8 @@ class TColorPicker extends TTextBox {
const SCRIPT_PATH = 'prado/colorpicker';
+ private $_clientSide;
+
/**
* @return boolean whether the color picker should pop up when the button is clicked.
*/
@@ -106,6 +108,24 @@ class TColorPicker extends TTextBox }
/**
+ * @return TColorPickerClientSide javascript event options.
+ */
+ public function getClientSide()
+ {
+ if(is_null($this->_clientSide))
+ $this->_clientSide = $this->createClientSide();
+ return $this->_clientSide;
+ }
+
+ /**
+ * @return TColorPickerClientSide javascript validator event options.
+ */
+ protected function createClientSide()
+ {
+ return new TColorPickerClientSide;
+ }
+
+ /**
* Get javascript color picker options.
* @return array color picker client-side options
*/
@@ -122,7 +142,7 @@ class TColorPicker extends TTextBox $options['OKButtonText'] = $this->getOKButtonText();
$options['CancelButtonText'] = $this->getCancelButtonText();
}
-
+ $options = array_merge($options,$this->getClientSide()->getOptions()->toArray());
return $options;
}
@@ -221,4 +241,33 @@ class TColorPickerMode extends TEnumerable const Full='Full';
}
+/**
+ * TColorPickerClientSide class.
+ *
+ * Client-side javascript code options.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.WebControls
+ * @since 3.1
+ */
+class TColorPickerClientSide extends TClientSideOptions
+{
+ /**
+ * @return string javascript code for when a color is selected.
+ */
+ public function getOnColorSelected()
+ {
+ return $this->getOption('OnColorSelected');
+ }
+
+ /**
+ * @param string javascript code for when a color is selected.
+ */
+ public function setOnColorSelected($javascript)
+ {
+ $this->setFunction('OnColorSelected', $javascript);
+ }
+}
+
?>
\ No newline at end of file diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index 91f0f033..efe3e6d9 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -268,9 +268,27 @@ class THtmlArea extends TTextBox return $this->getViewState('CustomPluginPath');
}
+ /**
+ * @return boolean enable compression of the javascript files, default is true.
+ */
+ public function getEnableCompression()
+ {
+ return $this->getViewState('EnableCompression', true);
+ }
+
+ /**
+ * @param boolean enable compression of the javascript files, default is true.
+ */
+ public function setEnableCompression($value)
+ {
+ $this->setViewState('EnableCompression', TPropertyValue::ensureBoolean($value));
+ }
+
public function onPreRender($param)
{
- $this->preLoadCompressedScript();
+ $this->loadJavascriptLibrary();
+ if($this->getEnableCompression())
+ $this->preLoadCompressedScript();
}
/**
@@ -310,8 +328,6 @@ class THtmlArea extends TTextBox protected function preLoadCompressedScript()
{
$scripts = $this->getPage()->getClientScript();
- if(!$scripts->isScriptFileRegistered('prado:THtmlArea'))
- $scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl());
$key = 'prado:THtmlArea:compressed';
if(!$scripts->isBeginScriptRegistered($key))
{
@@ -326,6 +342,13 @@ class THtmlArea extends TTextBox }
}
+ protected function loadJavascriptLibrary()
+ {
+ $scripts = $this->getPage()->getClientScript();
+ if(!$scripts->isScriptFileRegistered('prado:THtmlArea'))
+ $scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl());
+ }
+
/**
* Registers the editor javascript file and code to initialize the editor.
*/
@@ -342,7 +365,10 @@ class THtmlArea extends TTextBox */
protected function getScriptUrl()
{
- return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce_gzip.js';
+ if($this->getEnableCompression())
+ return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce_gzip.js';
+ else
+ return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce.js';
}
/**
|