details: /erp/devel/pi/rev/8a04ae8885f8 changeset: 9987:8a04ae8885f8 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jan 20 14:56:51 2011 +0100 summary: Prevent npe in OBViewForm
details: /erp/devel/pi/rev/ad6181bd95a1 changeset: 9988:ad6181bd95a1 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jan 20 14:58:57 2011 +0100 summary: Enabled title on checkbox header and solved issue with truncate of tab title details: /erp/devel/pi/rev/6cb4d640e856 changeset: 9989:6cb4d640e856 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jan 20 14:59:10 2011 +0100 summary: Solved extra comma in generated code details: /erp/devel/pi/rev/d7b8cfd21f41 changeset: 9990:d7b8cfd21f41 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jan 20 14:59:54 2011 +0100 summary: Merged heads diffstat: modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml | 11 +++ modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl | 10 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java | 18 +++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js | 36 ++++++++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js | 6 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js | 30 ++++++- 6 files changed, 85 insertions(+), 26 deletions(-) diffs (233 lines): diff -r 137c4a2cf12a -r d7b8cfd21f41 modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml Thu Jan 20 14:59:54 2011 +0100 @@ -827,4 +827,15 @@ <!--FF8081812DA32652012DA3559052006C--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> <!--FF8081812DA32652012DA3559052006C--></AD_MESSAGE> +<!--FF8081812DA37EE2012DA38E84E4000F--><AD_MESSAGE> +<!--FF8081812DA37EE2012DA38E84E4000F--> <AD_MESSAGE_ID><![CDATA[FF8081812DA37EE2012DA38E84E4000F]]></AD_MESSAGE_ID> +<!--FF8081812DA37EE2012DA38E84E4000F--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--FF8081812DA37EE2012DA38E84E4000F--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--FF8081812DA37EE2012DA38E84E4000F--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--FF8081812DA37EE2012DA38E84E4000F--> <VALUE><![CDATA[OBUIAPP_GridSelectAllColumnPrompt]]></VALUE> +<!--FF8081812DA37EE2012DA38E84E4000F--> <MSGTEXT><![CDATA[Click to (un)select all records]]></MSGTEXT> +<!--FF8081812DA37EE2012DA38E84E4000F--> <MSGTYPE><![CDATA[I]]></MSGTYPE> +<!--FF8081812DA37EE2012DA38E84E4000F--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> +<!--FF8081812DA37EE2012DA38E84E4000F--></AD_MESSAGE> + </data> diff -r 137c4a2cf12a -r d7b8cfd21f41 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 Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl Thu Jan 20 14:59:54 2011 +0100 @@ -63,20 +63,20 @@ labelValue: {<#list field.labelValues as value> '${value.value?js_string}': '${value.label?js_string}'<#if value_has_next>,</#if> </#list> - }, + } <#if field.showIf != ""> - displayIf: function(item, value, form, currentValues) { + , displayIf: function(item, value, form, currentValues) { currentValues = currentValues || form.view.getCurrentValues(); var context = form.view.getContextInfo(false, true); return context && (${field.showIf}); - }, + } </#if> <#if field.readOnlyIf != ""> - readOnlyIf: function(item, value, form, currentValues) { + , readOnlyIf: function(item, value, form, currentValues) { currentValues = currentValues || form.view.getCurrentValues(); var context = form.view.getContextInfo(false, true); return context && (${field.readOnlyIf}); - }, + } </#if> }<#if field_has_next>,</#if> </#list>], diff -r 137c4a2cf12a -r d7b8cfd21f41 modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java Thu Jan 20 14:59:54 2011 +0100 @@ -195,6 +195,8 @@ if (mode.equals("NEW") || mode.equals("EDIT")) { // We also include information related to validation dependencies // and we add the columns which have a callout + + final Map<String, String> sessionAttributesMap = new HashMap<String, String>(); for (Field field : tab.getADFieldList()) { if (field.getColumn().getCallout() != null) { final String columnName = "inp" @@ -210,20 +212,26 @@ final DynamicExpressionParser parser = new DynamicExpressionParser(field .getDisplayLogic(), tab); - if (parser.getSessionAttributes().size() > 0) { - final JSONObject sessionAttributes = new JSONObject(); - for (String attrName : parser.getSessionAttributes()) { + for (String attrName : parser.getSessionAttributes()) { + if (!sessionAttributesMap.containsKey(attrName)) { final String attrValue = Utility .getContext(new DalConnectionProvider(false), RequestContext.get() .getVariablesSecureApp(), attrName, tab.getWindow().getId()); - sessionAttributes.put(attrName.startsWith("#") ? attrName.replace("#", "_") + sessionAttributesMap.put(attrName.startsWith("#") ? attrName.replace("#", "_") : attrName, attrValue); } - finalObject.put("sessionAttributes", sessionAttributes); + } } } + + final JSONObject sessionAttributes = new JSONObject(); + for (String attr : sessionAttributesMap.keySet()) { + sessionAttributes.put(attr, sessionAttributesMap.get(attr)); + } + + finalObject.put("sessionAttributes", sessionAttributes); finalObject.put("dynamicCols", new JSONArray(changeEventCols)); } diff -r 137c4a2cf12a -r d7b8cfd21f41 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js Thu Jan 20 14:59:54 2011 +0100 @@ -1116,31 +1116,53 @@ this.originalTabTitle = this.tabTitle; } - var identifier, tab; + var identifier, tab, tabSet, title; // showing the form if (this.isShowingForm && this.viewGrid.getSelectedRecord() && this.viewGrid.getSelectedRecord()[OB.Constants.IDENTIFIER]) { identifier = this.viewGrid.getSelectedRecord()[OB.Constants.IDENTIFIER]; if (!this.parentTabSet && this.viewTabId) { tab = OB.MainView.TabSet.getTab(this.viewTabId); - OB.MainView.TabSet.setTabTitle(tab, prefix + this.originalTabTitle + ' - ' + identifier + suffix); + tabSet = OB.MainView.TabSet; + title = this.originalTabTitle + ' - ' + identifier; } else if (this.parentTabSet && this.tab) { - this.parentTabSet.setTabTitle(this.tab, prefix + this.originalTabTitle + ' - ' + identifier + suffix); + tab = this.tab; + tabSet = this.parentTabSet; + title = this.originalTabTitle + ' - ' + identifier; } } else if (!this.parentTabSet && this.viewTabId) { // the root view + tabSet = OB.MainView.TabSet; tab = OB.MainView.TabSet.getTab(this.viewTabId); - OB.MainView.TabSet.setTabTitle(tab, prefix + this.originalTabTitle + suffix); + title = this.originalTabTitle; } else if (this.parentTabSet && this.tab) { // the check on this.tab is required for the initialization phase // only show a count if there is one parent + tab = this.tab; + tabSet = this.parentTabSet; + if (this.parentView.viewGrid.getSelectedRecords().length !== 1) { - this.parentTabSet.setTabTitle(this.tab, prefix + this.originalTabTitle + suffix); + title = this.originalTabTitle; } else if (this.recordCount) { - this.parentTabSet.setTabTitle(this.tab, prefix + this.originalTabTitle + ' (' + this.recordCount + ')' + suffix); + title = this.originalTabTitle + ' (' + this.recordCount + ')'; } else { - this.parentTabSet.setTabTitle(this.tab, prefix + this.originalTabTitle + suffix); + title = this.originalTabTitle; } } + if (title) { + + // show a prompt with the title info + tab.prompt = title; + tab.showPrompt = true; + tab.hoverWidth = 150; + + if (title.length > 30) { + title = title.substring(0, 30) + "..."; + } + + // add the prefix/suffix here to prevent cutoff on that + title = prefix + title + suffix; + tabSet.setTabTitle(tab, title); + } }, isViewVisible: function(){ diff -r 137c4a2cf12a -r d7b8cfd21f41 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js Thu Jan 20 14:59:54 2011 +0100 @@ -259,7 +259,7 @@ } this.view.setToolBarButtonState(); this.view.toolBar.refreshCustomButtons(); - this.onFieldChanged(); + this.onFieldChanged(this); this.focus(); }, @@ -429,7 +429,9 @@ setAutoSaveFormInActiveView: function(form) { // the view of the form can be another than // the current active view - this.view.standardWindow.activeView.autoSaveForm = form; + if (this.view.standardWindow.activeView) { + this.view.standardWindow.activeView.autoSaveForm = form; + } }, setActionAfterAutoSave: function(action) { diff -r 137c4a2cf12a -r d7b8cfd21f41 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js Thu Jan 20 14:25:38 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js Thu Jan 20 14:59:54 2011 +0100 @@ -204,8 +204,7 @@ frozen: true, canFreeze: true, showHover: true, - prompt: OB.I18N.getLabel('OBUIAPP_GridSelectColumnPrompt'), - hoverHTML: OB.I18N.getLabel('OBUIAPP_GridSelectColumnPrompt'), + prompt: OB.I18N.getLabel('OBUIAPP_GridSelectAllColumnPrompt'), filterEditorProperties: { textAlign: 'center' }, @@ -215,6 +214,28 @@ this.Super('initWidget', arguments); }, + // overridden to support hover on the header for the checkbox field + setFieldProperties: function(field, properties) { + var localField = field; + if (isc.isA.Number(localField)) { + localField = this.fields[localField]; + } + if (this.isCheckboxField(localField) && properties) { + properties.showHover = true; + properties.prompt = OB.I18N.getLabel('OBUIAPP_GridSelectAllColumnPrompt'); + } + + return this.Super('setFieldProperties', arguments); + }, + + cellHoverHTML: function (record, rowNum, colNum) { + var field = this.getField(colNum); + if (this.isCheckboxField(field)) { + return OB.I18N.getLabel('OBUIAPP_GridSelectColumnPrompt'); + } + return this.Super('cellHoverHTML', arguments); + }, + show: function(){ var ret = this.Super('show', arguments); @@ -605,11 +626,6 @@ } }, - getCheckboxField: function() { - var ret = this.Super('getCheckboxField', arguments); - return ret; - }, - // note when solving selection issues in the future also // consider using the selectionChanged method, but that // one has as disadvantage that it is called multiple times ------------------------------------------------------------------------------ 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 Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits