summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page29
-rw-r--r--framework/3rdParty/TinyMCE/readme.txt13
-rw-r--r--framework/3rdParty/TinyMCE/tiny_mce.md52
-rw-r--r--framework/3rdParty/TinyMCE/tiny_mce.tarbin3164160 -> 3502080 bytes
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php143
6 files changed, 158 insertions, 30 deletions
diff --git a/.gitattributes b/.gitattributes
index 198a29a4..26e79ed6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1075,7 +1075,6 @@ framework/3rdParty/SafeHtml/TSafeHtmlParser.php -text
framework/3rdParty/SafeHtml/license.txt -text
framework/3rdParty/SafeHtml/readme.txt -text
framework/3rdParty/TinyMCE/license.txt -text
-framework/3rdParty/TinyMCE/readme.txt -text
framework/3rdParty/TinyMCE/tiny_mce.md5 -text
framework/3rdParty/TinyMCE/tiny_mce.tar -text
framework/3rdParty/geshi/docs/COPYING -text
diff --git a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
index 71343e64..6f6937ec 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.page
@@ -14,12 +14,33 @@ THtmlArea with default settings:
</td></tr>
<tr><td class="samplenote">
-THtmlArea with customized size and table toolbar:
+Full featured THtmlArea example
</td><td class="sampleaction">
-<com:THtmlArea ID="HtmlArea2" Width="500px" Height="250px">
+<com:THtmlArea ID="HtmlArea2" Width="670px" Height="300px">
<prop:Options>
- plugins : "table"
- theme_advanced_buttons3 : "tablecontrols"
+ theme : "advanced",
+ plugins : "devkit,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
+ theme_advanced_buttons1_add_before : "save,newdocument,separator,styleselect",
+ theme_advanced_buttons1_add : "separator,insertdate,inserttime,preview,separator,advsearchreplace",
+ theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
+ theme_advanced_buttons3 : "tablecontrols,separator,emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
+ theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_toolbar_align : "left",
+ theme_advanced_path_location : "bottom",
+ content_css : "example_full.css",
+ plugin_insertdate_dateFormat : "%Y-%m-%d",
+ plugin_insertdate_timeFormat : "%H:%M:%S",
+ extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
+ external_link_list_url : "example_link_list.js",
+ external_image_list_url : "example_image_list.js",
+ flash_external_list_url : "example_flash_list.js",
+ media_external_list_url : "example_media_list.js",
+ file_browser_callback : "fileBrowserCallBack",
+ theme_advanced_resize_horizontal : false,
+ theme_advanced_resizing : true,
+ nonbreaking_force_tab : true,
+ apply_source_formatting : true
</prop:Options>
</com:THtmlArea>
<com:TButton Text="Submit" OnClick="button2Clicked" />
diff --git a/framework/3rdParty/TinyMCE/readme.txt b/framework/3rdParty/TinyMCE/readme.txt
deleted file mode 100644
index e242d71a..00000000
--- a/framework/3rdParty/TinyMCE/readme.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-TinyMCE Compressor 1.03
--------------------------
-
-TinyMCE Compressor gzips all javascript files in TinyMCE to a single streamable file.
-This makes the overall download sice 70% smaller and all requests are merged into a few requests.
-
-To enable this compressor simply place the tiny_mce_gzip.php in the tiny_mce directory where tiny_mce.js is located and switch your scripts form:
-
-<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
-
-to
-
-<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script>
diff --git a/framework/3rdParty/TinyMCE/tiny_mce.md5 b/framework/3rdParty/TinyMCE/tiny_mce.md5
index 7e3ff1f8..b853cd60 100644
--- a/framework/3rdParty/TinyMCE/tiny_mce.md5
+++ b/framework/3rdParty/TinyMCE/tiny_mce.md5
@@ -1 +1 @@
-92380b28b827c8d569026439abb44142 tiny_mce.tar
+dcd33d2779fc68523fe73ab54b9e1034 *tiny_mce.tar
diff --git a/framework/3rdParty/TinyMCE/tiny_mce.tar b/framework/3rdParty/TinyMCE/tiny_mce.tar
index 125ee624..ddbbd1ac 100644
--- a/framework/3rdParty/TinyMCE/tiny_mce.tar
+++ b/framework/3rdParty/TinyMCE/tiny_mce.tar
Binary files differ
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index a505732a..f70f8d25 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -98,17 +98,21 @@ class THtmlArea extends TTextBox
'hu' => 'hu',
'is' => 'is',
'it' => 'it',
- 'ja' => 'ja',
+ 'ja' => 'ja_utf-8',
'ko' => 'ko',
'nb' => 'nb',
'nl' => 'nl',
+ 'nn' => 'nn',
'pl' => 'pl',
'pt' => 'pt',
'pt_BR' => 'pt_br',
- 'ru' => 'ru_UTF-8',
+ 'ro' => 'ro',
+ 'ru' => 'ru',
'si' => 'si',
'sk' => 'sk',
- 'sv' => 'sv',
+ 'sq' => 'sq',
+ 'sr' => 'sr',
+ 'sv' => 'sv_utf8',
'th' => 'th',
'tr' => 'tr',
'vi' => 'vi',
@@ -119,12 +123,48 @@ class THtmlArea extends TTextBox
);
/**
+ * @var array list of default plugins to load, override using getAvailablePlugins();
+ */
+ private static $_plugins = array(
+ 'style',
+ 'layer',
+ 'table',
+ 'save',
+ 'advhr',
+// 'advimage',
+// 'advlink',
+ 'emotions',
+ 'iespell',
+ 'insertdatetime',
+ 'preview',
+ 'media',
+ 'searchreplace',
+ 'print',
+ 'contextmenu',
+ 'paste',
+ 'directionality',
+ 'fullscreen',
+ 'noneditable',
+ 'visualchars',
+ 'nonbreaking',
+ 'xhtmlxtras'
+ );
+
+ /**
+ * @var array default themes to load
+ */
+ private static $_themes = array(
+ 'simple',
+ 'advanced'
+ );
+
+ /**
* Constructor.
* Sets default width and height.
*/
public function __construct()
{
- $this->setWidth('450px');
+ $this->setWidth('470px');
$this->setHeight('250px');
}
@@ -212,6 +252,27 @@ class THtmlArea extends TTextBox
}
/**
+ * @param string path to custom plugins to be copied.
+ */
+ public function setCustomPluginPath($value)
+ {
+ $this->setViewState('CustomPluginPath', $value);
+ }
+
+ /**
+ * @return string path to custom plugins to be copied.
+ */
+ public function getCustomPluginPath()
+ {
+ return $this->getViewState('CustomPluginPath');
+ }
+
+ public function onPreRender($param)
+ {
+ $this->preLoadCompressedScript();
+ }
+
+ /**
* Adds attribute name-value pairs to renderer.
* This method overrides the parent implementation by registering
* additional javacript code.
@@ -228,15 +289,50 @@ class THtmlArea extends TTextBox
}
/**
- * Registers the editor javascript file and code to initialize the editor.
+ * Returns a list of plugins to be loaded.
+ * Override this method to customize.
+ * @return array list of plugins to be loaded
*/
- protected function registerEditorClientScript($writer)
+ public function getAvailablePlugins()
+ {
+ return self::$_plugins;
+ }
+
+ /**
+ * @return array list of available themese
+ */
+ public function getAvailableThemes()
+ {
+ return self::$_themes;
+ }
+
+ 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))
+ {
+ $options['plugins'] = implode(',', $this->getAvailablePlugins());
+ $options['themes'] = implode(',', $this->getAvailableThemes());
+ $options['languages'] = $this->getLanguageSuffix($this->getCulture());
+ $options['disk_cache'] = true;
+ $options['debug'] = false;
+ $js = TJavaScript::encode($options);
+ $script = "if(typeof(tinyMCE_GZ)!='undefined'){ tinyMCE_GZ.init({$js}); }";
+ $scripts->registerBeginScript($key, $script);
+ }
+ }
+
+ /**
+ * Registers the editor javascript file and code to initialize the editor.
+ */
+ protected function registerEditorClientScript($writer)
+ {
+ $scripts = $this->getPage()->getClientScript();
$options = TJavaScript::encode($this->getEditorOptions());
- $script = "if(tinyMCE){ tinyMCE.init($options); }";
+ $script = "if(typeof(tinyMCE)!='undefined'){ tinyMCE.init($options); }";
$scripts->registerEndScript('prado:THtmlArea'.$this->ClientID,$script);
}
@@ -245,7 +341,7 @@ class THtmlArea extends TTextBox
*/
protected function getScriptUrl()
{
- return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce_gzip.php';
+ return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce_gzip.js';
}
/**
@@ -258,7 +354,21 @@ class THtmlArea extends TTextBox
$md5sum = Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.md5');
if($tarfile===null || $md5sum===null)
throw new TConfigurationException('htmlarea_tarfile_invalid');
- return $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum);
+ $url = $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum);
+ $this->copyCustomPlugins($url);
+ return $url;
+ }
+
+ protected function copyCustomPlugins($url)
+ {
+ if($plugins = $this->getCustomPluginPath())
+ {
+ $assets = $this->getApplication()->getAssetManager();
+ $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins);
+ $dest = $assets->getBasePath().'/'.basename($url).'/tiny_mce/plugins/';
+ if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance)
+ $assets->copyDirectory($path, $dest);
+ }
}
/**
@@ -295,10 +405,11 @@ class THtmlArea extends TTextBox
protected function parseEditorOptions($string)
{
$options = array();
- $substrings = preg_split('/\n|,\n/', trim($string));
+ $substrings = preg_split('/,\s*\n|\n/', trim($string));
foreach($substrings as $bits)
{
- $option = explode(":",$bits);
+ $option = explode(":",$bits,2);
+
if(count($option) == 2)
$options[trim($option[0])] = trim(preg_replace('/\'|"/','', $option[1]));
}
@@ -325,6 +436,16 @@ class THtmlArea extends TTextBox
return 'en';
}
+
+ /**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.THtmlArea';
+ }
}
?> \ No newline at end of file