You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/02/22 09:16:33 UTC

svn commit: r746646 - in /ofbiz/trunk: framework/common/entitydef/ framework/common/webcommon/WEB-INF/actions/includes/ framework/common/webcommon/portal/ framework/common/widget/ framework/example/data/ specialpurpose/myportal/data/ specialpurpose/myp...

Author: hansbak
Date: Sun Feb 22 08:16:32 2009
New Revision: 746646

URL: http://svn.apache.org/viewvc?rev=746646&view=rev
Log:
add the possibility to list portlets by portlet category

Modified:
    ofbiz/trunk/framework/common/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy
    ofbiz/trunk/framework/common/webcommon/portal/listPortalPortlets.ftl
    ofbiz/trunk/framework/common/widget/PortalPageForms.xml
    ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
    ofbiz/trunk/framework/example/data/ExampleDemoData.xml
    ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
    ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml

Modified: ofbiz/trunk/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/common/entitydef/entitymodel.xml Sun Feb 22 08:16:32 2009
@@ -620,6 +620,23 @@
         <field name="securityMainAction" type="short-varchar"><description>The main action which can be done with this portlet, possible values: CREATE UPDATE VIEW DELETE</description></field>
         <prim-key field="portalPortletId"/>
     </entity>
+    <entity entity-name="PortletCategory" package-name="org.ofbiz.common.portal" title="Portlet Category Entity">
+      <field name="portletCategoryId" type="id-ne"></field>
+      <field name="description" type="id"></field>
+      <prim-key field="portletCategoryId"/>
+    </entity>
+    <entity entity-name="PortletPortletCategory" package-name="org.ofbiz.common.portal" title="Defines Portlets included into Categories">
+      <field name="portalPortletId" type="id-ne"></field>
+      <field name="portletCategoryId" type="id-ne"></field>
+      <prim-key field="portalPortletId"/>
+      <prim-key field="portletCategoryId"/>
+      <relation type="one" fk-name="PPTLTCAT_PTPL" rel-entity-name="PortalPortlet">
+        <key-map field-name="portalPortletId"/>
+      </relation>
+      <relation type="one" fk-name="PPTLTCAT_PTLTCAT" rel-entity-name="PortletCategory">
+        <key-map field-name="portletCategoryId"/>
+      </relation>
+    </entity>
     <entity entity-name="PortalPage" package-name="org.ofbiz.common.portal" title="Defines a Portal Page">
         <field name="portalPageId" type="id-ne"></field>
         <field name="portalPageName" type="name"></field>

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy Sun Feb 22 08:16:32 2009
@@ -20,25 +20,30 @@
 import org.ofbiz.entity.*;
 import org.ofbiz.entity.condition.*;
 
-
-ppIter = delegator.find("PortalPortlet", null, null, null, null, null);
+ppCond = EntityCondition.makeCondition("portletCategoryId", EntityOperator.EQUALS, parameters.portletCategoryId);
+categories = delegator.findList("PortletPortletCategory", ppCond, null, null, null, false);
 
 portalPortlets = [];
