ilscipio/scipio-erp

View on GitHub
specialpurpose/assetmaint/widget/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://assetmaint/widget/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://assetmaint/widget/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>
                <property-map resource="AssetMaintUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="activeApp" value="assetmaint" global="true"/>
                <set field="layoutSettings.companyName" from-field="uiLabelMap.AssetMaintCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.AssetMaintCompanySubtitle" 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="applicationMenuName" value="AssetMaintAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://assetmaint/widget/AssetmaintMenus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.AssetMaintManager}"/>
                
                <!-- 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="CommonAssetMaintAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonAssetMaintAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="ASSETMAINT" 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="CommonAssetMaintAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <!-- do check for ASSETMAINT, _VIEW permission -->
                            <condition>
                                <if-true field="commonAssetMaintAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.AssetMaintViewPermissionError}</label>
                            </fail-widgets>
                        </section>                    
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonFacilityDecorator">
        <section>
            <actions>
                <!-- SCIPIO: NOTE: SPECIAL SUB-MENU: TODO: REVIEW:
                    in assetmaint must currently FORCE the sub-menu because the screens from facility
                    are setting sub-menus not present in assetmaint...
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://assetmaint/widget/AssetmaintMenus.xml#Facility" /> -->
                <set field="activeSubMenu" value="component://assetmaint/widget/AssetmaintMenus.xml#Facility" />
                
                <set field="facilityId" from-field="parameters.facilityId"/>
                <entity-one entity-name="Facility" value-field="facility"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonAssetMaintAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <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>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.AssetMaintViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonFixedAssetDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://assetmaint/widget/AssetmaintMenus.xml#FixedAsset" />
                <set field="fixedAssetId" from-field="fixedAsset.fixedAssetId" default-value="${parameters.fixedAssetId}"/>
                <entity-one entity-name="FixedAsset" value-field="fixedAsset"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <and>
                        <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                        <not><if-empty field="fixedAssetId"/></not>
                    </and>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonAssetMaintAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <not><if-empty field="fixedAssetId"/></not>
                                    </condition>
                                    <widgets>
                                        <section>
                                            <condition>
                                                <not><if-empty field="title"/></not>
                                            </condition>
                                            <widgets>
                                                <label style="heading" text="${title} ${uiLabelMap.CommonFor} ${fixedAsset.fixedAssetName} [${fixedAssetId}]  ${${extraFunctionName}}"/>
                                            </widgets>
                                            <fail-widgets>
                                                <label style="heading" text="${uiLabelMap[titleProperty]} ${uiLabelMap.CommonFor} ${fixedAsset.fixedAssetName} [${fixedAssetId}]  ${${extraFunctionName}}"/>
                                            </fail-widgets>
                                        </section>
                                    </widgets>
                                    <fail-widgets>
                                        <!-- SCIPIO: duplicate 
                                        <section>
                                            <condition>
                                                <not><if-empty field="title"/></not>
                                            </condition>
                                            <widgets>
                                                <label style="heading" text="${title}"/>
                                            </widgets>
                                            <fail-widgets>
                                                <label style="heading" text="${uiLabelMap[titleProperty]}"/>
                                            </fail-widgets>
                                        </section>-->
                                    </fail-widgets>
                                </section>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm" text="${uiLabelMap.AccountingViewPermissionError}"/>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonFixedAssetMaintDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://assetmaint/widget/AssetmaintMenus.xml#FixedAssetMaint" />
                <!--<set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="ListFixedAssetMaints"/>-->
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <and>
                        <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                        <!-- SCIPIO: don't do this for now... prevents browsing some fixed asset maint screens... TODO: REVIEW
                        <not><if-empty field="maintHistSeqId"/></not> -->
                    </and>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="CommonFixedAssetsDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="FixedAssetMaint" />
                <!--<set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="ListFixedAssetMaints"/>-->
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <and>
                        <if-service-permission service-name="fixedAssetPermissionCheck" main-action="VIEW"/>
                        <!-- SCIPIO: don't do this for now... prevents browsing some fixed asset maint screens... TODO: REVIEW
                        <not><if-empty field="maintHistSeqId"/></not> -->
                    </and>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.mainDecoratorLocation}">
                </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://assetmaint/widget/AssetmaintMenus.xml"/>
                <set field="menuCfg.name" value="AssetMaintAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://assetmaint/widget/AssetmaintMenus.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="CommonAssetMaintAppSideBarMenu">
        <section>
            <actions>
                <condition-to-field field="commonAssetMaintAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="ASSETMAINT" action="_VIEW"/>
                </condition-to-field>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonAssetMaintAppBasePermCond}"/>
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
</screens>