Accessing theme context from CommonScreens.xml in a component

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

Accessing theme context from CommonScreens.xml in a component

Mansour
Hello all:

I am wondering if there is a simple way to access the context of current
theme from the main-decorator in any component ?
Basically I want ot be able to do something like:

<screen name="main-decorator">
    <section>
        <actions>
            <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
            ...
            <set field="layoutSettings.headerImageUrl" from-field="${layoutSettings.contextPath}/images/accounting.png" global="true" />
            ....
        </actions>
    .....
    </section>

This will make the logo for each component themable.

Thank you.

Reply | Threaded
Open this post in threaded view
|

Re: Accessing theme context from CommonScreens.xml in a component

Mansour
If there's anything that's not clear, please ask.

On Thu Oct 07,2010 03:37 pm, Mansour Al Akeel wrote:

> Hello all:
>
> I am wondering if there is a simple way to access the context of current
> theme from the main-decorator in any component ?
> Basically I want ot be able to do something like:
>
> <screen name="main-decorator">
>     <section>
>         <actions>
>             <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
>             ...
>             <set field="layoutSettings.headerImageUrl" from-field="${layoutSettings.contextPath}/images/accounting.png" global="true" />
>             ....
>         </actions>
>     .....
>     </section>
>
> This will make the logo for each component themable.
>
> Thank you.
>
Reply | Threaded
Open this post in threaded view
|

Re: Accessing theme context from CommonScreens.xml in a component

Scott Gray-2
Yes you can do some of what your are asking but you should be using the "value" attribute instead of the "from-field" attribute in the set operation.

What I don't think you can do out of the box is make use of the ${layoutSettings.contextPath} variable simply because I don't think OFBiz provides such a thing.  Because the URLs provided in the theme data already have a full path provided, the mount point for the theme isn't stored anywhere, nor is there any guarantee that all theme resources will be stored under a single webapp.  In tomahawk for example, some resources are stored in /images and others are stored in /tomahawk so there is no single "contextPath".

So to summarize:
- Yes you can override the logo supplied by the theme data
- No you cannot have part of the logo URL path be data driven unless you find a way to supply that data yourself

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 8/10/2010, at 12:30 PM, Mansour Al Akeel wrote:

> If there's anything that's not clear, please ask.
>
> On Thu Oct 07,2010 03:37 pm, Mansour Al Akeel wrote:
>> Hello all:
>>
>> I am wondering if there is a simple way to access the context of current
>> theme from the main-decorator in any component ?
>> Basically I want ot be able to do something like:
>>
>> <screen name="main-decorator">
>>    <section>
>>        <actions>
>>            <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
>>            ...
>>            <set field="layoutSettings.headerImageUrl" from-field="${layoutSettings.contextPath}/images/accounting.png" global="true" />
>>            ....
>>        </actions>
>>    .....
>>    </section>
>>
>> This will make the logo for each component themable.
>>
>> Thank you.
>>


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

Re: Accessing theme context from CommonScreens.xml in a component

Mansour
Thank you Scott.

On Fri Oct 08,2010 01:15 pm, Scott Gray wrote:

> Yes you can do some of what your are asking but you should be using the "value" attribute instead of the "from-field" attribute in the set operation.
>
> What I don't think you can do out of the box is make use of the ${layoutSettings.contextPath} variable simply because I don't think OFBiz provides such a thing.  Because the URLs provided in the theme data already have a full path provided, the mount point for the theme isn't stored anywhere, nor is there any guarantee that all theme resources will be stored under a single webapp.  In tomahawk for example, some resources are stored in /images and others are stored in /tomahawk so there is no single "contextPath".
>
> So to summarize:
> - Yes you can override the logo supplied by the theme data
> - No you cannot have part of the logo URL path be data driven unless you find a way to supply that data yourself
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 8/10/2010, at 12:30 PM, Mansour Al Akeel wrote:
>
> > If there's anything that's not clear, please ask.
> >
> > On Thu Oct 07,2010 03:37 pm, Mansour Al Akeel wrote:
> >> Hello all:
> >>
> >> I am wondering if there is a simple way to access the context of current
> >> theme from the main-decorator in any component ?
> >> Basically I want ot be able to do something like:
> >>
> >> <screen name="main-decorator">
> >>    <section>
> >>        <actions>
> >>            <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
> >>            ...
> >>            <set field="layoutSettings.headerImageUrl" from-field="${layoutSettings.contextPath}/images/accounting.png" global="true" />
> >>            ....
> >>        </actions>
> >>    .....
> >>    </section>
> >>
> >> This will make the logo for each component themable.
> >>
> >> Thank you.
> >>
>