svn commit: r1178344 - in /ofbiz/trunk: applications/accounting/webapp/accounting/WEB-INF/ applications/accounting/widget/ applications/party/webapp/partymgr/WEB-INF/actions/party/ applications/party/webapp/partymgr/party/ specialpurpose/ecommerce/weba...

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

svn commit: r1178344 - in /ofbiz/trunk: applications/accounting/webapp/accounting/WEB-INF/ applications/accounting/widget/ applications/party/webapp/partymgr/WEB-INF/actions/party/ applications/party/webapp/partymgr/party/ specialpurpose/ecommerce/weba...

hansbak-2
Author: hansbak
Date: Mon Oct  3 09:04:58 2011
New Revision: 1178344

URL: http://svn.apache.org/viewvc?rev=1178344&view=rev
Log:
add paging to the shopping list, contribution of tukkata

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/party/editShoppingList.ftl
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl
    ofbiz/trunk/specialpurpose/ecommerce/widget/ShoppingListScreens.xml

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon Oct  3 09:04:58 2011
@@ -219,7 +219,7 @@ under the License.
     </request-map>
     <request-map uri="updateInvoiceApplication">
         <security https="true" auth="true"/>
-        <event type="service" invoke="updatePaymentApplicationDef"/>
+        <event type="service" invoke="addPaymentApplication"/>
         <response name="success" type="view" value="editInvoiceApplications"/>
         <response name="error" type="view" value="editInvoiceApplications"/>
     </request-map>

Modified: ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentForms.xml?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentForms.xml Mon Oct  3 09:04:58 2011
@@ -288,7 +288,6 @@ under the License.
                 </sub-hyperlink>
             </display-entity>
         </field>
-        <field name="invoiceItemSeqId"><display/></field>
         <field name="amountApplied"><display/></field>
         <!-- TODO: this is commented out because updating (instead of removing and recreating) payment application can cause wrong gl postings.
         <field name="updateButton" widget-style="buttontext"><submit button-type="text-link"/></field>

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy Mon Oct  3 09:04:58 2011
@@ -99,6 +99,24 @@ if (shoppingListId) {
                 shoppingListItemDatas.add(shoppingListItemData);
             }
             context.shoppingListItemDatas = shoppingListItemDatas;
+            // pagination for the shopping list
+            viewIndex = Integer.valueOf(parameters.VIEW_INDEX  ?: 0);
+            viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: 20);
+            listSize = 0;
+            if (shoppingListItemDatas)
+                listSize = shoppingListItemDatas.size();
+            
+            lowIndex = viewIndex * viewSize + 1;
+            highIndex = (viewIndex + 1) * viewSize;
+            
+            if (highIndex > listSize) {
+                highIndex = listSize;
+            }
+            context.viewIndex = viewIndex;
+            context.viewSize = viewSize;
+            context.listSize = listSize;
+            context.lowIndex = lowIndex;
+            context.highIndex = highIndex;
         }
 
         shoppingListType = shoppingList.getRelatedOne("ShoppingListType");

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/editShoppingList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/editShoppingList.ftl?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/editShoppingList.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/editShoppingList.ftl Mon Oct  3 09:04:58 2011
@@ -169,6 +169,16 @@ under the License.
   </div>
   <div class="screenlet-body">
     <#if shoppingListItemDatas?has_content>
+        <#-- Pagination -->
+        <#include "component://common/webcommon/includes/htmlTemplate.ftl"/>
+        <#assign commonUrl = "editShoppingList?partyId=" + partyId + "&"/>
+        <#assign viewIndexFirst = 0/>
+        <#assign viewIndexPrevious = viewIndex - 1/>
+        <#assign viewIndexNext = viewIndex + 1/>
+        <#assign viewIndexLast = Static["java.lang.Math"].floor(listSize/viewSize)/>
+        <#assign messageMap = Static["org.ofbiz.base.util.UtilMisc"].toMap("lowCount", lowIndex, "highCount", highIndex, "total", listSize)/>
+        <#assign commonDisplaying = Static["org.ofbiz.base.util.UtilProperties"].getMessage("CommonUiLabels", "CommonDisplaying", messageMap, locale)/>
+        <@nextPrev commonUrl=commonUrl ajaxEnabled=false javaScriptEnabled=false paginateStyle="nav-pager" paginateFirstStyle="nav-first" viewIndex=viewIndex highIndex=highIndex listSize=listSize viewSize=viewSize ajaxFirstUrl="" firstUrl="" paginateFirstLabel="" paginatePreviousStyle="nav-previous" ajaxPreviousUrl="" previousUrl="" paginatePreviousLabel="" pageLabel="" ajaxSelectUrl="" selectUrl="" ajaxSelectSizeUrl="" selectSizeUrl="" commonDisplaying=commonDisplaying paginateNextStyle="nav-next" ajaxNextUrl="" nextUrl="" paginateNextLabel="" paginateLastStyle="nav-last" ajaxLastUrl="" lastUrl="" paginateLastLabel="" paginateViewSizeLabel="" />
       <table class="basic-table" cellspacing="0">
         <tr class="header-row">
           <td>${uiLabelMap.PartyProduct}</td>
