Extension:CorporateContact
From MediaWiki.org
|
Release status: stable |
|
|---|---|
| Implementation | Special page |
| Description | Configurable contact page Localized for : en, fa, fr |
| Author(s) | Cédric Chantepie (CchantepTalk) |
| Last Version | 0.1-SNAPSHOT |
| MediaWiki | 1.8.x - 1.12.0, 1.13.x |
| License | No license specified |
| Download | Download page |
| Example | Example 1 |
|
check usage (experimental) |
|
Contents |
[edit] 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 subject (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.
[edit] Usage
[edit] Installation
To install this extensions, put files given in code section in your MediaWiki extensions folder and then add the following to LocalSettings.php:
# Include yours custom functions require_once("$IP/extensions/ContactPage/MyContact.php"); # Include Special:Contact setup (required) require_once("$IP/extensions/ContactPage/ContactPage.setup.php");
[edit] 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 is used to specify which subject should be selected when page is loaded. Should match a value of $subjects array in configuration (if subject:foo, foo should be found on $subjects, 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
[edit] Configuration parameters
Configuration is mainly done in ContactSettings.php. They are not global variables so you should not have to prevent conflict with other variable in your system.
- $subjects 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 array. Message key should match "contactpage-subject-$subject" (for "other" in $subjects array parameter you should have a "contactpage-subject-other" in i18n messages array).
- $dispatcherFunc (required) name of function (provided in by your own) used to know where to send mail (see MyContact.php).
- $subjectFunc (optional) name of custom function to determine subject of mail to be sent, given form values. If not provided localized value of wpSubject field is used (see $subjects).
- $renderFunc (optional) name of custom function to render content of mail to be sent, given form values. If not provided value of wpContent textarea in form will only be sent as mail content.
- $pageTitleRenderer (optional) name of custom function to render page title.
- $validateFunc (optional) name of custom function to perform custom validation upon form values. If not provided no extra validation is performed.
- $defaultSenderName (required) name used as sender one when he does not provide it in form.
- $defaultSenderEmail (required) email address used as sender one when he does not provide it in form.
- $wikiGetterFunc (optional) name of custom function used to get wiki text for before and/or after runtime parameters. If not provided parameter values are used directly.
- $formTabIndexes (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 'wpFirstName' => x and 'wpSubject' => x+1 in this array parameter).
[edit] Captcha
This extension support captcha. In order to enable that you should add following line in your LocalSettings.php file :
$wgCaptchaTriggers['contactpage'] = true;