Skip to content

Commit

Permalink
Implemented: Add a framework method to get main webapp menu with the …
Browse files Browse the repository at this point in the history
…webapp name

(OFBIZ-10601)

To improve theme management and provide better tools for new themes, we implement a method to obtain the main menu of a webapp.
Instead of just managing a menu, we extend the functionality by offering a method to expose a summary of the webapp, to simplify the navigation.

For this we add a new attribute on webapp definition app-shortcut-screen :

    <webapp name="mywebapp"
            ...
            app-shortcut-screen="component://mycomponent/widget/CommonScreens.xml#ShortcutApp"
            ...
    />

The idea is to define a new purpose screen *Shortcut* that contains what defines a webapp when an action or navigation has been requested. With this screen you can load a menu, a search, a complex description and use all screen powerfulness to resolve what displaying and support by theming

    <screen name="ShortcutApp">
        <section>
            <actions>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="body">
                        <include-menu name="MyShortcutAppBar" location="component://mycomponent/widget/CommonMenus.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

Each component are self-sufficient to define what shortcuts to display without framework change or knowledge about other component.
Each theme can implement and customize the display rendering at will.

To illustrate an example of implementation we set sub menu for each webapp defined on applications and exploit it on bluelight theme.

Thanks for Dennis Balkir, Jacques Leroux, Leila Mekika and Julien Nicolas for their involvement
  • Loading branch information
nmalin committed Jan 15, 2021
1 parent c4d8f90 commit 7165768
Show file tree
Hide file tree
Showing 42 changed files with 596 additions and 11 deletions.
3 changes: 3 additions & 0 deletions applications/accounting/ofbiz-component.xml
Expand Up @@ -80,19 +80,22 @@ under the License.
server="default-server"
location="webapp/accounting"
base-permission="OFBTOOLS,ACCOUNTING"
app-shortcut-screen="component://accounting/widget/CommonScreens.xml#ShortcutApp"
mount-point="/accounting"/>

<webapp name="ar"
title="Accounting - AR"
server="default-server"
location="webapp/ar"
base-permission="OFBTOOLS,ACCOUNTING"
app-shortcut-screen="component://accounting/widget/ar/CommonScreens.xml#ShortcutApp"
mount-point="/ar"/>

<webapp name="ap"
title="Accounting - AP"
server="default-server"
location="webapp/ap"
base-permission="OFBTOOLS,ACCOUNTING"
app-shortcut-screen="component://accounting/widget/ap/CommonScreens.xml#ShortcutApp"
mount-point="/ap"/>
</ofbiz-component>
32 changes: 32 additions & 0 deletions applications/accounting/widget/AccountingMenus.xml
Expand Up @@ -53,6 +53,38 @@ under the License.
<menu-item name="companies" title="${uiLabelMap.AccountingOrgGlSettings}"><link target="ListCompanies"/></menu-item>
</menu>

<menu name="AccountingShortcutAppBar" title="${uiLabelMap.AccountingManager}">
<menu-item name="invoices" title="${uiLabelMap.AccountingInvoicesMenu}"><link target="/accounting/control/findInvoices" url-mode="inter-app"/></menu-item>
<menu-item name="payments" title="${uiLabelMap.AccountingPaymentsMenu}"><link target="/accounting/control/findPayments" url-mode="inter-app"/></menu-item>
<menu-item name="PaymentGroup" title="${uiLabelMap.AccountingPaymentGroup}"><link target="/accounting/control/FindPaymentGroup" url-mode="inter-app"/></menu-item>
<menu-item name="transaction" title="${uiLabelMap.AccountingTransactions}">
<condition>
<or>
<if-has-permission permission="MANUAL" action="_PAYMENT"/>
<if-has-permission permission="ACCOUNTING" action="_CREATE"/>
</or>
</condition>
<link target="/accounting/control/FindGatewayResponses" url-mode="inter-app"/>
</menu-item>
<menu-item name="PaymentGatewayConfig" title="${uiLabelMap.AccountingPaymentGatewayConfig}">
<condition>
<or>
<if-has-permission permission="PAYPROC" action="_ADMIN"/>
<if-has-permission permission="ACCOUNTING" action="_ADMIN"/>
</or>
</condition>
<link target="/accounting/control/FindPaymentGatewayConfig" url-mode="inter-app"/>
</menu-item>
<menu-item name="billingaccount" title="${uiLabelMap.AccountingBillingMenu}"><link target="/accounting/control/FindBillingAccount" url-mode="inter-app"/></menu-item>
<menu-item name="FindFinAccount" title="${uiLabelMap.AccountingFinAccount}"><link target="/accounting/control/FinAccountMain" url-mode="inter-app"/></menu-item>
<menu-item name="TaxAuthorities" title="${uiLabelMap.AccountingTaxAuthorities}"><link target="/accounting/control/FindTaxAuthority" url-mode="inter-app"/></menu-item>
<menu-item name="agreements" title="${uiLabelMap.AccountingAgreements}"><link target="/accounting/control/FindAgreement" url-mode="inter-app"/></menu-item>
<menu-item name="ListFixedAssets" title="${uiLabelMap.AccountingFixedAssets}"><link target="/accounting/control/ListFixedAssets" url-mode="inter-app"/></menu-item>
<menu-item name="ListBudgets" title="${uiLabelMap.AccountingBudgets}"><link target="/accounting/control/ListBudgets" url-mode="inter-app"/></menu-item>
<menu-item name="GlobalGLSettings" title="${uiLabelMap.AccountingGlobalGLSettings}"><link target="/accounting/control/globalGLSettings" url-mode="inter-app"/></menu-item>
<menu-item name="companies" title="${uiLabelMap.AccountingOrgGlSettings}"><link target="/accounting/control/ListCompanies" url-mode="inter-app"/></menu-item>
</menu>

