File/program/modules/htmlpage/htmlpage_admin.php

Description

/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.

    htmlpage_disconnect(&$output,$area_id,$node_id,$module) htmlpage_connect(&$output,$area_id,$node_id,$module) htmlpage_show_edit(&$output,$area_id,$node_id,$module,$viewonly,$edit_again,$href) htmlpage_save(&$output,$area_id,$node_id,$module,$viewonly,&$edit_again)

These functions are called from pagemanagerlib.php whenever necessary.

Functions
htmlpage_connect (line 73)

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.

  • return: TRUE on success, FALSE otherwise
bool htmlpage_connect (object &$output, int $area_id, int $node_id, array $module)
  • object &$output: collects the html output (if any)
  • int $area_id: the area in which $node_id resides
  • int $node_id: the node to which we need to connect
  • array $module: the module record straight from the database
htmlpage_disconnect (line 53)

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).

  • return: TRUE on success, FALSE otherwise
bool htmlpage_disconnect (object &$output, int $area_id, int $node_id, array $module)
  • object &$output: collects the html output (if any)
  • int $area_id: the area in which $node_id resides
  • int $node_id: the node from which we need to disconnect
  • array $module: the module record straight from the database
htmlpage_save (line 180)

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 (and the value of $edit_again is a don't care).

Here is a summary of return values.

  • retval = TRUE ==> data saved successfully
  • retval = FALSE && edit_again = TRUE ==> re-edit the data, show the edit dialog again
  • retval = FALSE && edit_again = FALSE ==> cancelled, do nothing

  • return: TRUE on success + output stored via $output, FALSE otherwise
bool htmlpage_save (object &$output, int $area_id, int $node_id, array $module, bool $viewonly, bool &$edit_again)
  • object &$output: collects the html output (if any)
  • int $area_id: the area in which $node_id resides
  • int $node_id: the node to which the content is connected
  • array $module: the module record straight from the database
  • bool $viewonly: if TRUE, editing and hence saving is not allowed
  • bool &$edit_again: set to TRUE if we need to edit the content again, FALSE otherwise
htmlpage_show_edit (line 115)

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:

    $output->add_content($content): add $content to the content area $output->add_message($message): add $message to the message area (feedback to the user) $output->add_popup_bottom($message): make $message popup in the browser after loading the page (uses javascript) $output->add_popup_top($message): make $message popup in the browser before loading the page (uses javascript)

  • return: TRUE on success + output stored via $output, FALSE otherwise
bool htmlpage_show_edit (object &$output, int $area_id, int $node_id, array $module, bool $viewonly, bool $edit_again, string $href)
  • object &$output: collects the html output (if any)
  • int $area_id: the area in which $node_id resides
  • int $node_id: the node to which this module is connected
  • array $module: the module record straight from the database
  • bool $viewonly: if TRUE, editing is not allowed (but simply showing the content is allowed)
  • bool $edit_again: if TRUE start with data from $_POST, else use data from database
  • string $href: the action property of the HTML-form, the placa where data will be POST'ed

Documentation generated on Wed, 11 May 2011 23:45:15 +0200 by phpDocumentor 1.4.0