svn commit: r1163511 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java webapp/partymgr/party/findparty.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1163511 - in /ofbiz/trunk/applications/party: servicedef/services_view.xml src/org/ofbiz/party/party/PartyServices.java webapp/partymgr/party/findparty.ftl

hansbak-2
Author: hansbak
Date: Wed Aug 31 07:16:41 2011
New Revision: 1163511

URL: http://svn.apache.org/viewvc?rev=1163511&view=rev
Log:
add sortable add/mod date to the party find list

Modified:
    ofbiz/trunk/applications/party/servicedef/services_view.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
    ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl

Modified: ofbiz/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services_view.xml?rev=1163511&r1=1163510&r2=1163511&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services_view.xml Wed Aug 31 07:16:41 2011
@@ -54,6 +54,7 @@ under the License.
         <attribute name="softIdentifier" type="String" mode="IN" optional="true"/> <!-- does a LIKE compare on this -->
         <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="ownerPartyIds" type="List" mode="IN" optional="true"/><!-- Lead Owners Parties -->
+        <attribute name="sortField" type="String" mode="IN" optional="true"/>
 
         <attribute name="roleTypes" type="List" mode="OUT" optional="false"/>
         <attribute name="partyTypes" type="List" mode="OUT" optional="false"/>
@@ -67,6 +68,7 @@ under the License.
         <attribute name="paramList" type="String" mode="OUT" optional="false"/>
         <attribute name="highIndex" type="Integer" mode="OUT" optional="false"/>
         <attribute name="lowIndex" type="Integer" mode="OUT" optional="false"/>
