This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

Gadget User Macro

Name Gadget User Macro
Version 1.1
Product Versions Tested in 2.7 and later
Author(s) Mike Cannon-Brookes, Matt Ryall (Atlassian)
Homepage http://confluence.atlassian.com/display/CONFEXT/Gadget+User+Macro
Price Free
License Public domain

Description/Features

A simple user macro to embed Google gadgets. Get your gadgets from the Google Directory.

Security warning

This macro allows users to embed Google gadgets with arbitrary HTML into Confluence pages. This allows people with permission to edit pages in Confluence to conduct cross-site scripting (XSS) attacks against other users. For this reason, this user macro is not recommended for public installations of Confluence.

Installation

See User Macros for a guide on installing a user macro. You need to configure the following settings for your user macro:

  • Name: gadget
  • Body: uncheck, this macro does not have a body
  • Output: macro generates HTML markup
  • Template: see below.
#set ($height = "120")
#if ($paramh)
   #set ($height = $generalUtil.urlEncode($paramh))
#end

#set ($width = "320")
#if ($paramw)
   #set ($width = $generalUtil.urlEncode($paramw))
#end

#set ($title = "Gadget")
#if ($paramtitle)
     #set ($title = $generalUtil.urlEncode($paramtitle))
#end

#set ($url = $generalUtil.urlEncode($paramurl))

#if ($paramparams) 
   #set ($gadgetUPs = "")
   #set ($paramArr = $paramparams.split(";"))
   #foreach ($parameter in $paramArr)
     #set ($i = $parameter.indexOf("="))
#if ($i > 0)
     #set ($paramName = $parameter.substring(0, $i))
     #set ($j = $i + 1)
     #set ($paramValue = $parameter.substring($j))

     #set ($gadgetUPs = "$!{gadgetUPs}&up_$!{generalUtil.urlEncode($paramName)}=$!{generalUtil.urlEncode($paramValue)}")
#end
   #end
#end 

#if ($url)
<script src="http://gmodules.com/ig/ifr?url=${url}&amp;&amp;synd=open&amp;w=${width}&amp;h=${height}&amp;title=${title}$!{gadgetUPs}&amp;lang=en&amp;country=ALL&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
#else
<div class="errorBox">You must specify a <strong>url</strong> parameter. <code>{gadget:url=<strong>http://example.com/mygadget.xml</strong>}</code></div>
#end

Usage

{gadget:<params>}

Where <params> are:

  • url = the URL of the gadget XML (required, eg http://abowman.googlepages.com/spider.xml)
  • h = height (in pixels, eg 300)
  • w = width (in pixels, eg 300)
  • title = title of the gadget
  • params = semi-colon separated list of user preferences for the gadget (ie size=6;bellyColor=333333)

Screenshots

Version History

Version Author Changes
1.0 Mike Cannon-Brookes, Matt Ryall (Atlassian) Initial version
1.1 Matt Ryall (Atlassian) Fix string concatentation to be compatible with Confluence 2.7
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.