JavaScript in .jelly files

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JavaScript in .jelly files

Ulli Hafner-2
Hi,

I'm quite a newbie on using javascript in my Hudson jelly files and
got stuck when referencing a .js file in a Hudson jelly file.
What is exactly the way to reference a Hudson plug-in .js file?

I tried to reference a java script file in the following way:

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
  xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
  xmlns:i="jelly:fmt" xmlns:local="local">
  <j:if test="${it.hasAnnotations()}">
    <script type="text/javascript" src="tabview-min.js"></script>

    [...]

But this seems not to work. Are there some security aspects I need to consider?
What is the root path in the src references?
I tried to put the .js in different places without luck.

Currently, the jelly file and the *.js files are in the folder
$HUDSON_HOME\plugins\checkstyle\WEB-INF\classes\tabview
(The *.js files are also located in this folder).

When I'm using

    <script type="text/javascript"
                src="http://yui.yahooapis.com/2.5.2/build/tabview/tabview-min.js"></script>

then everything works!

Thanks, Ulli
--
Avaloq - essential for banking.

Avaloq Evolution AG
Allmendstrasse 140, 8027 Z├╝rich
T +41 44 488 6790, F +41 44 488 6868, http://www.avaloq.com
Dr. Ullrich Hafner mailto:[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JavaScript in .jelly files

Kohsuke Kawaguchi
Administrator
Hafner Ullrich wrote:

> Hi,
>
> I'm quite a newbie on using javascript in my Hudson jelly files and
> got stuck when referencing a .js file in a Hudson jelly file.
> What is exactly the way to reference a Hudson plug-in .js file?
>
> I tried to reference a java script file in the following way:
>
> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
>   xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
>   xmlns:i="jelly:fmt" xmlns:local="local">
>   <j:if test="${it.hasAnnotations()}">
>     <script type="text/javascript" src="tabview-min.js"></script>
>
>     [...]
> But this seems not to work.
It's essentially the same as referencing image files. So you can do:

<script ... src="${rootURL}/plugin/findbugs/tabview-min.js" />


 > Are there some security aspects I need to consider?

Not really.

> What is the root path in the src references?
> I tried to put the .js in different places without luck.
>
> Currently, the jelly file and the *.js files are in the folder
> $HUDSON_HOME\plugins\checkstyle\WEB-INF\classes\tabview
> (The *.js files are also located in this folder).
>
> When I'm using
>
>     <script type="text/javascript"
> src="http://yui.yahooapis.com/2.5.2/build/tabview/tabview-min.js"></script>
>
> then everything works!
We should probably have the entire YUI in Hudson core, so that you
always get the consistent version with the core.

Hudson has a special tag to include YUI script.


--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: JavaScript in .jelly files

Ulli Hafner-2
Ah, I tried ${rootURL}/plugins/ instead of ${rootURL}/plugin/ (since the
path on the folder is plugins).
Thanks, now it works!

What is the Hudson tag for YUI imports?

Ulli

> -----Original Message-----
> From: Kohsuke Kawaguchi [mailto:[hidden email]]
> Sent: Freitag, 20. Juni 2008 04:25
> To: [hidden email]
> Subject: Re: JavaScript in .jelly files
>
> Hafner Ullrich wrote:
> > Hi,
> >
> > I'm quite a newbie on using javascript in my Hudson jelly files and
> > got stuck when referencing a .js file in a Hudson jelly file.
> > What is exactly the way to reference a Hudson plug-in .js file?
> >
> > I tried to reference a java script file in the following way:
> >
> > <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
> xmlns:d="jelly:define"
> >   xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
> >   xmlns:i="jelly:fmt" xmlns:local="local">
> >   <j:if test="${it.hasAnnotations()}">
> >     <script type="text/javascript" src="tabview-min.js"></script>
> >
> >     [...]
> > But this seems not to work.
>
> It's essentially the same as referencing image files. So you can do:
>
> <script ... src="${rootURL}/plugin/findbugs/tabview-min.js" />
>
>
>  > Are there some security aspects I need to consider?
>
> Not really.
>
> > What is the root path in the src references?
> > I tried to put the .js in different places without luck.
> >
> > Currently, the jelly file and the *.js files are in the folder
> > $HUDSON_HOME\plugins\checkstyle\WEB-INF\classes\tabview
> > (The *.js files are also located in this folder).
> >
> > When I'm using
> >
> >     <script type="text/javascript"
> >
> >
> src="http://yui.yahooapis.com/2.5.2/build/tabview/tabview-min.js"></sc
> > ript>
> >
> > then everything works!
>
> We should probably have the entire YUI in Hudson core, so
> that you always get the consistent version with the core.
>
> Hudson has a special tag to include YUI script.
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems                   [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: JavaScript in .jelly files

Kohsuke Kawaguchi
Administrator
Hafner Ullrich wrote:
> Ah, I tried ${rootURL}/plugins/ instead of ${rootURL}/plugin/ (since the
> path on the folder is plugins).
> Thanks, now it works!
>
> What is the Hudson tag for YUI imports?

<l:yui />.

See lib/layout/yui.jelly

>
> Ulli
>
>> -----Original Message-----
>> From: Kohsuke Kawaguchi [mailto:[hidden email]]
>> Sent: Freitag, 20. Juni 2008 04:25
>> To: [hidden email]
>> Subject: Re: JavaScript in .jelly files
>>
>> Hafner Ullrich wrote:
>> > Hi,
>> >
>> > I'm quite a newbie on using javascript in my Hudson jelly files and
>> > got stuck when referencing a .js file in a Hudson jelly file.
>> > What is exactly the way to reference a Hudson plug-in .js file?
>> >
>> > I tried to reference a java script file in the following way:
>> >
>> > <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
>> xmlns:d="jelly:define"
>> >   xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
>> >   xmlns:i="jelly:fmt" xmlns:local="local">
>> >   <j:if test="${it.hasAnnotations()}">
>> >     <script type="text/javascript" src="tabview-min.js"></script>
>> >
>> >     [...]
>> > But this seems not to work.
>>
>> It's essentially the same as referencing image files. So you can do:
>>
>> <script ... src="${rootURL}/plugin/findbugs/tabview-min.js" />
>>
>>
>>  > Are there some security aspects I need to consider?
>>
>> Not really.
>>
>> > What is the root path in the src references?
>> > I tried to put the .js in different places without luck.
>> >
>> > Currently, the jelly file and the *.js files are in the folder
>> > $HUDSON_HOME\plugins\checkstyle\WEB-INF\classes\tabview
>> > (The *.js files are also located in this folder).
>> >
>> > When I'm using
>> >
>> >     <script type="text/javascript"
>> >
>> >
>> src="http://yui.yahooapis.com/2.5.2/build/tabview/tabview-min.js"></sc
>> > ript>
>> >
>> > then everything works!
>>
>> We should probably have the entire YUI in Hudson core, so
>> that you always get the consistent version with the core.
>>
>> Hudson has a special tag to include YUI script.
>>
>>
>> --
>> Kohsuke Kawaguchi
>> Sun Microsystems                   [hidden email]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment