SM2Gen/flow of control through controller
2024-04-28 12:03:06 +01:00

53 lines
1.6 KiB
Plaintext

* Scheme of things:
main:
#
# Initial entry - route is "/<whatever>"
#
set initial panel
for initial panel:
load up _data hash with DB fields
load up stash with pointer(s) to control fields hash(= get-))
and a pointer to the prefix_data hash
render initial panel
do_update:
#
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
# parameters in the params hash.
#
load up all params into prefix_data hash:
By panel (series of if statements - only one executed):
call validate-PANEL() - return ret = ok or error message
if validation not ok:
render back to current panel with error message in stash
otherwise:
By panel (series of if statements - only one executed):
Copy back to DB all relevant params (is this just the DB params for this panel?)
do whatever is required: call perform-PANEL() - return "ok" or Error Message
call signal-event for any global actions specified (check it exists - error and continue?)
if action smeserver-<whatever>-update exists
signal_event smeserver-<whatever>-update
call signal-event for any specific actions for thids panel (check it exists first - error and continue)
set success in stash
if no "nextpanel" entry:
set firstpanel
else
set nextpanel
call render
do_display:
#
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
#
load up all supplied params into prefix_data hash
call get-selected-PANEL() - returns hash of all relevent parameters
load up returned hash into prefix_data
render - to called panel