
| 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}&&synd=open&w=${width}&h=${height}&title=${title}$!{gadgetUPs}&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&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 |
