You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "info@agentur-m3.de" <in...@agentur-m3.de> on 2014/11/30 09:23:00 UTC
javascript and css directory
Hi All,
I try to create a link for a javascript-file
in a sub-directory of my compomenent.
So I defined the links with @ofbizUrl or
@ofbizContentUrl, but they don't give the
results I did would expect.
<@o...@ofbizUrl>
and
<@ofbizUrl fullPath=true></...@ofbizUrl>
give mycomponent/control/
(a /control sub-directory does not exist
in the component)
and
<@o...@ofbizContentUrl>
<@ofbizContentUrl fullPath=true></...@ofbizContentUrl>
both return an empty string.
In a forum post I found a hint, that
dataTemplateTypeId="FTL" should be defined in the
components entity definitions to use
ofbizurl in freemarker files.
But I could not find further documentation on that,
and also in the application-folders it is not
defined for each application.
Do you know a way to get the base-dir
of the component as string,
so that I could define the correct link
in the freemarker-file?
Many Thanks,
Ralf
Re: javascript and css directory
Posted by "info@agentur-m3.de" <in...@agentur-m3.de>.
Thank you for your help!
Now I could embed the js/css with the following steps:
(1) I added a subdirectory static (webapp/mycomponent/static)
and moved the javascript and css files there.
(2) in mycomponentscreens.xml to the desired screen I added
layoutSetting-fields
<actions>
<set field="layoutSettings.javaScripts[]"
value="/mycomponent/static/marks.js" global="true"/>
<set field="layoutSettings.styleSheets[]" value="/mycomponent/static
/marks.css" global="true"/>
</actions>
(3) to the filter in web.xml added the created directory /static
to allowedPathes:
<init-param>
<param-name>allowedPaths</param-name>
<param-value>/error:/control:/select:/index.html:/index.jsp:
/default.html:/default.jsp:/images:/static:/js</param-value>
</init-param>
(4) finally restarted ofBiz!
Then the scripts were added to the html-code from ofBiz
and worked.
Am 30.11.2014 um 20:29 schrieb Jacques Le Roux:
> There is even a peculiar case for order manager which has its js files
> in applications/commonext/webapp/ordermgr-js because the webapp is
> redefined in the specialpurpose birt component
> specialpurpose/birt/webapp/ordermgr
> This is explained in
> http://svn.apache.org/viewvc?view=revision&revision=1612202
>
> So as you can see it can get complicated when you use OFBiz all
> possibilities to override artefacts.
>
> I hope I did not confuse things, I believe it's better to know extreme
> cases than ignore them.
>
> Jacques
>
> Le 30/11/2014 17:22, Adrian Crum a écrit :
>> Adding JS and CSS to a component can be done, but there are no
>> instructions for it. There are plenty of examples though.
>>
>> See the applications/party/webapp/partymgr/static folder. Also note
>> that the folder is included in the allowedPaths filter in web.xml.
>>
>> In addition, each visual theme is a component - and the themes have JS
>> and CSS files contained within them.
>>
>> So, you will need to spend some time reverse-engineering the existing
>> examples.
>>
>>
>> Adrian Crum
>> Sandglass Software
>> www.sandglass-software.com
>>
>> On 11/30/2014 8:23 AM, info@agentur-m3.de wrote:
>>> Hi All,
>>>
>>> I try to create a link for a javascript-file
>>> in a sub-directory of my compomenent.
>>>
>>> So I defined the links with @ofbizUrl or
>>> @ofbizContentUrl, but they don't give the
>>> results I did would expect.
>>>
>>> <@o...@ofbizUrl>
>>>
>>> and
>>>
>>> <@ofbizUrl fullPath=true></...@ofbizUrl>
>>>
>>> give mycomponent/control/
>>>
>>> (a /control sub-directory does not exist
>>> in the component)
>>>
>>> and
>>>
>>> <@o...@ofbizContentUrl>
>>> <@ofbizContentUrl fullPath=true></...@ofbizContentUrl>
>>>
>>> both return an empty string.
>>>
>>> In a forum post I found a hint, that
>>> dataTemplateTypeId="FTL" should be defined in the
>>> components entity definitions to use
>>> ofbizurl in freemarker files.
>>> But I could not find further documentation on that,
>>> and also in the application-folders it is not
>>> defined for each application.
>>>
>>> Do you know a way to get the base-dir
>>> of the component as string,
>>> so that I could define the correct link
>>> in the freemarker-file?
>>>
>>>
>>> Many Thanks,
>>> Ralf
>>>
>>
>
Re: javascript and css directory
Posted by Jacques Le Roux <ja...@les7arts.com>.
There is even a peculiar case for order manager which has its js files in applications/commonext/webapp/ordermgr-js because the webapp is redefined in
the specialpurpose birt component specialpurpose/birt/webapp/ordermgr
This is explained in http://svn.apache.org/viewvc?view=revision&revision=1612202
So as you can see it can get complicated when you use OFBiz all possibilities to override artefacts.
I hope I did not confuse things, I believe it's better to know extreme cases than ignore them.
Jacques
Le 30/11/2014 17:22, Adrian Crum a écrit :
> Adding JS and CSS to a component can be done, but there are no instructions for it. There are plenty of examples though.
>
> See the applications/party/webapp/partymgr/static folder. Also note that the folder is included in the allowedPaths filter in web.xml.
>
> In addition, each visual theme is a component - and the themes have JS and CSS files contained within them.
>
> So, you will need to spend some time reverse-engineering the existing examples.
>
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 11/30/2014 8:23 AM, info@agentur-m3.de wrote:
>> Hi All,
>>
>> I try to create a link for a javascript-file
>> in a sub-directory of my compomenent.
>>
>> So I defined the links with @ofbizUrl or
>> @ofbizContentUrl, but they don't give the
>> results I did would expect.
>>
>> <@o...@ofbizUrl>
>>
>> and
>>
>> <@ofbizUrl fullPath=true></...@ofbizUrl>
>>
>> give mycomponent/control/
>>
>> (a /control sub-directory does not exist
>> in the component)
>>
>> and
>>
>> <@o...@ofbizContentUrl>
>> <@ofbizContentUrl fullPath=true></...@ofbizContentUrl>
>>
>> both return an empty string.
>>
>> In a forum post I found a hint, that
>> dataTemplateTypeId="FTL" should be defined in the
>> components entity definitions to use
>> ofbizurl in freemarker files.
>> But I could not find further documentation on that,
>> and also in the application-folders it is not
>> defined for each application.
>>
>> Do you know a way to get the base-dir
>> of the component as string,
>> so that I could define the correct link
>> in the freemarker-file?
>>
>>
>> Many Thanks,
>> Ralf
>>
>
Re: javascript and css directory
Posted by Adrian Crum <ad...@sandglass-software.com>.
Adding JS and CSS to a component can be done, but there are no
instructions for it. There are plenty of examples though.
See the applications/party/webapp/partymgr/static folder. Also note that
the folder is included in the allowedPaths filter in web.xml.
In addition, each visual theme is a component - and the themes have JS
and CSS files contained within them.
So, you will need to spend some time reverse-engineering the existing
examples.
Adrian Crum
Sandglass Software
www.sandglass-software.com
On 11/30/2014 8:23 AM, info@agentur-m3.de wrote:
> Hi All,
>
> I try to create a link for a javascript-file
> in a sub-directory of my compomenent.
>
> So I defined the links with @ofbizUrl or
> @ofbizContentUrl, but they don't give the
> results I did would expect.
>
> <@o...@ofbizUrl>
>
> and
>
> <@ofbizUrl fullPath=true></...@ofbizUrl>
>
> give mycomponent/control/
>
> (a /control sub-directory does not exist
> in the component)
>
> and
>
> <@o...@ofbizContentUrl>
> <@ofbizContentUrl fullPath=true></...@ofbizContentUrl>
>
> both return an empty string.
>
> In a forum post I found a hint, that
> dataTemplateTypeId="FTL" should be defined in the
> components entity definitions to use
> ofbizurl in freemarker files.
> But I could not find further documentation on that,
> and also in the application-folders it is not
> defined for each application.
>
> Do you know a way to get the base-dir
> of the component as string,
> so that I could define the correct link
> in the freemarker-file?
>
>
> Many Thanks,
> Ralf
>