%3 ::xowiki::formfield::author ::xowiki::formfield::author pretty_value ::xowiki::formfield::user_id ::xowiki::formfield::user_id initialize pretty_value ::xowiki::formfield::author->::xowiki::formfield::user_id ::xowiki::formfield::party_id ::xowiki::formfield::party_id check=party_id_check ::xowiki::formfield::party_id->::xowiki::formfield::user_id ::xowiki::formfield::numeric ::xowiki::formfield::numeric answer_check=eq check=numeric convert_to_external convert_to_internal convert_to_internal_value initialize pretty_value render_input ::xowiki::formfield::user_id->::xowiki::formfield::numeric ::xowiki::formfield::text ::xowiki::formfield::text ::xowiki::formfield::numeric->::xowiki::formfield::text

Class ::xowiki::formfield::author

::xowiki::formfield::author[i] create ... \
           [ -label (default "#xowiki.formfield-author#") ] \
           [ -photo_size (default "54") ] \
           [ -with_gravatar (default "true") ] \
           [ -with_photo (default "true") ] \
           [ -with_user_link (default "false") ]

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xowiki::formfield::user_id[i]
::xotcl::Class create ::xowiki::formfield::author \
     -superclass ::xowiki::formfield::user_id

Methods (to be applied on instances)

  • label (setter)

  • photo_size (setter)

  • pretty_value (scripted)

    if {$v ne ""} {
      acs_user::get -user_id $v -array user
      if {${:with_photo}} {
        set portrait_id [acs_user::get_portrait_id -user_id $v]
        if {$portrait_id == 0 && ${:with_gravatar}} {
          set src [::xowiki::includelet::gravatar url  -email $user(email) -size ${:photo_size}]
        } else {
          set src "/shared/portrait-bits.tcl?user_id=$v"
        }
        set photo "<img width='[:photo_size]' class='photo' src='[ns_quotehtml $src]'>"
        set photo_class "photo"
      } else {
        set photo ""
        set photo_class ""
      }
      set date_field [::xowiki::FormPage get_table_form_fields  -base_item ${:object}  -field_names _last_modified  -form_constraints ""]
      set date [$date_field pretty_value [${:object} property _last_modified]]
    
      if {[:with_user_link]} {
        set user_link_begin "<a href='[ns_quotehtml /shared/community-member?user_id=$v]'>"
        set user_link_end "</a>"
      } else {
        set user_link_begin ""
        set user_link_end ""
      }
    
      return [subst {
        <div class="cite $photo_class">$photo
        <p class="author">$user_link_begin$user(first_names) $user(last_name)$user_link_end</p>
        <p class="date">$date</p>
        </div>
      }]
    }
    return ""
  • with_gravatar (setter)

  • with_photo (setter)

  • with_user_link (setter)