Hi,

I have created the custom visual theme for my side-bar requirement by
following this doc
https://github.com/apache/ofbiz-framework/blob/trunk/themes/docs/themes.adoc

but I want Tomahawk theme styles, so I copied all the css, js, images into
my custom theme called "xerus-theme" by following this doc
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74685960

the entire custom theme folder structure is here
<https://www.canva.com/design/DAEug3mJSbE/lDQDNfQMpMeYdygo5Ri1Iw/edit>
below are the changes I have done
*themes/xerus-theme/ofbiz-component.xml*

<ofbiz-component name="xerus-theme"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:noNamespaceSchemaLocation="
https://ofbiz.apache.org/dtds/ofbiz-component.xsd";>
    <!-- define resource loaders; most common is to use the component
resource loader -->
    <resource-loader name="main" type="component"/>

    <!-- entity resources: model(s), eca(s), group, and data definitions -->
    <entity-resource type="data" reader-name="seed" loader="main"
location="data/Xerus-themeThemeData.xml"/>

    <!-- web applications -->
    <webapp name="xerus-theme"
        title="xerus-theme"
        menu-name="secondary"
        server="default-server"
        location="webapp/xerus-theme"
        mount-point="/xerus-theme"
        app-bar-display="false"/>
</ofbiz-component>

*themes/xerus-theme/widget/Theme.xml  => here I have made an entry for
sidebar as "VT_SIDEBAR_TMPLT_LOC". rest is same as tomahawk.*

<theme name="xerus-theme"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns="http://ofbiz.apache.org/Widget-Theme"; xsi:schemaLocation="
http://ofbiz.apache.org/Widget-Theme
http://ofbiz.apache.org/dtds/widget-theme.xsd";>
    <visual-themes>
        <visual-theme id="XERUS-THEME" display-name="xerus-theme">
            <description>${util:label('CommonEntityLabels',
'VisualTheme.description.TOMAHAWK', locale)}</description>
            <screenshot location="/tomahawk/screenshot.jpg"/>
        </visual-theme>
    </visual-themes>
    <extends location="component://common-theme/widget/Theme.xml"/>
    <extends location="component://tomahawk/widget/Theme.xml"/>
    <theme-properties>
        <!--template location-->
        <property name="VT_HDR_TMPLT_LOC"
value="component://xerus-theme/template/Header.ftl"/>
        <property name="VT_FTR_TMPLT_LOC"
value="component://xerus-theme/template/Footer.ftl"/>
        <property name="VT_NAV_OPEN_TMPLT"
value="component://xerus-theme/template/AppBarOpen.ftl"/>
        <property name="VT_NAV_CLOSE_TMPLT"
value="component://xerus-theme/template/AppBarClose.ftl"/>
        *<property name="VT_SIDEBAR_TMPLT_LOC"
value="component://xerus-theme/template/SideBar.ftl"/>*
        <!-- <property name="VT_MSG_TMPLT_LOC"
value="component://xerus-theme/template/includes/Messages.ftl"/> -->
        <!--header image -->
        <property name="VT_HDR_IMAGE_URL" value="/images/ofbiz_logo.png"/>
        <!--javascript lib-->
        <property name="VT_HDR_JAVASCRIPT['add']"
value="/xerus-theme/js/dropdown.js"/>
        <!--Css style-->
        <property name="VT_STYLESHEET['add']"
value="/xerus-theme/css/style.css"/>
        <property name="VT_HELPSTYLESHEET['add']"
value="/xerus-theme/css/help.css"/>
        <property name="VT_DOCBOOKSTYLESHEET['add']"
value="/xerus-theme/webapp/xerus-theme/css/docbook.css"/>
    </theme-properties>
</theme>

*themes/xerus-theme/data/Xerus-themeThemeData.xml*
<entity-engine-xml>
    <VisualTheme visualThemeId="XERUS-THEME" visualThemeSetId="BACKOFFICE"
description="xerus theme: the evolution of the tomahawk theme"/>
    <VisualThemeResource visualThemeId="XERUS-THEME"
resourceTypeEnumId="VT_STYLESHEET"
resourceValue="component://xerus-theme/webapp/css/style.css"
sequenceId="01"/>
    <VisualThemeResource visualThemeId="XERUS-THEME"
resourceTypeEnumId="VT_HDR_TMPLT_LOC"
resourceValue="component://xerus-theme/template/Header.ftl"
sequenceId="08"/>
    <VisualThemeResource visualThemeId="XERUS-THEME"
resourceTypeEnumId="VT_FTR_TMPLT_LOC"
resourceValue="component://xerus-theme/template/Footer.ftl"
sequenceId="10"/>
    *<VisualThemeResource visualThemeId="XERUS-THEME"
resourceTypeEnumId="VT_SIDEBAR_TMPLT_LOC"
resourceValue="component://xerus-theme/template/SideBar.ftl"
sequenceId="26"/>*
</entity-engine-xml>

*themes/common-theme/widget/CommonScreens.xml => GlobalDecorator Screen*
<set field="SidebarTemplateLocation"
form-field="layoutSettings.VT_SIDEBAR_TMPLT_LOC"/>
*added this section for side-bar*
<!-- render the navigation sidebar for xerus theme -->
                <section>
                    <condition>
                        <!-- <and> -->
                            <!-- <if-empty field="SidebarTemplateLocation"
/> -->
                            <not>
                                <if-empty field="SidebarTemplateLocation" />
                            </not>
                        <!-- </and> -->
                    </condition>
                    <widgets>
                        <platform-specific>
                            <html>
                                <html-template
location="${SidebarTemplateLocation}" />
                            </html>
                        </platform-specific>
                    </widgets>
                </section>

*themes/common-theme/widget/Theme.xml*
added a property

<property name="VT_SIDEBAR_TMPLT_LOC"
value="component://xerus-theme/template/SideBar.ftl"/>

*framework/common/data/CommonTypeData.xml*
made an Enumeration entry for side-bar
<Enumeration enumId="VT_SIDEBAR_TMPLT_LOC" description="navigation sidebar
Template Location" enumTypeId="VT_RES_TYPE" sequenceId="26"/>

*all the styles and templates(header, footer)  were rendered except
side-bar.*
I ran* gradlew "ofbiz --load-data readers=seed" *after all the changes.

is this the correct way, or am I missing something?. I dont want to change
the entire theme just wanted a side-bar in all the modules and sub-modules.
the entire theme will be same as tomahawk but there will be an  added
side-bar => please refer this image
<https://www.canva.com/design/DAEv4oU4kAA/sxTXDow6JTFW-Q6LrCPoTw/edit> . I
have extended Tomahawk theme in this custom theme.

Thanks and Regards,
Maheshwari.

Reply via email to