ilscipio/scipio-erp

View on GitHub
applications/workeffort/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://workeffort/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://workeffort/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>
                <!-- base/top/specific map first, then more common map added for shared labels -->
                <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" 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="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="TemporalExpressionUiLabels" map-name="uiLabelMap" global="true"/>

                <set field="layoutSettings.companyName" from-field="uiLabelMap.WorkEffortCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.WorkEffortCompanySubtitle" 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="workeffort" global="true"/>
                <set field="applicationMenuName" value="WorkEffortAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://workeffort/widget/WorkEffortMenus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.CommonWorkEffort}" 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="CommonWorkEffortAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonWorkEffortAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="workEffortManagerPermission" 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="CommonWorkEffortAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-true field="commonWorkEffortAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WorkEffortViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="login-decorator">
        <section>
            <widgets>
                <include-screen name="main-decorator"/>
            </widgets>
        </section>
    </screen>

    <screen name="CommonWorkEffortDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://workeffort/widget/WorkEffortMenus.xml#WorkEffort" />
                <set field="workEffortId" from-field="parameters.workEffortId"/>
                <entity-one entity-name="WorkEffort" value-field="workEffort"/>
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.workEffortId}"/>
                
                <set field="titleProperty" from-field="labelTitleProperty" default-value="${titleProperty}" />
                <set field="titleFormat" from-field="titleFormat" default-value="\${finalTitle} ${workEffortId} ${${extraFunctionName}}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWorkEffortAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <!-- TODO?
                        <include-menu name="WorkEffortSubTabBar" location="component://workeffort/widget/WorkEffortMenus.xml"/>
                        -->
                        <!--<section>
                            <condition>
                                <not>
                                    <if-empty field="workEffortId"/>
                                </not>
                            </condition>
                            <widgets>
                                <container style="h2">
                                    <section>
                                        <condition>
                                            <not><if-empty field="title"/></not>
                                        </condition>
                                        <widgets>
                                            <label>${title} - ${workEffort.workEffortName} [${workEffortId}]</label>
                                        </widgets>
                                        <fail-widgets>
                                            <label>${uiLabelMap[titleProperty]} - ${workEffort.workEffortName} [${workEffortId}]</label>
                                        </fail-widgets>
                                    </section>
                                </container>
                            </widgets>
                        </section>-->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonTimesheetDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://workeffort/widget/TimesheetMenus.xml#Timesheet" />
                <set field="timesheetId" from-field="parameters.timesheetId"/>
                <entity-one entity-name="Timesheet" value-field="timesheet"/><!-- SCIPIO: NOTE: only menu needs this -->
                <!-- <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.timesheetId}"/> handled in menu items instead (complex) -->
                
                <set field="titleProperty" from-field="labelTitleProperty" default-value="${titleProperty}" />
                <set field="titleFormat" from-field="titleFormat" default-value="\${finalTitle} ${timesheetId} ${${extraFunctionName}}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWorkEffortAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <!--<label>${uiLabelMap.WorkEffortTimesheetTimesheetId}: ${timesheetId}</label>-->
                        <include-menu name="TimesheetSubTabBar" location="component://workeffort/widget/TimesheetMenus.xml"/><!-- SCIPIO: new -->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonCalendarDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="calendar" />
            </actions>
            <widgets>
                <decorator-screen name="CommonWorkEffortAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <actions>
                                <script location="component://workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy" />
                            </actions>
                            <widgets>
                                <!-- <screenlet id="calendarOptions" name="calendarOptionsScreenlet" collapsible="true" title="${uiLabelMap.WorkEffortCalendarFindEntries}">
                                    <include-form name="FilterCalendarEvents" location="component://workeffort/widget/CalendarForms.xml" />
                                </screenlet> -->
                                <decorator-section-include name="body" />
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="iCalendarDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://workeffort/widget/WorkEffortMenus.xml#ICalendar" />                
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty context.workEffort}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWorkEffortAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <or>
                                    <if-service-permission service-name="workEffortICalendarPermission" main-action="CREATE" context-map="parameters"/>
                                    <if-service-permission service-name="workEffortICalendarPermission" main-action="UPDATE" context-map="parameters"/>
                                </or>
                            </condition>
                            <widgets>
                                <!--<container style="h2">
                                    <label text="${title}"/>
                                </container>-->
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WorkEffortViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="main">
        <section>
            <actions>
                <set field="activeSubMenuItem" value="main"/>
                <set field="titleProperty" value="WorkEffort"/>
                <set field="eventDetailWidgetName" from-field="eventDetailWidgetName" default-value="eventDetail" />
                <set field="eventDetailWidgetLocation" from-field="eventDetailWidgetLocation" default-value="component://workeffort/widget/CalendarScreens.xml" />
                <set field="eventDetailCols" from-field="eventDetailCols" default-value="12"/><!-- here 12 means half the screen -->
                <set field="parameters.period" from-field="parameters.period" default-value="${initialView}"/>
                <script location="component://workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy"/>
                <set field="parentTypeId" from-field="parameters.parentTypeId" default-value="EVENT"/><!-- workeffortTypeId parent to ad events --> 
                <entity-condition entity-name="TimeEntry" list="currentTimeEntryList">
                    <condition-list combine="and">
                        <condition-expr field-name="partyId" from-field="userLogin.partyId"/>
                        <condition-expr field-name="timesheetId" from-field="currentTimesheet.timesheetId"/>
                    </condition-list>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="CommonWorkEffortAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <platform-specific>
                            <html><html-template location="component://workeffort/webapp/workeffort/main.ftl"/></html>
                        </platform-specific>
                        <container style="${styles.grid_row}">
                            <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                <include-screen name="weekCalendar"  location="component://workeffort/widget/CalendarScreens.xml"/>
                            </container>
                            <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                <screenlet title="${uiLabelMap.WorkEffortMyTimesheets}">
                                    <include-form name="ListMyTimesheets" location="component://workeffort/widget/TimesheetForms.xml"/>
                                </screenlet>
                            </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://workeffort/widget/WorkEffortMenus.xml"/>
                <set field="menuCfg.name" value="WorkEffortAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://workeffort/widget/WorkEffortMenus.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="CommonWorkEffortAppSideBarMenu">
        <section>
            <actions>
                <condition-to-field field="commonWorkEffortAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-service-permission service-name="workEffortManagerPermission" main-action="VIEW"/>
                </condition-to-field>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonWorkEffortAppBasePermCond}"/>
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
</screens>