Author: pranayp
Date: Sat Sep 17 10:32:21 2016
New Revision: 1761180

URL: http://svn.apache.org/viewvc?rev=1761180&view=rev
Log:
Improved: Order: Remove inline js for toggleAll, checkToggle and selectAll 
calling from ftls.
(OFBIZ-7896)

Remove inline js for toggleAll, checkToggle and selectAll calling from ftls in 
Order component instead, added class="selectAll" on parent checkbox element for 
select all functionality.

Thanks: Amardeep Singh Jhajj for the contribution.


Modified:
    ofbiz/trunk/applications/order/template/entry/cart/Javascript.ftl
    ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl
    ofbiz/trunk/applications/order/template/return/ReturnItemInc.ftl

Modified: ofbiz/trunk/applications/order/template/entry/cart/Javascript.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/cart/Javascript.ftl?rev=1761180&r1=1761179&r2=1761180&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/cart/Javascript.ftl (original)
+++ ofbiz/trunk/applications/order/template/entry/cart/Javascript.ftl Sat Sep 
17 10:32:21 2016
@@ -17,35 +17,6 @@ specific language governing permissions
 under the License.
 -->
 <script language="JavaScript" type="text/javascript">
-function toggle(e) {
-    e.checked = !e.checked;
-}
-function checkToggle(e) {
-    var cform = document.cartform;
-    if (e.checked) {
-        var len = cform.elements.length;
-        var allchecked = true;
-        for (var i = 0; i < len; i++) {
-            var element = cform.elements[i];
-            if (element.name == "selectedItem" && !element.checked) {
-                allchecked = false;
-            }
-            cform.selectAll.checked = allchecked;
-        }
-    } else {
-        cform.selectAll.checked = false;
-    }
-}
-function toggleAll() {
-    var cform = document.cartform;
-    var len = cform.elements.length;
-    for (var i = 0; i < len; i++) {
-        var e = cform.elements[i];
-        if (e.name == "selectedItem") {
-            toggle(e);
-        }
-    }
-}
 function removeSelected() {
     var cform = document.cartform;
     cform.removeSelected.value = true;

Modified: ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl?rev=1761180&r1=1761179&r2=1761180&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl 
(original)
+++ ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl Sat 
Sep 17 10:32:21 2016
@@ -63,7 +63,7 @@ under the License.
           <td 
align="right"><div><b>${uiLabelMap.CommonUnitPrice}</b></div></td>
           <td 
align="right"><div><b>${uiLabelMap.OrderAdjustments}</b></div></td>
           <td align="right"><div><b>${uiLabelMap.OrderItemTotal}</b></div></td>
-          <td align="center"><input type="checkbox" name="selectAll" value="0" 
onclick="javascript:toggleAll(this);" /></td>
+          <td align="center"><input type="checkbox" name="selectAll" value="0" 
class="selectAll"/></td>
         </tr>
 
         <#assign itemsFromList = false>
@@ -294,7 +294,7 @@ under the License.
             </td>
             <td nowrap="nowrap" align="right"><div><@ofbizCurrency 
amount=cartLine.getOtherAdjustments() isoCode=currencyUomId/></div></td>
             <td nowrap="nowrap" align="right"><div><@ofbizCurrency 
amount=cartLine.getDisplayItemSubTotal() isoCode=currencyUomId/></div></td>
-            <td nowrap="nowrap" align="center"><div><#if 
!cartLine.getIsPromo()><input type="checkbox" name="selectedItem" 
value="${cartLineIndex}" 
onclick="javascript:checkToggle(this);"/><#else>&nbsp;</#if></div></td>
+            <td nowrap="nowrap" align="center"><div><#if 
!cartLine.getIsPromo()><input type="checkbox" name="selectedItem" 
value="${cartLineIndex}"/><#else>&nbsp;</#if></div></td>
           </tr>
         </#list>
 

Modified: ofbiz/trunk/applications/order/template/return/ReturnItemInc.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/return/ReturnItemInc.ftl?rev=1761180&r1=1761179&r2=1761180&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/return/ReturnItemInc.ftl (original)
+++ ofbiz/trunk/applications/order/template/return/ReturnItemInc.ftl Sat Sep 17 
10:32:21 2016
@@ -21,7 +21,7 @@ under the License.
       <td colspan="7"><h3>${uiLabelMap.OrderReturnFromOrder} 
${uiLabelMap.CommonNbr}<a 
href="<@ofbizUrl>orderview?orderId=${orderId}</@ofbizUrl>" 
class="buttontext">${orderId}</a></h3></td>
       <td colspan="2" align="right">
         <label><span>${uiLabelMap.CommonSelectAll}</span>&nbsp;
-        <input type="checkbox" name="selectAll" value="Y" 
onclick="javascript:toggleAll(this, 
'${selectAllFormName}');highlightAllRows(this, 'returnItemId_tableRow_', 
'selectAllForm');"/></label>
+        <input type="checkbox" name="selectAll" value="Y" class="selectAll" 
onclick="highlightAllRows(this, 'returnItemId_tableRow_', 
'selectAllForm');"/></label>
       </td>
     </tr>
 
@@ -85,7 +85,7 @@ under the License.
               </td>
               <td></td>
               <td align="right">
-                <input type="checkbox" name="_rowSubmit_o_${rowCount}" 
value="Y" onclick="javascript:checkToggle(this, 
'${selectAllFormName}');highlightRow(this,'returnItemId_tableRow_${rowCount}');"/>
+                <input type="checkbox" name="_rowSubmit_o_${rowCount}" 
value="Y" onclick="highlightRow(this,'returnItemId_tableRow_${rowCount}');"/>
               </td>
             </tr>
         <#else>
@@ -155,7 +155,7 @@ under the License.
                 </select>
               </td>
               <td align="right">
-                <input type="checkbox" name="_rowSubmit_o_${rowCount}" 
value="Y" onclick="javascript:checkToggle(this, 
'${selectAllFormName}');highlightRow(this,'returnItemId_tableRow_${rowCount}');"/>
+                <input type="checkbox" name="_rowSubmit_o_${rowCount}" 
value="Y" onclick="highlightRow(this,'returnItemId_tableRow_${rowCount}');"/>
               </td>
             </tr>
         </#if>
@@ -201,7 +201,7 @@ under the License.
             </select>
           </td>
           <td align="right">
-            <input type="checkbox" name="_rowSubmit_o_${rowCount}" value="Y" 
onclick="javascript:checkToggle(this, '${selectAllFormName}');"/>
+            <input type="checkbox" name="_rowSubmit_o_${rowCount}" value="Y"/>
           </td>
         </tr>
         <#assign rowCount = rowCount + 1>
@@ -238,7 +238,7 @@ under the License.
         </select>
       </td>
       <td align="right">
-        <input type="checkbox" name="_rowSubmit_o_${rowCount}" value="Y" 
onclick="javascript:checkToggle(this, '${selectAllFormName}');"/>
+        <input type="checkbox" name="_rowSubmit_o_${rowCount}" value="Y"/>
       </td>
     </tr>
     <#assign rowCount = rowCount + 1>


Reply via email to