Index: openacs-4/packages/acs-bootstrap-installer/installer/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/www/blank-master.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-bootstrap-installer/installer/www/blank-master.tcl 10 Jun 2015 19:14:01 -0000 1.2 +++ openacs-4/packages/acs-bootstrap-installer/installer/www/blank-master.tcl 14 Aug 2015 11:41:28 -0000 1.2.2.1 @@ -212,6 +212,10 @@ " -order tinymceZ } +if { [info exists ::acs_blank_master(ckeditor4)] } { + template::head::add_javascript -src "//cdn.ckeditor.com/4.5.2/standard/ckeditor.js" +} + if {![info exists doc(title)]} { set doc(title) "[ad_conn instance_name]" ns_log warning "[ad_conn url] has no doc(title) set." Index: openacs-4/packages/acs-templating/tcl/richtext-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/richtext-procs.tcl,v diff -u -r1.52 -r1.52.2.1 --- openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 27 Oct 2014 16:40:12 -0000 1.52 +++ openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 14 Aug 2015 11:41:28 -0000 1.52.2.1 @@ -295,8 +295,9 @@
Implements the richtext widget, which offers rich text editing options. - This version supports the xinha and tinymce - editors. + This version integrates support for the xinha and + tinymce editors out of the box, but other richtext editors + can be used including and configuring them in your custom template. If the acs-templating.UseHtmlAreaForRichtextP parameter is set to true (1), this will use the WYSIWYG editor widget set in the acs-templating.RichTextEditor @@ -318,9 +319,9 @@ You can also parameterize the richtext widget with a 'htmlarea_p' attribute, which can be true or false, and which will override the parameter setting.
- The available editors in wysigwig mode are xinha and tinymce. In order to - use xinha, one has to use 'editor xinha' in the options of the form field. - The following options for xinha may be specified: + The available integrated editors in wysigwig mode are xinha and tinymce. In + order to use xinha, one has to use 'editor xinha' in the options of the form + field. The following options for xinha may be specified:
+ Example for the use of a custom editor widget: +
+ text:richtext(richtext),nospell,optional + {label #acs-subsite.Biography#} + {options {editor custom ...custom configuration...}} + {html {rows 15 cols 50 style {width: 100%}}} ++
+ If provided with a WYSIWYG editor different than 'xinha' or 'tinymce', + system will just collect formfield ids and supplied options for the + richtext field and will provide them as-is to the blank-master environment. + When using a custom editor, funcional meaning of the options is totally up + to the user.
Note that the richtext editors interact with blank-master.tcl
and
@@ -431,15 +447,7 @@
set user_agent [string tolower [ns_set get [ns_conn headers] User-Agent]]
- if {[string first "chrome" $user_agent] != -1} {
- # vguerra: google chrome browser
- # needs more testing in order to check if chrome fully
- # supports xinha
- # roc: this check has to go first since safari use applewebkit,
- # so the agent always contain safari word
- # once xinha officially support chrome (already supports safari), we
- # can remove this if and add the check at the next if.
- } elseif {[string first "safari" $user_agent] != -1} {
+ if {[string first "safari" $user_agent] != -1} {
regexp {version/([0-9]+)[.]} $user_agent _ user_agent_version
if {$user_agent_version < 3} {
set element(htmlarea_p) false
@@ -477,10 +485,18 @@
# Tell the blank-master to include the special stuff
# for the richtext widget in the page header
set ::acs_blank_master($richtextEditor) 1
+
+ # Collect ids of richtext form fields
+ lappend ::acs_blank_master__htmlareas $attributes(id)
+ set postTextArea ""
+
if {$richtextEditor eq "xinha"} {
-
- # we have a xinha richtext widget, specified by "options {editor xinha}"
+ # Xinha is integrated in OpenACS:
+ # build speific javascript configurations from
+ # widget options and system parameters
+ #
+ # The richtext widget is specified by "options {editor xinha}"
# The following options are supported:
# editor plugins width height folder_id fs_package_id
#
@@ -505,24 +521,23 @@
append xinha_options "xinha_config.$e = '$options($e)';\n"
}
}
- # DAVEB add package_id
append xinha_options "xinha_config.package_id = '[ad_conn package_id]';\n"
# DAVEB find out if there is a key datatype in the form
- global af_key_name
- if {[info exists af_key_name(${element(form_id)})]} {
- append xinha_options "xinha_config.key = '[template::element get_value $element(form_id) $af_key_name(${element(form_id)})]';\n"
+ if {[info exists ::af_key_name(${element(form_id)})]} {
+ append xinha_options "xinha_config.key = '[template::element get_value $element(form_id) $::af_key_name(${element(form_id)})]';\n"
}
if {[info exists options(javascript)]} {
append xinha_options $options(javascript) \n
}
set ::acs_blank_master(xinha.options) $xinha_options
- lappend ::acs_blank_master__htmlareas $attributes(id)
} elseif {$richtextEditor eq "tinymce"} {
-
- lappend ::acs_blank_master__htmlareas $attributes(id)
-
+
+ # TinyMCE is integrated in OpenACS:
+ # build speific javascript configurations from
+ # widget options and system parameters
+
# get default configs
set tinymce_default_config {
{mode "exact" }
@@ -584,13 +599,46 @@
lappend pairslist "elements : \"[join $::acs_blank_master__htmlareas ","]\""
set tinymce_configs_js [join $pairslist ","]
set ::acs_blank_master(tinymce.config) $tinymce_configs_js
- }
- append output "\n\n"
- append output ""
+ } elseif {$richtextEditor eq "ckeditor4"} {
+ # Editor is ckeditor4
+ # handled options: plugins skin customConfig
+ set ckOptionsList {}
+ if {[info exists options(plugins)]} {
+ lappend ckOptionsList "extraPlugins: '$options(plugins)'"
+ }
+ if {[info exists options(skin)]} {
+ lappend ckOptionsList "skin: '$options(skin)'"
+ }
+ if {[info exists options(customConfig)]} {
+ lappend ckOptionsList "customConfig: '$options(skin)'"
+ }
+
+ set ckOptions [join $ckOptionsList ", "]
+ append postTextArea [subst {\n}]
+
+ } else {
+ # Editor is custom.
+ # Options will be passed as-is to the blank master
+ # and their meaning will be defined in the template
+
+ set ::acs_blank_master(${richtextEditor}.options) [array get options]
+ }
+
+ append output \
+ "\n\n\n" \
+ $postTextArea
+
if { $spellcheck(render_p) } {
- append output "