Extension:SemanticFormsToolbar

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Semantic Forms Toolbar

Release status: beta

Implementation Page action, API
Description Provides an infrastructure for turning semantic forms into toolbar items
Author(s) Andrew Garrett (WerdnaTalk)
Last version 1.0
MediaWiki 1.16+
License TBC
Download ExtensionDistributor

Check usage (experimental)

Contents

[edit] What can this extension do?

SemanticFormsToolbar provides a basic infrastructure for converting a semantic form into a toolbar icon. It was generated so that forms can be used to generate elements that are placed inline in wikitext, instead of editing an entire page.

[edit] Usage

In JavaScript, you can create a dialog definition suitable for WikiEditor's addDialog API using code similar to the following:

                $j('#wpTextbox1').wikiEditor( 'addDialog',
                        {'recommendation-form' : sfToolbar.getDialog( 'Form:Recommendation', 'recommendation' ) } );

Remember that you also need to associate a toolbar icon with the appropriate dialog like so:

                // Recommendation dialog
                $j('#wpTextbox1').wikiEditor( 'addToToolbar',
                        { 'section' : 'main', 'group' : 'insert', 'tools' : {
                                'recommendation-dialog' : { 'label' : 'Insert recommendation', 'type' : 'button',
                                'icon' : '/images/recommendation.png',
                                'action' : {
                                        'type' : 'dialog', 'module' : 'recommendation-form'
                                }
                        } } } );

The public interface for SemanticFormsToolbar consists of one method: sfToolbar.getDialog. It takes two parameters: the first is the name of the form to be used, and the second is a unique identifier for this dialog (for HTML ids).

When the dialog is triggered, it will prefill the form with any templates that are selected in the editor, so you can edit a template with the forms as well as inserting one. The "save" button on the form is overridden by a JavaScript action, which replaces the current text with the output of the form.

[edit] Download instructions

Download the tarball from MediaWiki.org, and extract it in your extensions directory.

[edit] Installation

Note that, before you install SemanticFormsToolbar, you must have Semantic MediaWiki and SemanticForms installed as well.

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/SemanticFormsToolbar/SemanticFormsToolbar.php");

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox