Open-CSP / FlexForm

MediaWiki extensions : HTML5 Form renderer
https://www.mediawiki.org/wiki/Extension:FlexForm
5 stars 4 forks source link
mediawiki mediawiki-extension

FlexForm

FlexForm is an enhanced HTML5 rendering engine.

It renders HTML5 form elements and allows to edit or create a page or multiple pages with one form.

Version 2 has changes in its config. So upgrading to version 2 means adjusting your local settings.

Version 1 was a complete rewrite and stripped down version from the previous WSForm.

Installation

Grab in instance from https://github.com/Open-CSP/FlexForm. Create a "FlexForm" folder in your Wiki extensions folder and extract the files there.

Or install using Composer. Read more here: https://www.mediawiki.org/wiki/Composer/For_extensions

The Composer required name is: open-csp/flex-form

If you are not installing FlexForm using composer, then you still need to run php composer --update inside extensions/Flex-Form

composer require open-csp/flex-form

Setup

You can tweak FlexForm to an extent in your Localsettings.php

$wgFlexFormConfig['secure']                                        = true; //( default is true ). Will render form that make no sense when inspected in the browser
$wgFlexFormConfig['sec_key']                                       = ""; // A salt key for encryption. Used together with "secure" option. Must be set when using multiple instances of a wiki
$wgFlexFormConfig['auto_save_interval']                            = 30000; // defaults to 3 minutes.
$wgFlexFormConfig['auto_save_after_change']                        = 3000; // defaults to 3 seconds after last change
$wgFlexFormConfig['FlexFormDefaultTheme']                          = "Plain"; // Currently the only form
$wgFlexFormConfig['rc_site_key']                                   = ""; // reCaptcha site key
$wgFlexFormConfig['rc_secret_key']                                 = ""; // reCaptcha secret key
$wgFlexFormConfig['file_temp_path']                                = ""; // When using image upload conversion, we need a place to temporarily store images.
$wgFlexFormConfig['can_create_user']                               = false; // If FlexForm is allowed to create new users
$wgFlexFormConfig['filter_input_tags']                             = false; // Defaults to false. Will filter all parser arguments to plain text, except value parameters. Will also disallow onClick and onFocus parameter. This feature will most likely be removed in future updates.
$wgFlexFormConfig['allowedGroups']                                 = ["sysop","moderator"]; // Defaults to sysop. Only a user in the allowedGroups is able to edit pages with a FlexForm in the source.
$wgFlexFormConfig['renderonlyapprovedforms']                       = true; // Defaults to true. When a user in the allowedGroups creates a form it will become valid and will be rendered. Someone not in the allowedGroups can create a form and save it, but it will never be rendered until a user from the allowedGroups will edit and re-save the page. Only then will a form become valid. The message "FORM CANNOT BE RENDERED, NOT VALIDATED" will be shown instead of the form when it is invalid.
$wgFlexFormConfig['renderi18nErrorInsteadofImageForApprovedForms'] = false; // When a form is invalid, an invalid image will be rendered instead of the form. Set to true to render i18n invalid message.
$wgFlexFormConfig['userscaneditallpages']                          = false; // Defaults to false. This differs from FlexForm before 2.0. FlexForm will now honor the UserCan functions in MediaWiki. If a form edits or creates a page a user has no rights to, the form will fail.
$wgFlexFormConfig['hideEdit']                                      = true; // Defaults to true. If a user is not in the allowedGroups then hide edit and editsource menu items for any page containing a FlexForm form.
$wgFlexFormConfig['create-seo-titles']                             = true; // Defaults to false. Will filter any user input on creating a new page to be SEO friendly.
$wgFlexFormConfig['auto_save_btn_on']                              = "Autosave On";
$wgFlexFormConfig['auto_save_btn_off']                             = "Autosave Off";
$wgFlexFormConfig['loadScriptPath']                                = ""; // Defaults to what is described by the loadscript form argument. When you change it do a different folder, then loadScript argument will be looking in this folder for its JavaScript file to load with the Form.
$wgFlexFormConfig['use_smtp']                                      = false; // when sending email, should we use separate smtp ?
$wgFlexFormConfig['smtp_host']                                     = "";
$wgFlexFormConfig['smtp_authentication']                           = true;
$wgFlexFormConfig['smtp_username']                                 = "";
$wgFlexFormConfig['smtp_password']                                 = "";
$wgFlexFormConfig['smtp_secure']                                   = "TLS";
$wgFlexFormConfig['smtp_port']                                     = 587;

Add the following line at the end of your LocalSettings.php to enable the extension :

wfLoadExtension( 'FlexForm' );

Run the update script which will automatically create the necessary database tables that this extension needs.

Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Migrate from version 1.x to 2.0

Please notice the changes in the config settings. Also, by default, the setting renderonlyapprovedforms will be true. Meaning that once you install FlexForm v2.0 all your existing FlexForm forms in your wiki will be shown as unvalidated. Visit this documentation page https://www.open-csp.org/DevOps:Doc/FlexForm/2.0/Validated_Forms to read how to solve this easily.

Docs

Visit : https://www.open-csp.org/DevOps:Doc/FlexForm

Changelog