Class ::xowiki::includelet::form-menu

::xowiki::includelet::form-menu[i] create ... \
           [ -__decoration (default "none") ] \
           [ -parameter_declaration (default " {-form_item_id:integer} {-parent_id} {-form} {-buttons {new answers}} {-button_objs} {-return_url} ") ]

Include a form menu for the specified Form
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl

Class Relations

  • class: ::xowiki::IncludeletClass[i]
  • superclass: ::xowiki::Includelet[i]
::xowiki::IncludeletClass create ::xowiki::includelet::form-menu \
     -superclass ::xowiki::Includelet

Methods (to be applied on instances)

  • __decoration (setter)

  • parameter_declaration (setter)

  • render (scripted)

    :get_parameters
    set package_id [${:__including_page} package_id]
    #:msg form-menu-[info exists form_item_id] buttons=$buttons
    
    if {![info exists form_item_id]} {
      set form_item_id [::$package_id instantiate_forms  -forms $form  -parent_id [${:__including_page} parent_id]]
      if {$form_item_id eq ""} {
        # we could throw an error as well...
        :msg "could not locate form '$form' for parent_id [${:__including_page} parent_id]"
        return ""
      }
    }
    if {[info exists parent_id]} {
      if {$parent_id eq "self"} {
        set parent_id [${:__including_page} item_id]
      }
    } else {
      set parent_id [${:__including_page} parent_id]
    }
    if {![info exists button_objs]} {
      set button_objs {}
      foreach b $buttons {
        if {[llength $b]>1} {
          lassign $b button id
        } else {
          lassign [list $b $form_item_id] button id
        }
        set form [::xo::db::CrClass get_instance_from_db -item_id $id]
        set form_package_id [$form package_id]
        if {$form_package_id eq ""} {
          #
          # When the package_id is empty, the page might be from a
          # site-wide page. Resolve the form page to the local context
          #
          $form set_resolve_context -package_id $package_id -parent_id $parent_id
          set form_package_id $package_id
        }
        #
        # "Package require" is just a part of "Package initialize"
        # creating the package object if needed....
        #
        ::xowiki::Package require $form_package_id
        set obj [form-menu-button-$button new -volatile -package_id $package_id  -base [::$package_id pretty_link -parent_id $parent_id [$form name]]  -form $form -parent_id $parent_id]
        if {[info exists return_url]} {$obj return_url $return_url}
        lappend button_objs $obj
      }
    }
    set links [list]
    foreach b $button_objs { lappend links [$b render] }
    return "<div style='clear: both;'><div class='wiki-menu'>[join $links { &middot; }]</div></div>\n"