<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">

    <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="/contentimages/css/contentForum.css" global="true"/>
                <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" from-field="uiLabelMap.ContentContentManagerApplication"/>
                <set field="helpAnchor" from-field="helpAnchor" default-value="_content_management"/>
            </actions>
            <widgets>
                <include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>
    <screen name="ShortcutApp">
        <section>
            <actions>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="mainMenuLocation" from-field="parameters.mainMenuLocation" default-value="component://content/widget/content/ContentMenus.xml"/>
            </actions>
            <widgets>
                <decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="body">
                        <include-menu name="ContentShortcutAppBar" location="${mainMenuLocation}"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="commonCmsDecorator">
        <section>
            <actions>
                <set field="currentCMSMenuItemName" from-field="currentCMSMenuItemName" from-scope="user"/>
                <set field="headerItem" value="CMS"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="cms" location="component://content/widget/cms/CMSMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="commonContentDecorator">
        <section>
            <actions>
                <set field="headerItem" value="Content"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="content" location="component://content/widget/content/ContentMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <container>
                                    <include-menu name="contentSub" location="component://content/widget/content/ContentMenus.xml"/>
                                </container>
                                <section>
                                    <condition>
                                        <not><if-empty field="currentValue.contentId"/></not>
                                    </condition>
                                    <widgets>
                                        <label style="h1" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${currentValue.contentName},${currentValue.description} [${currentValue.contentId}]  ${${extraFunctionName}}"/>
                                    </widgets>
                                    <fail-widgets>
                                        <label style="h1" text="${uiLabelMap.PageTitleAddContent}"/>
                                    </fail-widgets>
                                </section>
                                <container style="no-clear">
                                    <decorator-section-include name="body"/>
                                </container>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="contentDecorator">
        <section>
            <actions>
                <set field="headerItem" value="Content"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="contentTopMenu" location="component://content/widget/content/ContentMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <container style="no-clear">
                                    <decorator-section-include name="body"/>
                                </container>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>


    <screen name="commonDataResourceDecorator">
        <section>
            <actions>
                <set field="headerItem" value="DataResource"/>
                <set field="currentContentMenuItemName" from-field="currentContentMenuItemName" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="dataresourceTopMenu" location="component://content/widget/content/DataResourceMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <not><if-empty field="currentValue.dataResourceId"/></not>
                                    </condition>
                                    <widgets>
                                        <include-menu name="dataresource" location="component://content/widget/content/DataResourceMenus.xml"/>
                                        <container style="button-bar"><link target="EditDataResource" text="${uiLabelMap.CommonCreate}" style="buttontext create"/></container>
                                        <label style="h1" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${currentValue.dataResourceName} [${currentValue.dataResourceId}]  ${${extraFunctionName}}"/>
                                    </widgets>
                                </section>
                                <container style="no-clear">
                                    <decorator-section-include name="body"/>
                                </container>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="commonContentSetupDecorator">
        <section>
            <actions>
                <set field="currentMenuItemName" from-field="currentMenuItemName" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://content/widget/CommonScreens.xml">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="contentsetup" location="component://content/widget/contentsetup/ContentSetupMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="commonDataResourceSetupDecorator">
        <section>
            <actions>
                <set field="tabButtonItem" from-field="tabButtonItem" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://content/widget/CommonScreens.xml">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="dataresourcesetup" location="component://content/widget/datasetup/DataResourceSetupMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonWebSiteDecorator">
        <section>
            <actions>
                <set field="headerItem" value="websites"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://content/widget/CommonScreens.xml">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <and>
                                    <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                                    <not><if-empty field="parameters.webSiteId"/></not>
                                </and>
                            </condition>
                            <widgets>
                                <include-menu name="website" location="component://content/widget/content/ContentMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <!--<container style="button-bar">
                                    <link  text="${uiLabelMap.CommonCreate}" target="EditWebSite" style="buttontext create"/>
                                </container>-->
                                <container>
                                    <include-menu name="websiteMenu" location="component://content/widget/content/ContentMenus.xml"/>
                                </container>
                                <label style="h1" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${webSite.siteName} [${webSite.webSiteId}]  ${${extraFunctionName}}"/>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="CommonWebSitePathAliasDecorator">
        <section>
            <actions>
                <set field="headerItem" value="websites"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://content/widget/CommonScreens.xml">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <and>
                                    <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                                    <not><if-empty field="parameters.webSiteId"/></not>
                                </and>
                            </condition>
                            <widgets>
                                <include-menu name="website" location="component://content/widget/content/ContentMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <!--<container style="button-bar">
                                    <link  text="${uiLabelMap.CommonCreate}" target="EditWebSite" style="buttontext create"/>
                                </container>-->
                                <container>
                                    <include-menu name="websitePathAliasMenu" location="component://content/widget/content/ContentMenus.xml"/>
                                </container>
                                <label style="h1" text="${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${webSite.siteName} [${webSite.webSiteId}]  ${${extraFunctionName}}"/>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="commonLayoutDecorator">
        <section>
            <actions>
                <set field="tabButtonItem" from-field="tabButtonItem" from-scope="user"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://content/widget/CommonScreens.xml">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <include-menu name="layout" location="component://content/widget/layout/LayoutMenus.xml"/>
                            </widgets>
                        </section>
                        <container>
                            <link target="EditLayoutSubContent" text="${uiLabelMap.CommonCreate}" style="buttontext">
                                <parameter param-name="mode" value="add"/>
                                <parameter param-name="contentIdTo" value="TEMPLATE_MASTER"/>
                            </link>
                        </container>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="main">
        <section>
            <widgets>
                <decorator-screen name="main-decorator"  location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.ContentMain}">
                            <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="buttontext">
                                <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="buttontext">
                                <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>
            <actions>
                <property-to-field resource="fop.properties" field="defaultFontFamily" property="fop.font.family" default="NotoSans" />
            </actions>
            <widgets>
                <platform-specific>
                    <xsl-fo><html-template location="component://content/template/Fonts.fo.ftl"/></xsl-fo>
                </platform-specific>
            </widgets>
        </section>
    </screen>

    <screen name="CommonWebAnalyticsDecorator">
        <section>
            <actions>
                <set field="headerItem" value="websites"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator"  location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="pre-body">
                        <section>
                            <condition>
                                <and>
                                    <if-has-permission permission="CONTENTMGR" action="_VIEW"/>
                                    <not><if-empty field="parameters.webSiteId"/></not>
                                </and>
                            </condition>
                            <widgets>
                                <include-menu name="website" location="component://content/widget/content/ContentMenus.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <container style="button-bar">
                                    <include-menu name="WebAnalyticsConfigButtonBar" location="component://content/widget/content/ContentMenus.xml"/>
                                </container>
                                <label style="h1" text="${uiLabelMap.CatalogWebAnalytics} ${uiLabelMap.CommonFor} : ${webSite.siteName} [${webSite.webSiteId}]  ${${extraFunctionName}}"/>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ContentViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

</screens>
