details:   /erp/devel/pi/rev/72d116beea06
changeset: 9470:72d116beea06
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Dec 30 11:10:50 2010 +0100
summary:   Postthroughhiddenform now removes previous inputs

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
 |  109 ++++-----
 1 files changed, 52 insertions(+), 57 deletions(-)

diffs (157 lines):

diff -r 16facd58f737 -r 72d116beea06 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Thu Dec 30 10:22:03 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Thu Dec 30 11:10:50 2010 +0100
@@ -38,7 +38,7 @@
       windowId: data.windowId
     };
     OB.Layout.ViewManager.openView(openObject.viewId, openObject);
-  }
+  };
   
   var reqObj = {
     params: {
@@ -777,8 +777,8 @@
 // * {{{requestProperties}}}: original requestProperties.
 // Return:
 // * Original requestProperties including the new module and tab properties.
-OB.Utilities._getTabInfoRequestProperties = function (theView, 
requestProperties){
-  if (theView && theView.tabId){
+OB.Utilities._getTabInfoRequestProperties = function(theView, 
requestProperties){
+  if (theView && theView.tabId) {
     var tabParam = {
       params: {
         tabId: theView.tabId,
@@ -794,41 +794,40 @@
   return requestProperties;
 };
 
-OB.Utilities.openActionButton = function (button, o){
-       var theView = button.parentElement.parentElement.view;
-       var selectedRecord = theView.viewGrid.getSelectedRecord();
-       
-       if (!selectedRecord) {
-               isc.warn('No record selected');
-               return;
-       }
-       
-       
-       var allProperties = {}, sessionProperties={};
-       var theView = button.parentElement.parentElement.view;
-       
-       theView.getContextInfo(allProperties, sessionProperties);
-       
-       
-       for (param in allProperties){
-               if (allProperties.hasOwnProperty(param)){
-                       o.command += '&'+param+'='+allProperties[param];
-               }
-       }
-       
-       theView.setContextInfo(sessionProperties, function(){
-               OB.Layout.ViewManager.openView("OBPopupClassicWindow", o)
-       });
-       
-       
-//     OB.Layout.ViewManager.openView("OBPopupClassicWindow", o);
-       //OB.Layout.ViewManager.openView("OBClassicPopup", o);
-       
-       
-       //button.parentElement.parentElement.view.getContextInfo()
+OB.Utilities.openActionButton = function(button, o){
+  var theView = button.parentElement.parentElement.view;
+  var selectedRecord = theView.viewGrid.getSelectedRecord();
+  
+  if (!selectedRecord) {
+    isc.warn('No record selected');
+    return;
+  }
+  
+  
+  var allProperties = {}, sessionProperties = {};
+  
+  theView.getContextInfo(allProperties, sessionProperties);
+  
+  
+  for (var param in allProperties) {
+    if (allProperties.hasOwnProperty(param)) {
+      o.command += '&' + param + '=' + allProperties[param];
+    }
+  }
+  
+  theView.setContextInfo(sessionProperties, function(){
+    OB.Layout.ViewManager.openView("OBPopupClassicWindow", o);
+  });
+  
+  
+  //  OB.Layout.ViewManager.openView("OBPopupClassicWindow", o);
+  //OB.Layout.ViewManager.openView("OBClassicPopup", o);
+
+
+  //button.parentElement.parentElement.view.getContextInfo()
 };
 
-OB.Utilities.openActionButtonCallback = function (button, o){
+OB.Utilities.openActionButtonCallback = function(button, o){
   var theView = button.parentElement.parentElement.view;
   var selectedRecord = theView.viewGrid.getSelectedRecord();
   
@@ -840,18 +839,13 @@
   var allProperties = {}, sessionProperties = {};
   var params = theView.getContextInfo(allProperties, sessionProperties);
   
-  
-  for (param in params){
-    if (params.hasOwnProperty(param)){
-      o.command += '&'+param+'='+params[param];
+  for (var param in params) {
+    if (params.hasOwnProperty(param)) {
+      o.command += '&' + param + '=' + params[param];
     }
   }
   
   OB.Layout.ViewManager.openView("OBPopupClassicWindow", o);
-  //OB.Layout.ViewManager.openView("OBClassicPopup", o);
-  
-  
-  //button.parentElement.parentElement.view.getContextInfo()
 };
 
 
@@ -864,23 +858,24 @@
 // * {{{url}}}: the url to post the request.
 // * {{{data}}}: the data to include in the request.
 
-OB.Utilities.postThroughHiddenForm = function(url, data) {
+OB.Utilities.postThroughHiddenForm = function(url, data){
   OB.GlobalHiddenForm.setAttribute('action', url);
   
-//  for (var child in OB.GlobalHiddenForm.children) {
-//    OB.GlobalHiddenForm.removeChild(child);
-//  }
+  // remove all children, needs to be done like this as the 
+  // children array is getting updated while removing a child  
+  while (OB.GlobalHiddenForm.children[0]) {
+    OB.GlobalHiddenForm.removeChild(OB.GlobalHiddenForm.children[0]);
+  }
   
   for (var key in data) {
-    var field = document.createElement('input');
-    field.setAttribute('type', 'hidden');
-    field.setAttribute('name', key);
-    field.setAttribute('value', data[key]);
-    
-    OB.GlobalHiddenForm.appendChild(field);
+    if (data.hasOwnProperty(key)) {
+      var field = document.createElement('input');
+      field.setAttribute('type', 'hidden');
+      field.setAttribute('name', key);
+      field.setAttribute('value', data[key]);
+      OB.GlobalHiddenForm.appendChild(field);
+    }
   }
   
   OB.GlobalHiddenForm.submit();
-}
-
-
+};

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to