details:   /erp/devel/pi/rev/93900d2948d0
changeset: 9712:93900d2948d0
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 10:06:45 2011 +0100
summary:   [process] Call manual processes

details:   /erp/devel/pi/rev/f30ccf1588fe
changeset: 9713:f30ccf1588fe
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 11:23:49 2011 +0100
summary:   [process] Treat as button fields with button ref and list subref

details:   /erp/devel/pi/rev/ea8590035944
changeset: 9714:ea8590035944
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 11:59:01 2011 +0100
summary:   [process] Posted special case

details:   /erp/devel/pi/rev/663a22eb462e
changeset: 9715:663a22eb462e
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 12:24:40 2011 +0100
summary:   [process] Fixed getContextInfo for non session properties

details:   /erp/devel/pi/rev/d7cb83cb7c4d
changeset: 9716:d7cb83cb7c4d
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 12:46:02 2011 +0100
summary:   [process] Do not generate process for hidden fields as in WAD

details:   /erp/devel/pi/rev/dc9f76135c8a
changeset: 9717:dc9f76135c8a
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 15:52:11 2011 +0100
summary:   [process] UI definition for buttons is YesNo

details:   /erp/devel/pi/rev/ef12d6594f83
changeset: 9718:ef12d6594f83
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 11 15:54:31 2011 +0100
summary:   [process] Transform booleans into 'Y':'N' to send to processes

details:   /erp/devel/pi/rev/a1bb1aca4d5b
changeset: 9719:a1bb1aca4d5b
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Jan 12 08:59:05 2011 +0100
summary:   [process] Support for opening a new window when closing popup

details:   /erp/devel/pi/rev/32745c709ee4
changeset: 9720:32745c709ee4
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Jan 12 08:59:24 2011 +0100
summary:   [process] Open new window when closing popup

details:   /erp/devel/pi/rev/fbb6c793ac39
changeset: 9721:fbb6c793ac39
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Jan 12 09:24:45 2011 +0100
summary:   [process] Opening classic window, replace ? with & in manual url

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
           |  17 ++-
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
 |   4 +-
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
 |   8 +-
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
           |  57 +++++++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
          |  30 ++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-window.js
         |  13 +-
 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
                       |   2 +-
 src/org/openbravo/base/secureApp/PopUp_Response.html                           
                               |   3 +-
 8 files changed, 106 insertions(+), 28 deletions(-)

diffs (truncated from 315 to 300 lines):

diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
       Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java
       Wed Jan 12 09:24:45 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) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,7 +21,6 @@
 import java.util.Collections;
 import java.util.List;
 
-
 import org.apache.log4j.Logger;
 import org.hibernate.criterion.Expression;
 import org.openbravo.dal.core.OBContext;
@@ -31,6 +30,7 @@
 import org.openbravo.model.ad.access.RoleOrganization;
 import org.openbravo.model.ad.access.User;
 import org.openbravo.model.ad.access.UserRoles;
+import org.openbravo.model.ad.ui.Field;
 
 /**
  * Utility class for common operations
@@ -91,4 +91,17 @@
     }
     return Collections.emptyList();
   }
+
+  /**
+   * Checks whether the reference of a field is button.
+   * 
+   * Caution: this check is done by checking hardcoded reference ID 28.
+   * 
+   * @param field
+   *          Field to check
+   * @return true in case it is button, false if not
+   */
+  public static boolean isUIButton(Field field) {
+    return "28".equals(field.getColumn().getReference().getId());
+  }
 }
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Wed Jan 12 09:24:45 2011 +0100
@@ -25,8 +25,8 @@
 
 import org.apache.log4j.Logger;
 import org.openbravo.base.model.Property;
-import org.openbravo.base.model.domaintype.ButtonDomainType;
 import org.openbravo.base.model.domaintype.ForeignKeyDomainType;
+import org.openbravo.client.application.ApplicationUtils;
 import org.openbravo.client.kernel.BaseTemplateComponent;
 import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.client.kernel.Template;
@@ -87,7 +87,7 @@
       final Property property = 
KernelUtils.getInstance().getPropertyFromColumn(field.getColumn());
 
       // a button domain type, continue for now