<menu name="InvoiceTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
<menu-item name="find" title="${uiLabelMap.CommonFind}">
<link target="findInvoices"/>
Expand Down
16 changes: 15 additions & 1 deletion applications/accounting/widget/CommonScreens.xml
Expand Up @@ -47,7 +47,21 @@ under the License.
</widgets>
</section>
</screen>

<screen name="ShortcutApp">
<section>
<actions>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="AccountingShortcutAppBar" location="component://accounting/widget/AccountingMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CommonFinAccountDecorator">
<section>
<actions>
Expand Down
9 changes: 9 additions & 0 deletions applications/accounting/widget/ap/ApMenus.xml
Expand Up @@ -27,6 +27,15 @@ under the License.
<menu-item name="reports" title="${uiLabelMap.AccountingReports}"><link target="listReports"/></menu-item>
</menu>

<menu name="ApShortcutAppBar" title="${uiLabelMap.AccountingApManager}">
<menu-item name="agreements" title="${uiLabelMap.AccountingAgreements}"><link target="/ap/control/FindAgreement" url-mode="inter-app"/></menu-item>
<menu-item name="invoices" title="${uiLabelMap.AccountingInvoicesMenu}"><link target="/ap/control/FindApInvoices" url-mode="inter-app"/></menu-item>
<menu-item name="payments" title="${uiLabelMap.AccountingPaymentsMenu}"><link target="/ap/control/findPayments" url-mode="inter-app"/></menu-item>
<menu-item name="apPaymentGroups" title="${uiLabelMap.AccountingApPaymentGroupMenu}"><link target="/ap/control/FindApPaymentGroups" url-mode="inter-app"/></menu-item>
<menu-item name="findVendors" title="${uiLabelMap.AccountingApPageTitleFindVendors}"><link target="/ap/control/findVendors" url-mode="inter-app"/></menu-item>
<menu-item name="reports" title="${uiLabelMap.AccountingReports}"><link target="/ap/control/listReports" url-mode="inter-app"/></menu-item>
</menu>

<menu name="ApInvoiceTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"
default-menu-item-name="viewInvoices">
<menu-item name="viewInvoices" title="${uiLabelMap.CommonMain}">
Expand Down
15 changes: 15 additions & 0 deletions applications/accounting/widget/ap/CommonScreens.xml
Expand Up @@ -38,6 +38,21 @@ under the License.
</widgets>
</section>
</screen>
<screen name="ShortcutApp">
<section>
<actions>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="ApShortcutAppBar" location="component://accounting/widget/ap/ApMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>

