<?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="FindDataResource">
        <section>
            <actions>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="findDataResource"/>
                <set field="titleProperty" value="PageTitleFindDataResource"/>
                <set field="labelTitleProperty" value="PageTitleFindDataResource"/>
                <set field="viewIndex" from-field="requestParameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSize" from-field="requestParameters.VIEW_SIZE" type="Integer" default-value="30"/>
                <set field="asm_multipleSelectForm" value="FindDataResource"/>
                <set field="statusId.asm_multipleSelect" value="FindDataResource_statusId"/>
                <set field="statusId.asm_sortable" value="true"/>
                <set field="statusId.asm_title" value=" "/>
                <set field="asm_listField[]" from-field="statusId"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator"  location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                            <decorator-section name="menu-bar">
                                <container style="button-bar"><link target="EditDataResource" text="${uiLabelMap.CommonCreate}" style="buttontext create"/></container>
                            </decorator-section>
                            <decorator-section name="search-options">
                                <platform-specific>
                                    <html><html-template multi-block="true" location="component://common-theme/template/includes/SetMultipleSelectJsList.ftl"/></html>
                                </platform-specific>
                                <include-form name="FindDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                            </decorator-section>
                            <decorator-section name="search-results">
                                <include-form name="ListDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                            </decorator-section>
                        </decorator-screen>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="findDataResourceSearchResults">
        <section>
            <condition>
                <if-has-permission permission="CONTENTMGR" action="_UPDATE"/>
            </condition>
            <actions>
                <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"/>
            </actions>
            <widgets>
                <include-form name="ListDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
            </widgets>
        </section>
    </screen>
    <screen name="navigateDataResource">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleNavigateDataResources"/>
                <set field="tabButtonItem" value="navigateDataResource"/>
                <set field="labelTitleProperty" value="PageTitleNavigateDataResources"/>
                <entity-and entity-name="DataCategory" list="subCategories">
                    <field-map field-name="parentCategoryId" value="ROOT"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <container id="cmsnav" style="left">
                                    <screenlet title="${uiLabelMap.PageTitleNavigateDataResources}">
                                        <include-screen name="navigateMenu"/>
                                    </screenlet>
                                </container>
                                <container id="content-main-section" style="leftonly">
                                    <container id="cmscontent">
                                        <section>
                                            <widgets>
                                                <include-screen name="listDataResources"/>
                                            </widgets>
                                        </section>
                                    </container>
                                </container>
                            </widgets>
                            <fail-widgets>
                                <container id="norender" style="label">
                                    <label text="${uiLabelMap.ContentCMSNotExist}"/>
                                </container>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="navigateMenu">
        <section>
            <widgets>
                <platform-specific>
                    <html>
                        <html-template location="component://content/template/content/Nav.ftl"/>
                    </html>
                </platform-specific>
            </widgets>
        </section>
    </screen>

    <screen name="listDataResources">
        <section>
            <actions>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <screenlet title="${uiLabelMap.PageTitleNavigateDataResources}">
                    <include-form name="ListDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="LookupDataResource">
        <section>
            <actions>
                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="title" from-field="uiLabelMap.PageTitleLookupDataResource"/>
                <set field="entityName" value="DataResource"/>
                <set field="searchFields" value="[dataResourceId, dataResourceName]"/>
                <set field="viewIndex" from-field="requestParameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSize" from-field="requestParameters.VIEW_SIZE" type="Integer" default-value="20"/>
            </actions>
            <widgets>
                <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="search-options">
                        <include-form name="LookupDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                    <decorator-section name="search-results">
                        <include-form name="ListLookupDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditDataResource">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResource"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResource"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editDataResource"/>
                <set field="dataResourceId" from-field="parameters.dataResourceId"/>
                <entity-one entity-name="DataResource" value-field="currentValue"/>
                <set field="dataResource" from-field="currentValue"/>
                <entity-condition entity-name="DataCategory" list="dataCategoryList"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.ContentContentsAssociatedToDataResource}">
                            <include-form name="EditDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                        <section>
                            <condition>
                                <not><if-empty field="currentValue"/></not>
                            </condition>
                            <widgets>
                                <include-screen name="DataResourceViewLink"/>
                                <screenlet title="${uiLabelMap.PageTitleEditDataResource}">
                                    <include-form name="ListContentsAssociatedToDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                                </screenlet>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <!--
    <screen name="BrowseDataResource">
        <section>
            <actions>
                <set field="headerItem" value="DataResource"/>
                <set field="currentMenuItemName" to-scope="user" value="browsedataresource"/>
            </actions>
            <widgets>
                <decorator-screen name="common-decorator">
                    <decorator-section name="body">
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    -->
    <screen name="UploadImage">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleUploadImageDataResource"/>
                <set field="labelTitleProperty" value="PageTitleUploadImageDataResource"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="uploadImage"/>
                <entity-one entity-name="DataResource" value-field="currentValue">
                    <field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
                </entity-one>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="ImageUpload" location="component://content/widget/content/DataResourceForms.xml"/>
                        <!-- Commented out the following snippet because the behaviour is too random (does not depend on browser)-->
