Open main menu

Extension:ContactAtOnce Presence

MediaWiki extensions manual
OOjs UI icon advanced.svg
ContactAtOnce Presence
Release status: stable
Implementation Tag
Description Render ContactAtOnce presence icon
Latest version 1.0 (2006-05-18)
MediaWiki 1.6.5
License No license specified
Download see below
Translate the ContactAtOnce Presence extension if it is available at translatewiki.net
Check usage and version matrix.

ContactAtOnce PresenceEdit

Render the ContactAtOnce presence icon for the specified provider, merchant and placement.
For example:
"<ContactAtOncePresence ProviderId="1" MerchantId="1" PlacementId="1"></ContactAtOncePresence>"

<?php
# ContactAtOnce Presence Icon Extension
$wgExtensionFunctions[] = "ContactAtOncePresenceExtension";

function ContactAtOncePresenceExtension() {
    global $wgParser;
    $wgParser->setHook( "ContactAtOncePresence", "RenderPresence" );
}

function RenderPresence( $input, $argv ) {
	# Build HTML tag to include ContactAtOnce presence icon image and code for launching conversation.
	# Expected arguments are MerchantId, ProviderId and PlacementId
    # <ContactAtOncePresence MerchantId="10" ProviderId="17" PlacementId="1"></ContactAtOncePresence>   
	$output .= "<A onclick=\"javascript:window.open('http://applications.contactatonce.com/caoclientcontainer.aspx?";
    $output .= "MerchantId=" . $argv["merchantid"];
    $output .= "&ProviderId=" . $argv["providerid"];
    if (isset($argv['placementid']))
    {
		$output .= "&PlacementId=" . $argv["placementid"];
    }
    $output .= "&OriginationUrl='+encodeURIComponent(location.href),";
    $output .= "'','resizable=yes,toolbar=no,menubar=no,location=no,scrollbars=no,status=no,height=400,width=600');";
    $output .= "return false;\"";
    $output .= "href=\"#\"";
    $output .= ">";
    
    $output .= "<IMG src=\"http://applications.contactatonce.com/getagentstatusimage.aspx?";
    $output .= "MerchantId=" . $argv["merchantid"];
    $output .= "&ProviderId=" . $argv["providerid"];
    if (isset($argv['placementid']))
    {
		$output .= "&PlacementId=" . $argv["placementid"];
    }
    $output .= "\"";
    $output .= "onerror=\"this.height=0;this.width=0\" border=\"0\"";
    $output .= ">";
    
    $output .= "</A>";
    return $output;
}
?>

InstallationEdit

  1. Copy the code into a file (e.g. ContactAtOncePresence.php)
  2. Save the file in the extensions directory of your mediawiki folder
  3. Add the line include('extensions/ContactAtOncePresence.php'); to the end of your LocalSettings.php file.