-inMap = [:];
-while (portlet = ppIter.next()) {
+	categories.each { category ->
+	pCond = EntityCondition.makeCondition("portalPortletId", EntityOperator.EQUALS, category.get("portalPortletId"));
+	listPortalPortlets = delegator.findList("PortalPortlet", pCond, null, null, null, false);
 
-    if (portlet.securityServiceName && portlet.securityMainAction) {
-        inMap.mainAction = portlet.securityMainAction;
-        inMap.userLogin = context.userLogin;
-        result = dispatcher.runSync(portlet.securityServiceName, inMap)
-        hasPermission = result.hasPermission;
-    } else {
-        hasPermission = true;
-    }
+	inMap = [:];
+    listPortalPortlets.each { listPortalPortlet ->
+		if (listPortalPortlet.securityServiceName && listPortalPortlet.securityMainAction) {
+			inMap.mainAction = listPortalPortlet.securityMainAction;
+			inMap.userLogin = context.userLogin;
+			result = dispatcher.runSync(listPortalPortlet.securityServiceName, inMap)
+			hasPermission = result.hasPermission;
+		} else {
+			hasPermission = true;
+		}
     
-    if (hasPermission) {
-        portalPortlets.add(portlet);
-    }
+		if (hasPermission) {
+			portalPortlets.add(listPortalPortlet);
+		}
+	}
 }
-context.portalPortlets = portalPortlets;
 
+context.portletCat = delegator.findAll("PortletCategory");
+context.portalPortlets = portalPortlets;
\ No newline at end of file

Modified: ofbiz/trunk/framework/common/webcommon/portal/listPortalPortlets.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/listPortalPortlets.ftl?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/portal/listPortalPortlets.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/portal/listPortalPortlets.ftl Sun Feb 22 08:16:32 2009
@@ -49,6 +49,9 @@
                   <div class="tabletext">
                     ${portalPortlet.description}
                   </div>
+                  <div class="tabletext">
+                    ${parameters.portletCategoryId}
+                  </div>
                 </td>
                 <td>
                   <#if portalPortlet.screenshot?has_content>
@@ -66,6 +69,7 @@
         <#assign leftColumn = !leftColumn/> 
       </#list>
     </table>
-  
+    <#else/>
+    <h2>Please, choose new category again, No portlet in this category.</h2>
   </#if>
 </div>

Modified: ofbiz/trunk/framework/common/widget/PortalPageForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageForms.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageForms.xml Sun Feb 22 08:16:32 2009
@@ -67,5 +67,14 @@
         <field name="portalPageName" position="1"><text/></field>
         <field name="description" position="2"><text/></field>
         <field name="createButton"><submit button-type="button"/></field>
-    </form>       
+    </form>
+    
+    <form name="PortletCategoryAndPortlet" type="list" list-name="portletCat" paginate-target="AddPortlet" separate-columns="true"
+        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+        <field name="portletCategoryId" title="Category">
+            <hyperlink description="${portletCategoryId}" target="AddPortlet?portletCategoryId=${portletCategoryId}&amp;portalPortletId=${portalPortletId}&amp;portalPageId=${parameters.portalPageId}&amp;columnSeqId=${parameters.columnSeqId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"/>
+        </field>
+        <field name="description" title="${uiLabelMap.CommonDescription}" field-name="${description}"><display/></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=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageScreens.xml Sun Feb 22 08:16:32 2009
@@ -105,7 +105,10 @@
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">
+                    <decorator-section name="body">                        
+                        <screenlet title="Category of portlet pages for application: ${parameters.parentPortalPageId}">
+                            <include-form name="PortletCategoryAndPortlet" location="component://common/widget/PortalPageForms.xml"/>
+                        </screenlet>
                         <platform-specific><html><html-template location="component://common/webcommon/portal/listPortalPortlets.ftl"/></html></platform-specific>
                     </decorator-section>
                 </decorator-screen>

Modified: ofbiz/trunk/framework/example/data/ExampleDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/data/ExampleDemoData.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/data/ExampleDemoData.xml (original)
+++ ofbiz/trunk/framework/example/data/ExampleDemoData.xml Sun Feb 22 08:16:32 2009
@@ -30,4 +30,12 @@
     <PortalPortlet portalPortletId="EXAMPLE_3" portletName="Example 3" description="Example portlet n. 3"
         screenName="ExamplePortlet3" screenLocation="component://example/widget/example/PortletScreens.xml"
         editFormName="ExamplePortlet3Edit" editFormLocation="component://example/widget/example/PortletEditForms.xml" />
+    
+    <PortletCategory portletCategoryId="SAMPLE" description="Sample Portlet(s)"/>
+    
+    <PortletPortletCategory portalPortletId="WELCOME" portletCategoryId="SAMPLE"/>
+    <PortletPortletCategory portalPortletId="LOGIN" portletCategoryId="SAMPLE"/>
+    <PortletPortletCategory portalPortletId="EXAMPLE_1" portletCategoryId="SAMPLE"/>
+    <PortletPortletCategory portalPortletId="EXAMPLE_2" portletCategoryId="SAMPLE"/>
+    <PortletPortletCategory portalPortletId="EXAMPLE_3" portletCategoryId="SAMPLE"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml Sun Feb 22 08:16:32 2009
@@ -73,6 +73,13 @@
     <PortalPageColumn portalPageId="MYPORTAL_CUSTOMER2" columnSeqId="00001" />
     <PortalPageColumn portalPageId="MYPORTAL_CUSTOMER3" columnSeqId="00001" />
     
+    <PortletCategory portletCategoryId="PROFILE" description="Profiles"/>
+    <PortletCategory portletCategoryId="COMMUNICATIONS" description="Communication(s)"/>
+    <PortletCategory portletCategoryId="TASKS" description="Task(s)"/>
+    <PortletCategory portletCategoryId="TIMESHEETS" description="Timesheet(s)"/>
+    <PortletCategory portletCategoryId="LIST_REQUEST" description="List(s) Request"/>
+    <PortletCategory portletCategoryId="LIST_CUSTOMER" description="List(s) of Customer" />    
+    
     <PortalPortlet portalPortletId="Attributes" portletName="Attributes" screenName="Attributes" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Attributes in myportal from party" />
     <PortalPortlet portalPortletId="AvsSettings" portletName="Avs Settings" screenName="AvsSettings" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Avs Settings in myportal from party" />
     <PortalPortlet portalPortletId="Content" portletName="Content" screenName="Content" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Content in myportal from party" />
@@ -84,13 +91,13 @@
     <PortalPortlet portalPortletId="UserLogin" portletName="User Login" screenName="UserLogin" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="User Login in myportal from party" />
     <PortalPortlet portalPortletId="Visits" portletName="Visits" screenName="Visits" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Visits in myportal from party" />
     <PortalPortlet portalPortletId="contact" portletName="Contact" screenName="Contact" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="contact in myportal from party" />
-    <PortalPortlet portalPortletId="listrequestlist" portletName="List Request List" screenName="ListRequestList" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="List Request List From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="party" portletName="Party" screenName="Party" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="profile in myportal from party" />
     <PortalPortlet portalPortletId="mycommunications" portletName="My Communications" screenName="MyCommunications" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="My Communications From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="mycompanycomms" portletName="My Company Comms" screenName="MyCompanyComms" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="My Company Comms From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
+    <PortalPortlet portalPortletId="otherCommunications" portletName="Other Communications" screenName="OtherCommunications" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Other Communications From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="mytasks" portletName="My Tasks" screenName="MyTasks" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="My Tasks From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />    
+    <PortalPortlet portalPortletId="listrequestlist" portletName="List Request List" screenName="ListRequestList" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="List Request List From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="mytimesheet" portletName="My Timesheet" screenName="MyTimesheet" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="My Timesheet From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
-    <PortalPortlet portalPortletId="otherCommunications" portletName="Other Communications" screenName="OtherCommunications" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="Other Communications From My Page" securityServiceName="portalPermissionIsEmployee" securityMainAction="VIEW" />
-    <PortalPortlet portalPortletId="party" portletName="Party" screenName="Party" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="profile in myportal from party" />
     <PortalPortlet portalPortletId="ListInvoices" portletName="List Invoices" screenName="ListInvoices" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="List Invoices From MyPortal" securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="ListCustRequests" portletName="List Cust Requests" screenName="ListCustRequests" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="List Cust Requests From MyPortal" securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
     <PortalPortlet portalPortletId="ListCustRequestsComp" portletName="List Cust Requests Completed" screenName="ListCustRequestsCompleted" screenLocation="component://myportal/widget/MyPortalScreens.xml" description="List Cust Requests Completed From MyPortal" securityServiceName="portalPermissionIsCustomer" securityMainAction="VIEW" />
@@ -150,6 +157,33 @@
     <PortalPagePortlet portalPageId="MYPORTAL_CUSTOMER2" portalPortletId="ListInvoices" portletSeqId="00001" columnSeqId="00001"  sequenceNum="0"/>
     <PortalPagePortlet portalPageId="MYPORTAL_CUSTOMER3" portalPortletId="ListProjects" portletSeqId="00001" columnSeqId="00001"  sequenceNum="0"/>
 
+    <PortletPortletCategory portalPortletId="Attributes" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="AvsSettings" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="Content" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="LoyaltyPoints" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="MYTASKSPARTY" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="Notes" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="PaymentMethods" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="ShipperAccount" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="UserLogin" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="Visits" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="contact" portletCategoryId="PROFILE"/>
+    <PortletPortletCategory portalPortletId="party" portletCategoryId="PROFILE"/>
+    
+    <PortletPortletCategory portalPortletId="mycommunications" portletCategoryId="COMMUNICATIONS"/>
+    <PortletPortletCategory portalPortletId="mycompanycomms" portletCategoryId="COMMUNICATIONS"/>
+    <PortletPortletCategory portalPortletId="otherCommunications" portletCategoryId="COMMUNICATIONS"/>
+    
+    <PortletPortletCategory portalPortletId="mytasks" portletCategoryId="TASKS"/>
+    <PortletPortletCategory portalPortletId="mytimesheet" portletCategoryId="TIMESHEETS"/>
+    <PortletPortletCategory portalPortletId="listrequestlist" portletCategoryId="LIST_REQUEST"/>
+    
+    <PortletPortletCategory portalPortletId="ListInvoices" portletCategoryId="LIST_CUSTOMER"/>
+    <PortletPortletCategory portalPortletId="ListCustRequests" portletCategoryId="LIST_CUSTOMER"/>
+    <PortletPortletCategory portalPortletId="ListCustRequestsComp" portletCategoryId="LIST_CUSTOMER"/>
+    <PortletPortletCategory portalPortletId="ListPartyCommEvents" portletCategoryId="LIST_CUSTOMER"/>
+    <PortletPortletCategory portalPortletId="ListProjects" portletCategoryId="LIST_CUSTOMER"/>
+    
     <WebSite webSiteId="MYPORTAL" siteName="My Portal" visualThemeSetId="BACKOFFICE" />
     
 </entity-engine-xml>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml Sun Feb 22 08:16:32 2009
@@ -29,7 +29,7 @@
     
     <request-map uri="main">
         <security https="true" auth="true"/>
-        <response name="success" type="request-redirect-noparam" value="showPortalPage"/>
+        <response name="success" type="view" value="main"/>
     </request-map>
     <request-map uri="newRegisterLogin">
         <security https="true" auth="false"/>

Modified: ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml?rev=746646&r1=746645&r2=746646&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml Sun Feb 22 08:16:32 2009
@@ -146,11 +146,7 @@
     <screen name="main">
         <section>
             <widgets>
-                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">
-                        <include-screen name="showPortalPageInclude" location="component://common/widget/PortalPageScreens.xml"/>
-                    </decorator-section>
-                </decorator-screen>
+                <include-screen name="showPortalPage" location="component://common/widget/PortalPageScreens.xml"/>
             </widgets>
         </section>
     </screen>