<screen name="main">
<section>
Expand Down
7 changes: 7 additions & 0 deletions applications/accounting/widget/ar/ArMenus.xml
Expand Up @@ -26,6 +26,13 @@ under the License.
<menu-item name="paymentGroups" title="${uiLabelMap.AccountingArPaymentGroupMenu}"><link target="FindArPaymentGroups"/></menu-item>
<menu-item name="reports" title="${uiLabelMap.AccountingReports}"><link target="ListReports"/></menu-item>
</menu>
<menu name="ArShortcutAppBar" title="${uiLabelMap.AccountingArManager}">
<menu-item name="agreements" title="${uiLabelMap.AccountingAgreements}"><link target="/ar/control/FindAgreement" url-mode="inter-app"/></menu-item>
<menu-item name="invoices" title="${uiLabelMap.AccountingInvoicesMenu}"><link target="/ar/control/findInvoices" url-mode="inter-app"/></menu-item>
<menu-item name="payments" title="${uiLabelMap.AccountingPaymentsMenu}"><link target="/ar/control/findPayments" url-mode="inter-app"/></menu-item>
<menu-item name="paymentGroups" title="${uiLabelMap.AccountingArPaymentGroupMenu}"><link target="/ar/control/FindArPaymentGroups" url-mode="inter-app"/></menu-item>
<menu-item name="reports" title="${uiLabelMap.AccountingReports}"><link target="/ar/control/ListReports" url-mode="inter-app"/></menu-item>
</menu>
<menu name="ArPaymentTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
<menu-item name="findPayments" title="${uiLabelMap.PageTitleFindPayment}">
<link target="findPayments"/>
Expand Down
15 changes: 15 additions & 0 deletions applications/accounting/widget/ar/CommonScreens.xml
Expand Up @@ -40,6 +40,21 @@ under the License.
</widgets>
</section>
</screen>
<screen name="ShortcutApp">
<section>
<actions>
<property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="ArShortcutAppBar" location="component://accounting/widget/ar/ArMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>

<screen name="main">
<section>
Expand Down
1 change: 1 addition & 0 deletions applications/content/ofbiz-component.xml
Expand Up @@ -49,6 +49,7 @@ under the License.
server="default-server"
location="webapp/content"
base-permission="OFBTOOLS,CONTENTMGR"
app-shortcut-screen="component://content/widget/CommonScreens.xml#ShortcutApp"
mount-point="/content"/>

<webapp name="contentimages"
Expand Down
16 changes: 15 additions & 1 deletion applications/content/widget/CommonScreens.xml
Expand Up @@ -44,7 +44,21 @@ under the License.
</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"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="ContentShortcutAppBar" location="component://content/widget/content/ContentMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="commonCmsDecorator">
<section>
<actions>
Expand Down
14 changes: 14 additions & 0 deletions applications/content/widget/content/ContentMenus.xml
Expand Up @@ -33,6 +33,20 @@ under the License.
<menu-item name="CompDoc" title="${uiLabelMap.ContentCompDoc}"><link target="FindCompDoc"/></menu-item>
</menu>

<menu name="ContentShortcutAppBar" title="${uiLabelMap.ContentContentManager}">
<menu-item name="websites" title="${uiLabelMap.ContentWebSites}"><link target="FindWebSite" url-mode="inter-app"/></menu-item>
<menu-item name="survey" title="${uiLabelMap.ContentSurvey}"><link target="FindSurvey" url-mode="inter-app"/></menu-item>
<menu-item name="Forum" title="${uiLabelMap.ContentForum}"><link target="findForumGroups" url-mode="inter-app"/></menu-item>
<menu-item name="Blog" title="${uiLabelMap.ContentBlog}"><link target="blogMain" url-mode="inter-app"/></menu-item>
<menu-item name="Content" title="${uiLabelMap.ContentContent}"><link target="findContent" url-mode="inter-app"/></menu-item>
<menu-item name="DataResource" title="${uiLabelMap.ContentDataResource}"><link target="findDataResource" url-mode="inter-app"/></menu-item>
<menu-item name="ContentSetupMenu" title="${uiLabelMap.ContentContentSetup}"><link target="ContentSetupMenu" url-mode="inter-app"/></menu-item>
<menu-item name="DataResourceSetupMenu" title="${uiLabelMap.ContentDataSetup}"><link target="DataSetupMenu" url-mode="inter-app"/></menu-item>
<menu-item name="Layout" title="${uiLabelMap.ContentTemplate}"><link target="LayoutMenu" url-mode="inter-app"/></menu-item>
<menu-item name="CMS" title="${uiLabelMap.ContentCMS}"><link target="CMSContentFind" url-mode="inter-app"/></menu-item>
<menu-item name="CompDoc" title="${uiLabelMap.ContentCompDoc}"><link target="FindCompDoc" url-mode="inter-app"/></menu-item>
</menu>

<menu name="content" menu-container-style="button-bar tab-bar" default-selected-style="selected" default-menu-item-name="content" default-permission-operation="HAS_AUTHOR_ROLE|CONTENT_ADMIN"
default-permission-entity-action="_ADMIN" default-associated-content-id="${userLogin.userLoginId}" selected-menuitem-context-field-name="tabButtonItem"
title="" type="simple">
Expand Down
1 change: 1 addition & 0 deletions applications/humanres/ofbiz-component.xml
Expand Up @@ -38,5 +38,6 @@ under the License.
location="webapp/humanres"
base-permission="OFBTOOLS,HUMANRES"
mount-point="/humanres"
app-shortcut-screen="component://humanres/widget/CommonScreens.xml#ShortcutApp"
app-bar-display="true"/>
</ofbiz-component>
16 changes: 15 additions & 1 deletion applications/humanres/widget/CommonScreens.xml
Expand Up @@ -70,7 +70,21 @@ under the License.
</widgets>
</section>
</screen>

