ilscipio/scipio-erp

View on GitHub
framework/webtools/widget/CacheScreens.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">
    <screen name="FindUtilCache">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Server" />
                <set field="activeSubMenuItem" value="cache"/>
                <set field="titleProperty" value="PageTitleFindUtilCache"/>
                <script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for UTIL_CACHE, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="UTIL_CACHE" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="FindCacheTabBar" location="component://webtools/widget/Menus.xml" />

                                <screenlet title="${uiLabelMap.WebtoolsMemory}">
                                    <include-form name="MemoryInfo" location="component://webtools/widget/CacheForms.xml"/>
                                </screenlet>
                                <screenlet>
                                    <!-- SCIPIO: small form to filter caches by name -->
                                    <include-form name="FindCache" location="component://webtools/widget/CacheForms.xml"/>
                                    <include-form name="ListCache" location="component://webtools/widget/CacheForms.xml"/>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="FindUtilCacheElements">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Server" />
                <set field="activeSubMenuItem" value="cache"/>
                <set field="titleProperty" value="PageTitleFindUtilCacheElements"/>
                <script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for UTIL_CACHE, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="UTIL_CACHE" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <screenlet>
                                    <label>${uiLabelMap.WebtoolsCacheName}: ${cacheName} (${now}), ${uiLabelMap.WebtoolsSizeTotal}: ${totalSize} ${uiLabelMap.WebtoolsBytes}</label>
                                    <include-menu name="CacheElements" location="component://webtools/widget/Menus.xml"/>
                                    <section>
                                        <condition>
                                            <not><if-empty field="cache"/></not>
                                        </condition>
                                        <widgets>
                                            <include-form name="ListCacheElements" location="component://webtools/widget/CacheForms.xml"/>
                                        </widgets>
                                        <fail-widgets>
                                            <label style="common-msg-error">${groovy:org.ofbiz.base.util.UtilProperties.getMessage('WebtoolsErrorUiLabels', 'utilCache.cacheNotFound', [name:context.cacheName], context.locale)}</label>
                                        </fail-widgets>
                                    </section>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditUtilCache">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Server" />
                <set field="activeSubMenuItem" value="cache"/>
                <set field="titleProperty" value="PageTitleEditUtilCache"/>
                <script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/EditUtilCache.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for UTIL_CACHE, _EDIT permission -->
                            <condition>
                                <if-has-permission permission="UTIL_CACHE" action="_EDIT"/>
                            </condition>
                            <widgets>
                                <include-menu name="EditCache" location="component://webtools/widget/Menus.xml"/>
                                <section>
                                    <!-- do check for UTIL_CACHE, _EDIT permission -->
                                    <condition>
                                        <not><if-empty field="cache"/></not>
                                    </condition>
                                    <widgets>
                                        <include-form name="EditCache" location="component://webtools/widget/CacheForms.xml"/>
                                    </widgets>
                                    <fail-widgets>
                                        <label style="common-msg-error">${groovy:org.ofbiz.base.util.UtilProperties.getMessage('WebtoolsErrorUiLabels', 'utilCache.cacheNotFound', [name:context.cacheName], context.locale)}</label>
                                    </fail-widgets>
                                </section>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditPrewarmCacheUrls">
        <section>
            <actions>
                <set field="activeSubMenu" from-field="activeSubMenu" default-value="Server" />
                <set field="activeSubMenuItem" value="prewarmcache"/>
                <set field="titleProperty" value="WebtoolsPrewarmCacheUrls"/>
                <script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/EditPrewarmCacheUrls.groovy"/>
                <script lang="groovy"><![CDATA[
                    import org.ofbiz.base.util.*;

                    ctx = globalContext;

                    // Script languages which can currently be executed from stored bodies
                    // script names should be a subset of: CmsScriptTemplate.ScriptLang.getNames()
                    // This is limited by the Ofbiz script utils/API, which mostly expect file locations rather than bodies.
                    ctx.supportedScriptBodyLangs = ["groovy"];
                    ctx.defaultScriptBodyLang = "groovy";

                    // Script language names we currently accept for template locations
                    // FIXME: for now, we always required "auto" - auto-determine language from location, to simplify our code;
                    //     later we should allow override, because the auto-resolve algorithm is weak (see CmsScriptTemplate.ScriptExecutor)
                    //     In theory we should allow: "groovy", "simple-method", "screen-actions", "auto"
                    ctx.supportedScriptLocationLangs = ["auto"];
                    ctx.defaultScriptLocationLang = "auto";

                    // map of internal CMS script lang names to CodeMirror lang modes
                    ctx.scriptLangEditorModeMap = [
                        "groovy" : "groovy",
                        "screen-actions" : "xml",
                        "simple-method" : "xml",
                        // FIXME: what is sane default/fallback/none mode? "clike"? I am putting "text" so that nothing highlights for these, but it's not a real mode name.
                        "auto" : "text",
                        "none" : "text",
                        "default" : "text" // default is for anything that doesn't map into the above
                    ];

                    ctx.indentWithTabs = UtilProperties.getPropertyAsBoolean("cms", "cms.editor.indentWithTabs", false);
                ]]></script>

                <!-- CODEMIRROR and Codemirror freemarker extension -->
                <set field="layoutSettings.VT_STYLESHEET[+0]" value="/base-theme/bower_components/codemirror/lib/codemirror.css" global="true"/>
                <set field="layoutSettings.VT_STYLESHEET[+0]" value="/base-theme/bower_components/codemirror/addon/fold/foldgutter.css" global="true"/>
                <set field="layoutSettings.VT_STYLESHEET[+0]" value="/base-theme/bower_components/codemirror/addon/hint/show-hint.css" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/lib/codemirror.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/display/placeholder.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/edit/matchbrackets.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/edit/matchtags.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/edit/closetag.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/fold/foldcode.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/fold/foldgutter.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/fold/brace-fold.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/fold/xml-fold.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/fold/comment-fold.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/hint/show-hint.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/hint/xml-hint.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/addon/hint/html-hint.js" global="true"/>

                <!-- Languages - essential for CMS: Freemarker (render templates), Groovy & XML (script templates, edit & view). -->
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/mode/xml/xml.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/mode/htmlmixed/htmlmixed.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/mode/javascript/javascript.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/mode/vbscript/vbscript.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror/mode/groovy/groovy.js" global="true"/>
                <set field="layoutSettings.VT_FTPR_JAVASCRIPT[]" value="/base-theme/bower_components/codemirror-mode-freemarker/freemarker/freemarker.js" global="true"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonWebtoolsAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="UTIL_CACHE" action="_EDIT"/>
                            </condition>
                            <widgets>
                                <platform-specific>
                                    <html><html-template location="component://webtools/webapp/webtools/cache/prewarmCacheUrls.ftl"/></html>
                                </platform-specific>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.WebtoolsPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>