Extension:RoyalMailTrack

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

Release status: stable

Implementation Tag
Description Inserts form to submit a Royal Mail track & trace number
Author(s) JuuxTalk
Last version 1.1 (4 September 2008)
MediaWiki 1.12
License GPLv3
Download Link

Check usage (experimental)

This simple extension adds a form to a MediaWiki page that allows direct querying of Royal Mail track and trace numbers (recorded delivery and special delivery). I created this as a way to directly check recorded items from our intranet, instead of having to visit http://www.royalmail.com/ first.

With a few tweaks this extension could be used to check Parcelforce items aswell, the differences in query being explained here http://www.royalmail.com/portal/rm/content1?catId=28000674&mediaId=28100668

Contents

[edit] Licensing

This extension was developed from the Google search extension which in turn was based on the PayPal extension. Although no license was specified for the Google extension, the PayPal extension was released under some form of GPL so I have (hopefully) done the right thing and used the GPLv3 license.

[edit] Compatibility

I've tested this only on my own wiki which is running MediaWiki 1.12.0rc1, PHP 5.2.5 (apache2handler) & MySQL 5.0.51a so can't vouch for its compatibility with any other versions.

[edit] Installation

  • Create a new file named RoyalMailTrack.php in your MediaWiki extensions folder
  • Add the following code:

[edit] Code

<?php
 
/* To activate the extension, include it from your LocalSettings.php
** with: include("extensions/RoyalMailTrack.php");
**Syntax: <royalmailtrack/>
*/
 
$wgExtensionFunctions[] = "wfRoyalMailTrack";
 
function wfRoyalMailTrack() {
    global $wgParser;
 
    $wgParser->setHook( "royalmailtrack", "renderroyalmailtrack" );
}
 
# The callback function for converting the input text to HTML output
function renderroyalmailtrack( $input ) {
    $output = '<!-- Track Recorded -->';
    $output .= '<left>';
    $output .= '<form method="GET" action="http://www.royalmail.com/portal/rm/track?=">';
    $output .= '<table bgcolor="#FFFFFF"><tr><td>';
    $output .= '<a href="http://www.royalmail.com/">';
    $output .= '<img src="http://www.royalmail.com/IMAGE/MediaItemRepository/22600448_RM_Cruciform_Internalpage.gif" ';
    $output .= 'border="0" alt="Royal Mail logo" align="absmiddle"/></a>';
    $output .= '<input type="text" name="trackNumber" size="13" maxlength="13" value=""/>';
    $output .= '<input type="submit" value="Track It!"/>';
    $output .= '</td></tr></table>';
    $output .= '</form>';
    $output .= '</center>';
    $output .= '<!-- Track Recorded -->';
    return $output;
}
  • Add the following line to LocalSettings.php
include("extensions/RoyalMailTrack.php");
  • You can then add a Royal Mail track and trace form to any page by including the following tags
<royalmailtrack></royalmailtrack>
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox