%3 ::xotcl::Object ::xotcl::Object → getExitHandler → setExitHandler → unsetExitHandler __object_configureparameter __timediff abstract ad_doc ad_forward ad_proc asHTML check class db_0or1row db_1row debug destroy_on_cleanup ds extractConfigureArg filter filtersearch forward hasclass init invar isclass ismetaclass ismixin isobject istype log method mixin mset msg parametercmd proc procsearch qn self serialize set_instance_vars_defaults unknown vwait www-show-object ::xo::Context ::xo::Context exists_query_parameter export_vars get_all_query_parameter get_parameters initialize original_url_and_query process_query_parameter query_parameter set_query_parameter unset_query_parameter ::xo::Context->::xotcl::Object ::xowiki::Includelet ::xowiki::Includelet → available_includelets → describe_includelets → glob_clause → html_encode → html_id → html_to_text → js_encode → js_name → listing → locale_clause → parent_id_clause → publish_status_clause → require_YUI_CSS → require_YUI_JS category_clause get_current_folder get_page_order include_head_entries initialize js_name resolve_page_name screen_name tableWidget ::xowiki::Includelet->::xo::Context ::xo::ConnectionContext ::xo::ConnectionContext → require → require_package_id_from_url cache cache_exists cache_get cache_set cache_unset eval_as_user exists_form_parameter exists_parameter form_parameter get_all_form_parameter get_parameter get_user_id init lang load_form_parameter load_form_parameter_from_values perconnection_parameter_get_all perconnection_parameter_set_all permission query_parameter requestor require_form_parameter returnredirect role=admin role=all role=app_group_member role=community_member role=creator role=registered_user role=swa role=unregistered_user set_parameter set_user_id unset_parameter ::xo::ConnectionContext->::xo::Context ::xowiki::includelet::categories-recent ::xowiki::includelet::categories-recent include_head_entries initialize render ::xowiki::includelet::categories-recent->::xowiki::Includelet ::xowiki::includelet::presence ::xowiki::includelet::presence render ::xowiki::includelet::presence->::xowiki::Includelet ::xowiki::includelet::recent ::xowiki::includelet::recent render ::xowiki::includelet::recent->::xowiki::Includelet ::xowiki::includelet::unresolved-references ::xowiki::includelet::unresolved-references render ::xowiki::includelet::unresolved-references->::xowiki::Includelet ::xowiki::includelet::form-stats ::xowiki::includelet::form-stats render ::xowiki::includelet::form-stats->::xowiki::Includelet ::xowiki::includelet::link-with-local-return-url ::xowiki::includelet::link-with-local-return-url render ::xowiki::includelet::link-with-local-return-url->::xowiki::Includelet ::xowiki::includelet::personal-notification-messages ::xowiki::includelet::personal-notification-messages → get_messages_response → message_add → message_dismiss → modal_message_dialog → modal_message_dialog_register_submit initialize render ::xowiki::includelet::personal-notification-messages->::xowiki::Includelet ::xowiki::includelet::wf-todo ::xowiki::includelet::wf-todo initialize render render_ical ::xowiki::includelet::wf-todo->::xowiki::Includelet ::xowiki::includelet::available-includelets ::xowiki::includelet::available-includelets render ::xowiki::includelet::available-includelets->::xowiki::Includelet ::xowiki::includelet::folders ::xowiki::includelet::folders build_sub_tree build_tree collect_folders folder_query include_head_entries render ::xowiki::includelet::folders->::xowiki::Includelet ::xowiki::includelet::toc ::xowiki::includelet::toc → anchor build_navigation build_toc cache_includelet_data count current href include_head_entries initialize page_name page_number parent_id position render render_list render_tree render_yui_list yui_ajax yui_non_ajax ::xowiki::includelet::toc->::xowiki::Includelet ::xowiki::includelet::PageReorderSupport ::xowiki::includelet::PageReorderSupport ::xowiki::includelet::toc->::xowiki::includelet::PageReorderSupport ::xowiki::includelet::item-button ::xowiki::includelet::item-button get_page initialize render_button ::xowiki::includelet::item-button->::xowiki::Includelet ::xowiki::includelet::set-parameter ::xowiki::includelet::set-parameter render ::xowiki::includelet::set-parameter->::xowiki::Includelet ::xowiki::includelet::my-refers ::xowiki::includelet::my-refers render ::xowiki::includelet::my-refers->::xowiki::Includelet ::xowiki::includelet::last-visited ::xowiki::includelet::last-visited render ::xowiki::includelet::last-visited->::xowiki::Includelet ::xowiki::includelet::references-graph ::xowiki::includelet::references-graph render ::xowiki::includelet::references-graph->::xowiki::Includelet ::xowiki::includelet::current-irc-log ::xowiki::includelet::current-irc-log render ::xowiki::includelet::current-irc-log->::xowiki::Includelet ::xowiki::includelet::LTI-LaunchButton ::xowiki::includelet::LTI-LaunchButton init render_form_button ::xowiki::includelet::LTI-LaunchButton->::xowiki::Includelet ::xowiki::includelet::flowplayer ::xowiki::includelet::flowplayer include_head_entries render ::xowiki::includelet::flowplayer->::xowiki::Includelet ::xowiki::includelet::graph ::xowiki::includelet::graph graphHTML ::xowiki::includelet::graph->::xowiki::Includelet ::xowiki::includelet::get ::xowiki::includelet::get render ::xowiki::includelet::get->::xowiki::Includelet ::xowiki::includelet::most-popular ::xowiki::includelet::most-popular render ::xowiki::includelet::most-popular->::xowiki::Includelet ::xowiki::includelet::my-categories ::xowiki::includelet::my-categories render ::xowiki::includelet::my-categories->::xowiki::Includelet ::xowiki::includelet::creation-date ::xowiki::includelet::creation-date render ::xowiki::includelet::creation-date->::xowiki::Includelet ::xowiki::includelet::html-file ::xowiki::includelet::html-file href page_number render ::xowiki::includelet::html-file->::xowiki::Includelet ::xowiki::includelet::random-form-page ::xowiki::includelet::random-form-page → page_names render ::xowiki::includelet::random-form-page->::xowiki::Includelet ::xowiki::includelet::exam-top-includelet ::xowiki::includelet::exam-top-includelet render ::xowiki::includelet::exam-top-includelet->::xowiki::Includelet ::xowiki::includelet::s5 ::xowiki::includelet::s5 render render_overview render_slideshow slideshow_header ::xowiki::includelet::s5->::xowiki::Includelet ::xowiki::includelet::iframe ::xowiki::includelet::iframe render ::xowiki::includelet::iframe->::xowiki::Includelet ::xowiki::includelet::digg ::xowiki::includelet::digg render ::xowiki::includelet::digg->::xowiki::Includelet ::xowiki::includelet::community-link ::xowiki::includelet::community-link render ::xowiki::includelet::community-link->::xowiki::Includelet ::xowiki::includelet::available-formfields ::xowiki::includelet::available-formfields class_name render render_as_tree ::xowiki::includelet::available-formfields->::xowiki::Includelet ::xowiki::includelet::chat_room ::xowiki::includelet::chat_room render ::xowiki::includelet::chat_room->::xowiki::Includelet ::xowiki::includelet::form-menu ::xowiki::includelet::form-menu render ::xowiki::includelet::form-menu->::xowiki::Includelet ::xowiki::includelet::unread-items ::xowiki::includelet::unread-items render ::xowiki::includelet::unread-items->::xowiki::Includelet ::xowiki::includelet::categories ::xowiki::includelet::categories category_tree_edit_button category_tree_missing include_head_entries initialize render ::xowiki::includelet::categories->::xowiki::Includelet ::xowiki::includelet::rss-button ::xowiki::includelet::rss-button render ::xowiki::includelet::rss-button->::xowiki::Includelet ::xowiki::includelet::vspace ::xowiki::includelet::vspace render ::xowiki::includelet::vspace->::xowiki::Includelet ::xowiki::includelet::yui-carousel ::xowiki::includelet::yui-carousel form_images images render ::xowiki::includelet::yui-carousel->::xowiki::Includelet ::xowiki::includelet::my-references ::xowiki::includelet::my-references render ::xowiki::includelet::my-references->::xowiki::Includelet ::xowiki::includelet::my-yahoo-publisher ::xowiki::includelet::my-yahoo-publisher render ::xowiki::includelet::my-yahoo-publisher->::xowiki::Includelet ::xowiki::includelet::timeline ::xowiki::includelet::timeline render ::xowiki::includelet::timeline->::xowiki::Includelet ::xowiki::includelet::kibana ::xowiki::includelet::kibana → check_permission → grant_permission → url include_head_entries render ::xowiki::includelet::kibana->::xowiki::Includelet ::xowiki::includelet::most-frequent-visitors ::xowiki::includelet::most-frequent-visitors render ::xowiki::includelet::most-frequent-visitors->::xowiki::Includelet ::xowiki::includelet::form-usages ::xowiki::includelet::form-usages generate_voting_form render ::xowiki::includelet::form-usages->::xowiki::Includelet ::xowiki::includelet::chat ::xowiki::includelet::chat render ::xowiki::includelet::chat->::xowiki::Includelet ::xowiki::includelet::book ::xowiki::includelet::book render render_images render_item render_items ::xowiki::includelet::book->::xowiki::Includelet ::xowiki::includelet::book->::xowiki::includelet::PageReorderSupport ::xowiki::includelet::child-resources ::xowiki::includelet::child-resources render types_to_show ::xowiki::includelet::child-resources->::xowiki::Includelet ::xowiki::includelet::delicious ::xowiki::includelet::delicious render ::xowiki::includelet::delicious->::xowiki::Includelet ::xowiki::includelet::selection ::xowiki::includelet::selection render render_children ::xowiki::includelet::selection->::xowiki::Includelet ::xowiki::includelet::selection->::xowiki::includelet::PageReorderSupport instmixin ::xowiki::includelet::countdown-timer ::xowiki::includelet::countdown-timer render ::xowiki::includelet::countdown-timer->::xowiki::Includelet ::xowiki::includelet::my-tags ::xowiki::includelet::my-tags render ::xowiki::includelet::my-tags->::xowiki::Includelet ::xowiki::includelet::tags ::xowiki::includelet::tags render ::xowiki::includelet::tags->::xowiki::Includelet ::xowiki::includelet::bookmarklet-button ::xowiki::includelet::bookmarklet-button render ::xowiki::includelet::bookmarklet-button->::xowiki::Includelet ::xowiki::includelet::gravatar ::xowiki::includelet::gravatar → url render ::xowiki::includelet::gravatar->::xowiki::Includelet ::xowiki::includelet::rss-client ::xowiki::includelet::rss-client initialize render ::xowiki::includelet::rss-client->::xowiki::Includelet ::xowiki::includelet::my-general-comments ::xowiki::includelet::my-general-comments render ::xowiki::includelet::my-general-comments->::xowiki::Includelet

