details:   /erp/devel/pi/rev/20bd2f77ec89
changeset: 10102:20bd2f77ec89
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 15:44:39 2011 +0100
summary:   [process] Close popup when calling it in modal window

details:   /erp/devel/pi/rev/7666ee29fddd
changeset: 10103:7666ee29fddd
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 16:39:45 2011 +0100
summary:   [process] Allow POST when opening modal popups

details:   /erp/devel/pi/rev/c67f8af5b71b
changeset: 10104:c67f8af5b71b
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 16:47:06 2011 +0100
summary:   [process] Call process in modal popup

details:   /erp/devel/pi/rev/e612bfe5d41d
changeset: 10105:e612bfe5d41d
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 17:38:38 2011 +0100
summary:   [process] Call process in modal popup

details:   /erp/devel/pi/rev/c57d1b29b3c3
changeset: 10106:c57d1b29b3c3
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 17:40:05 2011 +0100
summary:   [process] Fixed doc action process to work on modal

details:   /erp/devel/pi/rev/81eaa81faa30
changeset: 10107:81eaa81faa30
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 18:01:06 2011 +0100
summary:   [process] Make post modal popup work on FF

details:   /erp/devel/pi/rev/7478341bfa2b
changeset: 10108:7478341bfa2b
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Jan 24 18:09:24 2011 +0100
summary:   [process] Generate process can be closed in modal popup

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
         |  25 ++-----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-compatibility.js
 |  30 ++++++++-
 src-wad/src/org/openbravo/wad/Template_ActionButton.html                       
                              |   6 +-
 src/org/openbravo/base/secureApp/PopUp_Response.html                           
                              |  13 +++-
 src/org/openbravo/erpCommon/ad_actionButton/DocAction.html                     
                              |   6 +-
 5 files changed, 48 insertions(+), 32 deletions(-)

diffs (190 lines):

diff -r b8c227ba3b24 -r 7478341bfa2b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
      Mon Jan 24 17:57:12 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
      Mon Jan 24 18:09:24 2011 +0100
@@ -49,34 +49,25 @@
   
   doAction: function(){
     var theView = this.view;
-    var popupParams = {
-      viewId : 'OBPopupClassicWindow',
-      obManualURL : this.obManualURL, 
-      processId : this.id,
-      id : this.id,
-      command : this.command,
-      tabTitle : this.title
-    };
 
     var allProperties = theView.getContextInfo(false, true);
     var sessionProperties = theView.getContextInfo(true, true);
+    var me = this;
 
     OB.ActionButton.executingProcess = this;
 
     for ( var param in allProperties) {
-      if (allProperties.hasOwnProperty(param)) {
-        var value = allProperties[param];
-        
-        if (typeof value === 'boolean') {
-          value = value?'Y':'N';
-        }
-        
-        popupParams.command += '&' + param + '=' + value;
+      // TODO: these transformations shoulnd't be needed here as soon as 
getContextInfo returns 
+      // the transformed values.
+      
+      if (allProperties.hasOwnProperty(param) && typeof allProperties[param] 
=== 'boolean') {
+        allProperties[param] = allProperties[param]?'Y':'N';
       }
     }
+    allProperties.Command = this.command;
 
     theView.setContextInfo(sessionProperties, function() {
-      OB.Layout.ViewManager.openView('OBPopupClassicWindow', popupParams);
+      OB.Layout.ClassicOBCompatibility.Popup.open('process', 625, 450,  
OB.Application.contextUrl + me.obManualURL, '', null, false, false, true, 
allProperties);
     });
   },
   
diff -r b8c227ba3b24 -r 7478341bfa2b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-compatibility.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-compatibility.js
      Mon Jan 24 17:57:12 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-compatibility.js
      Mon Jan 24 18:09:24 2011 +0100
@@ -349,8 +349,9 @@
       // * {{{url}}} type: String - the url to be opened in the popup
       // * {{{title}}} type: String - the title to be displayed in the popup
       // * {{{theOpener}}} type: Window Object - the window object of the 
opener
+      // * {{{postParams}}} type: Object - parameters to be sent to the url 
using POST instead of GET
       // of the popup. Used in window.open to allow IE know which is the opener
-      open: function(name, width, height, url, title, theOpener, 
showMinimizeControl, showMaximizeControl, showCloseControl){
+      open: function(name, width, height, url, title, theOpener, 
showMinimizeControl, showMaximizeControl, showCloseControl, postParams){
         if (showMinimizeControl !== false) {
           showMinimizeControl = true;
         }
@@ -375,7 +376,7 @@
           popupURL: url
         });
         cPopup.show();
-        cobcomp.Popup.postOpen(cPopup, theOpener);
+        cobcomp.Popup.postOpen(cPopup, theOpener, postParams);
       },
       
       // ** {{{ Popup.postOpen(cPopup) }}} **
@@ -384,7 +385,9 @@
       //
       // Parameters:
       // * {{{cPopup}}} type: Canvas - the drawn popup
