PoNG Module: MediaWiki View

From EWIKI
Jump to navigation Jump to search

This module shown MediaWiki content in your PoNG portal.

Please have a look at the other standard modules coming with PoNG.

Usage in "structure"

Simply add a action to the type array with "type": "pong-mediawiki"

Example structure file extract:

{
  "layout": {
     ...
     "rows": [
     {
       "rowId": "bla",
       "type" : "pong-mediawiki",
       "resourceURL": "http://mh-svr.de/mw/",        
       "resourceParam": { "page": "PoNG", "wikiRef":"/mw/index.php/", "wikiImg":"/mw/images/" },
       ...
     },
     ...
   ],
   ...
}

Since the REST API of the MediaWiki is used, there is no meta description file to be loaded.

So all the definition for this view have to be provided in the layout structure file in the field resourceParam. You have to provide the fields:

  • page: The initial page to be displayed.
  • wikiRef: WIKI internal href start with this string.
  • wikiImg: WIKI internal image src start with this string.

i18n Support

The language is passed in the REST API call as uselang parameter.

However, in Wikipedia the language code is part of the URL, so you can use a placeholder ${lang} in the ressourceURL to direct to the Wikipedia instance set by the i18n header module.

Since the page can also vary with the language (e.g. "Hauptseite", "Main page", ...) the page param can configured as object with attributes.

Example:

{
  "layout": {
     ...
     "rows": [
     {
       "rowId": "bla",
       "type" : "pong-mediawiki",
       "resourceURL": "http://${lang}.wikipedia.org/w/",        
       "resourceParam": { 
           "page": {
               "DE":"Wikipedia:Hauptseite",
               "IT":"Pagina_principale",
               "EN":"Main page"
            }, 
           "wikiRef":"/mw/index.php/", 
           "wikiImg":"/mw/images/" 
       },
       ...
     },
     ...
   ],
   ...
}