ilscipio/scipio-erp

View on GitHub
applications/commonext/widget/ofbizsetup/CommonScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->

<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://commonext/widget/ofbizsetup/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://commonext/widget/ofbizsetup/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="SetupUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ContentUiLabels" 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="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                
                <set field="MainColumnStyle" value="nocolumns" global="true"/>
                <set field="layoutSettings.companyName" from-field="uiLabelMap.SetupCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.SetupCompanySubtitle" 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="ofbizsetup" global="true"/>
                <set field="applicationMenuName" value="SetupAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://commonext/widget/ofbizsetup/Menus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.SetupApp}" 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-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="CommonSetupAppDecorator">
        <section>
            <actions>   
                <!-- FIXME: is there a common setup VIEW app permission appropriate here?
                <condition-to-field field="commonSetupAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="SETUP" action="_VIEW"/>
                </condition-to-field> -->
                <set field="commonSetupAppBasePermCond" from-field="commonSetupAppBasePermCond" type="Boolean" default-value="true"/>
            </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="CommonSetupAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-true field="commonSetupAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.CommonPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonPartyDecorator">
        <section>
            <widgets>
                <decorator-screen name="CommonSetupDecorator"/>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonSetupDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://commonext/widget/ofbizsetup/Menus.xml#Setup" />
                <entity-condition entity-name="PartyRole" list="parties">
                    <condition-expr field-name="roleTypeId" operator="equals" value="INTERNAL_ORGANIZATIO"/>
                </entity-condition>
                <set field="partyId" from-field="parties[0].partyId"/>
                <entity-one entity-name="Party" value-field="party"/>
                <entity-one entity-name="PartyGroup" value-field="lookupGroup"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <and>
                        <if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
                        <not><if-empty field="taxAuthority"/></not>
                    </and>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for PARTYMGR, _VIEW permission -->
                            <condition>
                                <if-service-permission service-name="partyBasePermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition><not><if-empty field="partyId"/></not></condition>
                                    <widgets>
                                        <container style="clear"/>
                                        <container style="h2">
                                            <section>
                                                <condition><not><if-empty field="lookupGroup"/></not></condition>
                                                <widgets>
                                                    <label text="${uiLabelMap.PartyTheProfileOf} ${lookupPerson.personalTitle} ${lookupPerson.firstName} ${lookupPerson.middleName} ${lookupPerson.lastName} ${lookupPerson.suffix} ${lookupGroup.groupName} [${partyId}]"/>
                                                    <horizontal-separator/>
                                                </widgets>
                                                <fail-widgets>
                                                    <label text="${uiLabelMap.PartyNewUser}"/>
                                                </fail-widgets>
                                            </section>
                                        </container>
                                    </widgets>
                                </section>
                               <!-- SCIPIO: Commenting this out for now, I'm not sure what the effect of completing this is, but definitely that button must not be placed here -->
                               <!-- <section>
                                    <condition>
                                        <not><if-empty field="partyId"/></not>
                                    </condition>
                                    <widgets>
                                        <container style="button-bar">
                                            <link target="OrganizationToComplete" text="${uiLabelMap.SetupSetToComplete}" style="${styles.link_run_sys} ${styles.action_complete}">
                                                <parameter param-name="partyId" from-field="organizationPartyId"/>
                                                <parameter param-name="roleTypeId" value="ORGANIZATION_ROLE"/>
                                            </link>
                                        </container>
                                    </widgets>
                                </section>-->
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.PartyMgrViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="EntityExportAll">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEntityExportAll"/>
                <set field="activeSubMenuItem" value="entityExportAll"/>
                <!-- SCIPIO: Has no effect because transaction already started + not needed for this screen
                <set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>-->
                <set field="results" from-field="parameters.results"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <platform-specific>
                                <html><html-template location="component://webtools/webapp/webtools/entity/EntityExportAll.ftl"/></html>
                            </platform-specific>
                        </screenlet>
                    </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://commonext/widget/ofbizsetup/Menus.xml"/>
                <set field="menuCfg.name" value="SetupAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://commonext/widget/ofbizsetup/Menus.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="CommonSetupAppSideBarMenu">
        <section>
            <actions>
                <!-- FIXME: is there a common setup VIEW app permission appropriate here?
                <condition-to-field field="commonSetupAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="SETUP" action="_VIEW"/>
                </condition-to-field> -->
                <set field="commonSetupAppBasePermCond" from-field="commonSetupAppBasePermCond" type="Boolean" default-value="true"/>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonWebtoolsAppBasePermCond}"/>
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
</screens>