Index: openacs-4/packages/acs-subsite/www/resources/core.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/resources/core.js,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-subsite/www/resources/core.js 30 Jan 2005 16:23:40 -0000 1.8 +++ openacs-4/packages/acs-subsite/www/resources/core.js 18 Mar 2005 18:10:39 -0000 1.9 @@ -110,8 +110,20 @@ } } -/* HTMLArea (part of Richtext Widget) Support */ +/* RTE functions */ +function acs_rteSubmitForm() { + updateRTEs(); + return true; +} +function acs_rteInit(form_name) { +// sets onsubmit to function for the given form name + if (document.forms == null) return; + if (document.forms[form_name] == null) return; + document.forms[form_name].onsubmit = acs_rteSubmitForm; +} + +/* HTMLArea (part of Richtext Widget) Support */ function acs_initHtmlArea(editor_var, elementid) { editor_var.generate(); return false; 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.17 -r1.18 --- openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 6 May 2004 21:38:20 -0000 1.17 +++ openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 18 Mar 2005 18:10:39 -0000 1.18 @@ -161,7 +161,7 @@ } } -ad_proc -public template::widget::richtext { element_reference tag_attributes } { +ad_proc -public -deprecated template::widget::richtext_htmlarea { element_reference tag_attributes } { Implements the richtext widget, which offers rich text editing options. If the acs-templating.UseHtmlAreaForRichtextP parameter is set to true (1), this will use the htmlArea WYSIWYG editor widget. @@ -173,6 +173,8 @@
  • HTML = normal HTML. 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. + + @see template::widget::richtext } { upvar $element_reference element @@ -256,3 +258,93 @@ return $output } + + + +ad_proc -public template::widget::richtext { element_reference tag_attributes } { + Implements the richtext widget, which offers rich text editing options. + + This version supports the rte editor. + + + If the acs-templating.UseHtmlAreaForRichtextP parameter is set to true (1), this will use the htmlArea WYSIWYG editor widget. + Otherwise, it will use a normal textarea, with a drop-down to select a format. The available formats are: + + 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. + + Derived from the htmlarea richtext widget for htmlarea by lars@pinds.com + + modified for RTE http://www.kevinroth.com/ by davis@xarg.net +} { + + upvar $element_reference element + + if { [info exists element(html)] } { + array set attributes $element(html) + } + + array set attributes $tag_attributes + + if { [info exists element(value)] } { + set contents [template::util::richtext::get_property contents $element(value)] + set format [template::util::richtext::get_property format $element(value)] + } else { + set contents {} + set format {} + } + + if { [string equal $element(mode) "edit"] } { + + set attributes(id) "richtext__$element(form_id)__$element(id)" + + if { [exists_and_not_null element(htmlarea_p)] } { + set htmlarea_p [template::util::is_true $element(htmlarea_p)] + } else { + set htmlarea_p [parameter::get \ + -package_id [apm_package_id_from_key "acs-templating"] \ + -parameter "UseHtmlAreaForRichtextP" \ + -default 0] + } + + set output "[textarea_internal $element(id) attributes $contents]\n
    Format: [menu $element(id).format [template::util::richtext::format_options] {} {}]" + + if { $htmlarea_p } { + # Tell the blank-master to include the special stuff for htmlArea in the page header + global acs_blank_master__htmlareas + lappend acs_blank_master__htmlareas $element(form_id) + + + regsub -all "\n" $contents "\\n" contents + regsub -all "\r" $contents "" contents + # Beware: & means "repeat the string being replaced" + regsub -all "'" $contents "\\'" contents + + # What we are generating here is the call to write the richtext widget but we also + # need to pass what to generate in for browsers for which the richtext widget + # won't work but which do have js enabled should output since we need the + # format widget (this for Safari among some others) + set output "" + + } + # Spell-checker + array set spellcheck [template::util::spellcheck::spellcheck_properties -element_ref element] + if { $spellcheck(render_p) } { + append output " Spellcheck: [menu "$element(id).spellcheck" [nsv_get spellchecker lang_options] $spellcheck(selected_option) attributes]" + } + } else { + # Display mode + if { [info exists element(value)] } { + append output [template::util::richtext::get_property html_value $element(value)] + append output "" + append output "" + } + } + + return $output +} + Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.36 -r1.37 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 27 Feb 2005 22:45:40 -0000 1.36 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 18 Mar 2005 18:10:39 -0000 1.37 @@ -696,3 +696,7 @@ } + + + + Index: openacs-4/www/blank-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.adp,v diff -u -r1.17 -r1.18 --- openacs-4/www/blank-master.adp 24 Feb 2005 13:33:30 -0000 1.17 +++ openacs-4/www/blank-master.adp 18 Mar 2005 18:10:39 -0000 1.18 @@ -10,26 +10,21 @@ - - - - + - - - @header_stuff;noquote@ @attribute.key@="@attribute.value@"> + + + - + Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/www/blank-master.tcl 13 Jan 2005 13:58:54 -0000 1.16 +++ openacs-4/www/blank-master.tcl 18 Mar 2005 18:10:39 -0000 1.17 @@ -33,12 +33,11 @@ set onload {} -# Handle htmlArea widget, which needs special javascript and css in the page header +# Handle RTE widget, which needs special javascript and css in the page header global acs_blank_master__htmlareas -if { [info exists acs_blank_master__htmlareas] } { - foreach htmlarea_id $acs_blank_master__htmlareas { - append header_stuff "" - lappend onload "acs_initHtmlArea(editor_var_${htmlarea_id}, '${htmlarea_id}');" +if {[info exists acs_blank_master__htmlareas] } { + foreach htmlarea_id [lsort -unique $acs_blank_master__htmlareas] { + lappend onload "acs_rteInit('${htmlarea_id}');" } }