Para::Frame::Route - Backtracking and planning steps in a session
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'.
[% 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
Use the html form fields
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.
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.
$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.
run query param exist, it will cause the action to run again
with the same parameters then we backtrack to that step.
$route-skip_step> to go back without taking the action.
$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.
This will use the post data if this was a post action.
Returns the caller_url, excluding actions, as an URI obj.
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.
Sets up the route for the present request. Should be called once from the application handler.
Takes any query params
plan_after and add those as
steps by calling the correspongding methods, removing the query
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->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.
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.
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 next step in the route. Do not change url or query params
True if the next steps caller page also is the next step
Return the number of steps in route
Returns the default template to use after the last step
Can be undef!