NAME

Para::Frame::Route - Backtracking and planning steps in a session

DESCRIPTION

For conditional planning inside a page, use param plan_next, like:

  [% jump('Do that', there, plan_next=uri(me, id=id)) %]

This will first "do that there" and then done, continue with $me. If the 'there' page has a defined next_template META, that will be done first. But if no such template is given, or there just are an default_template META, the next submit will follow the route.

Backtracking can also be done by running the action 'next_step'.

The plan will only be added to the route if the link is selected. In a form, the plan_next field can be modified by javascript. Use a hidden field for that, like

  [% hidden('plan_next', uri(me, id=id) ) %]

Several steps can be added by just adding up several plan_next hidden fields.

The steps can be set up during the generation of the page, from TT, by calling the function plan_next().

Select the action Para::Frame::Action::mark for bookmarking the current page, calling it with all the properties, except the call for mark.

Use the html form fields step_add_params or step_replace_params for selecting what values from the submitted form should be passed to the previous step.

You can also modify the route from actions and other places. Mostly you will be adding steps.

The [% regret(label) %] macro will create a button that will submit the form and run the action skip_step().

The [% backstep(label) %] macro will create a button that will submit the form and run the action next_step().

The skip_step action can be called to request a backtrack, rather than any of the other methods given above.

'plan_after' can be used in place of plan_next to put a step in the bottom of the route stack, rather than on top.

Exported objects

/plan_backtrack
plan : /plan_next
/plan_next
/plan_after

METHODS

plan_backtrack

  $route->plan_backtrack

Pops the URL from the top of the route stack and returns it. All parameters are set to the state of the step.

plan_backtrack() is called in the template header to set next_handler if non is specified.

TODO: Should make sure that the step only gets called one time.

plan_next

  $route->plan_next( @urls )

Insert a new step in the route. The url should include all the params that will be set then we backtrack to this step. The step will be placed on the top of the stack.

If a run query param exist, it will cause the action to run again with the same parameters then we backtrack to that step.

Use $route-skip_step> to go back without taking the action.

plan_after

  $route->plan_after( @urls )

Insert a new step as the last step in the route. The url should include all the params that will be set then we backtrack to this step. The step will be placed in the bottom of the stack.

caller_url

  $route->caller_url

This will use the post data if this was a post action.

Returns the caller_url, excluding actions, as an URI obj.

new

Construct the route object. This is used internally from the Session object. Calling the $session->route will return the route object or create it if not yet existing.

The $route->init() method is not called by new() and should be called once for each request.

init

  $route->init

Sets up the route for the present request. Should be called once from the application handler.

Calls $route->check_add().

check_add

  $route->check_add

Takes any query params plan_next and plan_after and add those as steps by calling the correspongding methods, removing the query params.

check_backtrack

  $route->check_backtrack

Called after each action in the request, if sessions are used.

This will check if a backtrack was requested, by an earlier use of $route-plan_backtrack>. If a backtrack was requested, takes a step back by calling $route-get_next>.

bookmark

  $route->bookmark( $url_str )

  $route->bookmark()

Same as /plan_next but defaults to the current page and the current query params.

This will add a step to the route with the page and all the query params we have at the moment, except file uploads.

This will also run the hook after_bookmark which will commit the DB. The changes up to date is needed for the bookmarking to be effective.

get_next

  $route->get_next

Take the next step in the route. That is; one step back.

This is the method used by the next_step action.

Set upp all the params for that step. The query param step_replace_params can be repeated, each param naming the name of antoher param given, that sould replace the corresponding param in the stpep. The query param step_add_params adds the corresponding parameter values rather than replacing them.

The template is set to that of the step.

skip_step

  $route->skip_step

Going back to the referer page of the request that set up the next step in the route. Giving that page the params it recieved then it was called before, except the special params like run(), et al. Removes that step from the route.

The step could have an explicit caller_page that would be used in place of the referer page.

Using run='mark' will make make the referer the same page as the step.

remove_step

  $route->remove_step

Remove next step in the route. Do not change url or query params

caller_is_next_step

  $route->caller_is_next_step

True if the next steps caller page also is the next step

steps

  $route->steps

Return the number of steps in route

default

  $route->default

Returns the default template to use after the last step

Can be undef!

replace_query

debug_query

list

on_configure

SEE ALSO

Para::Frame, Para::Frame::Manual::Templates