Technical Details
From UN-INSTRAW Wiki
Contents |
Code Changes
Multiple Starting Page Hack
- includes/EditPage.php
- includes/Linker.php
To edit a Starting Page template, edit something like MediaWiki:NewInstitution
Table Sections Hack
Table Sections Hack (Display sections as a key/value table when MAG_TABLESEC is set)
- includes/MagicWord.php : add MAG_TABLESEC to $magicWords array
- includes/Language.php : add
MAG_TABLESEC => array( 0, '_ _TABLESEC__' ),
to $wgMagicWordsEn array
- includes/Parser.php: add the following to function doHeadings, after "wfProfileIn".
$mw =& MagicWord::get( MAG_TABLESEC );
if ($mw->matchAndRemove( $text )) {
$text = preg_replace( "/^==(.+)==(\\s|$)/m","<table><tr><td valign='top'><nobr><b>\\1:</b></nobr></td><td>",$text,1); //replace first
$text = preg_replace( "/^==(\s+)==(\\s|$)/m","</td></tr></table>",$text,1); //replace last
$text = preg_replace( "/^==(.+)==(\\s|$)/m","</td></tr><tr><td valign='top'><nobr><b>\\1: </b></nobr></td><td>",$text); //replace all
}
Link Length Hack
Long external links were causing problems with formatting. This hack simply limits the length of external links.
- includes/Linker.php: in function makeExternalLink, before the "return"..
if (strlen($text) > 60) {
$text = substr($text,0,57) . "...";
}
return '<a href="'.$url.'"'.$style.'>'.$text.'</a>';
Google Maps Extension
Google_Maps_Extension will be the basis for assigning location to articles in the wiki. It's been modified for our usage model.
Dynamic Page List Extension
DynamicPageList will be the basis of collecting all mapped articles into GeoRSS feed.
Can now produce GeoRSS, and a calendar list, in cooperation with the other extensions.
This has also been modified to support an ordermethod=alpha modifier
Bread Crumbs Extension
- KW Bread Crumbs
- added call to kwBreadCrumbs directly in skins/MonoBook.php
YCalendar Extension
For inserting a Date range. Works in a similar fashion to the Google Maps extension.
Styling, Etc
CSS and MonoBook templates have been modified to simplify the Training Wiki look and feel.
Installing a New Wiki
- Create new directory ("/wiki/new/")
- ln -s /usr/lib/mediawiki/* /wiki/new
- Visit http://www.un-instraw.org/wiki/new and configure
- mv LocalSettings.php to parent directory and remove config subdirectory
- Other initialization tasks
- complete multiple starting page hack (create MediaWiki:Noarticletext) .. how to autmate this??
Scratchpad Thoughts
Just thinking out load .. some of this stuff is already done. Here for posterity.
Some thoughts on the mapping extension
1) Add hooks to GMaps extension so that the <googlemap> tag (or another to avoid conflict) was never seen by the editor. There's a link to Add/Remove Map. Whatever the location of that map is stored in a googlemap tag, in a set location in the text. When the page is edited later, it is preparsed by a hook to look for a <googlemap> tag.
2) Add Geocoding, based on MGeocoder for producing a form in map and the Google geocoder for lookups.
3) DynamicPageList is another extension, which produces lists based on assigned categories. My thought is to have the hooks in #1 also add a Category:Mapped, to easily find all the geotagged articles. And then modify DynamicPageList to output GeoRSS, rather than an HTML list.
4) The map of collected geotagged articles would be displayed in Google Maps with my MGeoRSS extension.
UI Issues
- preview/conflict/diff modes will show the hidden commands
- placement/names/instructions for assigning location/time to an entry
- how to show time (use cal, or text)
Assigning Time
http://developer.yahoo.com/yui/calendar/ will be useful. Otherwise will look similar to GoogleMapsExtension
For the listing, may simply have an Upcoming Events and Past Events page, which uses slightly modified DynamicPageList to sort based on the stated date of the page.
Microformats
Would be ideal to embed microformats in here?