Main Menu
Function
The Main Menu module is the hub to launch the other modules. The currently selected place name is displayed along the top for convenience.
The buttons that launch other modules can be dynamically added and removed via the Settings screen in the Configuration module.
Implementation
The file assets/eps_main_menu.html
is launched by the Select button in the Configuration module. It provides a basic skeleton for this UI, but most of this screen's elements are dynamic. They are defined in assets/js/eps_main_menu.js
.
The file eps_main_menu.js
creates the buttons to launch the various modules of this application. It selectively hides these buttons if the configuration dictates this (see the init()
function). It also handles setting up the state for launching each of these modules.
To launch the Village Geographic Survey (with the Collect button), no setup is required. A direct call to odkTables.launchHTML(...)
will suffice. This is true of the Task List Generation (with the Select button) as well.
To launch the Geographic Navigation, a query must be passed that selects the points to which this particular user should navigate. The call happens with this function: odkTables.openTableToNavigateView(...)
which queries the Census table for these points (see the Village Geographic Survey for how this table is populated). The preceding code dynamically generates the SQL WHERE
clause and SELECT
arguments. This view is also opened with a dispatchStruct
, which triggers the Action-Callback workflow.
The launch of the Geographic Navigation is automatic, unlike the manual button pressing of the other modules. This occurs via the Action-Callback workflow triggered when the Navigation module is launched. See the actionCBFn()
function and the odkCommon.registerListener(...)
, odkCommon.viewFirstQueuedAction(...)
, and odkCommon.removFirstQueuedAction(...)
functions. When the Navigation module completes its action, the result is handled by this function. If the result indicates to do so, the Household Survey module will be launched via odkTables.editRowWithSurvey(...)
(using the configured Form ID).
The Household Survey is also launched with the Action-Callback workflow. When it returns, the results are used to update the Census table to match its corresponding form's completion status.
The currently selected location is displayed at the top by reading the value from localStorage
.
Files
assets/eps_main_menu.html
assets/js/eps_main_menu.js
Forms
None
Database Tables
Config
Census