@@ -179,7 +189,7 @@ under the License.
           <td>&nbsp;</td>
         </tr>
         <#assign alt_row = false>
-        <#list shoppingListItemDatas as shoppingListItemData>
+        <#list shoppingListItemDatas[lowIndex..highIndex-1] as shoppingListItemData>
           <#assign shoppingListItem = shoppingListItemData.shoppingListItem>
           <#assign product = shoppingListItemData.product>
           <#assign productContentWrapper = Static["org.ofbiz.product.product.ProductContentWrapper"].makeProductContentWrapper(product, request)>

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy Mon Oct  3 09:04:58 2011
@@ -58,6 +58,7 @@ context.shoppingListTypes = shoppingList
 // get the shoppingListId for this reqest
 parameterMap = UtilHttp.getParameterMap(request);
 shoppingListId = parameterMap.shoppingListId ?: request.getAttribute("shoppingListId") ?: session.getAttribute("currentShoppingListId");
+context.shoppingListId = shoppingListId;
 
 // no passed shopping list id default to first list
 if (!shoppingListId) {
@@ -135,6 +136,23 @@ if (shoppingListId) {
                 shoppingListItemDatas.add(shoppingListItemData);
             }
             context.shoppingListItemDatas = shoppingListItemDatas;
+            // pagination for the shopping list
+            viewIndex = Integer.valueOf(parameters.VIEW_INDEX  ?: 1);
+            viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: 20);
+            listSize = 0;
+            if (shoppingListItemDatas)
+                listSize = shoppingListItemDatas.size();
+            
+            lowIndex = (((viewIndex - 1) * viewSize) + 1);
+            highIndex = viewIndex * viewSize;
+            if (highIndex > listSize) {
+                highIndex = listSize;
+            }
+            context.viewIndex = viewIndex;
+            context.viewSize = viewSize;
+            context.listSize = listSize;
+            context.lowIndex = lowIndex;
+            context.highIndex = highIndex;
         }
 
         shoppingListType = shoppingList.getRelatedOne("ShoppingListType");

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Mon Oct  3 09:04:58 2011
@@ -1982,6 +1982,23 @@ under the License.
         <response name="error" type="view" value="error"/>
     </request-map>
 
+     <request-map uri="showShoppingList">
+        <security https="false" auth="false"/>
+        <response name="success" type="view" value="showShoppingList" save-current-view="true"/>
+    </request-map>
+        <request-map uri="showShoppingListSecure">
+        <security https="true" auth="false"/>
+        <response name="success" type="view" value="showShoppingList" save-current-view="true"/>
+    </request-map>
+    <request-map uri="showShoppingListAjaxFired">
+        <security https="false" auth="false"/>
+        <response name="success" type="view" value="showShoppingList" save-current-view="true"/>
+    </request-map>
+    <request-map uri="showShoppingListAjaxFiredSecure">
+        <security https="true" auth="false"/>
+        <response name="success" type="view" value="showShoppingList" save-current-view="true"/>
+    </request-map>
+    
     <!-- End of Request Mappings -->
 
     <!-- View Mappings -->
@@ -2137,6 +2154,9 @@ under the License.
     
     <!-- Product Category 's Ajax -->
     <view-map name="productCategoryList" type="screen" page="component://ecommerce/widget/CatalogScreens.xml#productCategoryList"/>
-
+    
+    <!-- Shopping List 's Ajax -->
+    <view-map name="showShoppingList" type="screen" page="component://ecommerce/widget/ShoppingListScreens.xml#showShoppingList"/>
+    
     <!-- End of View Mappings -->
 </site-conf>

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl Mon Oct  3 09:04:58 2011
@@ -30,8 +30,54 @@ under the License.
        }
        jQuery(obj).submit();
     }
+    
+    function callDocumentByPaginate(info) {
+        var str = info.split('~');
+        var checkUrl = '<@ofbizUrl>showShoppingListAjaxFired</@ofbizUrl>';
+        if(checkUrl.search("http"))
+            var ajaxUrl = '<@ofbizUrl>showShoppingListAjaxFired</@ofbizUrl>';
+        else
+            var ajaxUrl = '<@ofbizUrl>showShoppingListAjaxFiredSecure</@ofbizUrl>';
+        //jQuerry Ajax Request
+        jQuery.ajax({
+            url: ajaxUrl,
+            type: 'POST',
+            data: {"shoppingListId" : str[0], "VIEW_SIZE" : str[1], "VIEW_INDEX" : str[2]},
+            error: function(msg) {
+                alert("An error occured loading content! : " + msg);
+            },
+            success: function(msg) {
+                jQuery('#div3').html(msg);
+            }
+        });
+     }
 </script>
 <br />
