Developer Hooks
From Daxipedia
Contents |
[edit] Overview
Developer Hooks allow the 4D developer to override certain default behaviours and to trap various events. Use of the Developer Hooks is optional.
[edit] User Authentication
By default 4D Ajax Framework will use the built in 4D Users and Groups system for users login and group management. 4D Ajax Framework also has its own internal session management system. You can override the 4D Ajax Framework login system, the 4D Ajax Framework login system and session management, or just let 4D Ajax Framework handle both for you. You can not override session management unless you are also overriding login.
This means if you already have your own login system in place, for instance a Users table, you can hook into the 4D Ajax Framework implementation and authorize users yourself. Then if you also have your own session management system you can hook into the 4D Ajax Framework session implementation and validate the sessions yourself as well.
[edit] Authentication Developer Hooks
DAX_DevHook_Login - Allows the developer to use their own login system instead of the 4D Ajax Framework Users and Groups login system.
DAX_DevHook_SessionValidate - Allows the developer to use their own session management system instead of the 4D Ajax Framework session management system.
DAX_DevHook_GetGroupsList - Allows the developer to use their own groups system. If this is not implemented and you are not using the 4D Users and Groups then there will only be one group for all users.
DAX_DevHook_UserInGroup - Required if the developer overrides groups using DAX_DevHook_GetGroupsList.
[edit] On Query
Every time 4D Ajax Framework is about to query the database for a selection of records to be sent to the front-end the developer is given the opportunity to perform the query themselves. This allows you to create more advanced query code than is possible with standard query calls. For instance you could use 'fuzzy matching' or 'hash' queries.
[edit] On Query Developer Hook
DAX_DevHook_OnQuery - Called anytime 4D Ajax Framework is about to query the database for records. Allows the developer to Handle the query themselves.
[edit] Selection Modification
Every time 4D Ajax Framework is about to send a selection of records to the front-end the developer is given the opportunity to modify this selection. This allows you to remove records that are not valid. For instance if you have a 'Deleted' flag field you could remove all of the records that are flagged as deleted.
[edit] Selection Modification Developer Hook
DAX_DevHook_QueryFilter - Called anytime 4D Ajax Framework is about to send a list of records. Allows the developer to modify the selection before it is sent.
[edit] Data Modification
Every time 4D Ajax Framework is about to save or delete a record the developer is given the opportunity to deny the action or handle other related tasks as necessary.
[edit] Data Modification Developer Hooks
DAX_DevHook_SaveRecord - Called anytime 4D Ajax Framework is about to save a record. Allows the developer to add any necessary internal field modifications such as date created or modified fields, or to handle other necessary actions such as updating related records or a system log.
DAX_DevHook_DeleteRecord - Called anytime 4D Ajax Framework is about to delete a record. Allows the developer to deny the deletion or to handle other necessary actions such as deleting related records or updating a system log.
[edit] Saved Queries
Saved Queries are preset queries that you create and assign to a selection. These saved queries then appear as tabs in a Grid view. For instance you could create a saved query for each letter of the alphabet and assign it to the last name field of a Contacts table. Then the user would see 26 tabs that each return the results for the associated letter.
[edit] Saved Queries Developer Hook
DAX_DevHook_QueryAdd - Called at startup to add your defined saved queries. Allows the developer to add new preset queries.
[edit] Callbacks
Starting with version 1.2 Callbacks are being transitioned to a new DevHook implementation. The previous implementation will be removed in a later version.
[edit] Callback Developer Hooks
DAX_DevHook_CB_Install - Allows the developer to install a callback at startup via code.
DAX_DevHook_CB_EventFired - Method called every time a callback event fires. Allows the developer to make any necessary changes to data due to the event occurring.
[edit] Developer Created Selections (Views)
Developer Created Selections allow the developer to add a new item to the list of tables (Views) that are displayed on the front-end using arrays as the data source. The arrays can then be populated with data from any data source the developer has access to. To the end user a DCS view appears and acts no differently than any other table.
Since DCS does a lot of array manipulation it is highly recommended that DCS only be used in systems that will be deployed compiled.
[edit] DCS Developer Hooks
DAX_DevHook_DCS_ViewAdd - Allows the developer to add DCS views. This is the only supported way to add a DCS view.
DAX_DevHook_DCS_SetSelection - Required if using DCS, allows the developer to create the data arrays to be displayed as the selection.
DAX_DevHook_DCS_RecordSave - Required if using DCS, allows the developer to handle saving DCS record information.
DAX_DevHook_DCS_RecordDelete - Required if using DCS, allows the developer to handle deleting DCS records.
DAX_Dev_DCS_Delete - Remove a previously added DCS View
[edit] Developer Defined Windows (Views)
Developer Defined Windows (DDW) give developers the ability to add a window with any html content they want on the front-end. The developer can have the window display an html blob or content from any valid URL. A DDW can display anything that can be displayed in a web browser.
[edit] DDW Developer Hooks
DAX_DevHook_DDW_Install - Allows the developer to add DDW views.
[edit] Choice Lists
Every time 4D Ajax Framework is about to send a list to the front-end the developer is given the opportunity to modify the list. This allows you to remove items from the list or create the list completely in code.
[edit] Choice Lists Developer Hooks
DAX_DevHook_ListContents - Allows the developer to override a list.
DAX_DevHook_InstallChoiceList - Allows the developer to define lists to fields with no assigned choice list in Design mode. You can also override the current choice list with another choice list. If you force-change the default list, A, with another list, B, and plan to redefine your lists in any callback methods, make sure that your callback method defines the new list, B, instead of the former list, A.
[edit] Global Preferences
DAX_DevHook_Preferences - Allows the developer to set the global preference values for the 4D Ajax Framework. The global preferences are
[edit] Dashboard and iPhone Report
[edit] Report Developer Hooks
DAX_DevHook_RPT_Formats - Allows the developer to add/update/delete report formats.
DAX_DevHook_RPT_Formula - Allows the developer to perform a custom calculation on the report footer(s).
DAX_DevHook_DefineChart - Allows the developer to define a chart that will appear in a dashboard.
