Extension:CorporateContact

What can this extension do?
Provides a special page Special:Contact so that people can contact you without you to expose some email (no spam). Form allow to gather some basic information about people like name, email, company or organisation ...

This extension is highly configurable so that you can add custom wiki texts before and/or after contact form (according parameters), display custom suject (with i18n used). You can also make a custom mail content according values (according subject, according user type ...) in form providing your own mail rendering function. It is possible to provide a custom dispatch function so that you can choose according form values where mail should be sent.

Installation
To install this extensions, put files given in code section in your MediaWiki extensions folder and then add the following to LocalSettings.php:

Runtime (HTTP) parameters
Special:Contact page can be called with some parameters, separated by / character :
 * before:value Value of before parameter is used to specify custom text displayed before contact form. It should be a short value, such as identifier or key. If $wikiGetterFunc is given in configuration, this value is passed to this function to obtain final wiki text displayed before contact form, otherwise value is directly displayed.
 * after:value Value of after parameter is used to specify custom text displayed before contact form. It should be a short value, such as identifier or key. If $wikiGetterFunc is given in configuration, this value is passed to this function to obtain final wiki text displayed after contact form, otherwise value is directly displayed.
 * subject:value Value of subject</tt> is used to specify which subject should be selected when page is loaded. Should match a value of $subjects</tt> array in configuration (if subject:foo</tt>, foo</tt> should be found on $subjects</tt>, and so it will be selected when page is loaded).

Usage samples :
 * /Special:Contact/after:aaa/subject:foo/before:bbb
 * /Special:Contact/subject:foo
 * /Special:Contact/subject:foo/after:bbb

Configuration parameters
Configuration is mainly done in ContactSettings.php</tt>. They are not global variables so you should not have to prevent conflict with other variable in your system.
 * $subjects</tt> array of subject identifier, used as value in form for the subject popup menu. You have to localized it by adding in ContactPage.i18n.YOUR_LANG.php a key-value pair in messages</tt> array. Message key should match "contactpage-subject-$subject"</tt> (for "other" in $subjects</tt> array parameter you should have a "contactpage-subject-other" in i18n messages array).
 * $dispatcherFunc</tt> (required) name of function (provided in by your own) used to know where to send mail (see MyContact.php).
 * $subjectFunc</tt> (optional) name of custom function to determine subject of mail to be sent, given form values. If not provided localized value of wpSubject</tt> field is used (see $subjects</tt>).
 * $renderFunc</tt> (optional) name of custom function to render content of mail to be sent, given form values. If not provided value of wpContent</tt> textarea in form will only be sent as mail content.
 * <tt>$validateFunc</tt> (optional) name of custom function to perform custom validation upon form values. If not provided no extra validation is performed.
 * <tt>$defaultSenderName</tt> (required) name used as sender one when he does not provide it in form.
 * <tt>$defaultSenderEmail</tt> (required) email address used as sender one when he does not provide it in form.
 * <tt>$wikiGetterFunc</tt> (optional) name of custom function used to get wiki text for <tt>before</tt> and/or <tt>after</tt> runtime parameters. If not provided parameter values are used directly.
 * <tt>$formTabIndexes</tt> (optional) associative array (dictionary) used to specify tab index for form field. Very useful if you change display position of form field with CSS, so with ajusting tab indexes user can navigation through form field in a coherent way given what is displayed (if in your form subject is after first name you should add entries <tt>'wpFirstName' => x</tt> and <tt>'wpSubject' => x+1</tt> in this array parameter).

Code
File <tt>ContactPage.setup.php</tt> : extension setup (should not be modified)

File <tt>ContactPage.body.php</tt> : extension implementation (should not be modified)

File <tt>ContactPage.i18n.en.php</tt> : <a name="ContactPage.i18n.YOUR_LANG.php">English i18n</a>

File <tt>ContactPage.i18n.fr.php</tt> : French i18n

File <tt>ContactSettings.php</tt> : extension settings (should be modified)

File <tt>MyContact.php</tt> : custom functions (should be provided)

Captcha
This extension support captcha. In order to enable that you should add following line in your <tt>LocalSettings.php</tt> file :

$wgCaptchaTriggers['contactpage'] = true