ad_return_url (public)

 ad_return_url [ -urlencode ] [ -path_encode ] [ -qualified ] \
    [ -exclude exclude ] [ -formvars formvars ] \
    [ -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.
-exclude (optional)
list of form variables to be excluded in the result (negative selection)
-formvars (optional)
A list of query/form variables potentially included in the returnurl. Per default, all form vars are exported. By providing this positive selection, only these will be used. If you specify this empty, no variables are included.
-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 ::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 ad_get_login_url ad_get_login_url (public) ad_get_login_url->ad_return_url ad_get_logout_url ad_get_logout_url (public) ad_get_logout_url->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]} {
        if {[info exists formvars]} {
            set query_list [export_vars -formvars $formvars]
        } else {
            set query_list [export_vars -exclude $exclude -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: