applications/cms/widget/CommonScreens.xml
<?xml version="1.0" encoding="UTF-8"?>
<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://cms/widget/CommonScreens.xml"/>
<render-init><local><actions><include-screen-actions name="static-common-actions" location="component://cms/widget/CommonScreens.xml"/></actions></local></render-init>
</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://cms/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>
<!-- Automatically included at beginning of every cms backend app screen render (statically - even if were included through another webapp). -->
<screen name="static-common-actions">
<actions>
<script location="component://cms/script/com/ilscipio/scipio/cms/editor/CmsEditorCommon.groovy"/>
</actions>
</screen>
<screen name="main-decorator">
<section>
<actions>
<property-map resource="CMSUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
<set field="layoutSettings.companyName" from-field="uiLabelMap.CMSCompanyName" global="true"/>
<set field="layoutSettings.companySubtitle" from-field="uiLabelMap.CMSCompanySubtitle" global="true"/>
<set field="activeApp" value="cms" global="true"/>
<set field="applicationMenuName" value="MainAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://cms/widget/CMSMenus.xml" global="true"/>
<set field="applicationTitle" value="${uiLabelMap.CMSApplication}" 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="component://cms/widget/CommonScreens.xml"/>
</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="CommonCMSAppDecorator">
<section>
<actions>
<condition-to-field field="commonCMSAppBasePermCond" type="Boolean" only-if-field="empty">
<if-has-permission permission="CMS" action="_VIEW"/>
</condition-to-field>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="left-column">
<include-screen name="CommonCMSAppSideBarMenu"/>
</decorator-section>
<decorator-section name="body">
<section>
<condition>
<if-true field="commonCMSAppBasePermCond"/>
</condition>
<widgets>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
<label style="common-msg-error-perm">${uiLabelMap.CmsViewPermissionError}</label>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CommonSettingsDecorator">
<section>
<actions>
<set field="activeSubMenu" from-field="activeSubMenu" default-value="Settings"/>
</actions>
<widgets>
<decorator-screen name="CommonCMSAppDecorator" location="${parameters.mainDecoratorLocation}">
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CommonCmsImportExportDecorator">
<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" />
<set field="useEntityMaintCheck" type="Boolean" from-field="useEntityMaintCheck" default-value="false" global="true" />
<if>
<condition>
<if-compare field="useEntityMaintCheck" operator="equals" type="Boolean" value="true"/>
</condition>
<then>
<condition-to-field field="commonSideBarMenu.condList[]" type="Boolean">
<if-has-permission permission="ENTITY_MAINT"/>
</condition-to-field>
</then>
</if>
</actions>
<widgets>
<decorator-screen name="CommonCMSAppDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<condition>
<or>
<if-compare field="useEntityMaintCheck" operator="equals" type="Boolean" value="false"/>
<if-has-permission permission="ENTITY_MAINT"/>
</or>
</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>
<!-- Common Actions -->
<screen name="CodeEditorCommonIncludes">
<actions>
<!-- Rainbow code highlighting -->
<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" />
<!-- 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/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"/>
<!-- NOTE: The lang names below are not related to the codemirror language names above;
they are a mix of CmsScriptTemplate.ScriptLang names, which are in part
from widget-common.xsd and the ofbiz script engine names, while others are brand new (e.g., screen-actions is new to scipio) -->
<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>
</actions>
</screen>
<!-- SCIPIO: Special Screens -->
<!-- A default completely blank screen (for security reasons) -->
<screen name="CmsBlank">
<section>
<actions>
</actions>
<widgets>
<platform-specific><html><html-template location="component://cms/webcommon/common/CmsBlank.ftl"/></html></platform-specific>
</widgets>
</section>
</screen>
<!-- SCIPIO: Reusable Screens -->
<screen name="404">
<section>
<actions>
<set field="titleProperty" value="Cms404" />
<set field="noTitle" value="true" global="true" /><!-- Hack to remove the header element -->
<set field="isErrorPage" type="Boolean" value="true" />
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<platform-specific>
<html><html-template location="${errorTemplateLocation}"/></html>
</platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<!-- SCIPIO: Reusable Widgets -->
<screen name="CmsContentTree">
<section>
<actions>
<script location="component://cms/script/com/ilscipio/scipio/cms/editor/CmsContentTree.groovy"/>
</actions>
<widgets>
<screenlet>
<platform-specific><html><html-template location="component://cms/webapp/cms/pages/contentTree.ftl"/></html></platform-specific>
</screenlet>
</widgets>
</section>
</screen>
<screen name="CmsPageViewMappingsSelect">
<section>
<actions>
<script location="component://cms/script/com/ilscipio/scipio/cms/editor/CmsGetPageViewMappings.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://cms/webapp/cms/pages/pageViewMappingsSelect.ftl"/></html></platform-specific>
</widgets>
</section>
</screen>
<!-- SCIPIO: Main SideBar Menu -->
<screen name="MainSideBarMenu">
<section>
<actions>
<set field="menuCfg.location" value="component://cms/widget/CMSMenus.xml"/>
<set field="menuCfg.name" value="MainAppSideBar"/>
<set field="menuCfg.defLocation" value="component://cms/widget/CMSMenus.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="CommonCMSAppSideBarMenu">
<section>
<actions>
<condition-to-field field="commonCMSAppBasePermCond" type="Boolean" only-if-field="empty">
<if-has-permission permission="CMS" action="_VIEW"/>
</condition-to-field>
<set field="commonSideBarMenu.cond" from-field="commonSideBarMenu.cond" type="Boolean" default-value="${commonCMSAppBasePermCond}"/>
</actions>
<widgets>
<include-screen name="CommonSideBarMenu" location="component://common/widget/CommonScreens.xml"/>
</widgets>
</section>
</screen>
</screens>