Gadgets and Dashboards 2.0 : Using Substitution Variables and Directives in your Gadget
This page last changed on Jun 03, 2009 by smaddox.
The Atlassian Gadgets framework allows you to specify substitution variables and #-directives in your gadget specification XML file that will be replaced by generated content at run time. On this page: Substitution VariablesThe Atlassian Gadgets framework supports the standard substitution variables as defined in the Google documentation on user preference substitution variables. These are variables like __UP_myuserpref__, in the attributes in the <ModulePrefs> and <UserPref> sections, where myuserpref matches the name attribute of a user preference. In addition, the following Atlassian-specific substitution variables are available. Atlassian Base URL VariableAt run time, this variable will be replaced with the base URL of the host application (e.g. JIRA) that is serving the URL.
Format: __ATLASSIAN_BASE_URL__ Note: There is a double underscore at the beginning and at the end of the variable. Example 1: <img src="__ATLASSIAN_BASE_URL__/download/resources/com.atlassian.jira.gadgets/loading.gif" height="35" width="35"/> At run time, the above section of the gadget XML will be replaced with the following: <img src="http://myhost.com:port/myapp/download/resources/com.atlassian.jira.gadgets/loading.gif" height="35" width="35"/> Example 2: gadgets.io.makeRequest("__ATLASSIAN_BASE_URL__/rest/gadget/1.0/intro", response, params); At run time, the above section of the gadget XML will be replaced with the following: gadgets.io.makeRequest("http://myhost.com:port/myapp/rest/gadget/1.0/intro", response, params); DirectivesOur software (JIRA, FishEye etc) is packaged software that can be installed on customers' servers. We want our gadget developers to be able to write gadgets that can retrieve information from any server, rather than from a specific web service or URL. So we have developed a templating layer that sits on top of the gadget specification. The Atlassian Gadgets framework allows you to specify #-directives in your gadget specification XML file that will be replaced by generated content at run time. These #-directives are provided by the Atlassian Gadget Publisher plugin. They work for any gadget that is provided as a plugin in an Atlassian application. The #-directives do not work for gadgets that are served from an external web server. Specific uses of #-directives: RELATED TOPICSCreating your Gadget XML Specification |
![]() |
Document generated by Confluence on Nov 22, 2009 17:46 |