xo::lti::LTI method form_render (public)
<instance of xo::lti::LTI> form_render [ -height height ] \ [ -sandbox sandbox ] [ -style style ] \ [ -auto_launch_p auto_launch_p ]
Defined in packages/xooauth/tcl/lti-procs.tcl
Set per-call parameters
- Switches:
- -height (optional, defaults to
"700"
)- -sandbox (optional)
- -style (optional, defaults to
"min-width:100%;width:100%;min-height:100%;"
)- -auto_launch_p (optional, defaults to
"0"
)- Testcases:
- No testcase defined.
Source code: if {![info exists :oauth_timestamp]} { set :oauth_timestamp [::xo::oauth::timestamp] } if {![info exists :oauth_nonce]} { set :oauth_nonce [::xo::oauth::nonce] } :get_context # # Collect the provided parameters # set params {} set signature_parameters {} foreach param [::xo::lti::LTI cget -lti_params] { if {[info exists :$param]} { lappend params $param lappend signature_parameters [list $param [set :$param]] } } # # Add potential GET parameters from the launch_url to # the signature parameters. # set url_info [ns_parseurl ${:launch_url}] if {[dict exists $url_info query]} { foreach {key value} [ns_set array [ns_parsequery [dict get $url_info query]]] { lappend signature_parameters [list $key $value] } } security::csp::require form-action ${:launch_url} security::csp::require frame-src ${:launch_url} # # Create signature # set signature [[::xo::oauth::Signature new -volatile -base_string_uri [::xo::oauth::Signature base_string_from_url ${:launch_url}] -signature_parameters $signature_parameters -client_secret ${:shared_secret}] generate] set lti_form_parameters $signature_parameters lappend lti_form_parameters [list oauth_signature $signature] #ns_log notice "==================== lti_form_parameters = $lti_form_parameters" # # We need an autogenerated frame name, because otherwise, # cascaded LTI frames may have the same name, which causes # trouble. However, we might need a configuration option # to allow opening up in _parent frames. # if { ${:launch_presentation_document_target} eq "iframe"} { set iframe_name "ltiframe${:oauth_nonce}" set target "ltiframe${:oauth_nonce}" } else { set iframe_name "" set target "_blank" } set form_name ltiform_${:oauth_nonce} set wrapper_id ltiLaunchFormSubmitArea_${:oauth_nonce} # # Create the HTML form. # ::xo::require_html_procs dom createDocument div lti $lti appendFromScript { ::html::div id $wrapper_id { ::html::form target $target action ${:launch_url} name $form_name id $form_name method "POST" encType "application/x-www-form-urlencoded" { foreach pair $lti_form_parameters { lassign $pair k v ::html::input type hidden name $k value $v } } } # # Add iframe if needed # if {${:launch_presentation_document_target} eq "iframe"} { ::html::iframe name $target style $style height $height sandbox $sandbox } } # auto launch if {$auto_launch_p} { template::add_body_handler -event onload -script [subst -nocommands {document.getElementById('$form_name').submit();}] } set html [$lti asHTML] $lti delete if {${:launch_presentation_document_target} eq "window"} { ::template::add_footer -html $html set html "" } return [list HTML $html form_name $form_name iframe_name $iframe_name]XQL Not present: Generic, PostgreSQL, Oracle