/program/modules/htmlpage/htmlpage_admin.php - management interface for htmlpage-module
This file defines the administrative interface to this module. The interface consists of the following four functions.
These functions are called from pagemanagerlib.php whenever necessary.
connect this module to a node
this makes the link between the node $node_id in area $area_id and this module. In this case we simply link a data container to node $node_id in a 1-to-1 relation. Note that we might decide lateron to keep versions of pages around, e.g. by inserting new records every save rather than updating the existing.
disconnect this module from a node
this breaks the link between the node $node_id in area $area_id and this module. For now we simply delete the record with page data. In a future version we might want to retain the page data, 'for future reference' (but: what do we do with it? Oh well).
construct the dialog definition for editing a plain HTML page
save the modified content data of this module linked to node $node_id
this validates and saves the data that was submitted by the user. If validation fails, or storing the data doesn't work, the flag $edit_again is set to TRUE and the return value is FALSE.
If the user has cancelled the operation, the flag $edit_again is set to FALSE and the return value is also FALSE.
If the modified data is stored successfully, the return value is TRUE. The value of $edit_again is determined by the key used to save: [Save] brings the user back to edit ($edit_again = TRUE) where [Done] leaves editing alltogether ($edit_again = FALSE).
Here is a summary of return values.
$retval | $edit_again | Action ------- | ----------- | ------ FALSE | FALSE | [Cancel] Stop editing, unlock & return to tree view FALSE | TRUE | [Save] or [Done] failed: redo the dialog and let user correct mistakes TRUE | FALSE | [Done] pressed, everything saved succesfully, we're done TRUE | TRUE | [Save] pressed, everything saved succesfully but continue editing
The parameter $option is not used in this module.
present the user with a dialog to modify the content that is connected to node $node_id
this prepares a dialog for the user filled with existing data (if any), possibly allowing the user to modify the content. If the flag $viewonly is TRUE, this routine should only display the content rather than let the user edit it. If the flag $edit_again is TRUE, the routine should use the data available in the $_POST array, otherwise it should read the data from the database (or wherever the data comes from). The parameter $href is the place where the form should be POST'ed.
The dialog should be added to the $output object. Useful routines are:
Note: the field version is basically unused, allthough the version number gets to be incremented on save. We keep the original functionality, including picking the latest version of the page_data (via $order = version DESC).
The parameter $option is not used in this module.
Documentation generated on Tue, 28 Jun 2016 19:09:49 +0200 by phpDocumentor 1.4.0