Extension:ContactAtOnce Presence

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
ContactAtOnce Presence

Release status: stable

Implementation Tag
Description Render ContactAtOnce presence icon
Version 1.0 (05-18-2006)
MediaWiki 1.6.5
Download see below

[edit] ContactAtOnce Presence

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;
}
?>

[edit] Installation

  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.
Personal tools