/program/modules/mailpage/mailpage_view.php - interface to the view-part of the mailpage module
This file defines the interface with the mailpage-module for viewing content. The interface consists of this function:
This function is called from /index.php when the node to display is connected to this module.
actually send the visitor's message to the selected destination
In order to get a feeling for the time a visitor needs, we also record the delay (in seconds) next to the visitor's IP address.
display the contact form
this displays the contact form. Every destination gets a separate DIV just below the listbox, with the additional information for that destination. If JavaScript is NOT enabled, all DIVs are displayed, otherwise only the currently selected destination is displayed and the others are not. IOW: this form is still usable even without JS enabled AND it is screenreader-friendly.
If there is only a single destination, the listbox is not defined in the dialogdef and hence not rendered at all: there is no point in showing a list of options if there is nothing to choose from. This means that the necessary javascript is NOT added and also no DIVs are shown. So: a clean, uncluttered form in case of a single destination.
show a preview of the message to the visitor
this shows a preview of the message to visitor. Nothing is editable, it is view-only. The only option is to either press the Send-button to actually send the messate OR to press the Edit button to go back to the editable form.
Sending a message is a two-step procedure by design.
thank the visitor for the message and show a text copy too
Almost the same as {@see mailpage_show_preview()}.
display the content of the mailpage linked to node $node_id
validate the data entered by the visitor
Other than the standard validation we check for at least 1 @-sign in the email address. (It is non-trivial to validate an email address, it may not even be possible to do it in a single regular expression. See http://stackoverflow.com/questions/201323 for more information.)
retrieve all configuration data for this mailpage
this retrieves all configuration data for this mailpage, i.e. both the general parameters (header/intro/etc.) and the full list of configured destination addresses. Here is a quick reminder of the structure in $config.
'node_id' 'header' 'introduction' 'message' 'addresses' = ['mailpage_address_id','node_id','sort_order','name','email','description','thankyou'],...
construct a dialog definition for the visitor's mail form
this defines the contact form. If there is but one destination we don't even add the listbox because it makes no sense to tell the user to select an option from a listbox with a single item.
Documentation generated on Tue, 28 Jun 2016 19:10:17 +0200 by phpDocumentor 1.4.0