Sorry to comment this commit very late.
I am looking into the PortalPortlet system how it is now. IMO it is now too
complicated with the portlet attribute feature not used as supposed by the
original design.

The generic portlets added with this commit use the Portlet Attribute system
to actually render a screenlet defined by the portlet attributes.
There is a portlet to show a GenericScreenlet, this defines a (collapsible)
screenlet retrieves the screenlet title from a portlet attribute, and
include a form selected by means of other portlet attributes.
Then we have similar additional portlets GenericScreenletAjax,
GenericScreenletAjaxWithMenu that add more features using more attributes.

How is all this useful?
The original idea behind the portlet attributes was to offer to the user a
portlet (but not so much generic) that could be customized is some way.
Examples of Attributes usage could be:
- A portlet lists all new orders or new communications. Attributes could be
used to limit the max number of orders to be displayed, or the order status
etc.

The Generic portlets added in this commit use the Attributes to select the
actual screen to render, the menu to include etc. So the attributes are not
intended to be used by the user any more but by the developer.
So how do they differ from Decorators that are already designed for this.

I propose to eliminate all this stuff. It seems to me just more things to
know to use OFBiz and do not add any real feature.

Thank you,
-Bruno

2010/4/20 <er...@apache.org>

> Author: erwan
> Date: Tue Apr 20 13:57:26 2010
> New Revision: 935923
>
> URL: http://svn.apache.org/viewvc?rev=935923&view=rev
> Log:
> Adding a whole set of generic portlets. Those are more designed to be
> customised
>
> Added:
>    ofbiz/trunk/framework/common/data/CommonPortletData.xml   (with props)
> Modified:
>    ofbiz/trunk/framework/common/ofbiz-component.xml
>
>  
> ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy
>    ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
>    ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>    ofbiz/trunk/framework/common/widget/PortalPageForms.xml
>    ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
>    ofbiz/trunk/framework/common/widget/PortletEditForms.xml
>
> Added: ofbiz/trunk/framework/common/data/CommonPortletData.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/CommonPortletData.xml?rev=935923&view=auto
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/data/CommonPortletData.xml (added)
> +++ ofbiz/trunk/framework/common/data/CommonPortletData.xml Tue Apr 20
> 13:57:26 2010
> @@ -0,0 +1,33 @@
> +<?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.
> +-->
> +<entity-engine-xml>
> +    <PortletCategory portletCategoryId="GENERIC_PORTLET"
> description="Generics portlets usable for easily parametrize portalPages"/>
> +    <PortalPortlet portalPortletId="GenericPortalPage" portletName="Sub
> PortalPage" screenName="GenericPortalPage"
> screenLocation="component://common/widget/PortalPageScreens.xml"
> editFormName="GenericPortalPageParam"
> editFormLocation="component://common/widget/PortalEditForms.xml"
> description="a portlet which included a portalPage to be able to have
> multiple line, each line being a sub page. This portlet has 1 mandatory
> parameters." securityServiceName="" securityMainAction="VIEW"/>
> +    <PortletPortletCategory portalPortletId="GenericPortalPage"
> portletCategoryId="GENERIC_PORTLET"/>
> +    <PortalPortlet portalPortletId="FindGenericEntity" portletName="Entity
> List simple search criteria" screenName="FindGenericEntity"
> screenLocation="component://common/widget/PortalPageScreens.xml"
> editFormName="FindGenericEntityParam"
> editFormLocation="component://common/widget/PortalEditForms.xml"
> description="Simple search criteria, only Id (param idName) and description
> for entityList, result is sent to List${Entity}Area (FindGenericEntityPrtl
> define this area). This portel has 3 mandatory parameters."
> securityServiceName="" securityMainAction="VIEW"/>
> +    <PortletPortletCategory portalPortletId="FindGenericEntity"
> portletCategoryId="GENERIC_PORTLET"/>
> +    <PortalPortlet portalPortletId="GenericScreenlet"
> portletName="Screenlet with one screen" screenName="GenericScreenlet"
> screenLocation="component://common/widget/PortalPageScreens.xml"
> editFormName="GenericScreenletParam"
> editFormLocation="component://common/widget/PortalEditForms.xml"
> description="Simple portlet using screenlet, with one screen. This portlet
> has 3 mandatory parameters." securityServiceName=""
> securityMainAction="VIEW"/>
> +    <PortletPortletCategory portalPortletId="GenericScreenlet"
> portletCategoryId="GENERIC_PORTLET"/>
> +    <PortalPortlet portalPortletId="GenericScreenletAjax"
> portletName="Screenlet with one screen called by ajax"
> screenName="GenericScreenletAjax"
> screenLocation="component://common/widget/PortalPageScreens.xml"
> editFormName="GenericScreenletAjaxParam"
> editFormLocation="component://common/widget/PortalEditForms.xml"
> description="Simple portlet using screenlet, with one screen which was
> update by ajax process, so with a div. This portlet has 4 mandatory
> parameters." securityServiceName="" securityMainAction="VIEW"/>
> +    <PortletPortletCategory portalPortletId="GenericScreenletAjax"
> portletCategoryId="GENERIC_PORTLET"/>
> +    <PortalPortlet portalPortletId="GricScltAjaxWithMenu"
> portletName="Screenlet with one screen, and one menu called by ajax"
> screenName="GenericScreenletAjaxWithMenu"
> screenLocation="component://common/widget/PortalPageScreens.xml"
> editFormName="GenericScreenletAjaxWithMenuParam"
> editFormLocation="component://common/widget/PortalEditForms.xml"
> description="Simple portlet using screenlet with a menu, with one screen
> which was update by ajax process, so with a div. This portlet has 6
> mandatory parameters." securityServiceName="" securityMainAction="VIEW"/>
> +    <PortletPortletCategory portalPortletId="GricScltAjaxWithMenu"
> portletCategoryId="GENERIC_PORTLET"/>
> +    <PortalPage portalPageId="_NA_" sequenceNum="000" portalPageName="For
> using genericPortletScreen" description="To be able to have parameters at
> the portlet level, not PortletPage level" ownerUserLoginId="_NA_"/>
> +</entity-engine-xml>
>
> Propchange: ofbiz/trunk/framework/common/data/CommonPortletData.xml
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: ofbiz/trunk/framework/common/data/CommonPortletData.xml
>
> ------------------------------------------------------------------------------
>    svn:keywords = Date Rev Author URL Id
>
> Propchange: ofbiz/trunk/framework/common/data/CommonPortletData.xml
>
> ------------------------------------------------------------------------------
>    svn:mime-type = text/xml
>
> Modified: ofbiz/trunk/framework/common/ofbiz-component.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/ofbiz-component.xml?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/ofbiz-component.xml (original)
> +++ ofbiz/trunk/framework/common/ofbiz-component.xml Tue Apr 20 13:57:26
> 2010
> @@ -52,6 +52,7 @@ under the License.
>     <entity-resource type="data" reader-name="seed" loader="main"
> location="data/UnitData.xml"/>
>     <entity-resource type="data" reader-name="seed" loader="main"
> location="data/PeriodData.xml"/>
>     <entity-resource type="data" reader-name="seed" loader="main"
> location="data/DimensionTypeData.xml"/>
> +    <entity-resource type="data" reader-name="seed" loader="main"
> location="data/CommonPortletData.xml"/>
>
>     <service-resource type="model" loader="main"
> location="servicedef/services.xml"/>
>     <service-resource type="model" loader="main"
> location="servicedef/services_cdyne.xml"/>
>
> Modified:
> ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy
> (original)
> +++
> ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy
> Tue Apr 20 13:57:26 2010
> @@ -25,6 +25,16 @@ portalPortletId = request.getAttribute("
>  portletSeqId = request.getAttribute("portletSeqId");
>
>  portletAttributes = delegator.findList("PortletAttribute",
> +
>  EntityCondition.makeCondition([portalPageId : "_NA_", portalPortletId:
> portalPortletId, portletSeqId: "00000"]),
> +                                        null, null, null, false);
> +iter = portletAttributes.iterator();
> +
> +while (iter) {
> +  attribute = iter.next();
> +  context.put(attribute.attrName, attribute.attrValue);
> +}
> +
> +portletAttributes = delegator.findList("PortletAttribute",
>
> EntityCondition.makeCondition([portalPageId : portalPageId, portalPortletId:
> portalPortletId, portletSeqId: portletSeqId]),
>                                         null, null, null, false);
>
>
> Modified:
> ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
> (original)
> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
> Tue Apr 20 13:57:26 2010
> @@ -28,6 +28,10 @@ under the License.
>         <security https="true" auth="true"/>
>         <response name="success" type="view" value="showPortlet"/>
>     </request-map>
> +    <request-map uri="refreshPortlet">
> +        <security https="true" auth="true"/>
> +        <response name="success" type="view"
> value="showPortletUiLabelDecorator"/>
> +    </request-map>
>     <request-map uri="showPortletMainDecorator">
>         <security https="true" auth="true"/>
>         <response name="success" type="view"
> value="showPortletMainDecorator"/>
> @@ -137,6 +141,7 @@ under the License.
>     <!-- View Mappings -->
>     <view-map name="showPortalPage" type="screen"
> page="component://common/widget/PortalPageScreens.xml#showPortalPage"/>
>     <view-map name="showPortlet" type="screen"
> page="component://common/widget/PortalPageScreens.xml#showPortlet"/>
> +    <view-map name="showPortletUiLabelDecorator" type="screen"
> page="component://common/widget/PortalPageScreens.xml#showPortletUiLebelDecorator"/>
>     <view-map name="showPortletMainDecorator" type="screen"
> page="component://common/widget/PortalPageScreens.xml#showPortletMainDecorator"/>
>     <view-map name="showPortletSimpleDecorator" type="screen"
> page="component://common/widget/PortalPageScreens.xml#showPortletSimpleDecorator"/>
>     <view-map name="ManagePortalPages" type="screen"
> page="component://common/widget/PortalPageScreens.xml#ManagePortalPages"/>
>
> Modified: ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
> (original)
> +++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl Tue
> Apr 20 13:57:26 2010
> @@ -28,11 +28,18 @@ under the License.
>             <#assign portletFields = '<input name="portalPageId" value="' +
> portlet.portalPageId + '" type="hidden"/><input name="portalPortletId"
> value="' + portlet.portalPortletId + '" type="hidden"/><input
> name="portletSeqId" value="' + portlet.portletSeqId  + '" type="hidden"/>'>
>             <form method="post"
> action="<@ofbizUrl>movePortletToPortalPage</@ofbizUrl>"
> name="movePP_${portlet_index}">${portletFields}<input name="newPortalPageId"
> value="${portlet.portalPageId}" type="hidden"/></form>
>             <div id="portalPortlet_${portlet_index}" class="noClass">
> -            ${setRequestAttribute("portalPageId",
> portalPage.portalPageId)}
> -            ${setRequestAttribute("portalPortletId",
> portlet.portalPortletId)}
> -            ${setRequestAttribute("portletSeqId", portlet.portletSeqId)}
> -            ${screens.render(portlet.screenLocation, portlet.screenName)}
> -            ${screens.setRenderFormUniqueSeq(portlet_index)}
> +              <#assign idRefreshAttr =
> delegator.findOne("PortletAttribute", {"portalPageId":portlet.portalPageId,
> "portalPortletId":portlet.portalPortletId, "portletSeqId":
> portlet.portletSeqId, "attrName": "divIdRefresh"},true)?if_exists />
> +              <#if idRefreshAttr?has_content>
> +                <div id="${idRefreshAttr.attrValue}">
> +              <#else>
> +                <div id="${portlet.portalPortletId}_refresh">
> +              </#if>
> +              ${setRequestAttribute("portalPageId",
> portalPage.portalPageId)}
> +              ${setRequestAttribute("portalPortletId",
> portlet.portalPortletId)}
> +              ${setRequestAttribute("portletSeqId", portlet.portletSeqId)}
> +              ${screens.render(portlet.screenLocation,
> portlet.screenName)}
> +              ${screens.setRenderFormUniqueSeq(portlet_index)}
> +              </div>
>             </div>
>             <#-- DragNDrop is only activated, when the portal Page isn't
> the Default page -->
>             <#if portalPage.originalPortalPageId?has_content><script
> type="text/javascript">setMousePointer("${portlet_index}")</script></#if>
>
> Modified: ofbiz/trunk/framework/common/widget/PortalPageForms.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageForms.xml?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/widget/PortalPageForms.xml (original)
> +++ ofbiz/trunk/framework/common/widget/PortalPageForms.xml Tue Apr 20
> 13:57:26 2010
> @@ -115,7 +115,7 @@ under the License.
>         </field>
>         <field name="description"
> title="${uiLabelMap.CommonDescription}"><display/></field>
>     </form>
> -
> +
>     <form name="PortletList" type="list" separate-columns="true"
> list-name="portlets"
>         odd-row-style="alternate-row" header-row-style="header-row-2"
> default-table-style="basic-table hover-bar">
>         <actions>
> @@ -128,5 +128,17 @@ under the License.
>         </field>
>         <field name="description"><display/></field>
>     </form>
> -
> +
> +    <form name="FindGenericEntity" type="single" target="list${entity}"
> title="" focus-field-name="idName">
> +        <field name="hideSearch"><hidden value="Y"/></field>
> +        <field name="idName"
> title="${uiLabelMap.FormFieldTitle_${pkIdName}"><text size="16"/></field>
> +        <field name="idName_op" ><hidden value="contains"/></field>
> +        <field name="idName_ic" ><hidden value="Y"/></field>
> +        <field name="description" ><text size="16"/></field>
> +        <field name="description_op" ><hidden value="contains"/></field>
> +        <field name="description_ic" ><hidden value="Y"/></field>
> +        <field name="submitButton" title=" " widget-style="smallSubmit">
> +            <hyperlink
> target="javascript:ajaxUpdateArea('List${entity}Area', 'list${entity}',
> $(FindGenericEntity).serialize());" target-type="plain"
>  description="${uiLabelMap.CommonSearch}"/>
> +        </field>
> +    </form>
>  </forms>
>
> Modified: ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageScreens.xml?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/widget/PortalPageScreens.xml (original)
> +++ ofbiz/trunk/framework/common/widget/PortalPageScreens.xml Tue Apr 20
> 13:57:26 2010
> @@ -44,6 +44,17 @@ under the License.
>             </widgets>
>         </section>
>     </screen>
> +    <screen name="showPortletUiLabelDecorator">
> +        <section>
> +            <widgets>
> +                <decorator-screen name="uiLabelDecorator"
> location="${parameters.mainDecoratorLocation}">
> +                    <decorator-section name="body">
> +                        <include-screen name="showPortlet"/>
> +                    </decorator-section>
> +                </decorator-screen>
> +            </widgets>
> +        </section>
> +    </screen>
>     <screen name="showPortletMainDecorator">
>         <section>
>             <widgets>
> @@ -179,4 +190,69 @@ under the License.
>             </widgets>
>         </section>
>     </screen>
> +
> +    <screen name="GenericPortalPage">
> +        <section>
> +            <actions>
> +                <script
> location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/>
> +                <set field="portalPageId" value="${pageId}"/>
> +            </actions>
> +            <widgets>
> +                <include-screen name="PortalPageScreen"
> location="component://common/widget/CommonScreens.xml"/>
> +            </widgets>
> +        </section>
> +    </screen>
> +    <screen name="FindGenericEntity">
> +        <section>
> +            <actions>
> +                <script
> location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/>
> +            </actions>
> +            <widgets>
> +                <screenlet title="${uiLabelMap.${titleLabel}}">
> +                    <include-form name="FindGenericEntity"
> location="component://common/widget/PortalPageForms.xml"/>
> +                </screenlet>
> +            </widgets>
> +        </section>
> +    </screen>
> +    <screen name="GenericScreenlet">
> +        <section>
> +            <actions>
> +                <script
> location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/>
> +            </actions>
> +            <widgets>
> +                <screenlet title="${uiLabelMap.${titleLabel}}">
> +                    <include-form name="${formName}"
> location="${formLocation}"/>
> +                </screenlet>
> +            </widgets>
> +        </section>
> +    </screen>
> +    <screen name="GenericScreenletAjax">
> +        <section>
> +            <actions>
> +                <script
> location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/>
> +            </actions>
> +            <widgets>
> +                <screenlet title="${uiLabelMap.${titleLabel}}">
> +                    <container id="${divIdArea}">
> +                        <include-screen name="${screenName}"
> location="${screenLocation}"/>
> +                    </container>
> +                </screenlet>
> +            </widgets>
> +        </section>
> +    </screen>
> +    <screen name="GenericScreenletAjaxWithMenu">
> +        <section>
> +            <actions>
> +                <script
> location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/>
> +            </actions>
> +            <widgets>
> +                <screenlet title="${uiLabelMap.${titleLabel}}"
> navigation-menu-name="${menuName}">
> +                    <include-menu name="${menuName}"
> location="${menuLocation}"/>
> +                    <container id="${divIdArea}">
> +                        <include-screen name="${screenName}"
> location="${screenLocation}"/>
> +                    </container>
> +                </screenlet>
> +            </widgets>
> +        </section>
> +    </screen>
>  </screens>
>
> Modified: ofbiz/trunk/framework/common/widget/PortletEditForms.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortletEditForms.xml?rev=935923&r1=935922&r2=935923&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/framework/common/widget/PortletEditForms.xml (original)
> +++ ofbiz/trunk/framework/common/widget/PortletEditForms.xml Tue Apr 20
> 13:57:26 2010
> @@ -33,5 +33,41 @@ under the License.
>         <field name="portalPortletId"><hidden
> value="${parameters.portalPortletId}"/></field>
>         <field name="portletSeqId"><hidden
> value="${parameters.portletSeqId}"/></field>
>     </form>
> +    <form name="GenericPortalPageParam" extends="CommonPortletEdit">
> +        <field name="pageId" required-field="true"><text/></field>
> +        <field name="submit" widget-style="smallSubmit"><submit
> button-type="button"/></field>
> +    </form>
> +    <form name="FindGenericEntityParam" extends="CommonPortletEdit">
> +        <field name="titleLabel" required-field="true"><text/></field>
> +        <field name="entity" required-field="true"><text/></field>
> +        <field name="pkIdName" required-field="true"><text/></field>
> +        <field name="divIdRefresh"><text/></field>
> +        <field name="submit" widget-style="smallSubmit"><submit
> button-type="button"/></field>
> +    </form>
> +    <form name="GenericScreenletParam" extends="CommonPortletEdit">
> +        <field name="titleLabel" required-field="true"><text/></field>
> +        <field name="divIdRefresh"><text/></field>
> +        <field name="formName" required-field="true"><text/></field>
> +        <field name="formLocation" required-field="true"><text/></field>
> +        <field name="submit" widget-style="smallSubmit"><submit
> button-type="button"/></field>
> +    </form>
> +    <form name="GenericScreenletAjaxParam" extends="CommonPortletEdit">
> +        <field name="titleLabel" required-field="true"><text/></field>
> +        <field name="divIdRefresh"><text/></field>
> +        <field name="divIdArea" required-field="true"><text/></field>
> +        <field name="screenName" required-field="true"><text/></field>
> +        <field name="screenLocation" required-field="true"><text/></field>
> +        <field name="submit" widget-style="smallSubmit"><submit
> button-type="button"/></field>
> +    </form>
> +    <form name="GenericScreenletAjaxWithMenuParam"
> extends="CommonPortletEdit">
> +        <field name="titleLabel" required-field="true"><text/></field>
> +        <field name="divIdRefresh"><text/></field>
> +        <field name="divIdArea" required-field="true"><text/></field>
> +        <field name="screenName" required-field="true"><text/></field>
> +        <field name="screenLocation" required-field="true"><text/></field>
> +        <field name="menuName" required-field="true"><text/></field>
> +        <field name="menuLocation" required-field="true"><text/></field>
> +        <field name="submit" widget-style="smallSubmit"><submit
> button-type="button"/></field>
> +    </form>
>
>  </forms>
>
>
>

Reply via email to