# WIDGET TECHNICAL OVERVIEW

Created At: 9/25/2017 11:19:14 PM
Updated At: 11/21/2017 6:03:02 AM
Original Doc: widget-technical-overview
Original ID: 278491
Internal: No

The dashboard controller program, MVDB.MAIN, is the mainline program responsible for generating the dashboard HTML pages. This program calls each widget’s BASIC subroutine in the appropriate sequence as specified by the active dashboard’s configuration.

The MVDB.SUBS file is designed to contain widget programs. All widget program source code must begin as follows:

SUBROUTINE widget_subroutine_name

INCLUDE WBPD MVDB.INCLUDE

W$TYPE = “FCPIE” <- Or desired widget type

W$TITLE = “Widget Title” <- Or desired widget title

W$WIDTH = 1 <- Or desired widget width

IF G$QUERYMODE = 1 THEN RETURN

(the rest of your code to follow)

The dashboard controller program initializes a named common space that is available to each of the widget subroutines. The named common space is declared in WBPD MVDB.INCLUDE as follows:

COMMON /MVDB/ GLOBAL.INFO(100), GLOBAL.USER.DATA(20), GLOBAL.TEMP.DATA(20), WIDGET.INFO(100), WIDGET.USER.DATA(100)

GLOBAL.INFO(1…100) contains global variables that are assigned and used by the dashboard controller programs. Widget subroutines are not expected to modify the information in the global variable space. However, these variables can be useful to widget programs. EQUATES for the variables in GLOBAL.INFO(1…100) make the following variable names available:

G$USERID
The ID of the user currently logged in.
G$CURRENT.DB
Current dashboard name.
G$LOGIN.DATE
Date user logged in (from session).
G$LOGIN.TIME
Time user logged in (from session).
G$WIDGET.NAME
Name of the widget being executed.
G$WIDGET.SUB
Name of the widget subroutine being called.
G$WIDGET.NAME.LIST
List of all widget names on this dashboard in the order that they are to be executed.
G$WIDGET.SUB.LIST
List of subroutine names associated with each of the widgets.
G$WIDGET.CALL.TIME
Time/Date stamp that each widget was called. This value will be blank for all widgets that have not yet been executed.
G$WIDGET.CALL.DUR
Duration (in milliseconds) of each widget subroutine. This value will be blank for all widgets that have not yet been executed.
G$QUERYMODE
Set to “1” if used to query subroutines without running them. The administration module uses this flag to determine the type and width of each widget without requiring the entire widget program to run.
G$SUBMITTED
Set to “1” if the user clicked the submit button on this widget by use of the W$INPUT… parameters.
G$REMOTE.ADDR
IP Address of the user’s computer on the network.
G$SERVER.NAME
Server name as referenced by the user’s browser.
G$HTTP.PORT
HTTP Port in use (e.g. 81).
G$DRILLDOWN.MODE
Set to “1” if the widget is being executed in drill-down mode.
G$DD.REFERRER
In Drilldown mode, the name of the widget calling the drilldown.
G$DD.FROM.DB
In Drilldown mode, the name of the dashboard calling the drilldown.

Each widget subroutine may use these variables to determine (for example) who the user is, what widgets have been called before this widget and what widgets will be called after this widget.

GLOBAL.USER.DATA(1…20) contains 20 variables that are shared by all widget programs. The values of these variables are persistent with the user's session. As long as the user's session is valid, these variables will remain intact. Widget programs must be developed to coordinate the use of these global variable positions as all widget programs will be able to read and write values in this array.

GLOBAL.TEMP.DATA(1…20) contains 20 variables that are shared by all widget programs. The values of these variables are initialized each time the dashboard is displayed. Unlike GLOBAL.USER.DATA(20), these variables are not persistent with the user's session. Widget programs may share the information in this array, but widgets will only have access to values set by programs executed earlier in the sequence of subroutine calls.

WIDGET.USER.DATA(1…100) contains 100 variables that are visible only to the active widget program. The private variables remain persistent with the user's session. The dashboard controller program does not modify these variables except as directed by the widget program through link information or user input (described below). When the user logs out, or closes his or her browser window, these values are destroyed.

WIDGET.INFO(1…100) holds all information generated by a widget subroutine for the purpose of generating the visible display. The structure of this array is defined in WBPD MVDB.INCLUDE. EQUATES for the variables in WIDGET.INFO(1…100) make the following variable names available: