ilscipio/scipio-erp

View on GitHub
applications/product/widget/facility/CommonScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
        
    <!-- SCIPIO: Common settings for other *Screens.xml files in this app that primarily use decorators referenced using parameters.mainDecoratorLocation -->
    <screen-settings name="common-settings"><!-- all settings are currently valid/needed for this file as well, so omit: active="false" -->
        <decorator-screen-settings default-fallback-location="component://product/widget/facility/CommonScreens.xml"/>
    </screen-settings>
        
    <!-- SCIPIO: The settings for this file (active) -->
    <screen-settings name="local-settings">
        <!-- These settings are automatically included in all *Screens.xml files in the same folder as this CommonScreens.xml file or any subfolder without its own CommonScreens.xml -->
        <auto-include-settings>
            <include-settings as-name="local-settings" name="common-settings" location="component://product/widget/facility/CommonScreens.xml"/>
        </auto-include-settings>
    </screen-settings>
        
    <!-- SCIPIO: Actions automatically included at beginning of every render request, for our webapp (discovered via web.xml, mainDecoratorLocation) -->
    <screen name="webapp-common-actions">
        <actions>
            <!-- Make the main side bar name/location available to all (without need for globals) -->
            <include-screen-actions name="MainSideBarMenu"/>
            <set field="mainSideBarMenuCfg" from-field="menuCfg"/>
            <set field="mainComplexMenuCfg" from-field="menuCfg"/>
            <set field="menuCfg" value=""/>
        </actions>
    </screen>
        
    <screen name="main-decorator">
        <section>
            <actions>
                <!-- base/top/specific map first, then more common map added for shared labels -->
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductErrorUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>

                <set field="layoutSettings.companyName" from-field="uiLabelMap.FacilityCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.FacilityCompanySubtitle" global="true"/>
                <!-- layoutSettings.headerImageUrl can be used to specify an application specific logo; if not set,
                     then the global layoutSettings.commonHeaderImageUrl (specified in GlobalDecorator) will be used. -->
                <!--<set field="layoutSettings.headerImageUrl" value="/images/ofbiz_logo.gif" global="true"/>-->
                <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> -->
                <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> -->
                <set field="activeApp" value="facilitymgr" global="true"/>
                <set field="applicationMenuName" value="FacilityAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://product/widget/facility/FacilityMenus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.ProductFacility}" global="true"/>
                
                <!-- SCIPIO: This uses activeSubMenu/activeSubMenuItem to automatically determine activeMainMenuItem -->
                <set field="menuCfg" from-field="mainComplexMenuCfg"/>
                <include-screen-actions name="DeriveComplexSideBarMenuItems" location="component://common/widget/CommonScreens.xml"/>
            </actions>
            <widgets>
                <decorator-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml">
                    <decorator-section name="left-column" use-when="${context.widePage != true}"> <!-- override-by-auto-include="true" -->
                        <section>
                            <condition>
                                <not><if-empty-section section-name="left-column" /></not>
                            </condition>
                            <widgets>
                                <decorator-section-include name="left-column"/>
                            </widgets>
                            <fail-widgets>
                                <!-- provide default column for all others -->
                                <include-screen name="DefMainSideBarMenu" location="${parameters.mainDecoratorLocation}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!-- SCIPIO: App-wide common decorator, wrapper around main-decorator; expected to have globally unique name. See Admin app CommonScreens.xml for more info. -->
    <screen name="CommonFacilityAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonFacilityAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="left-column" use-when="${context.widePage != true}" override-by-auto-include="true">
                        <include-screen name="CommonFacilityAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-true field="commonFacilityAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.ProductFacilityViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonFacilityDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://product/widget/facility/FacilityMenus.xml#Facility" />
                <set field="facilityId" from-field="parameters.facilityId"/>
                <entity-one entity-name="Facility" value-field="facility"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <or>
                        <not><if-empty field="facility"/></not>
                        <not><if-empty field="displayWithNoFacility"/></not>
                    </or>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <or>
                                    <not><if-empty field="facility"/></not>
                                    <not><if-empty field="displayWithNoFacility"/></not>
                                </or>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error">${uiLabelMap.ProductErrorFacilityIdNotFound}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- generates the subtab of [Scheduling] using FacilityScheduleTabBar -->
    <screen name="CommonFacilityScheduleDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="Scheduling"/> 
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <platform-specific>
                            <html><html-template location="component://product/webapp/facility/facility/FacilityScheduleTabBar.ftl"/></html>
                        </platform-specific>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: new, child of Facility, originally added to help factoring menus -->
    <screen name="CommonFacilitySettingsDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://product/widget/facility/FacilityMenus.xml#FacilitySettings"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: new, child of Facility, originally added to help factoring menus -->
    <screen name="CommonFacilityInventoryDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://product/widget/facility/FacilityMenus.xml#FacilityInventory"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: new, child of Facility, originally added to help factoring menus -->
    <screen name="CommonFacilityPickingDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://product/widget/facility/FacilityMenus.xml#FacilityPicking"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: new, child of Facility, originally added to help factoring menus -->
    <screen name="CommonFacilityPackOrderDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://product/widget/facility/FacilityMenus.xml#FacilityPackOrder"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="main">
        <section>
            <actions>
                <set field="activeSubMenuItem" value="main"/>
                <set field="titleProperty" value="ProductFacilityManager"/>
                <set field="parameters.lookupFlag" value="Y"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFacilityAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <container style="${styles.grid_row}">
                            <container style="${styles.grid_large}12 ${styles.grid_cell}">
                                <screenlet title="${uiLabelMap.CommonRecentActivity}">
                                    <container style="${styles.grid_row}">
                                        <section>
                                            <actions>
                                                <set field="parameters.shipmentTypeId" value="PURCHASE_SHIPMENT"/>
                                                <set field="sectionTitle" value="${uiLabelMap.ProductIncomingShipments}"/>
                                                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy"/>
                                            </actions>
                                            <widgets>
                                                <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                                    <platform-specific><html><html-template location="component://product/webapp/facility/dashboard/FacilityShipments.ftl"/></html></platform-specific>
                                                </container>
                                            </widgets>
                                        </section>
                                        <section>
                                            <actions>
                                                <set field="parameters.shipmentTypeId" value="SALES_SHIPMENT"/>
                                                <set field="sectionTitle" value="${uiLabelMap.ProductOutgoingShipments}"/>
                                                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy"/>
                                            </actions>
                                            <widgets>
                                                <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                                    <platform-specific><html><html-template location="component://product/webapp/facility/dashboard/FacilityShipments.ftl"/></html></platform-specific>
                                                </container>
                                            </widgets>
                                        </section>
                                    </container>
                                </screenlet>
                            </container>
                        </container>
                        <!-- TODO?
                        <container style="${styles.grid_row}">
                            <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                                                
                            </container>
                            <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                
                            </container>
                        </container> -->
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Main SideBar Menu (see component://common/widget/CommonScreens.xml#ComplexSideBarMenu for available arguments and Admin app CommonScreens.xml for more info) -->
    <screen name="MainSideBarMenu">
        <section>
            <actions>
                <set field="menuCfg.location" value="component://product/widget/facility/FacilityMenus.xml"/>
                <set field="menuCfg.name" value="FacilityAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://product/widget/facility/FacilityMenus.xml"/>
            </actions>
            <widgets>
                <include-screen location="component://common/widget/CommonScreens.xml" name="ComplexSideBarMenu"/>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Default Main SideBar Menu, version of MainSideBarMenu that disregards screen's selected/active sub-menu -->
    <screen name="DefMainSideBarMenu">
        <section>
            <actions>
                <script location="component://common/webcommon/WEB-INF/actions/includes/scipio/PrepareDefComplexSideBarMenu.groovy"/>
            </actions>
            <widgets>
                <include-screen name="MainSideBarMenu"/>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Common SideBar Menu inclusion logic, for/from Common*AppDecorator, with application-specific logic 
        (see component://common/widget/CommonScreens.xml#CommonSideBarMenu for available arguments and Admin app CommonScreens.xml for more info) -->
    <screen name="CommonFacilityAppSideBarMenu">
        <section>
            <actions>   
                <condition-to-field field="commonFacilityAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
                </condition-to-field>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonFacilityAppBasePermCond}"/>
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
</screens>