<!--                        <content dataresource-id="${currentValue.dataResourceId}" border="false"/>
                        <horizontal-separator></horizontal-separator>
                        <label>${uiLabelMap.ContentContentShow}:</label>
                        <container>
                            <content dataresource-id="${currentValue.dataResourceId}" border="false"/>
                            <horizontal-separator></horizontal-separator>
                        </container>
-->                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="AddDataResource">
        <section>
            <actions>
                <set field="headerItem" value="DataResource"/>
                <set field="currentMenuItemName" to-scope="user" value="adddataresource"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="AddDataResource" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="AddDataResourceText">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleAddDataResourceText"/>
                <set field="labelTitleProperty" value="PageTitleAddDataResourceText"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="adddataresourcetext"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="AddDataResourceText" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="AddDataResourceUrl">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleAddDataResourceUrl"/>
                <set field="labelTitleProperty" value="PageTitleAddDataResourceUrl"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="adddataresourceurl"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="AddDataResourceUrl" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>

                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="AddDataResourceUpload">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleAddDataResourceUpload"/>
                <set field="labelTitleProperty" value="PageTitleAddDataResourceUpload"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="adddataresourceupload"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="AddDataResourceUpload" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="AddDataResourceFromContent">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleAddDataResourceFromContent"/>
                <set field="labelTitleProperty" value="PageTitleAddDataResourceFromContent"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="adddataresource"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="AddDataResourceFromContent" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceText">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceText"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceText"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editdataresourcetext"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="EditDataResourceText" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceUrl">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceUrl"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceUrl"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editdataresourceurl"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="EditDataResourceUrl" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceUpload">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceUpload"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceUpload"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editdataresourceupload"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="EditDataResourceUpload" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditElectronicText">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditElectronicText"/>
                <set field="labelTitleProperty" value="PageTitleEditElectronicText"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editElectronicText"/>
                <entity-one entity-name="DataResource" value-field="currentValue"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.PageTitleEditElectronicText}">
                            <include-form name="EditElectronicText" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceAttribute">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceAttribute"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceAttribute"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editDataResourceAttribute"/>
                <entity-one entity-name="DataResource" value-field="currentValue">
                    <field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
                </entity-one>
                <get-related value-field="currentValue" relation-name="DataResourceAttribute" list="dataResourceAttribute"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="DataResourceAttributePanel" title="${uiLabelMap.PageTitleEditDataResourceAttribute}" collapsible="true">
                            <include-form name="AddDataResourceAttribute" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                        <screenlet>
                            <include-form name="ListDataResourceAttribute" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceRole">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceRole"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceRole"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editDataResourceRole"/>
                <entity-one entity-name="DataResource" value-field="currentValue">
                    <field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
                </entity-one>
                <get-related value-field="currentValue" relation-name="DataResourceRole" list="dataResourceRole"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="DataResourceRolePanel" title="${uiLabelMap.PageTitleEditDataResourceRole}" collapsible="true">
                            <include-form name="AddDataResourceRole" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                        <screenlet>
                            <include-form name="ListDataResourceRole" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditDataResourceProductFeatures">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditDataResourceProductFeatures"/>
                <set field="labelTitleProperty" value="PageTitleEditDataResourceProductFeatures"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editDataResourceProductFeatures"/>
                <entity-one entity-name="DataResource" value-field="currentValue">
                    <field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
                </entity-one>
                <get-related value-field="currentValue" relation-name="ProductFeatureDataResource" list="productFeatureDataResource"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="DataResourceProductFeaturePanel" title="${uiLabelMap.PageTitleEditDataResourceProductFeatures}" collapsible="true">
                            <include-form name="AddDataResourceProductFeature" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                        <include-form name="ListDataResourceProductFeature" location="component://content/widget/content/DataResourceForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditHtmlText">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditHtmlText"/>
                <set field="labelTitleProperty" value="PageTitleEditHtmlText"/>
                <set field="headerItem" value="DataResource"/>
                <set field="tabButtonItem" value="editHtmlText"/>
                <entity-one entity-name="DataResource" value-field="currentValue"/>
            </actions>
            <widgets>
                <decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.PageTitleEditHtmlText}">
                            <include-form name="EditHtmlText" location="component://content/widget/content/DataResourceForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="DataResourceViewLink">
        <section>
            <condition>
                <or>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="application/msword"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="application/pdf"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="application/vnd.oasis.opendocument.text"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="image/jpeg"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="image/gif"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="image/tiff"/>
                    <if-compare field="dataResource.mimeTypeId" operator="equals" value="image/png"/>
                </or>
            </condition>
            <widgets>
                <container>
                    <link target="ViewBinaryDataResource" text="${uiLabelMap.ContentDownload}" style="buttontext">
                        <parameter param-name="dataResourceId"/>
                   </link>
                </container>
            </widgets>
        </section>
    </screen>
</screens>
