Extension:PlasticMW

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
PlasticMW
Release status: experimental
Implementation Tag
Description Provides a wrapper for the plastic.js data display library
Author(s) Simon Heimler (Fannontalk)
Latest version 0.0.1 pre-alpha (November 2014)
MediaWiki 1.19+
PHP 5.2+
Database changes No
License MIT License
Download
README
Tags
plastic
Hooks used
ParserFirstCallInit
onBeforePageDisplay
Translate the PlasticMW extension if it is available at translatewiki.net
Check usage and version matrix.

The PlasticMW exentsion provides a wrapper for the plastic.js data display library.

WARNING: This extension is not ready for production use. It may work, but it is vulnerable to HTML / JS injection. Don't use it on (unprotected) production sites!

Installation[edit]

  • Download and place the file(s) in a directory called PlasticMW in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/PlasticMW/PlasticMW.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Instead of downloading the zip archive you may also check this extension out via Git:

git clone https://github.com/Fannon/PlasticMW.git

Features[edit]

  • Use a tag to embed a plastic embed code
  • plastic is a javascript library that can (asynchronously) query/fetch data, process it and display it through various modules. It supports querying of SPARQL endpoints and the Semantic MediaWiki ASK API.
  • TODO: Provide an parser function that is less verbose and more secure and uses the MediaWiki syntax.

Usage[edit]

This Wrapper Extension provides a <plastic> tag that works exactly like the native plastic.js embed code with the one difference that the <plastic> tag is used instead of an <div class="plastic"> tag.

For more detailed instructions how to use the plastic.js in general, head to the user documentation.

Example[edit]

Embed Code[edit]

<plastic id="table-ask-query" class="test" style="height: auto; width: 800px">

    <script class="plastic-query" type="application/ask-query"
            data-query-url="http://semwiki-exp01.multimedia.hs-augsburg.de/ba-wiki/api.php">
                [[Kategorie:Mitarbeiter]]
                | ?Vorname=Vorname
                | ?Nachname=Nachname
                | ?Mail=Mail
                | ?Festnetz=Festnetz
                | ?Handy=Handy
            </script>

    <script class="plastic-options" type="application/json">
        {
            "benchmark": true
        }
    </script>

    <script class="plastic-display" data-display-module="advanced-table" type="application/json">
        {
            "tableClasses": "table table-condensed smaller-font",
            "paging": true,
            "searching": true,
            "ordering": true,
            "orderMulti": true
        }
    </script>
</plastic>

Result[edit]

Plasticjs-example.png