details: /erp/devel/pi/rev/9fa593e5a9f8
changeset: 10154:9fa593e5a9f8
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Jan 27 09:19:01 2011 +0100
summary: [process] openProcessPopup allows sending POST
details: /erp/devel/pi/rev/33fdbb4a6853
changeset: 10155:33fdbb4a6853
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Jan 27 09:34:32 2011 +0100
summary: [process] Custom button processes can be executed in popup through
preference
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
| 1 +
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
| 18 +++++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
| 28 +++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
| 32 +++++++--
4 files changed, 66 insertions(+), 13 deletions(-)
diffs (180 lines):
diff -r 73632b7eb431 -r 33fdbb4a6853
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
Wed Jan 26 18:24:48 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl
Thu Jan 27 09:34:32 2011 +0100
@@ -60,6 +60,7 @@
command: '${field.command?js_string}',
property: '${field.propertyName?js_string}',
autosave: ${field.autosave?string},
+ <#if !field.modal>modal: ${field.modal?string},</#if>
labelValue: {<#list field.labelValues as value>
'${value.value?js_string}': '${value.label?js_string}'<#if
value_has_next>,</#if>
</#list>
diff -r 73632b7eb431 -r 33fdbb4a6853
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 26 18:24:48 2011 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
Thu Jan 27 09:34:32 2011 +0100
@@ -36,7 +36,9 @@
import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBDal;
import org.openbravo.data.Sqlc;
+import org.openbravo.erpCommon.businessUtility.Preferences;
import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.utility.PropertyException;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.model.ad.datamodel.Column;
import org.openbravo.model.ad.domain.ModelImplementation;
@@ -390,6 +392,7 @@
private String showIf = "";
private String readOnlyIf = "";
private boolean sessionLogic = false;
+ private boolean modal = true;
public ButtonField(Field fld) {
id = fld.getId();
@@ -424,6 +427,17 @@
url = manualProcessMapping;
command = "DEFAULT";
}
+
+ // Show in modal by default unless preference to prevent it is set
+ try {
+ modal = "Y".equals(Preferences.getPreferenceValue("ModalProcess" +
process.getId(),
+ false, OBContext.getOBContext().getCurrentClient(),
OBContext.getOBContext()
+ .getCurrentOrganization(),
OBContext.getOBContext().getUser(), OBContext
+ .getOBContext().getRole(), null));
+ } catch (PropertyException e) {
+ // If not found or conflict, the process is modal
+ modal = true;
+ }
} else {
String colName = column.getDBColumnName();
if ("Posted".equalsIgnoreCase(colName) ||
"CreateFrom".equalsIgnoreCase(colName)) {
@@ -515,6 +529,10 @@
return readOnlyIf;
}
+ public boolean isModal() {
+ return modal;
+ }
+
public class Value {
private String value;
private String labelValue;
diff -r 73632b7eb431 -r 33fdbb4a6853
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 26 18:24:48 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
Thu Jan 27 09:34:32 2011 +0100
@@ -24,6 +24,7 @@
isc.OBToolbarActionButton.addProperties( {
visible: false,
+ modal: true,
action : function() {
this.runProcess();
@@ -52,7 +53,7 @@
var allProperties = theView.getContextInfo(false, true);
var sessionProperties = theView.getContextInfo(true, true);
- var me = this;
+ var me = this, callbackFunction;
OB.ActionButton.executingProcess = this;
@@ -64,11 +65,28 @@
allProperties[param] = allProperties[param]?'Y':'N';
}
}
- allProperties.Command = this.command;
+
+ if (this.modal){
+ allProperties.Command = this.command;
+ callbackFunction = function(){
+ OB.Layout.ClassicOBCompatibility.Popup.open('process', 625, 450,
OB.Application.contextUrl + me.obManualURL, '', null, false, false, true,
allProperties);
+ };
+ } else {
+ var popupParams = {
+ viewId: 'OBPopupClassicWindow',
+ obManualURL: this.obManualURL,
+ processId: this.id,
+ id: this.id,
+ command: this.command,
+ tabTitle: this.title,
+ postParams: allProperties
+ };
+ callbackFunction = function(){
+ OB.Layout.ViewManager.openView('OBPopupClassicWindow', popupParams);
+ };
+ }
- theView.setContextInfo(sessionProperties, function() {
- OB.Layout.ClassicOBCompatibility.Popup.open('process', 625, 450,
OB.Application.contextUrl + me.obManualURL, '', null, false, false, true,
allProperties);
- });
+ theView.setContextInfo(sessionProperties, callbackFunction);
},
closeProcessPopup: function(newWindow) {
diff -r 73632b7eb431 -r 33fdbb4a6853
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
Wed Jan 26 18:24:48 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
Thu Jan 27 09:34:32 2011 +0100
@@ -30,9 +30,6 @@
if (OB.Utilities.hasUrlParameter('mode', 'classic')) {
return true;
}
- if (OB.WindowDefinitions[windowId] &&
OB.WindowDefinitions[windowId].showInClassicMode) {
- return true;
- }
var propValue = OB.PropertyStore.get('OBUIAPP_UseClassicMode', windowId);
if (propValue === 'Y') {
return true;
@@ -137,8 +134,11 @@
// Parameters:
// * {{{url}}}: the url of the html page to open
// * {{{noFrameSet}}}: if true then the page is opened directly without a
+// * {{{postParams}}}: if this object is set and noFrameSet is not true, main
Framset send
+// properties of this object to url as POST, other case a
GET to url is
+// performed
// frameset
-OB.Utilities.openProcessPopup = function(/* String */url, noFrameSet){
+OB.Utilities.openProcessPopup = function(/* String */url, noFrameSet,
postParams){
var height = 450;
var width = 625;
var top = (screen.height - height) / 2;
@@ -158,19 +158,35 @@
winPopUp = window.open(url, 'PROCESS', adds);
} else {
winPopUp = window.open('', 'PROCESS', adds);
- var html = '<html>' +
+ var mainFrameSrc = !postParams?('src="' + url + '"'):'',
+ html = '<html>' +
'<frameset cols="0%,100%" frameborder="no" border="0" framespacing="0"
rows="*" id="framesetMenu">' +
'<frame name="frameMenu" scrolling="no" src="' +
OB.Application.contextUrl +
'utility/VerticalMenu.html?Command=LOADING"
id="paramFrameMenuLoading"></FRAME>' +
- '<frame name="mainframe" noresize="" src="' +
- url +
- '" id="fieldProcessId"></frame>' +
+ '<frame name="mainframe" noresize="" '+ mainFrameSrc +
+ ' id="fieldProcessId"></frame>' +
'<frame name="hiddenFrame" scrolling="no" noresize="" src=""></frame>' +
'</frameset>' +
'</html>';
winPopUp.document.write(html);
+ if (postParams) {
+ var frm = winPopUp.document.createElement('form');
+ frm.setAttribute('method','post');
+ frm.setAttribute('action', url);
+ for (var i in postParams) {
+ if (postParams.hasOwnProperty(i)){
+ var inp = winPopUp.document.createElement('input');
+ inp.setAttribute('type', 'hidden');
+ inp.setAttribute('name', i);
+ inp.setAttribute('value', postParams[i]);
+ frm.appendChild(inp);
+ }
+ }
+ winPopUp.document.body.appendChild(frm);
+ frm.submit();
+ }
winPopUp.document.close();
}
winPopUp.focus();
------------------------------------------------------------------------------
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