+<#macro paginationControls>
+    <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
+      <#if (viewIndexMax?int > 0)>
+        <div class="product-prevnext">
+            <#-- Start Page Select Drop-Down -->
+            <select name="pageSelect" onchange="callDocumentByPaginate(this[this.selectedIndex].value);">
+                <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
+                <#list 0..viewIndexMax as curViewNum>
+                     <option value="${shoppingListId?if_exists}~${viewSize}~${curViewNum?int + 1}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
+                </#list>
+            </select>
+            <#-- End Page Select Drop-Down -->
+            <#if (viewIndex?int > 1)>
+                <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int - 1}');" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+            </#if>
+            <#if ((listSize?int - viewSize?int) > 0)>
+                <span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
+            </#if>
+            <#if highIndex?int < listSize?int>
+             | <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int + 1}');" class="buttontext">${uiLabelMap.CommonNext}</a>
+            </#if>
+        </div>
+    </#if>
+</#macro>
+
 <div class="screenlet">
         <div class="boxlink">
             <a href="<@ofbizUrl>createEmptyShoppingList?productStoreId=${productStoreId}</@ofbizUrl>" class="submenutextright">${uiLabelMap.CommonCreateNew}</a>
@@ -375,6 +421,8 @@ under the License.
     </div>
     <div class="screenlet-body">
         <#if shoppingListItemDatas?has_content>
+            <#-- Pagination -->
+            <@paginationControls/>
             <table width="100%" cellspacing="0" cellpadding="1" border="0">
               <tr>
                 <td><div class="tabletext"><b>${uiLabelMap.OrderProduct}</b></div></td>
@@ -385,7 +433,7 @@ under the License.
                 <td>&nbsp;</td>
               </tr>
 
-              <#list shoppingListItemDatas as shoppingListItemData>
+              <#list shoppingListItemDatas[lowIndex..highIndex-1] as shoppingListItemData>
                 <#assign shoppingListItem = shoppingListItemData.shoppingListItem/>
                 <#assign product = shoppingListItemData.product/>
                 <#assign productContentWrapper = Static["org.ofbiz.product.product.ProductContentWrapper"].makeProductContentWrapper(product, request)/>

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/ShoppingListScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/ShoppingListScreens.xml?rev=1178344&r1=1178343&r2=1178344&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/ShoppingListScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/ShoppingListScreens.xml Mon Oct  3 09:04:58 2011
@@ -40,4 +40,69 @@ under the License.
             </widgets>
         </section>
     </screen>
+    
+    <screen name="showShoppingList">
+        <section>
+            <condition>
+                <if-empty field="parameters.mainSubmited"/>
+            </condition>
+            <actions>
+                <property-map resource="EcommerceUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
+                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy"/>
+                <set field="check" type="PlainString" value="${groovy: return request.getAttribute('checkValue');}"/>
+                <set field="visualThemeId" from-field="productStore.visualThemeId" default-value="EC_DEFAULT"/>
+                <service service-name="getVisualThemeResources">
+                    <field-map field-name="visualThemeId"/>
+                    <field-map field-name="themeResources" from-field="layoutSettings"/>
+                </service>
+                <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/>
+            </actions>
+            <widgets>
+                <section>
+                    <condition>
+                        <if-compare operator="equals" value="check" field="check" type="PlainString"/>
+                    </condition>
+                    <widgets>
+                        <label text="11111111111111111111111111"></label>
+                        <include-screen name="editShoppingList"/>
+                    </widgets>
+                    <fail-widgets>
+                        <label text="444444444444444444444444444"></label>
+<!--                        <include-screen name="category-include" share-scope="true"/>-->
+                        <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl"/></html></platform-specific>
+                    </fail-widgets>
+                </section>
+            </widgets>
+            <fail-widgets>
+                <section>
+                   <widgets>
+                   <label text="555555555555"></label>
+                        <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl"/></html></platform-specific>
+                   </widgets>
+                </section>
+            </fail-widgets>
+        </section>
+    </screen>
+    
+<!--    <screen name="editShoppingList">-->
+<!--        <section>-->
+<!--            <actions>-->
+<!--                <set field="rightbarScreenName" value="rightbar"/>-->
+<!--                <set field="MainColumnStyle" value="rightonly"/>-->
+<!---->
+<!--                <set field="titleProperty" value="PageTitleShoppingList"/>-->
+<!--                <set field="headerItem" value="Shopping List"/>-->
+<!--                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy"/>-->
+<!--            </actions>-->
+<!--            <widgets>-->
+<!--                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">-->
+<!--                    <decorator-section name="body">-->
+<!--                        <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl"/></html></platform-specific>-->
+<!--                    </decorator-section>-->
+<!--                </decorator-screen>-->
+<!--            </widgets>-->
+<!--        </section>-->
+<!--    </screen>-->
 </screens>