ilscipio/scipio-erp

View on GitHub
applications/content/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://content/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://content/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="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WorkEffortUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="layoutSettings.companyName" from-field="uiLabelMap.ContentCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.ContentCompanySubtitle" global="true"/>
                <set field="layoutSettings.styleSheets[]" value="/content/images/contentForum.css" global="true"/>
                <!--<set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/> SCIPIO: already included -->
                <set field="activeApp" value="contentmgr" global="true"/>
                <set field="applicationMenuName" value="ContentAppBar" global="true"/>
                <set field="applicationMenuLocation" value="component://content/widget/content/ContentMenus.xml" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.ContentContentManagerApplication}"/>
                
                <!-- 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">
                        <!-- SCIPIO: content user interface is largely deprecated -->
                        <section>
                            <condition><not><if-empty field="userLogin"/></not></condition>
                            <widgets><label text="${uiLabelMap.ContentWebAppUiDeprecated}" style="common-msg-warning" /></widgets>
                        </section>
                        <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="CommonContentAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonContentAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="CONTENTMGR" 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="CommonContentAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-true field="commonContentAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonCmsDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/cms/CMSMenus.xml#Cms" />
                <set field="currentCMSMenuItemName" from-field="currentCMSMenuItemName" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonContentDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/content/ContentMenus.xml#Content" />
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <container>
                            <include-menu name="ContentSubButtonBar" location="component://content/widget/content/ContentMenus.xml"/>
                        </container>
                        <section>
                            <condition>
                                <not><if-empty field="currentValue.contentId"/></not>
                            </condition>
                            <actions>
                                <!-- SCIPIO: Prevent random comma -->
                                <set field="currentValueNameSep" value="${groovy:(context.currentValue?.contentName &amp;&amp; context.currentValue?.description) ? ', ' : ''}"/>
                            </actions>
                            <widgets>
                                <screenlet title="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${currentValue.contentName}${currentValueNameSep}${currentValue.description} [${currentValue.contentId}]  ${${extraFunctionName}}">
                                    <decorator-section-include name="body"/>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <screenlet title="${uiLabelMap.PageTitleAddContent}">
                                    <decorator-section-include name="body"/>
                                </screenlet>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="ContentDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/content/ContentMenus.xml#ContentTop" />
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>


    <screen name="CommonDataResourceDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/content/DataResourceMenus.xml#DataResource" />
                <set field="currentContentMenuItemName" from-field="currentContentMenuItemName" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="currentValue.dataResourceId"/></not>
                            </condition>
                            <widgets>
                                <include-menu name="dataresource" location="component://content/widget/content/DataResourceMenus.xml"/>
                                <label style="heading" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${currentValue.dataResourceName} [${currentValue.dataResourceId}]  ${${extraFunctionName}}"/>
                            </widgets>
                        </section>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonCompDocDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="CompDoc"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="left-column" use-when="${context.widePage != true}" override-by-auto-include="true">
                        <include-screen name="DefMainSideBarMenu" location="${parameters.mainDecoratorLocation}"/>
                        <include-menu name="${menuName}" location="component://content/widget/compdoc/CompDocMenus.xml"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <label text="${subTitle}" style="heading"/>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonContentSetupDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/contentsetup/ContentSetupMenus.xml#ContentSetup" />
                <set field="currentMenuItemName" from-field="currentMenuItemName" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonDataResourceSetupDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/datasetup/DataResourceSetupMenus.xml#DataResourceSetup" />
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonWebSiteDecorator">
        <section>
            <actions>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/content/ContentMenus.xml#WebSite" />
 
                <!-- SCIPIO: this should already be done by screen but sometimes it's not. Do NOT make global (local use here only) -->
                <set field="webSiteId" from-field="webSiteId" default-value="${parameters.webSiteId}"/>
                <entity-one entity-name="WebSite" value-field="webSite"/>
                
                <set field="titleProperty" from-field="labelTitleProperty" default-value="${titleProperty}" />
                <set field="titleFormat" from-field="titleFormat" default-value="\${finalTitle} ${parameters.webSiteId} ${${extraFunctionName}}"/>
                
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty parameters.webSiteId}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <!--<container style="button-bar">
                            <link text="${uiLabelMap.ContentNewWebSite}" target="EditWebSite" style="${styles.link_nav} ${styles.action_add}"/>
                        </container>-->
                        <container>
                            <include-menu name="websiteMenu" location="component://content/widget/content/ContentMenus.xml"/>
                        </container>
                        <!-- SCIPIO: too verbose, redundant with page title
                        <label style="heading" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${webSite.siteName} [${webSite.webSiteId}] ${${extraFunctionName}}"/>
                        -->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonLayoutDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/layout/LayoutMenus.xml#Layout" />
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="main">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="main"/>
                <set field="titleProperty" value="ContentMain"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <container><label text="${uiLabelMap.ContentWelcome}"/></container>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="responseTreeLine">
        <section>
            <actions>
                <service service-name="getContentAndDataResource" result-map="contentData">
                    <field-map field-name="contentId" from-field="rsp.contentId"/>
                </service>
                <set field="textData" from-field="contentData.resultData.electronicText.textData"/>
            </actions>
            <widgets>
                <section>
                    <condition>
                        <if-compare-field field="responseContentId" operator="equals" to-field="rsp.contentId"/>
                    </condition>
                    <widgets>
                        <container style="responseSelected">
                            <label text="${rsp.contentName} - ${rsp.description} [${rsp.contentId}]" style="responseheader"/>
                            <link text="${uiLabelMap.PartyReply}" target="addForumThreadMessage" style="${styles.link_nav} ${styles.action_add}">
                                <parameter param-name="forumGroupId" from-field="parameters.forumGroupId"/>
                                <parameter param-name="forumId" from-field="parameters.forumId"/>
                                <parameter param-name="forumMessageIdTo" from-field="rsp.contentId"/>
                                <parameter param-name="contentAssocTypeId" value="RESPONSE"/>
                            </link>
                            <container style="responsetext">
                                <include-form name="EditForumThreadMessage" location="component://content/widget/forum/ForumForms.xml"/>
                            </container>
                        </container>
                    </widgets>
                    <fail-widgets>
                        <container>
                            <label text="${rsp.contentName} - ${rsp.description} [${rsp.contentId}]" style="responseheader"/>
                            <link text="${uiLabelMap.PartyReply}" target="addForumThreadMessage" style="${styles.link_nav} ${styles.action_add}">
                                <parameter param-name="forumGroupId" from-field="parameters.forumGroupId"/>
                                <parameter param-name="forumId" from-field="parameters.forumId"/>
                                <parameter param-name="forumMessageIdTo" from-field="rsp.contentId"/>
                                <parameter param-name="contentAssocTypeId" value="RESPONSE"/>
                            </link>
                            <container style="responsetext">
                                <include-form name="EditForumThreadMessage" location="component://content/widget/forum/ForumForms.xml"/>
                            </container>
                        </container>
                    </fail-widgets>
                </section>
            </widgets>
        </section>
    </screen>
    <screen name="fonts.fo">
        <section>
            <widgets>
                <platform-specific>
                    <xsl-fo><html-template location="component://content/webapp/content/fonts.fo.ftl"/></xsl-fo>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonWebAnalyticsDecorator">
        <section>
            <actions>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="component://content/widget/content/ContentMenus.xml#WebSite" />

                <!-- SCIPIO: this should already be done by screen but sometimes it's not. Do NOT make global (local use here only) -->
                <set field="webSiteId" from-field="webSiteId" default-value="${parameters.webSiteId}"/>
                <entity-one entity-name="WebSite" value-field="webSite"/>
                
                <set field="titleProperty" from-field="labelTitleProperty" default-value="${titleProperty}" />
                <set field="titleFormat" from-field="titleFormat" default-value="\${finalTitle} ${parameters.webSiteId} ${${extraFunctionName}}"/>
                
                <set field="commonSideBarMenu.condList[]" type="Boolean" value="${not empty parameters.webSiteId}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <container style="button-bar">
                            <include-menu name="WebAnalyticsConfigButtonBar" location="component://content/widget/content/ContentMenus.xml"/>
                        </container>
                        <!-- SCIPIO: too verbose/redundant
                        <label style="heading" text="${uiLabelMap.CatalogWebAnalytics} ${uiLabelMap.CommonFor} : ${webSite.siteName} [${webSite.webSiteId}]  ${${extraFunctionName}}"/>
                        -->
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonForumDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="Forum"/>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="pageTitle" value="${uiLabelMap.${titleProperty}}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonContentAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <!--
                    <decorator-section name="left-column" use-when="${context.widePage != true and not empty context.tabBar}" override-by-auto-include="true">
                        <section>
                            <condition>
                                <and>
                                    <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                                </and>
                            </condition>
                            <widgets>
                                <include-menu name="${tabBar}" location="component://content/widget/forum/ForumMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>  -->
                    <decorator-section name="body">
                        <label style="heading" text="${pageTitle}"/>
                        <decorator-section-include name="body"/>
                    </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://content/widget/content/ContentMenus.xml"/>
                <set field="menuCfg.name" value="ContentAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://content/widget/content/ContentMenus.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="CommonContentAppSideBarMenu">
        <section>
            <actions>
                <condition-to-field field="commonContentAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                </condition-to-field>
                <set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonContentAppBasePermCond}"/>
            </actions>
            <widgets>
                <include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    
</screens>