template::widget::richtext_htmlarea (public, deprecated)

 template::widget::richtext_htmlarea element_reference tag_attributes

Defined in packages/acs-templating/tcl/deprecated-procs.tcl

Deprecated. Invoking this procedure generates a warning.

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. Otherwise, it will use a normal textarea, with a drop-down to select a format. The available formats are:

  • Enhanced text = Allows HTML, but automatically inserts line and paragraph breaks.
  • Plain text = Automatically inserts line and paragraph breaks, and quotes all HTML-specific characters, such as less-than, greater-than, etc.
  • Fixed-width text = Same as plain text, but conserves spacing; useful for tabular data.
  • 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.

Parameters:
element_reference (required)
tag_attributes (required)
See Also:

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc template::widget::richtext_htmlarea
  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 {}
  }
  
  set output {}

  if {$element(mode) eq "edit"} {
      append output {<script type="text/javascript" nonce='$::__csp_nonce'><!--} \n {acs_RichText_WriteButtons();  //--></script>}
      
      set attributes(id) "richtext__$element(form_id)__$element(id)"
      
      if { [info exists element(htmlarea_p)] && $element(htmlarea_p) ne "" } {
          set htmlarea_p [string is true -strict $element(htmlarea_p)]
      } else {
          set htmlarea_p [parameter::get  -package_id [apm_package_id_from_key "acs-templating"]  -parameter "UseHtmlAreaForRichtextP"  -default 0]
      }

      # Check browser's User-Agent header for compatibility with htmlArea
      ad_return_complaint 1 "use htmlareap = $htmlarea_p"
      if { $htmlarea_p } {
          set user_agent [string tolower [ns_set iget [ns_conn headers] User-Agent]]
          if { [string first "opera" $user_agent] != -1 } { 
              # Opera - doesn't work, even though Opera claims to be IE
              set htmlarea_p 0
          } elseif { [regexp {msie ([0-9]*)\.([0-9]+)} $user_agent matches major minor] } {
              # IE, works for browsers > 5.5
              if { $major < 5 || ($major == 5  && $minor < 5) } {
                  set htmlarea_p 0
              }
          } elseif { [regexp {gecko/0*([1-9][0-9]*)} $user_agent match build] } {
              if { $build < 20030210 } {
                  set htmlarea_p 0
              }
          } else {
              set htmlarea_p 0
          }
      }

      if { $htmlarea_p } {
          # Tell the blank-master to include the special stuff for htmlArea in the page header
          lappend ::acs_blank_master__htmlareas $attributes(id)
      }

      append output [textarea_internal $element(id) attributes $contents]
      if { $htmlarea_p } {
          append output [subst {<input name="$element(id).format" value="text/html" type="hidden">}]
      } else {
          append output  [subst {<br>[_ acs-templating.Format]:}]  [menu $element(id).format [template::util::richtext::format_options$format attributes]
      }
          
      # Spell-checker
      array set spellcheck [template::util::spellcheck::spellcheck_properties -element_ref element]
      if { $spellcheck(render_p) } {
          append output  [subst { [_ acs-templating.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)]  [subst {<input type="hidden" name="$element(id)" value="[ns_quotehtml $contents]">}]  [subst {<input type="hidden" name="$element(id).format" value="[ns_quotehtml $format]">}]
      }
  }
      
  return $output
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: