svn commit: r613381 - in /ofbiz/trunk/framework: common/config/CommonUiLabels.properties webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh webtools/webapp/webtools/entity/FindGeneric.ftl

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

svn commit: r613381 - in /ofbiz/trunk/framework: common/config/CommonUiLabels.properties webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh webtools/webapp/webtools/entity/FindGeneric.ftl

jleroux@apache.org
Author: jleroux
Date: Sat Jan 19 02:08:02 2008
New Revision: 613381

URL: http://svn.apache.org/viewvc?rev=613381&view=rev
Log:
A refactored (FindGeneric.bsh) patch from Ratnesh Upadhya <<Display "First" and "Last" View for Entity Data Maintenance in WebTools.>> (https://issues.apache.org/jira/browse/OFBIZ-1582) - OFBIZ-1582

Modified:
    ofbiz/trunk/framework/common/config/CommonUiLabels.properties
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.ftl

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.properties?rev=613381&r1=613380&r2=613381&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.properties (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.properties Sat Jan 19 02:08:02 2008
@@ -167,6 +167,7 @@
 CommonFind=Find
 CommonFindAll=Find All
 CommonFinishDate=Finish Date/Time
+CommonFirst=First
 CommonFollowingErrorsOccurred=The Following Errors Occurred
 CommonFollowingOccurred=The Following Occurred
 CommonFor=For
@@ -223,6 +224,7 @@
 CommonJune=June
 CommonLanguageTitle=Language
 CommonLarge=Large
+CommonLast=Last
 CommonLastUpdated=Last Updated
 CommonLine=Line
 CommonLink=Link

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh?rev=613381&r1=613380&r2=613381&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.bsh Sat Jan 19 02:08:02 2008
@@ -80,32 +80,24 @@
 curFindString = UtilFormatOut.encodeQuery(curFindString);
 context.put("curFindString", curFindString);
 
-String viewIndexString = (String)parameters.get("VIEW_INDEX");
-if (viewIndexString == null || viewIndexString.length() == 0) {
-    viewIndexString = "0";
-}
-
-int viewIndex = 0;
 try {
-    viewIndex = Integer.valueOf(viewIndexString).intValue();
+    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue();
 } catch (NumberFormatException nfe) {
     viewIndex = 0;
 }
+
+int viewIndexFirst = 0;
+context.put("viewIndexFirst",viewIndexFirst);
 context.put("viewIndex", viewIndex);
 context.put("viewIndexPrevious", viewIndex-1);
 context.put("viewIndexNext", viewIndex+1);
 
-String viewSizeString = (String)parameters.get("VIEW_SIZE");
-if (viewSizeString == null || viewSizeString.length() == 0) {
-    viewSizeString = "10";
-}
-
-int viewSize = 10;
 try {
-    viewSize = Integer.valueOf(viewSizeString).intValue();
+    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
 } catch (NumberFormatException nfe) {
     viewSize = 10;
 }
+
 context.put("viewSize", viewSize);
 
 int lowIndex = viewIndex*viewSize+1;
@@ -167,6 +159,13 @@
 context.put("highIndex", highIndex);
 context.put("arraySize", arraySize);
 context.put("resultPartialList", resultPartialList);
+viewIndexLast = arraySize/viewSize;
+if (arraySize%2 != 0)
+   {
+      context.put("viewIndexLast",viewIndexLast);      
+   }else{
+        context.put("viewIndexLast",viewIndexLast-1);        
+   }
 
 List fieldList = FastList.newInstance();
 for (int fnum = 0; fnum < modelEntity.getFieldsSize(); fnum++) {

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.ftl?rev=613381&r1=613380&r2=613381&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/FindGeneric.ftl Sat Jan 19 02:08:02 2008
@@ -67,7 +67,9 @@
 <#macro tableNav>
     <div class="button-bar">
         <ul>
-            <#if (viewIndex > 0)>
+            <#if (viewIndex > 0)>
+                <li><a href='<@ofbizUrl>FindGeneric?${curFindString}&amp;VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndexFirst}</@ofbizUrl>' class="nav-next">${uiLabelMap.CommonFirst}</a></li>
+                <li>|</li>
                 <li><a href='<@ofbizUrl>FindGeneric?${curFindString}&amp;VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndexPrevious}</@ofbizUrl>' class="nav-previous">${uiLabelMap.CommonPrevious}</a></li>
                 <li>|</li>
             </#if>
@@ -77,6 +79,8 @@
             <#if (arraySize > highIndex)>
                 <li>|</li>
                 <li><a href='<@ofbizUrl>FindGeneric?${curFindString}&amp;VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndexNext}</@ofbizUrl>' class="nav-next">${uiLabelMap.CommonNext}</a></li>
+                <li>|</li>                
+                <li><a href='<@ofbizUrl>FindGeneric?${curFindString}&amp;VIEW_SIZE=${viewSize}&amp;VIEW_INDEX=${viewIndexLast}</@ofbizUrl>' class="nav-next">${uiLabelMap.CommonLast}</a></li>
             </#if>
         </ul>
         <br class="clear"/>