ad_return_url (public)

 ad_return_url [ -urlencode ] [ -path_encode ] [ -qualified ] \
    [ -default_url default_url ] [ extra_args ]

Defined in packages/acs-tcl/tcl/defs-procs.tcl

Build a return url suitable for passing to a page you expect to return back to the current page. Per default, the result is URL-encoded (like the result of "export_vars" or ":pretty_link").

Example for direct inclusion in a link:

    ad_returnredirect "foo?return_url=[ad_return_url]"
    
Example setting a variable to be used by export_vars:
    set return_url [ad_return_url]
    set edit_link [export_vars -base edit item_id return_url]
    
Example setting a variable with extra_vars:
    set return_url [ad_return_url [list [list some_id $some_id] [list some_other_id $some_other_id]]]
    

Switches:
-urlencode (optional, boolean)
-path_encode (optional, boolean, defaults to "true")
If false do no URL-encode the result
-qualified (optional, boolean)
If provided the return URL will be fully qualified including http or https.
-default_url (optional, defaults to ".")
When there is no connection, fall back to this URL
Parameters:
extra_args (optional)
A list of {name value} lists to append to the query string
Author:
Don Baccus <dhogaza@pacifier.com>

Partial Call Graph (max 5 caller/called nodes):
%3 test_login_logout_urls login_logout_urls (test acs-tcl) ad_return_url ad_return_url test_login_logout_urls->ad_return_url test_xowiki_test_cases xowiki_test_cases (test xowiki) test_xowiki_test_cases->ad_return_url export_vars export_vars (public) ad_return_url->export_vars security::get_qualified_url security::get_qualified_url (public) ad_return_url->security::get_qualified_url Class ::xowf::test_item::Answer_manager Class ::xowf::test_item::Answer_manager (public) Class ::xowf::test_item::Answer_manager->ad_return_url Class ::xowf::test_item::AssessmentInterface Class ::xowf::test_item::AssessmentInterface (public) Class ::xowf::test_item::AssessmentInterface->ad_return_url Class ::xowiki::includelet::child-resources Class ::xowiki::includelet::child-resources (public) Class ::xowiki::includelet::child-resources->ad_return_url Class ::xowiki::includelet::form-usages Class ::xowiki::includelet::form-usages (public) Class ::xowiki::includelet::form-usages->ad_return_url Class ::xowiki::includelet::my-categories Class ::xowiki::includelet::my-categories (public) Class ::xowiki::includelet::my-categories->ad_return_url

Testcases:
login_logout_urls, xowiki_test_cases
Source code:

    if { $urlencode_p } {
        ns_log warning "deprecated flag -urlencode; result is encoded per default"
    }

    if {[ns_conn isconnected]} {
        set query_list [export_vars -entire_form]
        set base_url [ns_conn url]
    } else {
        set query_list ""
        set base_url $default_url
    }

    if { $path_encode_p } {
        set base_url [ns_urlencode $base_url]
    }

    if { [llength $query_list] == 0 } {
        set url $base_url
    } else {
        set url "${base_url}?[join $query_list &]"
    }

    if {[llength $extra_args] > 0} {
        #
        # Deactivate base encode, since the input URL is already
        # encoded as requested.
        #
        set url [export_vars -base $url -no_base_encode $extra_args]
    }

    if { $qualified_p } {
        # Make the return_url fully qualified
        set url [security::get_qualified_url $url]
    }

    return $url
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: