resource files and plugin

Angelo Diego Crabolu February 11, 2013

In my search request view plugin I have a velocity template that has a reference to an xslt file i wrote, I'd like my plugin to install this xslt file automatically (ideally in "http://myserver:2990/jira/styles/)

I've tried adding a resource in atlassian-pugin.xml but I can't figure out which url to use to reference the xslt file.

2 answers

1 accepted

0 votes
Answer accepted
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2013

atlassian-plugin.xml:

<web-resource key="xslt-resources" name="Xslt Web Resources">
    <resource type="download" name="test.xslt" location="/xslt/test.xslt"/>
  </web-resource>

vm file:

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet href="$webResourceManager.getStaticPluginResource("com.myplugin:xslt-resources","test.xslt")" type="text/xsl"?>

...

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2013

You can take a look at

https://developer.atlassian.com/display/PLUGINFRAMEWORK/Web+Resource+Plugin+Module

https://developer.atlassian.com/display/PLUGINFRAMEWORK/Web+Resource+Plugin+Module#WebResourcePluginModule-Non-BatchedMode

You can add param <param name="batch"value="false"/> and then refer to the resource using the url pattern given in the documentation:

SERVER_ROOT/s/BUILD_NUM/PLUGIN_VERSION/SYSTEM_COUNTER/_/download/resources/PLUGIN_KEY:MODULE_KEY/RESOURCE_NAME
Angelo Diego Crabolu February 18, 2013

Can I use the resource from the velocity template this way?

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2013

Yes, you can. I can provide you with some sample code for atlassian-plugin.xml and the vm file if you give me an example of what you want to achieve exactly.

Angelo Diego Crabolu February 18, 2013

Here is my velocity template (A modified version of the standard view issues xml) , I would like to have my xslt file instead of MYSTYLESHEET,

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet href="MYSTYLESHEET" type="text/xsl"?>

<rss version="0.92">

<channel>

<title>#xmlEscape($title)</title>

## Ensure we have no spaces around the link tag and its value. JRA-16175

<link>#xmlEscape($link)</link>

<description>#xmlEscape($!{description})</description>

#if ($rssLocale)

<language>$rssLocale</language>

#end

#if ($totalissue)

<issue start="$!{startissue}" end="$!{endissue}" total="$!{totalissue}"/>

#end

<build-info>

<version>#xmlEscape($version)</version>

<build-number>#xmlEscape($buildNumber)</build-number>

<build-date>#xmlEscape($buildDate)</build-date>

</build-info>

this is the configuration in atlassian-plugin.xml

<web-resource name="xslt" i18n-name-key="xslt.name" key="xslt">

<description key="xslt.description">.xslt resources for search request plugins</description>

<resource name="GroupByCategoriesEdt" type="download" location="xslt/GroupByCategoriesEdt.xslt">

<param name="batch" value="false"/>

</resource>

<resource name="GroupByDeveloppeur" type="download" location="xslt/GroupByDeveloppeur.xslt">

<param name="batch" value="false"/>

</resource>

</web-resource>

I tried with <?xml-stylesheet href="$webResourceManager.requireResource("xslt:GroupByDeveloppeur")" type="text/xsl"?> but It doesent seem to work, in the console it tells me "Cannot find we resource module for: xslt:GroupeByDeveloppeur"

Thanks for your help

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events