details: https://code.openbravo.com/erp/devel/pi/rev/fe6c4992e9bc
changeset: 15112:fe6c4992e9bc
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Jan 11 11:07:29 2012 +0100
summary: Fixes issue 19422: Grid personalization not stored
Form and grid changes are persisted even if no view is saved. These form/grid
settings act as defaults in case there is no default view.
This is only done in case of professional edition.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
| 43 +++------
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
| 31 +++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
| 14 +-
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
| 13 +++
4 files changed, 59 insertions(+), 42 deletions(-)
diffs (192 lines):
diff -r 52ebfa05a090 -r fe6c4992e9bc
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Wed Jan 11 10:06:46 2012 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Wed Jan 11 11:07:29 2012 +0100
@@ -283,11 +283,14 @@
var ret = this.Super('initWidget', arguments);
- vwState =
this.view.standardWindow.getDefaultGridViewState(this.view.tabId);
- if (vwState) {
- this.setViewState(vwState);
+ // only personalize if there is a professional license
+ if (!OB.Utilities.checkProfessionalLicense(null, true)) {
+ vwState =
this.view.standardWindow.getDefaultGridViewState(this.view.tabId);
+ if (vwState) {
+ this.setViewState(vwState);
+ }
}
-
+
this.noDataEmptyMessage = '<span class="OBGridNotificationText">' +
OB.I18N.getLabel('OBUISC_ListGrid.loadingDataMessage') + '</span>'; //
OB.I18N.getLabel('OBUIAPP_GridNoRecords')
this.filterNoRecordsEmptyMessage = '<span class="OBGridNotificationText">'
+ OB.I18N.getLabel('OBUIAPP_GridFilterNoResults') + '</span>' +
'<span onclick="window[\'' +
@@ -425,8 +428,14 @@
return ret;
},
+ viewStateChanged: function() {
+ if (OB.Utilities.checkProfessionalLicense(null, true)) {
+ this.view.standardWindow.storeViewState();
+ }
+ },
+
// also store the filter criteria
- getViewState : function (returnObject, includeFilter) {
+ getViewState: function (returnObject, includeFilter) {
var state = this.Super('getViewState', [returnObject || true]);
if (includeFilter) {
@@ -2467,30 +2476,6 @@
isEditLinkColumn: function(colNum){
return this.editLinkColNum === colNum;
- },
-
- reorderField: function(fieldNum, moveToPosition){
- var res = this.Super('reorderField', arguments);
- this.view.standardWindow.storeViewState();
- return res;
- },
-
- hideField: function(field, suppressRelayout){
- var res = this.Super('hideField', arguments);
- this.view.standardWindow.storeViewState();
- return res;
- },
-
- showField: function(field, suppressRelayout){
- var res = this.Super('showField', arguments);
- this.view.standardWindow.storeViewState();
- return res;
- },
-
- resizeField: function(fieldNum, newWidth, storeWidth){
- var res = this.Super('resizeField', arguments);
- this.view.standardWindow.storeViewState();
- return res;
}
});
diff -r 52ebfa05a090 -r fe6c4992e9bc
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
Wed Jan 11 10:06:46 2012 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
Wed Jan 11 11:07:29 2012 +0100
@@ -213,6 +213,11 @@
setPersonalization: function(personalization) {
var i, defaultView, persDefaultValue, views, length, me = this;
+ // only personalize if there is a professional license
+ if (!OB.Utilities.checkProfessionalLicense(null, true)) {
+ return;
+ }
+
// cache the original view so that it can be restored
if (!this.getClass().originalView) {
this.getClass().originalView = {};
@@ -255,6 +260,17 @@
// maybe do this in a separate thread
if (defaultView) {
OB.Personalization.applyViewDefinition(defaultView.personalizationId,
defaultView.viewDefinition, this);
+ } else {
+ // check the default form and grid viewstates
+ length = this.views.length;
+ for (i = 0; i < length; i++) {
+ if (personalization.forms &&
personalization.forms[this.views[i].tabId]) {
+
OB.Personalization.personalizeForm(personalization.forms[this.views[i].tabId],
this.views[i].viewForm);
+ }
+ if (this.viewState && this.viewState[this.views[i].tabId]) {
+
this.views[i].viewGrid.setViewState(this.viewState[this.views[i].tabId]);
+ }
+ }
}
this.getClass().personalization.views.sort(function(v1, v2) {
@@ -273,12 +289,8 @@
var views, length, i, personalization = this.getClass().personalization,
defaultView,
persDefaultValue = OB.PropertyStore.get('OBUIAPP_DefaultSavedView',
this.windowId);
-
- if (!personalization) {
- return null;
- }
- if (personalization.views) {
+ if (personalization && personalization.views) {
views = personalization.views;
length = views.length;
if (persDefaultValue) {
@@ -304,6 +316,10 @@
return defaultView.viewDefinition[tabId].grid;
}
+ if (this.viewState && this.viewState[tabId]) {
+ return this.viewState[tabId];
+ }
+
return null;
},
@@ -783,10 +799,11 @@
storeViewState: function(){
var result = {}, i, length = this.views.length;
for (i = 0; i < length; i++) {
- if(this.views[i].viewGrid){
- result[this.views[i].tabId]=this.views[i].viewGrid.getViewState();
+ if ( this.views[i].viewGrid ) {
+ result[this.views[i].tabId] = this.views[i].viewGrid.getViewState();
}
}
+ this.viewState = result;
OB.PropertyStore.set('OBUIAPP_GridConfiguration', result, this.windowId);
}
});
diff -r 52ebfa05a090 -r fe6c4992e9bc
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
Wed Jan 11 10:06:46 2012 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
Wed Jan 11 11:07:29 2012 +0100
@@ -26,16 +26,18 @@
// (!= community). If the instance has a community instance then
// a popup message is shown and false is returned.
// The parameter can be used to add a custom message to the popup.
-OB.Utilities.checkProfessionalLicense = function(msg) {
+OB.Utilities.checkProfessionalLicense = function(msg, doNotShowMessage) {
if(OB.Application.licenseType === 'C') {
- if (!msg) {
- msg = '';
- }
- isc.warn(OB.I18N.getLabel('OBUIAPP_ActivateMessage', [msg]), {
+ if (!doNotShowMessage) {
+ if (!msg) {
+ msg = '';
+ }
+ isc.warn(OB.I18N.getLabel('OBUIAPP_ActivateMessage', [msg]), {
isModal: true,
showModalMask: true,
toolbarButtons: [isc.Dialog.OK]
- });
+ });
+ }
return false;
}
return true;
diff -r 52ebfa05a090 -r fe6c4992e9bc
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
---
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
Wed Jan 11 10:06:46 2012 +0100
+++
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
Wed Jan 11 11:07:29 2012 +0100
@@ -33,6 +33,19 @@
isc.DataSource.serializeTimeAsDatetime=true;
+isc.ListGrid.addProperties({
+ // overridden to prevent too aggressive viewstate change notifications
+ // Override handleSelectionChanged() to fire our viewStateChanged method
+ handleSelectionChanged : function (record,state) {
+ var returnVal = this.Super("handleSelectionChanged", arguments);
+ return returnVal;
+ },
+
+ handleSortChanged : function (sortSpecifiers) {
+ this.sortChanged(sortSpecifiers);
+ }
+});
+
isc.Canvas.addProperties({
// make sure that the datasources are also destroyed
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits