Extension:Semantic Forms Inputs

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Semantic Forms Inputs

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type User interface
DescriptionTemplate:Extension#description Provides additional input types for Semantic Forms
Author(s)Template:Extension#username Stephan Gambke, with contributions from Yaron Koren, Jeroen De Dauw, Sanyam Goyal, Yury Katkov and others
Latest versionTemplate:Extension#version 0.10.1 (2016-02-11)
MediaWikiTemplate:Extension#mediawiki 1.22+
PHPTemplate:Extension#php 5+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download Download Semantic Forms Inputs 0.10.1
Download latest development version
README
Version History
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the Semantic Forms Inputs extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

Description[edit]

Semantic Forms Inputs is an extension to MediaWiki that provides additional input types for Semantic MediaWikis that use the Semantic Forms extension.

The Semantic Forms extension allows users to add, edit and query data of a Semantic MediaWiki using forms. For every form field the input type specifies the type of input a field will have in the form. Semantic Forms comes with basic input types for all data types. This extension -- Semantic Forms Inputs -- aims to collect further, optically and/or functionally enhanced input types.

Installation[edit]

$IP stands for the Installation Path (or "directory") of your MediaWiki installation, the same directory that holds LocalSettings.php, index.php etc..

Note: Having MediaWiki (version 1.22 or higher) and Semantic Forms (versions 3.4.3 to 3.6.0) installed is a precondition for the Semantic Forms Inputs extension; the code will not work without them. Lower versions might work but are not tested.

  1. Download a released version or the current development version and extract the files to the $IP/extensions directory
    Alternatively you can clone Semantic Forms Inputs using git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git
  1. Rename the new folder to SemanticFormsInputs, if necessary
  2. Add to the end of LocalSettings.php:
    require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php");
    
  3. Do some customization if necessary (see below)
  4. Go to the Special:Version page of your wiki and verify that an entry for Semantic Forms Inputs exists

There is a version history available.

Customization[edit]

You can change the settings of the Semantic Forms Inputs extension by placing new settings in your LocalSettings.php file, below the inclusion of SemanticFormsInputs.php.

You can find all the default settings and their descriptions in the file SFI_Settings.php.

Time picker[edit]

A timepicker input with times opened

Input type: timepicker

The time picker lets a user pop up a menu of hours and minutes and choose a time from it. You can tweak the appearance of the time picker by changing or overriding the CSS rules of the jQuery library and/or the SFI time picker stylesheet.

Examples[edit]

Example: A field that uses a time picker with all parameters set to their default values

{{{field|foo|input type=timepicker}}}


Example: A field that uses a time picker with specific parameters:

{{{field|foo|input type=timepicker
|disable input field
|show reset button
|mintime=07:00
|maxtime=16:59
|interval=10
}}}


Parameters[edit]

Parameter Support Meaning/Remark
Standard
size Yes Specifies the width of the text entry.
maxlength Yes Specifies the maximum allowed length of the text entry.
rows No
cols No
mandatory Yes
hidden Yes
restricted Yes
uploadable No
autocomplete No
no autocomplete No
autocomplete on category No
autocomplete on concept No
autocomplete on namespace No
remote autocompletion No
property No
default Yes Format: hh:mm
values No
values from category No
values from concept No
list No
delimiter No
class Yes
Type Specific
mintime The earliest time to show. Format: hh:mm
maxtime The latest time to show. Format: hh:mm
interval Interval between minutes. Number between 1 and 60.
disable/enable input field If the user shall be able to fill the input field directly or only via the date picker.
show/hide reset button If a reset button shall be shown. This is the only way for the user to erase the input field if it is disabled for direct input.


DateTime picker[edit]

Input type: datetimepicker

The datetime picker is a combination of the Date picker and the Time picker. It presents the datepicker and timepicker inputs side by side and returns one combined value in the format "yyyy/mm/dd hh:mm".

Examples[edit]

Example: A field that uses a datetime picker with all parameters set to their default values

{{{field|foo|input type=datetimepicker}}}


Example: A field that uses a datetime picker with specific parameters:

{{{field|foo|input type=datetimepicker
|disable input field
|show reset button
|week start=1
|highlight days of week=0
|disable days of week=6,0
|disable dates=2011/05/01,2010/12/25-2011/01/06
|mintime=07:00
|maxtime=16:59
|interval=10
}}}

Parameters[edit]

The parameters are the same as for the component inputs, i.e. for datepicker and timepicker combined. Exceptions are given below:

Parameter Support Meaning/Remark
size Yes Specifies the width of each entry. No way to set it separately.
maxlength Yes Specifies the maximum allowed length of each entry. No way to set it separately.
default Yes Format: yyyy/mm/dd hh:mm
values Yes Only the date portion will be used. The time portion will be ignored.
values from category Yes Only the date portion will be used. The time portion will be ignored.
values from concept Yes Only the date portion will be used. The time portion will be ignored.

Menuselect[edit]

A menuselect input with menu opened

Input type: menuselect

The menuselect input type lets a user pop up a menu with submenus and choose an entry from it. To use the menuselect you have to pass the menu structure as an unordered list. If you use wiki-internal links, the link text will be shown in the menu while the name of the target article will be sent back to the form. This currently only works in the development version on Git.

This input type is intended to display menus of modest dimensions. It is not intended for monsters with hundreds of entries in dozens of submenus. You have been warned.

You can tweak the appearance of the menuselect by changing or overriding the CSS rules of the jQuery library and/or the SFI menuselect stylesheet.

If you need to use the pipe symbol (|) in the structure, you have to replace it by {{!}}.


Examples[edit]

Example: A field that uses a menuselect with all parameters set to their default values

{{{field|foo|input type=menuselect
|structure=
* Item 1
** Item 11
** Item 12
* Item 2
** Item 21
** Item 22
}}}


Example: A field that generates the menu structure from semantic data. You need Extension:SemanticResultFormats version 1.9 or later for this to work.

{{{field|Part of|input type=menuselect|structure= {{#ask: [[Part of::+]]{{!}} format=tree{{!}} parent=Part of }} }}}

Parameters[edit]

Parameter Support Meaning/Remark
Standard
size Yes Specifies the width of the text entry.
maxlength Yes Specifies the maximum allowed length of the text entry.
rows No
cols No
mandatory Yes
hidden Yes
restricted Yes
uploadable No
autocomplete No
no autocomplete No
autocomplete on category No
autocomplete on concept No
autocomplete on namespace No
remote autocompletion No
property No
default Yes
values No
values from category No
values from concept No
list No
delimiter No
class Yes (for the input field only)
Type Specific
structure The menu structure as an unordered list
disable/enable input field If the user shall be able to fill the input field directly or only via the menu.

Two Listboxes[edit]

A two listboxes input

Input type: two listboxes

The twolistboxes input is very much like a listbox input from Semantic Forms. Use it if you need to add a list of predefined values to the field. The left listbox contains the possible values. If you click on one of the values it will move to a right listbox and will be considered as selected.

Use this input in conjunction with parameters values, values from category, values from concept, values from property, values from query.

Examples[edit]

Example:

{{{field|Employees|input type=two listboxes|values=Dilbert,Alice,Asok,Boss,PHB,Wally}}}

Example:

Parameters[edit]

Parameter Support Meaning/Remark
Standard
size Yes
maxlength Yes
rows No
cols No
mandatory Yes
hidden Yes
restricted Yes
uploadable No
autocomplete No
no autocomplete No
autocomplete on category No
autocomplete on concept No
autocomplete on namespace No
remote autocompletion No
property No
default Yes
values Yes
values from category Yes
values from concept Yes
list No
delimiter No
class Yes
Type Specific
someparam

Date Check[edit]

Input type: datecheck

The datecheck input is new in version 0.8. It checks if the inserted date has the right Format.

we use this JQuery Plugin: http://formvalidator.net/#default-validators_dates

Examples[edit]

Example:

{{{field|Date|input type=datecheck|date format=YYYY/MM}}}

Parameters[edit]

Parameter Support Meaning/Remark
Standard
size No
maxlength No
rows No
cols No
mandatory Yes
hidden No
restricted Yes
uploadable No
autocomplete No
no autocomplete No
autocomplete on category No
autocomplete on concept No
autocomplete on namespace No
remote autocompletion No
property No
default No
values No
values from category No
values from concept No
list No
delimiter No
class No
Type Specific
date format dd/mm/yyyy

Credits[edit]

SFI uses the jQuery and jQuery UI Javascript libraries for several input types.

Button icons for 'datetimepicker' and 'timepicker' are derived from the Mini Icons 2 icon set from brandspankingnew.net. See the relevant article on brandspankingnew.net

Finally, internationalization was achieved through the work of the translatewiki community. See translatewiki.net

Contact[edit]

Bugs should preferably be reported on the Wikimedia bug tracker.

Comments, questions and suggestions should be sent to the Semantic MediaWiki User mailing list.

See also[edit]