-      if (property.getDomainType() instanceof ButtonDomainType) {
+      if (ApplicationUtils.isUIButton(field)) {
         continue;
       }
 
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
     Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
     Wed Jan 12 09:24:45 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) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -24,7 +24,7 @@
 import java.util.List;
 
 import org.openbravo.base.model.Property;
-import org.openbravo.base.model.domaintype.ButtonDomainType;
+import org.openbravo.client.application.ApplicationUtils;
 import org.openbravo.client.kernel.BaseTemplateComponent;
 import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.client.kernel.Template;
@@ -108,7 +108,7 @@
         if (!fld.isDisplayed()) {
           continue;
         }
-        if (prop.getDomainType() instanceof ButtonDomainType) {
+        if (ApplicationUtils.isUIButton(fld)) {
           continue;
         }
         // these are currently also ignored
@@ -132,7 +132,7 @@
         if (!fld.isDisplayed()) {
           continue;
         }
-        if (prop.getDomainType() instanceof ButtonDomainType) {
+        if (ApplicationUtils.isUIButton(fld)) {
           continue;
         }
         fields.add(createLocalField(fld, prop, false));
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Wed Jan 12 09:24:45 2011 +0100
@@ -25,7 +25,7 @@
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
-import org.openbravo.base.model.domaintype.ButtonDomainType;
+import org.openbravo.client.application.ApplicationUtils;
 import 
org.openbravo.client.application.window.OBViewFormComponent.FormFieldComparator;
 import org.openbravo.client.kernel.BaseTemplateComponent;
 import org.openbravo.client.kernel.KernelUtils;
@@ -36,7 +36,10 @@
 import org.openbravo.data.Sqlc;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.datamodel.Column;
+import org.openbravo.model.ad.domain.ModelImplementation;
+import org.openbravo.model.ad.domain.ModelImplementationMapping;
 import org.openbravo.model.ad.ui.Field;
+import org.openbravo.model.ad.ui.Process;
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.ad.ui.TabTrl;
 import org.openbravo.utils.FormatUtilities;
@@ -77,19 +80,11 @@
     final List<Field> adFields = new ArrayList<Field>(tab.getADFieldList());
     Collections.sort(adFields, new FormFieldComparator());
     for (Field fld : adFields) {
-      if (fld.isActive()) {
-        final Property prop = 
KernelUtils.getInstance().getPropertyFromColumn(fld.getColumn());
-        if (!(prop.getDomainType() instanceof ButtonDomainType)) {
+      if (fld.isActive() && fld.isDisplayed()) {
+        if (!(ApplicationUtils.isUIButton(fld))) {
           continue;
         }
-        final ButtonField buttonField = new ButtonField();
-        buttonField.setId(fld.getId());
-        buttonField.setLabel(OBViewUtil.getLabel(fld));
-        buttonField.setUrl(Utility.getTabURL(fld.getTab().getId(), "E", 
false));
-        buttonField.setCommand("BUTTON"
-            + FormatUtilities.replace(fld.getColumn().getDBColumnName())
-            + fld.getColumn().getProcess().getId());
-        buttonFields.add(buttonField);
+        buttonFields.add(new ButtonField(fld));
       }
     }
     return buttonFields;
@@ -251,6 +246,44 @@
     private String label;
     private String url;
 
+    public ButtonField(Field fld) {
+      id = fld.getId();
+      label = OBViewUtil.getLabel(fld);
+
+      // Define command
+      Column column = fld.getColumn();
+      Process process = column.getProcess();
+      if (process != null) {
+        String manualProcessMapping = null;
+        for (ModelImplementation impl : 
process.getADModelImplementationList()) {
+          if (impl.isDefault()) {
+            for (ModelImplementationMapping mapping : 
impl.getADModelImplementationMappingList()) {
+              if (mapping.isDefault()) {
+                manualProcessMapping = mapping.getMappingName();
+                break;
+              }
+            }
+            break;
+          }
+        }
+
+        if (manualProcessMapping == null) {
+          // Standard UI process
+          url = Utility.getTabURL(fld.getTab().getId(), "E", false);
+          command = "BUTTON" + 
FormatUtilities.replace(column.getDBColumnName())
+              + column.getProcess().getId();
+        } else {
+          url = manualProcessMapping;
+          command = "DEFAULT";
+        }
+      } else {
+        if ("Posted".equals(column.getDBColumnName()) && column.getProcess() 
== null) {
+          command = "BUTTONPosted";
+          url = Utility.getTabURL(fld.getTab().getId(), "E", false);
+        }
+      }
+    }
+
     public String getUrl() {
       return url;
     }
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
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
      Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
      Wed Jan 12 09:24:45 2011 +0100
@@ -19,7 +19,7 @@
 
 OB.ActionButton = {};
 
-OB.ActionButton.closeProcessPopup = function(msg) {
+OB.ActionButton.closeProcessPopup = function(msg, newWindow) {
   if (msg && msg.text && OB.ActionButton.calledFromView) {
     var msgType;
     switch (msg.type) {
@@ -40,6 +40,26 @@
   }
 
   OB.ActionButton.calledFromView = null;
+  
+  if (newWindow) {
+    if (newWindow.indexOf(location.origin) !== -1){
+      newWindow = newWindow.substr(location.origin.length);
+    }
+    
+    if (newWindow.startsWith(OB.Application.contextUrl)){
+      newWindow = newWindow.substr(OB.Application.contextUrl.length);
+    }
+    
+    if (!newWindow.startsWith('/')){
+      newWindow = '/'+newWindow;
+    }
+    
+    var popupParams = {
+        viewId : 'OBPopupClassicWindow',
+        obManualURL : newWindow  
+      };
+    OB.Layout.ViewManager.openView('OBClassicWindow', popupParams);
+  }
 }
 
 isc.ClassFactory.defineClass('OBToolbarActionButton', isc.OBToolbarTextButton);
@@ -73,7 +93,13 @@
 
     for ( var param in allProperties) {
       if (allProperties.hasOwnProperty(param)) {
-        popupParams.command += '&' + param + '=' + allProperties[param];
+        var value = allProperties[param];
+        
+        if (typeof value === 'boolean') {
+          value = value?'Y':'N';
+        }
+        
+        popupParams.command += '&' + param + '=' + value;
       }
     }
 
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-window.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-window.js
     Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-classic-window.js
     Wed Jan 12 09:24:45 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) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -107,10 +107,15 @@
       this.recordId +
       '&noprefs=true&Command=DIRECT&hideMenu=true';
     } else if (this.obManualURL && this.obManualURL !== '') {
+      this.obManualURL = this.obManualURL.replace('?', '&');
+      
       this.contentsURL = this.appURL + urlCharacter + 'url=' + 
this.obManualURL +
-      '&noprefs=true&Command=' +
-      this.command +
-      '&hideMenu=true';
+      '&noprefs=true&hideMenu=true';
+      
+      if (this.obManualURL.indexOf('Command=') === -1) {
+        // Add command in case it is not already set in the obManualURL
+        this.contentsURL = this.contentsURL + '&Command=' + this.command; 
+      }
     } else {
       this.contentsURL = this.appURL + urlCharacter + 'Command=' + 
this.command +
       '&noprefs=true';
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
--- 
a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
   Wed Jan 12 00:24:50 2011 +0100
+++ 
b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
   Wed Jan 12 09:24:45 2011 +0100
@@ -256,7 +256,7 @@
 <!--BEB18F60FD5945D2A157F85D8AC8D63F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--BEB18F60FD5945D2A157F85D8AC8D63F-->  
<AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--BEB18F60FD5945D2A157F85D8AC8D63F-->  
<AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
-<!--BEB18F60FD5945D2A157F85D8AC8D63F-->  
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.StringUIDefinition]]></CLASSNAME>
+<!--BEB18F60FD5945D2A157F85D8AC8D63F-->  
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.YesNoUIDefinition]]></CLASSNAME>
 <!--BEB18F60FD5945D2A157F85D8AC8D63F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--BEB18F60FD5945D2A157F85D8AC8D63F--></OBCLKER_UIDEFINITION>
 
diff -r 5ab9cc6ba158 -r fbb6c793ac39 
src/org/openbravo/base/secureApp/PopUp_Response.html
--- a/src/org/openbravo/base/secureApp/PopUp_Response.html      Wed Jan 12 
00:24:50 2011 +0100
+++ b/src/org/openbravo/base/secureApp/PopUp_Response.html      Wed Jan 12 
09:24:45 2011 +0100
@@ -24,6 +24,7 @@
 }

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
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