<screen name="ShortcutApp">
<section>
<actions>
<property-map resource="HumanResUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="HumanResShortcutAppBar" location="component://humanres/widget/HumanresMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="OrgTree">
<section>
<actions>
Expand Down
14 changes: 14 additions & 0 deletions applications/humanres/widget/HumanresMenus.xml
Expand Up @@ -34,6 +34,20 @@
<menu-item name="Leave" title="${uiLabelMap.HumanResEmplLeave}"><link target="FindEmplLeaves"/></menu-item>
<menu-item name="GlobalHRSettings" title="${uiLabelMap.HumanResGlobalHRSettings}" selected-style="selected"><link target="globalHRSettings"/></menu-item>
</menu>
<menu name="HumanResShortcutAppBar" title="${uiLabelMap.HumanResManager}">
<menu-item name="Employees" title="${uiLabelMap.HumanResEmployees}"><link target="/humanres/control/findEmployees" url-mode="inter-app"/></menu-item>
<menu-item name="Employment" title="${uiLabelMap.HumanResEmployment}"><link target="/humanres/control/FindEmployments" url-mode="inter-app"/></menu-item>
<menu-item name="EmplPosition" title="${uiLabelMap.HumanResEmployeePosition}"><link target="/humanres/control/FindEmplPositions" url-mode="inter-app"/></menu-item>
<menu-item name="PerfReview" title="${uiLabelMap.HumanResPerfReview}"><link target="/humanres/control/FindPerfReviews" url-mode="inter-app"/></menu-item>
<menu-item name="EmplSkills" title="${uiLabelMap.HumanResSkills}"><link target="/humanres/control/FindPartySkills" url-mode="inter-app"/></menu-item>
<menu-item name="PartyQual" title="${uiLabelMap.HumanResPartyQualification}"><link target="/humanres/control/FindPartyQuals" url-mode="inter-app"/></menu-item>
<menu-item name="Recruitment" title="${uiLabelMap.HumanResRecruitment}"><link target="/humanres/control/FindJobRequisitions" url-mode="inter-app"/></menu-item>
<menu-item name="Training" title="${uiLabelMap.HumanResTraining}"><link target="/humanres/control/TrainingCalendar" url-mode="inter-app"/></menu-item>
<menu-item name="EmploymentApp" title="${uiLabelMap.HumanResEmploymentApp}"><link target="/humanres/control/FindEmploymentApps" url-mode="inter-app"/></menu-item>
<menu-item name="PartyResume" title="${uiLabelMap.HumanResPartyResume}"><link target="/humanres/control/FindPartyResumes" url-mode="inter-app"/></menu-item>
<menu-item name="Leave" title="${uiLabelMap.HumanResEmplLeave}"><link target="/humanres/control/FindEmplLeaves" url-mode="inter-app"/></menu-item>
<menu-item name="GlobalHRSettings" title="${uiLabelMap.HumanResGlobalHRSettings}" selected-style="selected"><link target="/humanres/control/globalHRSettings" url-mode="inter-app"/></menu-item>
</menu>
<menu name="EmploymentBar" default-menu-item-name="EditPartyBenefit" default-selected-style="selected"
type="simple" menu-container-style="button-bar tab-bar" selected-menuitem-context-field-name="tabButtonItem">
<actions>
Expand Down
1 change: 1 addition & 0 deletions applications/manufacturing/ofbiz-component.xml
Expand Up @@ -49,6 +49,7 @@ under the License.
server="default-server"
location="webapp/manufacturing"
base-permission="OFBTOOLS,MANUFACTURING"
app-shortcut-screen="component://manufacturing/widget/manufacturing/CommonScreens.xml#ShortcutApp"
mount-point="/manufacturing"/>

</ofbiz-component>
Expand Down
16 changes: 16 additions & 0 deletions applications/manufacturing/widget/manufacturing/CommonScreens.xml
Expand Up @@ -72,5 +72,21 @@ under the License.
</widgets>
</section>
</screen>
<screen name="ShortcutApp">
<section>
<actions>
<property-map resource="ManufacturingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
<decorator-screen name="ShortcutDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="body">
<include-menu name="ManufacturingShortcutAppBar" location="component://manufacturing/widget/manufacturing/ManufacturingMenus.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
</screens>

0 comments on commit 7165768

Please sign in to comment.