%3 ::xowiki::formfield::workflow_definition ::xowiki::formfield::workflow_definition as_graph check=workflow pretty_value ::xowiki::formfield::textarea ::xowiki::formfield::textarea add_statistics clear_editor_mixins initialize render_input set_feedback ::xowiki::formfield::workflow_definition->::xowiki::formfield::textarea ::xowiki::formfield::menuentries ::xowiki::formfield::menuentries pretty_value ::xowiki::formfield::menuentries->::xowiki::formfield::textarea ::xowiki::formfield::code_listing ::xowiki::formfield::code_listing pretty_value ::xowiki::formfield::code_listing->::xowiki::formfield::textarea ::xowiki::formfield::richtext ::xowiki::formfield::richtext check=safe_html editor initialize pretty_value render_richtext_as_div ::xowiki::formfield::richtext->::xowiki::formfield::textarea ::xowiki::formfield::form_constraints ::xowiki::formfield::form_constraints ::xowiki::formfield::form_constraints->::xowiki::formfield::textarea ::xowiki::formfield::FormField ::xowiki::formfield::FormField ::xowiki::formfield::textarea->::xowiki::formfield::FormField ::xowiki::formfield::richtext::ckeditor4 ::xowiki::formfield::richtext::ckeditor4 initialize js_image_helper pathNames render_input ::xowiki::formfield::richtext::ckeditor4->::xowiki::formfield::richtext ::xowiki::formfield::richtext::wym ::xowiki::formfield::richtext::wym initialize render_input ::xowiki::formfield::richtext::wym->::xowiki::formfield::richtext ::xowiki::formfield::richtext::xinha ::xowiki::formfield::richtext::xinha initialize render_input ::xowiki::formfield::richtext::xinha->::xowiki::formfield::richtext ::xowiki::formfield::form ::xowiki::formfield::form check=form initialize ::xowiki::formfield::form->::xowiki::formfield::richtext ::xowiki::formfield::localized_richtext ::xowiki::formfield::localized_richtext ::xowiki::formfield::localized_richtext->::xowiki::formfield::richtext ::xowiki::formfield::localized_text ::xowiki::formfield::localized_text ::xowiki::formfield::localized_richtext->::xowiki::formfield::localized_text

Class ::xowiki::formfield::richtext

::xowiki::formfield::richtext[i] create ... \
           [ -displayMode (default "standard") ] \
           [ -folder_id folder_id ] \
           [ -height height ] \
           [ -plugins plugins ] \
           [ -script_dir script_dir ] \
           [ -width width ] \
           [ -wiki (default "false") ]

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xowiki::formfield::textarea[i]
  • subclass: ::xowiki::formfield::richtext::ckeditor4[i], ::xowiki::formfield::richtext::wym[i], ::xowiki::formfield::richtext::xinha[i], ::xowiki::formfield::form[i], ::xowiki::formfield::localized_richtext[i]
::xotcl::Class create ::xowiki::formfield::richtext \
     -superclass ::xowiki::formfield::textarea

Methods (to be applied on instances)

  • check=safe_html (scripted)

    #
    # Don't check, if the user has sufficient permissions on the
    # package
    #
    if {[::xo::cc permission  -object_id [::xo::cc package_id]  -privilege swa  -party_id [::xo::cc user_id]]} {
      set msg ""
    } else {
      #
      # Check, if the package has global settings for AllowedTags,
      # AllowedAttributes, or AllowedProtocols. If (some of) these
      # exist, use these for configuring "ad_html_security_check". If
      # not, fall back to the default (site wide) definition.
      #
      set package_key [apm_package_key_from_id [${:object} package_id]]
      set options {}
      foreach var {attributes tags protocols} {
        set params [parameter::get_global_value  -package_key $package_key  -parameter Allowed[string totitle $var]  -default ""]
        if {$params ne ""} {
          lappend options -allowed_$var $params
        }
      }
      set msg [ad_html_security_check {*}$options $value]
    }
    if {$msg ne ""} {
      :uplevel [list set errorMsg $msg]
      return 0
    }
    return 1
  • displayMode (setter)

  • editor (scripted)

    #
    # TODO: this should be made a slot setting
    #
    #:log "RICHTEXT setting editor for ${:name}, args=$args,[llength $args]"
    if {[llength $args] == 0} {
      return ${:editor}
    }
    set editor [lindex $args 0]
    
    if {[info exists :editor] && $editor eq ${:editor} && [info exists :__initialized]} {
      return ${:editor}
    }
    
    #
    # The "none" setting for the richtext field is especially
    # important for cases, where no editor is specified, which causes
    # the PreferredRichtextEditor to be used. However, the "form"
    # field of the xowiki::Form class requires a content surrounded by
    # the form tag (<form>....</form>), but the CKEditor will remove
    # sich entries. Since it is better to work on the raw text,
    # editor=none prevents the usage of the rich text widget, although
    # it is a richtext field.
    #
    if {$editor eq "none"} {
      set :editor "none"
      :clear_editor_mixins
      if {[info exists :options]} {
        unset :options
      }
      return ${:editor}
    }
    
    set editor_class [self class]::$editor
    if {$editor ne "" && ![:hasclass $editor_class]} {
      if {![:isclass $editor_class]} {
        set editors [list]
        foreach c [::xowiki::formfield::richtext info subclass] {
          if {![$c exists editor_mixin]} continue
          lappend editors [namespace tail $c]
        }
        error [_ xowiki.error-form_constraint-unknown_editor  [list name ${:name} editor [:editor] editors $editors]]
      }
      :clear_editor_mixins
      :mixin add $editor_class
      #:msg "MIXIN $editor: [:info precedence]"
      :reset_parameter
      set :__initialized 1
    }
    set :editor $editor
  • folder_id (setter)

  • height (setter)

  • initialize (scripted)

    #set :display_field false
    switch -- ${:displayMode} {
      inplace -
      inline -
      standard {}
      default {error "value '${:displayMode}' invalid: valid entries for displayMode are inplace, inline or standard (default)"}
    }
    #
    # Don't set HTML5 attribute "required", since this does not match
    # well with Richtext Editors (at least ckeditor4 has problems,
    # other probably as well).
    #
    set :booleanHTMLAttributes {readonly disabled formnovalidate}
    next
    #ns_log notice "==== ${:name} EDITOR specified? [info exists :editor]"
    
    if {![info exists :editor]} {
      set :editor [parameter::get_global_value -package_key xowiki  -parameter PreferredRichtextEditor -default ckeditor4]
      #:msg "setting default of ${:name} to ${:editor}"
    }
    if {![info exists :__initialized]} {
      #
      # Mixin the editor based on the attribute 'editor' if necessary
      # and call initialize again in this case...
      #
      #ns_log notice "==== initializing EDITOR: ${:editor}"
      :editor ${:editor}
      :initialize
    }
    set :widget_type richtext
    #set :__initialized 1
  • plugins (setter)

  • pretty_value (scripted)

    # for richtext, perform minimal output escaping
    if {[:wiki]} {
      return [${:object} substitute_markup $v]
    } else {
      return [string map [list @ "&#64;"$v]
    }
  • render_richtext_as_div (scripted)

    #:msg "[:get_attributes id style {CSSclass class}]"
    ::html::div [:get_attributes id style {CSSclass class}] {
      if {[:wiki]} {
        ${:object} references clear
        ::html::t -disableOutputEscaping [${:object} substitute_markup [:value]]
      } else {
        ::html::t -disableOutputEscaping [:value]
      }
    }
    ::html::div
  • script_dir (setter)

  • validator (setter)

  • width (setter)

  • wiki (setter)