Class ::xo::Context

::xo::Context[i] create ... \
           [ -actual_query (default " ") ] \
           [ -invoke_object invoke_object ] \
           [ -locale locale ] \
           [ -package_id (default "0") ] \
           [ -parameter_declaration (default "") ]

Defined in

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Object[i]
  • subclass: ::xowiki::Includelet[i], ::xo::ConnectionContext[i]
::xotcl::Class create ::xo::Context \
     -superclass ::xotcl::Object

Methods (to be applied on instances)

  • actual_query (setter)

  • exists_query_parameter (scripted)

     <instance of xo::Context[i]> exists_query_parameter

    Testcases:
    test_xo_cc, xotcl-core
    #:log "--qp exists $name => [info exists :queryparm($name)]"
    info exists :queryparm($name)
  • export_vars (scripted, public)

     <instance of xo::Context[i]> export_vars [ -all ] [ -level level ]

    Export either the declared query variables (default) or all (when explicitly demanded).

    Switches:
    -all (optional)
    when specified, export all query variables
    -level (optional, defaults to "1")
    target level

    Testcases:
    package_normalize_path, xowiki_test_cases, link_tests, slot_interactions, path_resolve
    
    if {$all} {
      foreach p [array names :queryparm] {
        regsub -all : $p _ varName
        uplevel $level [list set $varName [set :queryparm($p)]]
      }
    } else {
      #
      # Export only declared parameters (coming from the package
      # initialization or from the includelet definition).
      #
      foreach p [array names :queryparm] {
        if {$p in ${:declared_parameters}} {
          #ns_log notice "=== export <$p>"
          uplevel $level [list set $p [set :queryparm($p)]]
        }
      }
    }
    #
    # Set always variable package_id
    #
    uplevel $level [list set package_id ${:package_id}]
  • get_all_query_parameter (scripted)

    return [array get :queryparm]
  • get_parameters (scripted, public)

     <instance of xo::Context[i]> get_parameters

    Convenience routine for includelets. It combines the actual parameters from the call in the page (highest priority) with the values from the url (second priority) and the default values from the signature.

    Testcases:
    xowiki_test_cases
    set source [expr {[info exists :__caller_parameters]
                      ? [self] : [:info parent]}]
    $source instvar __caller_parameters
    
    #set n [expr {[info exists :name] ? ${:name} : "NONE"}]
    #ns_log notice "$n: GET PARAMETERS source <$source> have [info exists __caller_parameters]"
    if {![info exists :__including_page]} {
      #
      # An includelet is called from the top-level. The actual_query
      # might be cached, so we reset it here.
      #
      set :actual_query [::xo::cc actual_query]
    }
    
    if {[info exists __caller_parameters]} {
      :process_query_parameter -all_from_query false -caller_parameters $__caller_parameters
    } else {
      :process_query_parameter -all_from_query false
    }
    :export_vars -level 2
  • initialize (scripted)

    set :parameter_declaration $parameter
  • invoke_object (setter)

     <instance of xo::Context[i]> invoke_object

    Testcases:
    create_folder_with_page, xowf, create_workflow_with_instance, create_form_with_form_instance
  • locale (setter)

  • original_url_and_query (scripted)

     <instance of xo::Context[i]> original_url_and_query

    Testcases:
    package_normalize_path, xowiki, xowiki_test_cases, link_tests, slot_interactions, path_resolve
    if {[llength $args] == 1} {
      set :original_url_and_query [lindex $args 0]
    } elseif {[info exists :original_url_and_query]} {
      return ${:original_url_and_query}
    } else {
      return ${:url}?${:actual_query}
    }
  • package_id (setter)

     <instance of xo::Context[i]> package_id

    Testcases:
    xotcl_core_tutorial_2, xotcl-core, xowiki_test_cases, link_tests
  • parameter_declaration (setter)

  • process_query_parameter (scripted)

     <instance of xo::Context[i]> process_query_parameter

    Testcases:
    api__context, xotcl-core
    set declared_parameters [lmap v ${:parameter_declaration} {
      string range [lindex [split [lindex $v 0] :] 0] 1 end
    }]
    
    if {${:actual_query} eq " "} {
      if {[ns_conn isconnected]} {
        set :actual_query [ns_conn query]
      }
      #:log "--P actual_query <${:actual_query}> url [ns_conn url] q [ns_conn query]"
    }
    set passed_args ""
    #:log "--P processing actual query '${:actual_query}'"
    try {
      set paramset [ns_parsequery ${:actual_query}]
      foreach {att_name att_value} [ns_set array $paramset] {
        if {$att_name eq ""} continue
        if {$att_name in $declared_parameters} {
          dict lappend passed_args -$att_name $att_value
        } elseif {$all_from_query} {
          set :queryparm($att_name$att_value
        }
      }
    } on error {errorMsg} {
      ad_log warning "process_query_parameter: $errorMsg"
      ad_return_complaint 1 "invalid characters in HTTP query parameters"
    }
    
    # get the query parameters (from the form if necessary)
    if {[:istype ::xo::ConnectionContext]} {
      foreach name $declared_parameters {
        set param -$name
        #:log "--cc check $param [dict exists $passed_args $param]"
        if {![dict exists $passed_args $param]
            && [:exists_form_parameter $name]
          } {
          #:log "--cc adding passed_args(-$name) [:form_parameter $name]"
          dict set passed_args $param [:form_parameter $name]
        }
      }
    }
    
    # get the caller parameters (e.g. from the includelet call)
    if {[info exists caller_parameters]} {
      #:log "--cc caller_parameters=$caller_parameters"
    
      foreach param [dict keys $caller_parameters] {
        set name [string range $param 1 end]
        if {$name in $declared_parameters} {
          dict set passed_args $param [dict get $caller_parameters $param]
        } elseif {$all_from_caller} {
          set :queryparm($name) [dict get $caller_parameters $param]
          lappend declared_parameters $name
        }
      }
    }
    
    if {[::acs::icanuse "nsf::parseargs -asdict"]} {
      # OLD {64.347249 microseconds per iteration}
      # NEW {17.132942 microseconds per iteration}
      try {
        foreach {k v} [nsf::parseargs -asdict ${:parameter_declaration} $passed_args] {
          set :queryparm($k$v
        }
      } on error {errorMsg} {
        ad_return_complaint 1 [ns_quotehtml $errorMsg]
        ad_script_abort
      }
    } else {
      #:log "--cc calling parser eval [self] __parse <${:parameter_declaration}> <$passed_args>"
    
      :proc __parse ${:parameter_declaration} {
        foreach v [info vars] {
          :log "--cc uplevel [list set :queryparm($v) [set $v]]"
          uplevel [list set :queryparm($v) [set $v]]
        }
      }
    
      if {[catch {[self] __parse {*}$passed_args} errorMsg]} {
        ad_return_complaint 1 [ns_quotehtml $errorMsg]
        ad_script_abort
      }
    }
    set :declared_parameters $declared_parameters
    #:log "--cc qp [array get :queryparm] // ${:actual_query}"
  • query_parameter (scripted)

    if {[info exists :queryparm($name)]} {
      return [set :queryparm($name)]
    }
    return $default
  • set_query_parameter (scripted)

    set :queryparm($name$value
  • unset_query_parameter (scripted)

    unset -nocomplain :queryparm($name)