details: https://code.openbravo.com/erp/devel/pi/rev/f2eb38f962af changeset: 19124:f2eb38f962af user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Dec 27 08:24:46 2012 +0100 summary: Fixes issue 22235: OBMessageUtils asumes incorrectly that RequestContext is set Set variables secure app in RequestContext in case of running a process
details: https://code.openbravo.com/erp/devel/pi/rev/e8e0844b64a8 changeset: 19125:e8e0844b64a8 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Dec 27 08:25:53 2012 +0100 summary: Merging heads diffstat: .hgsigs | 1 + .hgtags | 1 + modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java | 4 + modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-calendar.js | 57 ++++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-style.js | 122 ++++++++++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js | 45 +++ modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css | 74 +++++- modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.js | 77 ++++++- modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/RequestContext.java | 15 +- src-test/org/openbravo/test/dal/IssuesTest.java | 48 +++ src/org/openbravo/service/db/DalBaseProcess.java | 3 + 11 files changed, 444 insertions(+), 3 deletions(-) diffs (truncated from 610 to 300 lines): diff -r 51ea214b67be -r e8e0844b64a8 .hgsigs --- a/.hgsigs Wed Dec 26 18:26:12 2012 +0100 +++ b/.hgsigs Thu Dec 27 08:25:53 2012 +0100 @@ -93,3 +93,4 @@ 3ded67251154d0aa958eacb918de97fd5a77e3dc 0 iEYEABECAAYFAlC3tuIACgkQCX/oGf+2qkO0zgCdFACe5suzHq8pukNoc8ghZJlvO6UAn3wzW4/wmIEfmngxthdtqRTrSQ2X bf495495c05c0e9414450e54d6da22ec685bd21a 0 iEYEABECAAYFAlDT6OkACgkQCX/oGf+2qkMqegCdEjWD+dHlIP66pL/adAL3iuBYXsUAoJvOAhmZbvUSUIZhI44gkjlnCbYu 9fd46b5349c522407c7fe4eaedeed678487e02a2 0 iEYEABECAAYFAlDK72cACgkQCX/oGf+2qkNv1gCfYsphl/F7dyNNh+u046YI9RwEdD4AoMPAoXJFhg9rV8gF6tZgeSMSAOV3 +73102dce4ea86f1b3fab97709f1832f39f89d227 0 iEYEABECAAYFAlDYYXMACgkQCX/oGf+2qkNpJQCg09+Ojgco2TaKN6BlNC4888yhLCgAoJfCfQ/93ePShFci2Fic/lzeg/wL diff -r 51ea214b67be -r e8e0844b64a8 .hgtags --- a/.hgtags Wed Dec 26 18:26:12 2012 +0100 +++ b/.hgtags Thu Dec 27 08:25:53 2012 +0100 @@ -104,3 +104,4 @@ 41ad849c6978ec887187853448c1f1a79fc01c4f 3.0MP17.1 814d8af3a240b363c9bcba7cf7ae839c8822ecce 3.0MP17.2 43986bd34e503950718f87d719d70fccfc8607fe 3.0MP18 +26a81bd13b9118ce8591e58ed7d04533469708f0 3.0MP18.1 diff -r 51ea214b67be -r e8e0844b64a8 modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java Wed Dec 26 18:26:12 2012 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java Thu Dec 27 08:25:53 2012 +0100 @@ -87,6 +87,8 @@ "web/org.openbravo.client.application/js/utilities/ob-utilities-date.js", true)); globalResources.add(createStaticResource( "web/org.openbravo.client.application/js/utilities/ob-utilities-number.js", true)); + globalResources.add(createStaticResource( + "web/org.openbravo.client.application/js/utilities/ob-utilities-style.js", true)); globalResources.add(createStaticResource( "web/org.openbravo.client.application/js/utilities/ob-popup.js", false)); @@ -155,6 +157,8 @@ globalResources.add(createStaticResource( "web/org.openbravo.client.application/js/main/ob-tab.js", false)); globalResources.add(createStaticResource( + "web/org.openbravo.client.application/js/form/formitem/ob-formitem-calendar.js", true)); + globalResources.add(createStaticResource( "web/org.openbravo.client.application/js/grid/ob-grid.js", false)); globalResources.add(createStaticResource( diff -r 51ea214b67be -r e8e0844b64a8 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-calendar.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-calendar.js Thu Dec 27 08:25:53 2012 +0100 @@ -0,0 +1,57 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.1 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use. this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2012 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************ + */ + +// == OBClientClassCanvasItem == +// Extends Calendar, with some customizations (most of them styling related) +isc.ClassFactory.defineClass('OBCalendar', isc.Calendar); + +isc.ClassFactory.defineClass('OBCalendarTabSet', isc.TabSet); + + +isc.OBCalendar.addProperties({ + initWidget: function () { + this.firstDayOfWeek = 1; + this.eventWindowStyle = OB.Styles.OBCalendar.eventWindowStyle; + this.datePickerButtonDefaults.src = OB.Styles.OBCalendar.datePickerButton.src; + this.datePickerButtonDefaults.width = OB.Styles.OBCalendar.datePickerButton.width; + this.datePickerButtonDefaults.height = OB.Styles.OBCalendar.datePickerButton.height; + this.previousButtonDefaults.src = OB.Styles.OBCalendar.previousButton.src; + this.previousButtonDefaults.width = OB.Styles.OBCalendar.previousButton.width; + this.previousButtonDefaults.height = OB.Styles.OBCalendar.previousButton.height; + this.nextButtonDefaults.src = OB.Styles.OBCalendar.nextButton.src; + this.nextButtonDefaults.width = OB.Styles.OBCalendar.nextButton.width; + this.nextButtonDefaults.height = OB.Styles.OBCalendar.nextButton.height; + this.controlsBarDefaults.layoutTopMargin = OB.Styles.OBCalendar.controlsTopMarging; + this.mainViewDefaults._constructor = isc.OBCalendarTabSet; + this.Super('initWidget', arguments); + this.controlsBar.reorderMember(4, 1); // Moves the 'next' button to the second position + this.controlsBar.reorderMember(2, 4); // Moves the 'displayed date' to last position + if (this.showDayView !== false) { + this.dayView.baseStyle = OB.Styles.OBCalendar.dayView_baseStyle; + } + if (this.showWeekView !== false) { + this.weekView.baseStyle = OB.Styles.OBCalendar.weekView_baseStyle; + this.weekView.headerBaseStyle = OB.Styles.OBCalendar.weekView_headerBaseStyle; + } + if (this.showMonthView !== false) { + this.monthView.baseStyle = OB.Styles.OBCalendar.monthView_baseStyle; + this.monthView.headerBaseStyle = OB.Styles.OBCalendar.monthView_headerBaseStyle; + } + } +}); \ No newline at end of file diff -r 51ea214b67be -r e8e0844b64a8 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-style.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-style.js Thu Dec 27 08:25:53 2012 +0100 @@ -0,0 +1,122 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.1 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2012 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************ + */ + +OB = window.OB || {}; +OB.Utilities = window.OB.Utilities || {}; + +// = Openbravo Style Utilities = +// Defines utility methods related to Styles. +OB.Utilities.Style = {}; + + +// ** {{{ OB.Utilities.Style.getSheet }}} ** +// +// Gets a CSS spreadsheet +// +// Parameters: +// * {{{position}}}: {Integer} position +// Return: +// * The CSS spreadsheet +OB.Utilities.Style.getSheet = function (position, type) { + var stylesheet, i; + if (position) { + stylesheet = document.styleSheets[position]; + } else { + if (!type) { + for (i = 0; i < document.styleSheets.length; i++) { + if (document.styleSheets[i].href) { + stylesheet = document.styleSheets[i]; + } + } + } else if (type) { + for (i = 0; i < document.styleSheets.length; i++) { + if (document.styleSheets[i].href && document.styleSheets[i].href.indexOf(type) === -1) { + stylesheet = document.styleSheets[i]; + } + } + } + } + return stylesheet; +}; +// ** {{{ OB.Utilities.Style.addRule }}} ** +// +// Adds a style definition to the CSS in last position +// +// Parameters: +// * {{{selector}}}: {String} the selector name to be added +// * {{{declaration}}}: {String} the properties of this selector +OB.Utilities.Style.addRule = function (selector, declaration) { + var stylesheet = OB.Utilities.Style.getSheet(); + if (typeof stylesheet === 'object') { + if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1) { + stylesheet.addRule(selector, declaration); + } else { + stylesheet.insertRule(selector + ' { ' + declaration + ' }', stylesheet.cssRules.length); + } + } +}; + +// ** {{{ OB.Utilities.Style.removeRule }}} ** +// +// Removes a style definition at given position +// +// Parameters: +// * {{{selectorIndex}}}: {Integer} the position of the selector to remove +OB.Utilities.Style.removeRule = function (selectorIndex) { + var stylesheet = OB.Utilities.Style.getSheet(); + + if (typeof stylesheet === 'object') { + if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1) { + stylesheet.removeRule(selectorIndex); + } else { + stylesheet.deleteRule(selectorIndex); + } + } +}; + +// ** {{{ OB.Utilities.Style.getRulePosition }}} ** +// +// Removes a style definition at given position +// +// Parameters: +// * {{{selector}}}: {String} the name of the selector to obtain position +// Return: +// * The selector position +OB.Utilities.Style.getRulePosition = function (selector) { + var stylesheet = OB.Utilities.Style.getSheet(), + position = [], + i; + + if (typeof stylesheet === 'object') { + if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1) { + for (i = 0; i < stylesheet.rules.length; i++) { + if (stylesheet.rules[i].selectorText.toLowerCase() === selector.toLowerCase()) { + position.push(i); + } + } + } else { + for (i = 0; i < stylesheet.cssRules.length; i++) { + if (typeof stylesheet.cssRules[i].selectorText !== 'undefined' && stylesheet.cssRules[i].selectorText.toLowerCase() === selector.toLowerCase()) { + position.push(i); + } + } + } + } + return position; +}; \ No newline at end of file diff -r 51ea214b67be -r e8e0844b64a8 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 Dec 26 18:26:12 2012 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Thu Dec 27 08:25:53 2012 +0100 @@ -996,4 +996,49 @@ return false; } return (/[A-Fa-f0-9]{32,32}/).test(object); +}; + + +//** {{{ OB.Utilities.getRGBAStringFromOBColor }}} ** +// +// Returns a string like "rgba(*RedValue*, *GreenValue*, *BlueValue*, *OpacityValue*)" from an OBColor value +// Parameters: +// * {{{color}}} OBColor value +OB.Utilities.getRGBAStringFromOBColor = function (color) { + var rgbaColor = 'rgba(', + colorArray, i; + if (!color) { + return; + } + colorArray = color.split('-'); + for (i = 0; i < colorArray.length; i++) { + if (i < 3) { + rgbaColor += parseInt(colorArray[i], 10); + rgbaColor += ','; + } else { + rgbaColor += parseInt(colorArray[i], 10) / 100; + } + } + rgbaColor += ')'; + return rgbaColor; +}; + +//** {{{ OB.Utilities.getBrightFromOBColor }}} ** +// +// Returns the bright value (from 0 to 255) from an OBColor value +// Parameters: +// * {{{color}}} OBColor value +OB.Utilities.getBrightFromOBColor = function (color) { + var bright = 0, + colorArray; + if (!color) { + return; + } + colorArray = color.split('-'); + bright = bright + parseInt(colorArray[0], 10) * 299; + bright = bright + parseInt(colorArray[1], 10) * 587; + bright = bright + parseInt(colorArray[2], 10) * 114; + bright = bright / 1000; + bright = parseInt(bright, 10); + return bright; }; \ No newline at end of file diff -r 51ea214b67be -r e8e0844b64a8 modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css --- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css Wed Dec 26 18:26:12 2012 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-form-styles.css Thu Dec 27 08:25:53 2012 +0100 @@ -28,6 +28,7 @@ * SectionItem Button * Dialog * Note section + * Calendar Item =======================================================================*/ /*======================================================================= @@ -879,4 +880,75 @@ a.OBNoteListGridDelete:hover { text-decoration: underline; -} \ No newline at end of file +} + +/*======================================================================= ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
