ilscipio/scipio-erp

View on GitHub
framework/webtools/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: Admin app CommonScreens.xml
        NOTE: The Admin app screen and related definitions have the double-purpose of implementing Admin 
        as well as providing app implementation documentation and examples; 
        to this end it also frequently contains descriptions of many patterns used throughout the backend.
        Some descriptions are also found instead in the common component files such as component://common/widget/CommonScreens.xml and CommonMenus.xml,
        and others in the create-component templated files under framework/resources/templates/Screens.xml and Menus.xml.
        For more elemental widget language definitions, see corresponding component://widget/dtd/widget-*.xsd files. -->
        
    <!-- SCIPIO: Common settings for other *Screens.xml files in this app (those that primarily use decorators referenced using parameters.mainDecoratorLocation) -->
    <screen-settings name="common-settings"><!-- All settings are currently valid/needed for this CommonScreens.xml file as well, so we omit the flag that would disable them for this file only: active="false" -->
        <!-- With the following decorator-screen-settings configuration, when a decorator-screen lookup fails to find a decorator using parameters.mainDecoratorLocation (or other), 
            it will look in our CommonScreens.xml file here instead.
            This prevents the worst application extensibility issues related to the heavy use of mainDecoratorLocation, so that extending applications
            can safely include screens from our app without having to worry about missing decorators in its own CommonScreens.xml file (which otherwise crashes).
            It also mitigates the versatility loss that comes from using a generic parameters.mainDecoratorLocation rather than hundreds of specific 
            parameters.commonXxxDecoratorLocation fields (this is the compromise: mainDecoratorLocation with default-fallback-location is slightly less versatile, 
            but it makes overriding decorators easier, with no need to edit web.xml).
            NOTE: For mainDecoratorLocation overriding to work correctly (with or without this fallback) w.r.t. application extensibility, the decorators referenced through 
                parameters.mainDecoratorLocation should have globally unique names across all CommonScreens.xml files, so apps should take
                care to avoid too generic names in their CommonScreens.xml files, or if they share names,
                it means the decorators would be interchangeable.
             -->
        <decorator-screen-settings default-fallback-location="component://webtools/widget/CommonScreens.xml"/>
        <!-- These actions will be included at start of render for all top-level screens we define, regardless of which webapp they're rendered through 
            By convention we delegate this to a screen actions named "static-common-actions". -->
        <render-init><local><actions><include-screen-actions name="static-common-actions" location="component://webtools/widget/CommonScreens.xml"/></actions></local></render-init>
    </screen-settings>
        
    <!-- SCIPIO: The settings for this file (active). 
        NOTE: 2016-11: currently the common-settings above also apply to this file (both definitions are active), so they are
            merged together to produce the effective settings for this file (avoiding copy-paste). -->
    <screen-settings name="local-settings">
        <!-- These auto-include 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.
            These are found by the renderer through a special lookup on the CommonScreens.xml file whenever a screen in the *Screens.xml files in the same or subfolders are rendered. -->
        <auto-include-settings>
            <!-- Every *Screens.xml file in same folder should include our common-settings defined above.
                NOTE: Here you could also simply copy-paste the settings under common-settings instead of having this indirect include directive (and then even remove the common-settings above). 
                    But to keep things versatile, we want the common-settings to be in their own block above so that it's possible to include them manually
                    or using different patterns than auto-include-settings if the need arises. -->
            <include-settings as-name="local-settings" name="common-settings" location="component://webtools/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) (webapp-aware auto-included actions)
        This works similar to manually including actions at the start of every screen invoked by our controller (on condition of the webapp). 
        NOTE: If it is a different webapp invoking our screens, this will not be included, and that webapp's 
            webapp-common-actions (if any) will end up being used instead (similar to main-decorator). 
        2016-11-11: New pattern, added for 1.14.3. -->
    <screen name="webapp-common-actions">
        <actions>
            <script lang="groovy"><![CDATA[
                import org.ofbiz.base.util.Debug;
                if (Debug.verboseOn()) Debug.logVerbose("Begin Admin webapp screen render (webapp-common-actions)", "AdminCommonActions.groovy");
            ]]></script>
            <!-- 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>
    
    <!-- SCIPIO: Actions automatically included at beginning of the first local screen rendered in a request, regardless of webapp (discovered via screen-settings, above) (static, webapp-agnostic auto-included actions)
        This works similar to manually including actions at the start of every screen in this file, with a double-include guard.
        These always execute after webapp-common-actions; however there may be a number of other actions in between them 
        in the case of screen reuse by other applications. They are still run if the screens are included by another webapp,
        but in that case actions from the screens of the calling webapp will be run before these.  -->
    <screen name="static-common-actions">
        <actions>
            <script lang="groovy"><![CDATA[
                import org.ofbiz.base.util.Debug;
                if (Debug.verboseOn()) Debug.logVerbose("Begin Admin local/static screen render (static-common-actions)", "AdminCommonActions.groovy");
            ]]></script>
        </actions>
    </screen>
        
    <!-- SCIPIO: Admin webapp's implementation of the generic main-decorator pattern. 
        Every webapp is EXPECTED to define its own main-decorator, which gets included on webapp basis through ${parameters.mainDecoratorLocation} (NOTE: the parameters map is misleading; mainDecoratorLocation is from servlet context attributes which override request parameters in it).
        Any webapp that extends this one should provide its own main decorator, but it is possible for it to statically reuse definitions from this one.  -->
    <screen name="main-decorator">
        <section>
            <actions>
                <!-- base/top/specific map first, then more common map added for shared labels -->
                <property-map resource="TemporalExpressionUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="SecurityUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonEntityLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="layoutSettings.companyName" from-field="uiLabelMap.WebtoolsCompanyName" global="true"/>
                <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.WebtoolsCompanySubtitle" global="true"/>
                <set field="activeApp" value="webtools" global="true"/>

                <!-- Help link actions -->
                <set field="helpTopic" value="${groovy: context.webappName?.toUpperCase() + '_' + requestAttributes._CURRENT_VIEW_}"/>
                <set field="applicationMenuLocation" value="component://webtools/widget/Menus.xml" global="true"/>
                <set field="applicationMenuName" value="WebtoolsAppBar" global="true"/>
                <set field="applicationTitle" value="${uiLabelMap.FrameworkWebTools}" 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"/>

                <!-- ToDo: Move to themes? -->
                <set field="layoutSettings.styleSheets[]" value="/base-theme/bower_components/rainbow/rainbow.css" global="true" />
                
                <set field="layoutSettings.javaScripts[+0]" value="/base-theme/bower_components/jquery.cookie/jquery.cookie.js" global="true"/>
                <set field="layoutSettings.styleSheets[+0]" value="/base-theme/bower_components/jstree/dist/themes/default/style.css" global="true"/>
                <set field="layoutSettings.javaScripts[+0]" value="/base-theme/bower_components/jstree/dist/jstree.min.js" global="true"/>
                
                <!-- Use this to prettify code elements
                <set field="layoutSettings.styleSheets[]" value="/base-theme/bower_components/rainbow/rainbow.css" global="true" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                 -->
            </actions>
            <widgets>
                <decorator-screen name="GlobalDecorator" location="component://common/widget/CommonScreens.xml">
                    <!-- SCIPIO: NOTE: On most of the main-decorators including this one, override-by-auto-include is left disabled and is instead implemented manually with decorator-section-include.
                        The manual inclusion is more flexible whereas the override-by-auto-include flag is easier to use. In some cases, override-by-auto-include="true" makes the decorator a lot easier to implement.
                        Both are valid. -->
                    <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>
                                <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.
        Every webapp is EXPECTED to provide a version of this decorator named uniquely after themselves (following "CommonXxxAppDecorator" by convention).
        
        This wrapper simplifies the other decorators and screens by providing a common static reusable point for
        code such as permission check, and if need arises it also allows extending apps that extend multiple applications to 
        specifically override screen code for this specific application only (important for permissions to
        be re-implemented correctly by the extending app).
        
        This decorator (pattern) was originally primarily designed to provide a central point for statically-reusable code; in other
        words, permission checks and code that would otherwise be copy-pasted in each top screen or their intermediate decorators,
        and that are logically tied to the screens (for example, queries of entities specific to webtools are tied to WEBTOOLS_VIEW perm check).
        Nevertheless, because this is usually included using "${parameters.mainDecoratorLocation}", it is
        possible for a webapp extending this one to override this decorator. The main reason for doing so would be to add
        code that modifies the behavior of only the screens of one specific application it is extending (this is
        otherwise not easily possible with the patterns in stock ofbiz).
        However, if overriding this way, the extending webapp must take care to fulfill the static contract of the original
        decorator, especially permission checks; the screens rely on this. The easiest way is to simply delegate
        statically to the original decorator, if the changes allow. Note that this also true for many of the other
        intermediate decorators typically named CommonXxxDecorator. -->
    <screen name="CommonWebtoolsAppDecorator">
        <section>
            <actions>
                <condition-to-field field="commonWebtoolsAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="WEBTOOLS" 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="CommonWebtoolsAppSideBarMenu"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-true field="commonWebtoolsAppBasePermCond"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!-- SCIPIO: Admin webapp's main screen, implementing dashboard.
        Generally webapps should define this screen unless they have a different way of handling the controller "main" uri (the uri, however, is not optional). -->
    <screen name="main">
        <section>
            <actions>
                <set field="titleProperty" value="Webtools"/>
                <set field="activeSubMenuItem" value="main"/>                
                <set field="infoMessage" value="&lt;strong&gt;Developer Info:&lt;/strong&gt; You can use the &lt;a href='ListDemoDataGeneratorServices'&gt;demo generator&lt;/a&gt;, to generate test-data" type="PlainString" />
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                        <container style="${styles.grid_row}">
                            <container style="${styles.grid_large}12 ${styles.grid_cell}">
                                <screenlet title="${uiLabelMap.WebtoolsServer}">
                                    <container style="${styles.grid_row}">
                                        <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                            <include-screen name="ScipioMemoryInfo" location="component://webtools/widget/CommonScreens.xml"/>
                                        </container>
                                        <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                            <include-screen name="DashboardWSLiveRequests" location="component://webtools/widget/CommonWidgets.xml"/>
                                        </container>
                                    </container>
                                </screenlet>
                            </container>
                        </container>
                        <container style="${styles.grid_row}">
                           <container style="${styles.grid_large}6 ${styles.grid_cell}">
                                <screenlet>
                                    <include-screen name="ScipioLogView" location="component://webtools/widget/CommonScreens.xml"/>
                                </screenlet>
                            </container>
                            <container style="${styles.grid_large}6 ${styles.grid_cell}">
                               <include-screen name="ScipioSecurityAlerts" location="component://party/widget/partymgr/CommonScreens.xml"/>
                            </container>
                        </container>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Dashboard widget implementation 
        TODO: move to more approp file -->
    <screen name="ScipioMemoryInfo">
        <section>
            <actions>
                <set field="chartType" value="pie"/>
                <set field="chartLibrary" value="chart"/>
                <set field="chartDatasets" value="1"/>
                <set field="xlabel" value=""/> <!-- x-axis label -->
                <set field="ylabel" value=""/> <!-- y-axis label -->
                <set field="label1" value="${uiLabelMap.WebtoolsMemoryUsage}"/> <!-- 1st dataset label -->
                <script location="component://webtools/script/com/ilscipio/dashboard/MemoryInfo.groovy"/>
           </actions>
           <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="memoryInfo"/>
                        </not>
                    </condition>
                     <widgets>
                       <screenlet title="${uiLabelMap.WebtoolsStatsSystemMemory}">
                            <platform-specific>
                                <html><html-template location="component://webtools/webapp/webtools/dashboard/MemoryInfo.ftl"/></html>
                            </platform-specific>
                       </screenlet>
                   </widgets>
                </section>
           </widgets>
        </section>
    </screen>
    
    <screen name="ScipioUserRequestCount">
        <section>
            <actions>
                <set field="chartType" value="bar"/>
                <set field="chartLibrary" value="chart"/>
                <set field="chartIntervalScope" value="hour"/>
                <set field="chartIntervalScopeLabel" value="CommonHour"/>
                <set field="chartIntervalCount" value="12"/>
                <set field="chartDatasets" value="1"/>
                <set field="xlabel" value=""/> <!-- x-axis label -->
                <set field="ylabel" value=""/> <!-- y-axis label -->
                <set field="label1" value="${uiLabelMap.WebtoolsStatsRequestsBy} ${chartIntervalScope}"/> <!-- 1st dataset label -->
                <script location="component://webtools/script/com/ilscipio/dashboard/UserRequestCount.groovy"/>
           </actions>
           <widgets>
                <section>
                    <condition>
                        <not>
                            <if-empty field="userRequestCount"/>
                        </not>
                    </condition>
                     <widgets>
                       <screenlet title="${uiLabelMap.WebtoolsStatsRequestsBy} ${uiLabelMap[chartIntervalScopeLabel]}">
                            <platform-specific>
                                <html><html-template location="component://webtools/webapp/webtools/dashboard/UserRequestCount.ftl"/></html>
                            </platform-specific>
                       </screenlet>
                   </widgets>
                </section>
           </widgets>
        </section>
    </screen>
    
    <screen name="ScipioLogView">
         <section>
             <actions>
                 <property-to-field resource="debug" property="log4j.appender.css.File" field="logFileName" default="runtime/logs/ofbiz.log" no-locale="true"/>
                 <script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy"/>
             </actions>
             <widgets>
                  <screenlet>
                      <platform-specific>
                          <html><html-template location="component://webtools/webapp/webtools/dashboard/ViewLog.ftl"/></html>
                      </platform-specific>
                  </screenlet>
             </widgets>
         </section>
     </screen>
    
    
    <screen name="printStart">
        <section>
            <widgets>
                <!-- SCIPIO: TODO: REVIEW: this template is removed/missing
                <platform-specific><html><html-template location="component://webtools/webapp/webtools/print/printStart.ftl"/></html></platform-specific>-->
            </widgets>
        </section>
    </screen>
    <screen name="printDone">
        <section>
            <widgets>
                <!-- SCIPIO: TODO: REVIEW: this template is removed/missing
                <platform-specific><html><html-template location="component://webtools/webapp/webtools/print/printDone.ftl"/></html></platform-specific>-->
            </widgets>
        </section>
    </screen>
    <screen name="browsercerts">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="configuration"/>
                <set field="activeSubMenuItem" value="myCertificates"/>
                <set field="titleProperty" value="WebtoolsCertsX509"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <platform-specific><html><html-template location="component://webtools/webapp/webtools/cert/viewbrowsercerts.ftl"/></html></platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="PopUpDecorator">
        <section>
            <actions>
                <property-map resource="TemporalExpressionUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="SecurityUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <include-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>

    <screen name="CommonEntityDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Entity" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonServiceDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="service" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- SCIPIO: TODO: review: it seems like there should be a different perm check here... -->
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="WEBTOOLS" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonImportExportDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="importExport" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonArtifactDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="artifact" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonLabelDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Property" />
                <!-- SCIPIO: force this item -->
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="labels"/>
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonConfigurationDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="configuration" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonGeoManagementDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="geoManagement" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonDemoDataGeneratorDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Entity" />
                <set field="layoutSettings.VT_HDR_JAVASCRIPT[]" value="/base-theme/bower_components/rainbow/rainbow-custom.min.js" global="true" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="ENTITY_MAINT"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="ENTITY_MAINT"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="StatsDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Stats" />
                <condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
                    <if-has-permission permission="SERVER_STATS" action="_VIEW"/>
                </condition-to-field>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="SERVER_STATS" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="TemporalExpressionDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItem" from-field="activeSubMenuItem" default-value="tempexpr"/>
                <property-map resource="TemporalExpressionUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="title" value="${uiLabelMap[titleProperty]}" global="true"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonConfigurationDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="tempExprPermissionCheck" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: new, overrides the one from component://common/widget/SecurityScreens.xml -->
    <screen name="SecurityDecorator">
        <section>
            <actions>
                <set field="securityTargetDecoratorName" from-field="securityTargetDecoratorName" default-value="CommonWebtoolsAppDecorator"/>
            </actions>
            <widgets>
                <decorator-screen name="SecurityDecorator" location="component://common/widget/SecurityScreens.xml">
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: New -->
    <screen name="CommonDocumentationDecorator">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Development" />
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="userLogin"/></not>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <!-- FIXME?: workaround for default theme missing bg -->
                                <screenlet>
                                    <decorator-section-include name="body"/>
                                </screenlet>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonSolrDecorator">
        <section>
            <actions>
                <property-map resource="SolrUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingEntityLabels" map-name="uiLabelMap" global="true"/>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Solr" />
                <script lang="groovy"><![CDATA[
                    globalContext.isSolrWebappLocal = com.ilscipio.scipio.solr.SolrUtil.isSolrWebappLocal(); 
                ]]></script>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- SCIPIO: TODO: review: it seems like there should be a different perm check here... -->
                            <!-- do check for WEBTOOLS, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="WEBTOOLS" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="SolrButtonBar" location="component://webtools/widget/Menus.xml"/>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <!-- SCIPIO: Main SideBar Menu (see component://common/widget/CommonScreens.xml#ComplexSideBarMenu for available arguments) 
        This (along with DefMainSideBarMenu) is a generalized pattern meant to support overriding by apps extending this one; 
        inclusions of this widget should be done using parameters.mainDecoratorLocation, mirroring the main-decorator pattern.
        An extending application can provide a different menu as long as it provides names and hooks in its complex menu (XxxAppSideBar)
        which satisfy the activeSubMenu/activeSubMenuItem/activeMainMenuItem values that are set by the screens it is reusing.
        Permissions are handled outside of this, in app-specific logic (see CommonXxxAppSideBarMenu pattern below). -->
    <screen name="MainSideBarMenu">
        <section>
            <actions>
                <set field="menuCfg.location" value="component://webtools/widget/Menus.xml"/>
                <set field="menuCfg.name" value="WebtoolsAppSideBar"/>
                <set field="menuCfg.defLocation" value="component://webtools/widget/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 
        NOTE: DefMainSideBarMenu is expected to be safe to render even if the user is missing necessary permissions for the app.
            Typically used for fallback for missing permissions (even if none of the entries are accessible).
            For regular browsing it is preferable to invoke MainSideBarMenu with activeSubMenu="TOP", though this can work as well. -->
    <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)
        This is especially responsible for checking the base permissions before showing any sub-menus (this is completely application-specific).
        This contrasts with MainSideBarMenu/DefMainSideBarMenu which are more generic in nature. -->
    <screen name="CommonWebtoolsAppSideBarMenu">
        <section>
            <actions>
                <condition-to-field field="commonWebtoolsAppBasePermCond" type="Boolean" only-if-field="empty">
                    <if-has-permission permission="WEBTOOLS" action="_VIEW"/>
                </condition-to-field>
                <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>