-      postOpen: function(cPopup){
+      // * {{{theOpener}}} type: Window Object - the window object of the 
opener
+      // * {{{postParams}}} type: Object - parameters to be sent to the url 
using POST instead of GET
+      postOpen: function(cPopup, theOpener, postParams){
         if (!cPopup.isFramesetDraw) {
           
cPopup.getIframeHtmlObj().contentWindow.document.write(cPopup.htmlCode);
           cPopup.isFramesetDraw = true;
@@ -411,7 +414,26 @@
         var wName = cPopup.ID;
         wName = wName.substring(0, wName.lastIndexOf(cobcomp.Popup.secString) 
- 1);
         if (!cPopup.areParamsSet) {
-          cPopup.getIframeHtmlObj().contentWindow.frames[0].location.href = 
cPopup.popupURL;
+          if (!postParams) {
+            cPopup.getIframeHtmlObj().contentWindow.frames[0].location.href = 
cPopup.popupURL;
+          } else {
+            // Create a form and POST parameters as input hidden values
+            var doc = 
cPopup.getIframeHtmlObj().contentWindow.frames[0].document,
+                frm = doc.createElement('form');
+            frm.setAttribute('method','post');
+            frm.setAttribute('action', cPopup.popupURL);
+            for (var i in postParams) {
+              if (postParams.hasOwnProperty(i)){
+                var inp = doc.createElement('input');
+                inp.setAttribute('type', 'hidden');
+                inp.setAttribute('name', i);
+                inp.setAttribute('value', postParams[i]);
+                frm.appendChild(inp);
+              }
+            }
+            doc.body.appendChild(frm);
+            frm.submit();
+          }
           cPopup.getIframeHtmlObj().contentWindow.frames[0].name = wName;
           
cPopup.getIframeHtmlObj().contentWindow.document.getElementById('MDIPopupContainer').name
 = wName;
           cPopup.areParamsSet = true;
diff -r b8c227ba3b24 -r 7478341bfa2b 
src-wad/src/org/openbravo/wad/Template_ActionButton.html
--- a/src-wad/src/org/openbravo/wad/Template_ActionButton.html  Mon Jan 24 
17:57:12 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Template_ActionButton.html  Mon Jan 24 
18:09:24 2011 +0100
@@ -79,10 +79,6 @@
   return true;
 }
 
-function closeThisPage() {
-       parent.parent.window.close();
-       return true;
-}
 </script>
        <script language="JavaScript" type="text/javascript">
        function onLoadDo(){
@@ -328,7 +324,7 @@
                 <button type="button" 
                   id="buttonCancel" 
                   class="ButtonLink" 
-                  onclick="closeThisPage();return false;" 
+                  onclick="closePage();return false;" 
                   onfocus="buttonEvent('onfocus', this); window.status='xx'; 
return true;" 
                   onblur="buttonEvent('onblur', this);" 
                   onkeyup="buttonEvent('onkeyup', this);" 
diff -r b8c227ba3b24 -r 7478341bfa2b 
src/org/openbravo/base/secureApp/PopUp_Response.html
--- a/src/org/openbravo/base/secureApp/PopUp_Response.html      Mon Jan 24 
17:57:12 2011 +0100
+++ b/src/org/openbravo/base/secureApp/PopUp_Response.html      Mon Jan 24 
18:09:24 2011 +0100
@@ -25,15 +25,22 @@
 
 function submitThisPage(ref) {
     
-  if (top.opener.submitCommandForm) {
+  if (top && top.opener && top.opener.submitCommandForm) {
     top.opener.submitCommandForm("DEFAULT", false, null, ref, '_self');
   } else {
-       var process = top.opener.OB.ActionButton.executingProcess;
+    
+    var process;
+    if (getFrame('LayoutMDI')) {
+      process = getFrame('LayoutMDI').OB.ActionButton.executingProcess;
+    } else if (top && top.opener) {
+      process = top.opener.OB.ActionButton.executingProcess;
+    }
+     
     if (process) {
       process.closeProcessPopup(ref);
     }
   }
-  top.close();
+  closePage();
   return true;
 }
 </script>
diff -r b8c227ba3b24 -r 7478341bfa2b 
src/org/openbravo/erpCommon/ad_actionButton/DocAction.html
--- a/src/org/openbravo/erpCommon/ad_actionButton/DocAction.html        Mon Jan 
24 17:57:12 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_actionButton/DocAction.html        Mon Jan 
24 18:09:24 2011 +0100
@@ -11,7 +11,7 @@
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
-* All portions are Copyright (C) 2001-2010 Openbravo SLU 
+* All portions are Copyright (C) 2001-2011 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -55,7 +55,7 @@
       }
 
       function closeThisPage() {
-        parent.window.close();
+        closePage();
         return true;
       }
 
@@ -65,7 +65,7 @@
       function submitThisPage(strCommand) {
         if (validate()){
           setProcessingMode('popup', true);
-          submitCommandForm(strCommand, false, null, null, '_top');
+          submitCommandForm(strCommand, false, null, null);
         }
         return true;
       }

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to