template::wizard::get_current_step (public)

 template::wizard::get_current_step [ -start start ]

Defined in packages/acs-templating/tcl/wizard-procs.tcl

Set the step to display for this particular request This is determined by the wizard_step parameter. If not set, the first step is used.

Make sure that you call any "template::wizard set_param" if needed before calling get_current_step. get_current_step will redirect to the wizard -action properly setting all -params value and its other needed http state vars

The wizard will rewrite the url always. Only self submitting forms are preserved. Once the form is finished processing the wizard will take over and rewrite the url.

Switches:
-start (optional)
Optionally specify
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 template::forward template::forward (public) template::wizard::get_forward_url template::wizard::get_forward_url (public) template::wizard::get_reference template::wizard::get_reference (private) template::wizard::get_visited_step template::wizard::get_visited_step (public) template::wizard::get_current_step template::wizard::get_current_step template::wizard::get_current_step->template::forward template::wizard::get_current_step->template::wizard::get_forward_url template::wizard::get_current_step->template::wizard::get_reference template::wizard::get_current_step->template::wizard::get_visited_step

Testcases:
No testcase defined.
Source code:
    get_reference

    upvar #$level wizard:current_id current_id
    set current_id [ns_queryget wizard_step${wizard_name} {}]
    if { $current_id eq "" } {
        if { [info exists start] } {
            set current_id $start
        } else {
            set current_id [lindex $steps 0]
        }
    }

    upvar #$level wizard:visited_step visited_step
    set visited_step [get_visited_step]

    # if there is no step state, we are likely in the first step.
    # lets redirect with the proper state vars
    if {[ns_queryget wizard_step${wizard_name}] eq ""} {
        template::forward [get_forward_url $current_id]
    }

    # get a reference to the step
    upvar #$level wizard:$current_id step

    upvar #$level wizard:current_url current_url

    # let's see if this step exists, if not we are finished with wizard and pass the steps
    if {[info exists step(url)]} {
        set current_url $step(url)
    } else {
        # if we have set_finish_url then we redirect to that url when we are finished
        # otherwise increment the parent wizard step
        if {[info exists wizard_finish_url]} {
            template::forward $wizard_finish_url
        } else {

            # let's set the current wizard name to the parent wizard
            set parent_wizard [lindex $wizards 0]
            set wizard_name $parent_wizard

            # lets now increment step of the parent wizard
            set parent_step [expr {[ns_queryget wizard_step${parent_wizard}] + 1}]
            template::forward [get_forward_url $parent_step]
        }

    }

    # check for a "back" submission and forward immediately if so
    # also check if we are backing up the current wizard or another wizard

    if { [ns_queryexists wizard_submit_back] && $wizard_name eq [ns_queryget wizard_name]} {

        set last_index [expr {[lsearch -exact $steps $current_id] - 1}]
        set last_id [lindex $steps $last_index]

        # LARS: I removed this, because it causes forms to not save their changes when you hit the back button
        # If you construct your form, so it calls 'wizard forward' in the -after_submit block, things will
        # work the way you expect them to
        #template::forward [get_forward_url $last_id]
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: