Specific theme for a component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Specific theme for a component

pierre.gaudin
Hi all,

I have created a new component and i'd wish to use a specific theme for
this component. I also wish to force all users to use this theme for
this component and only this component.
I have a look at OFBiz documentation and the only way to do so is to
create a productstore and associate it to the theme... but i think It's
not the right way for a component.

Is there a way to do that?
I think that webapp definition should be the right place....

Regards,

Pierre

--
Pierre Gaudin
Consultant Fonctionnel Apache-OFBiz, ERP en logiciel Libre

Société Néréide
3b Les isles
37270 Veretz
http://www.nereide.fr
Tel : 09 74 53 36 12
Mob : 06 08 40 25 70

Membre d'OFBiz-France
http://www.ofbiz-fr.org


Reply | Threaded
Open this post in threaded view
|

Re: Specific theme for a component

Adrian Crum-3
In framework/common/widget/CommonScreens.xml, you will find the
GlobalActions screen widget - where the visual theme data is loaded into
the screen rendering context.

The trick will be to copy the visual theme specific code:

<set field="visualThemeId" from-field="userPreferences.VISUAL_THEME"
global="true" />
<service service-name="getVisualThemeResources">
   <field-map field-name="visualThemeId" />
   <field-map field-name="themeResources" from-field="layoutSettings" />
</service>
<set field="layoutSettings" from-field="themeResources"
default-value="${layoutSettings}" global="true" />

to your component's application decorator screen (in the component's
CommonScreens.xml file), then modify the code to use your theme:

<set field="visualThemeId" value="MY_THEME" global="true" />

There may be problems due to action element execution order, so you
might have to experiment to find the right location in the decorator to
insert the visual theme loading code.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 10/24/2014 10:06 AM, pierre.gaudin wrote:

> Hi all,
>
> I have created a new component and i'd wish to use a specific theme for
> this component. I also wish to force all users to use this theme for
> this component and only this component.
> I have a look at OFBiz documentation and the only way to do so is to
> create a productstore and associate it to the theme... but i think It's
> not the right way for a component.
>
> Is there a way to do that?
> I think that webapp definition should be the right place....
>
> Regards,
>
> Pierre
>
Reply | Threaded
Open this post in threaded view
|

Re: Specific theme for a component

pierre.gaudin
Hi Adrian,

I have seen this code in the GlobalActions decorator before i asked this
question, but i didn't think to override the value in the context from
my component's application decorator...

Thank you for the trick, I'll try and give you feedback.

Many thanks Adrian.

Pierre

On 24/10/2014 11:47, Adrian Crum wrote:

> In framework/common/widget/CommonScreens.xml, you will find the
> GlobalActions screen widget - where the visual theme data is loaded
> into the screen rendering context.
>
> The trick will be to copy the visual theme specific code:
>
> <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME"
> global="true" />
> <service service-name="getVisualThemeResources">
>   <field-map field-name="visualThemeId" />
>   <field-map field-name="themeResources" from-field="layoutSettings" />
> </service>
> <set field="layoutSettings" from-field="themeResources"
> default-value="${layoutSettings}" global="true" />
>
> to your component's application decorator screen (in the component's
> CommonScreens.xml file), then modify the code to use your theme:
>
> <set field="visualThemeId" value="MY_THEME" global="true" />
>
> There may be problems due to action element execution order, so you
> might have to experiment to find the right location in the decorator
> to insert the visual theme loading code.
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 10/24/2014 10:06 AM, pierre.gaudin wrote:
>> Hi all,
>>
>> I have created a new component and i'd wish to use a specific theme for
>> this component. I also wish to force all users to use this theme for
>> this component and only this component.
>> I have a look at OFBiz documentation and the only way to do so is to
>> create a productstore and associate it to the theme... but i think It's
>> not the right way for a component.
>>
>> Is there a way to do that?
>> I think that webapp definition should be the right place....
>>
>> Regards,
>>
>> Pierre
>>
>


--
Pierre Gaudin
Consultant Fonctionnel Apache-OFBiz, ERP en logiciel Libre

Société Néréide
3b Les isles
37270 Veretz
http://www.nereide.fr
Tel : 09 74 53 36 12
Mob : 06 08 40 25 70

Membre d'OFBiz-France
http://www.ofbiz-fr.org