+        <attribute name="sortField" type="String" mode="OUT" optional="true"/>
     </service>
 
     <service name="getPartyContactMechValueMaps" engine="java"

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=1163511&r1=1163510&r2=1163511&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Wed Aug 31 07:16:41 2011
@@ -1113,6 +1113,8 @@ public class PartyServices {
             dynamicView.addAlias("PT", "partyId");
             dynamicView.addAlias("PT", "statusId");
             dynamicView.addAlias("PT", "partyTypeId");
+            dynamicView.addAlias("PT", "createdDate");
+            dynamicView.addAlias("PT", "lastModifiedDate");
             dynamicView.addRelation("one-nofk", "", "PartyType", ModelKeyMap.makeKeyMapList("partyTypeId"));
             dynamicView.addRelation("many", "", "UserLogin", ModelKeyMap.makeKeyMapList("partyId"));
 
@@ -1126,6 +1128,8 @@ public class PartyServices {
             fieldsToSelect.add("partyId");
             fieldsToSelect.add("statusId");
             fieldsToSelect.add("partyTypeId");
+            fieldsToSelect.add("createdDate");
+            fieldsToSelect.add("lastModifiedDate");
 
             // filter on parties that have relationship with logged in user
             String partyRelationshipTypeId = (String) context.get("partyRelationshipTypeId");
@@ -1433,6 +1437,11 @@ public class PartyServices {
 
             Debug.logInfo("In findParty mainCond=" + mainCond, module);
 
+            String sortField = (String) context.get("sortField");
+            if(UtilValidate.isNotEmpty(sortField)){
+                orderBy.add(sortField);
+            }
+            
             // do the lookup
             if (mainCond != null || "Y".equals(showAll)) {
                 try {

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl?rev=1163511&r1=1163510&r2=1163511&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/findparty.ftl Wed Aug 31 07:16:41 2011
@@ -20,6 +20,7 @@ under the License.
 <#assign inventoryItemId = parameters.inventoryItemId?default("")>
 <#assign serialNumber = parameters.serialNumber?default("")>
 <#assign softIdentifier = parameters.softIdentifier?default("")>
+<#assign sortField = parameters.sortField?if_exists/>
 <#-- Only allow the search fields to be hidden when we have some results -->
 <#if partyList?has_content>
   <#assign hideFields = parameters.hideFields?default("N")>
@@ -40,9 +41,9 @@ under the License.
 <#if partyList?has_content>
     <ul>
   <#if hideFields == "Y">
-      <li class="collapsed"><a href="<@ofbizUrl>findparty?hideFields=N${paramList}</@ofbizUrl>" title="${uiLabelMap.CommonShowLookupFields}">&nbsp;</a></li>
+      <li class="collapsed"><a href="<@ofbizUrl>findparty?hideFields=N&sortField=${sortField?if_exists}${paramList}</@ofbizUrl>" title="${uiLabelMap.CommonShowLookupFields}">&nbsp;</a></li>
   <#else>
-      <li class="expanded"><a href="<@ofbizUrl>findparty?hideFields=Y${paramList}</@ofbizUrl>" title="${uiLabelMap.CommonHideFields}">&nbsp;</a></li>
+      <li class="expanded"><a href="<@ofbizUrl>findparty?hideFields=Y&sortField=${sortField?if_exists}${paramList}</@ofbizUrl>" title="${uiLabelMap.CommonHideFields}">&nbsp;</a></li>
   </#if>
     </ul>
     <br class="clear"/>
@@ -208,7 +209,7 @@ under the License.
   <#if partyList?has_content>
     <#-- Pagination -->
     <#include "component://common/webcommon/includes/htmlTemplate.ftl"/>
-    <#assign commonUrl = "findparty?hideFields=" + hideFields + paramList + "&"/>
+    <#assign commonUrl = "findparty?hideFields=" + hideFields + paramList + "&sortField=" + sortField?if_exists + "&"/>
     <#assign viewIndexFirst = 0/>
     <#assign viewIndexPrevious = viewIndex - 1/>
     <#assign viewIndexNext = viewIndex + 1/>
@@ -242,6 +243,16 @@ under the License.
         <td>${uiLabelMap.PartyRelatedCompany}</td>
         <td>${uiLabelMap.PartyType}</td>
         <td>${uiLabelMap.PartyMainRole}</td>
+        <td>
+            <a href="<@ofbizUrl>findparty</@ofbizUrl>?<#if sortField?has_content><#if sortField == "createdDate">sortField=-createdDate<#elseif sortField == "-createdDate">sortField=createdDate<#else>sortField=createdDate</#if><#else>sortField=createdDate</#if>${paramList?if_exists}&VIEW_SIZE=${viewSize?if_exists}&VIEW_INDEX=${viewIndex?if_exists}"
+                <#if sortField?has_content><#if sortField == "createdDate">class="sort-order-desc"<#elseif sortField == "-createdDate">class="sort-order-asc"<#else>class="sort-order"</#if><#else>class="sort-order"</#if>>${uiLabelMap.FormFieldTitle_createdDate}
+            </a>
+        </td>
+        <td>
+            <a href="<@ofbizUrl>findparty</@ofbizUrl>?<#if sortField?has_content><#if sortField == "lastModifiedDate">sortField=-lastModifiedDate<#elseif sortField == "-lastModifiedDate">sortField=lastModifiedDate<#else>sortField=lastModifiedDate</#if><#else>sortField=lastModifiedDate</#if>${paramList?if_exists}&VIEW_SIZE=${viewSize?if_exists}&VIEW_INDEX=${viewIndex?if_exists}"
+                <#if sortField?has_content><#if sortField == "lastModifiedDate">class="sort-order-desc"<#elseif sortField == "-lastModifiedDate">class="sort-order-asc"<#else>class="sort-order"</#if><#else>class="sort-order"</#if>>${uiLabelMap.FormFieldTitle_lastModifiedDate}
+            </a>
+        </td>
         <td>&nbsp;</td>
       </tr>
     <#assign alt_row = false>
@@ -321,6 +332,9 @@ under the License.
       <#assign mainRole = dispatcher.runSync("getPartyMainRole", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", partyRow.partyId, "userLogin", userLogin))/>
               ${mainRole.description?if_exists}
         </td>
+        <#assign partyDate = delegator.findOne("Party", {"partyId":partyRow.partyId}, true)/>
+        <td>${partyDate.createdDate?if_exists}</td>
+        <td>${partyDate.lastModifiedDate?if_exists}</td>
         <td class="button-col align-float">
           <a href="<@ofbizUrl>viewprofile?partyId=${partyRow.partyId}</@ofbizUrl>">${uiLabelMap.CommonDetails}</a>
       <#if security.hasRolePermission("ORDERMGR", "_VIEW", "", "", session)>