[OFBiz] Users - Screen Widget Idea

Adrian Crum adrianc at hlmksw.com
Wed Mar 16 11:19:49 EST 2005


Chris,

Thanks for the reply, but... it doesn't explain WHY the widgets aren't 
performing the way they should.

 From my perspective, the code I supplied should work. It doesn't. If 
mainScript.bsh defines a variable, why is that variable seen in 
myPage.ftl, but NOT header.ftl?


Chris Howe wrote:

> either place mainScript.bsh before the pre-template
> runs, or if mainScript.bsh is supposed to run any time
> the pre-template does, put it at the begining of the
> pre-template definition.  As long as the bsh script
> isn't overwritting variables in another bsh script you
> can begin them anywhere as long as it's before where
> the variables are used. 
> 
> ===================Original Message==============
> Adrian wrote:
> 
> I'm working on my idea of OFBiz components sharing a
> common template. I 
> need help with a problem getting my idea implemented.
> Any help would be 
> appreciated!
> 
> Let's say a component references a main decorator in
> common/widget. The 
> main decorator would look something like:
> 
> <screen name="main-decorator">
>    <section>
>      <actions>
>        <property-map resource="CommonUiLabels"
> map-name="uiLabelMap" 
> global="true"/>
>        <!-- <set
> field="layoutSettings.headerMiddleBackgroundUrl" 
> value="" global="true"/> -->
>        <!-- <set
> field="layoutSettings.headerRightBackgroundUrl" 
> value="" global="true"/> -->
>      </actions>
>      <widgets>
>        <!-- OFBiz customization hook - decorator
> sections named 
> "pre-template" are included here -->
>        <decorator-section-include
> name="pre-template"/>
> 
>        <!-- render header -->
>        <platform-specific><html><html-template 
> location="component://common/webcommon/includes/header.ftl"/></html></platform-specific>
> 
>        <!-- render appbar -->
>        <platform-specific><html><html-template 
> location="component://common/webcommon/includes/appbar.ftl"/></html></platform-specific>
> 
>        <container style="centerarea">
>          <!-- render appheader -->
>          <platform-specific><html><html-template 
> location="component://example/webapp/example/includes/appheader.ftl"/></html></platform-specific>
> 
>          <container style="contentarea">
>            <container style="column-main">
>              <!-- render messages -->
>              <platform-specific><html><html-template 
> location="component://common/webcommon/includes/messages.ftl"/></html></platform-specific>
>              <decorator-section-include name="body"/>
>            </container>
>          </container>
>        </container>
> 
>        <!-- render footer -->
>        <platform-specific><html><html-template 
> location="component://common/webcommon/includes/footer.ftl"/></html></platform-specific>
> 
>        <!-- OFBiz customization hook - decorator
> sections named 
> "post-template" are included here -->
>        <decorator-section-include
> name="post-template"/>
>      </widgets>
>    </section>
> </screen>
> 
> I added the "pre-template" decorator-section-include
> so that the 
> <page-action> feature of JPublish could be simulated.
> The problem is, 
> any scripts that are specified in the "pre-template"
> decorator sections 
> in the components aren't run BEFORE the header.ftl
> template is output. 
> The "pre-template" scripts seem to run where the 
> <decorator-section-include name="body"/> line appears.
> 
> My component's XML file looks something like this:
> 
> <screen name="myPage">
>    <section>
>      <actions>
>        <set field="headerItem" value="main"/>
>      </actions>
>      <widgets>
>        <decorator-screen name="main-decorator" 
> location="component://common/widget/CommonScreens.xml">
>          <decorator-section name="pre-template">
>            <section>
>              <actions>
>                <script 
> location="component://myapp/webapp/WEB-INF/actions/main/mainScript.bsh"/>
>              </actions>
>              <widgets>
>              </widgets>
>            </section>
>          </decorator-section>
>          <decorator-section name="body">
>            <section>
>              <actions>
>                <script 
> location="component://myapp/webapp/WEB-INF/actions/main/myPage.bsh"/>
>              </actions>
>              <widgets>
>                <platform-specific> 
> <html><html-template 
> location="component://myapp/webapp/main/myPage.ftl"/></html>
>                </platform-specific>
>              </widgets>
>            </section>
>          </decorator-section>
>        </decorator-screen>
>      </widgets>
>    </section>
> </screen>
> 
> 
> The goal is to have the mainScript.bsh run first. Then
> the templates in 
> main-decorator are used. Finally, the myPage.bsh
> script runs when 
> myPage.ftl is output.
> 
> The myPage.bsh/myPage.ftl combination work fine. It's
> just the 
> mainScript.bsh part that I can't seem to get to work
> as desired.
> 
> Everything else seems to work well with this arrangement.
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/ 
>  
> _______________________________________________
> Users mailing list
> Users at lists.ofbiz.org
> http://lists.ofbiz.org/mailman/listinfo/users
> 


More information about the Users mailing list