diff --git a/.gitignore b/.gitignore index 27932a34dd..a4e87cbd2a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ /data/tmp/* /build /node_modules -npm-debug.log +/npm-debug.log /test.php /main.html @@ -15,7 +15,7 @@ npm-debug.log !/tests/unit/testData/cache/.data /tests/integration/config.php .phpunit.result.cache -composer.phar -vendor/ +/composer.phar +/vendor/ /custom/Espo/Custom/* /install/config.php \ No newline at end of file diff --git a/application/Espo/Core/Api/Auth.php b/application/Espo/Core/Api/Auth.php index dc21589bff..dd3986a206 100644 --- a/application/Espo/Core/Api/Auth.php +++ b/application/Espo/Core/Api/Auth.php @@ -178,6 +178,8 @@ class Auth } if ($hasAuthData) { + $authResult = null; + try { $authResult = $this->authentication->login($username, $password, $request, $authenticationMethod); } diff --git a/application/Espo/Core/Loaders/BaseLanguage.php b/application/Espo/Core/Loaders/BaseLanguage.php index 11c1edf3d8..9329a2cb39 100644 --- a/application/Espo/Core/Loaders/BaseLanguage.php +++ b/application/Espo/Core/Loaders/BaseLanguage.php @@ -59,7 +59,7 @@ class BaseLanguage implements Loader $this->fileManager, $this->metadata, $this->dataCache, - $this->config->get('useCache') + $this->config->get('useCache') ?? false ); } } diff --git a/application/Espo/Core/Loaders/DefaultLanguage.php b/application/Espo/Core/Loaders/DefaultLanguage.php index 07e527d82b..b2249e13d6 100644 --- a/application/Espo/Core/Loaders/DefaultLanguage.php +++ b/application/Espo/Core/Loaders/DefaultLanguage.php @@ -42,7 +42,7 @@ class DefaultLanguage extends BaseLanguage $this->fileManager, $this->metadata, $this->dataCache, - $this->config->get('useCache') + $this->config->get('useCache') ?? false ); } } diff --git a/application/Espo/Core/Loaders/Language.php b/application/Espo/Core/Loaders/Language.php index d519d1ee6a..65a25de41e 100644 --- a/application/Espo/Core/Loaders/Language.php +++ b/application/Espo/Core/Loaders/Language.php @@ -64,7 +64,7 @@ class Language implements Loader $this->fileManager, $this->metadata, $this->dataCache, - $this->config->get('useCache') + $this->config->get('useCache') ?? false ); } } diff --git a/application/Espo/Core/Loaders/Metadata.php b/application/Espo/Core/Loaders/Metadata.php index 9290a0fb03..5af3dc2b82 100644 --- a/application/Espo/Core/Loaders/Metadata.php +++ b/application/Espo/Core/Loaders/Metadata.php @@ -52,7 +52,7 @@ class Metadata implements Loader public function load() : MetadataService { - $useCache = $this->config->get('useCache'); + $useCache = $this->config->get('useCache') ?? false; return new MetadataService($this->fileManager, $this->dataCache, $useCache); } diff --git a/application/Espo/Core/Notificators/DefaultNotificator.php b/application/Espo/Core/Notificators/DefaultNotificator.php index cfa3dfba45..e9d4384b6a 100644 --- a/application/Espo/Core/Notificators/DefaultNotificator.php +++ b/application/Espo/Core/Notificators/DefaultNotificator.php @@ -123,4 +123,22 @@ class DefaultNotificator implements Notificator return $this->userIdEnabledMap[$userId]; } + + /** + * For backward compatibility. + * @todo Remove. + */ + protected function getEntityManager() + { + return $this->entityManager; + } + + /** + * For backward compatibility. + * @todo Remove. + */ + protected function getUser() + { + return $this->user; + } } diff --git a/client/lib/flotr2.js b/client/lib/flotr2.js index 668f3d4ce3..51621d7eaf 100644 --- a/client/lib/flotr2.js +++ b/client/lib/flotr2.js @@ -521,20 +521,20 @@ Flotr = { bean: bean, isIphone: /iphone/i.test(navigator.userAgent), isIE: (navigator.appVersion.indexOf("MSIE") != -1 ? parseFloat(navigator.appVersion.split("MSIE")[1]) : false), - + /** * An object of the registered graph types. Use Flotr.addType(type, object) * to add your own type. */ graphTypes: {}, - + /** * The list of the registered plugins */ plugins: {}, - + /** - * Can be used to add your own chart type. + * Can be used to add your own chart type. * @param {String} name - Type of chart, like 'pies', 'bars' etc. * @param {String} graphType - The object containing the basic drawing functions (draw, etc) */ @@ -543,7 +543,7 @@ Flotr = { Flotr.defaultOptions[name] = graphType.options || {}; Flotr.defaultOptions.defaultType = Flotr.defaultOptions.defaultType || name; }, - + /** * Can be used to add a plugin * @param {String} name - The name of the plugin @@ -553,7 +553,7 @@ Flotr = { Flotr.plugins[name] = plugin; Flotr.defaultOptions[name] = plugin.options || {}; }, - + /** * Draws the graph. This function is here for backwards compatibility with Flotr version 0.1.0alpha. * You could also draw graphs by directly calling Flotr.Graph(element, data, options). @@ -563,11 +563,11 @@ Flotr = { * @param {Class} _GraphKlass_ - (optional) Class to pass the arguments to, defaults to Flotr.Graph * @return {Object} returns a new graph object and of course draws the graph. */ - draw: function(el, data, options, GraphKlass){ + draw: function(el, data, options, GraphKlass){ GraphKlass = GraphKlass || Flotr.Graph; return new GraphKlass(el, data, options); }, - + /** * Recursively merges two objects. * @param {Object} src - source object (likely the object with the least properties) @@ -599,7 +599,7 @@ Flotr = { return result; }, - + /** * Recursively clones an object. * @param {Object} object - The object to clone @@ -609,7 +609,7 @@ Flotr = { clone: function(object){ return Flotr.merge(object, {}); }, - + /** * Function calculates the ticksize and returns it. * @param {Integer} noTicks - number of ticks @@ -623,15 +623,15 @@ Flotr = { magn = Flotr.getMagnitude(delta), tickSize = 10, norm = delta / magn; // Norm is between 1.0 and 10.0. - + if(norm < 1.5) tickSize = 1; else if(norm < 2.25) tickSize = 2; else if(norm < 3) tickSize = ((decimals === 0) ? 2 : 2.5); else if(norm < 7.5) tickSize = 5; - + return tickSize * magn; }, - + /** * Default tick formatter. * @param {String, Integer} val - tick value integer @@ -641,7 +641,7 @@ Flotr = { defaultTickFormatter: function(val, axisOpts){ return val+''; }, - + /** * Formats the mouse tracker values. * @param {Object} obj - Track value Object {x:..,y:..} @@ -649,8 +649,8 @@ Flotr = { */ defaultTrackFormatter: function(obj){ return '('+obj.x+', '+obj.y+')'; - }, - + }, + /** * Utility function to convert file size values in bytes to kB, MB, ... * @param value {Number} - The value to convert @@ -678,7 +678,7 @@ Flotr = { return (Math.round(value * precision) / precision) + sizes[total]; }, - + /** * Returns the magnitude of the input value. * @param {Integer, Float} x - integer or float value @@ -701,7 +701,7 @@ Flotr = { ctx.drawText(text, x, y, style); return; } - + style = this._.extend({ size: Flotr.defaultOptions.fontSize, color: '#000000', @@ -710,7 +710,7 @@ Flotr = { weight: 1, angle: 0 }, style); - + ctx.save(); ctx.translate(x, y); ctx.rotate(style.angle); @@ -724,13 +724,13 @@ Flotr = { getBestTextAlign: function(angle, style) { style = style || {textAlign: 'center', textBaseline: 'middle'}; angle += Flotr.getTextAngleFromAlign(style); - - if (Math.abs(Math.cos(angle)) > 10e-3) + + if (Math.abs(Math.cos(angle)) > 10e-3) style.textAlign = (Math.cos(angle) > 0 ? 'right' : 'left'); - - if (Math.abs(Math.sin(angle)) > 10e-3) + + if (Math.abs(Math.sin(angle)) > 10e-3) style.textBaseline = (Math.sin(angle) > 0 ? 'top' : 'bottom'); - + return style; }, alignTable: { @@ -829,7 +829,7 @@ Flotr.defaultOptions = { color: '#545454', // => primary color used for outline and labels backgroundColor: null, // => null for transparent, else color backgroundImage: null, // => background image. String or object with src, left and top - watermarkAlpha: 0.4, // => + watermarkAlpha: 0.4, // => tickColor: '#DDDDDD', // => color used for the ticks labelMargin: 3, // => margin in pixels verticalLines: true, // => whether to show gridlines in vertical direction @@ -853,7 +853,7 @@ Flotr.defaultOptions = { trackY: true, // => whether or not to track the mouse in the y axis radius: 3, // => radius of the track point fillColor: null, // => color to fill our select bar with only applies to bar and similar graphs (only bars for now) - fillOpacity: 0.4 // => opacity of the fill color, set to 1 for a solid fill, 0 hides the fill + fillOpacity: 0.4 // => opacity of the fill color, set to 1 for a solid fill, 0 hides the fill } }; @@ -955,19 +955,19 @@ _.extend(Color, { // rgb(num,num,num) if((result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))) return new Color(parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10)); - + // #fff if((result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))) return new Color(parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)); - + // rgba(num,num,num,num) if((result = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(color))) return new Color(parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10), parseFloat(result[4])); - + // rgb(num%,num%,num%) if((result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))) return new Color(parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55); - + // rgba(num%,num%,num%,num) if((result = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(color))) return new Color(parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55, parseFloat(result[4])); @@ -989,15 +989,15 @@ _.extend(Color, { if (!color) return 'rgba(0, 0, 0, 0)'; if (color instanceof Color) return color.alpha(opacity).toString(); if (_.isString(color)) return Color.parse(color).alpha(opacity).toString(); - + var grad = color.colors ? color : {colors: color}; - + if (!options.ctx) { if (!_.isArray(grad.colors)) return 'rgba(0, 0, 0, 0)'; return Color.parse(_.isArray(grad.colors[0]) ? grad.colors[0][1] : grad.colors[0]).alpha(opacity).toString(); } - grad = _.extend({start: 'top', end: 'bottom'}, grad); - + grad = _.extend({start: 'top', end: 'bottom'}, grad); + if (/top/i.test(grad.start)) options.x1 = 0; if (/left/i.test(grad.start)) options.y1 = 0; if (/bottom/i.test(grad.end)) options.x2 = 0; @@ -1041,7 +1041,7 @@ Flotr.Date = { format: function(d, format, mode) { if (!d) return; - // We should maybe use an "official" date format spec, like PHP date() or ColdFusion + // We should maybe use an "official" date format spec, like PHP date() or ColdFusion // http://fr.php.net/manual/en/function.date.php // http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_c-d_29.html var @@ -1062,13 +1062,13 @@ Flotr.Date = { n += ''; return n.length == 1 ? "0" + n : n; } - + var r = [], c, escape = false; - + for (var i = 0; i < format.length; ++i) { c = format.charAt(i); - + if (escape) { r.push(tokens[c] || c); escape = false; @@ -1098,7 +1098,7 @@ Flotr.Date = { // first check global format if (axis.options.timeFormat) return Flotr.Date.format(d, options.timeFormat, options.timeMode); - + var span = (axis.max - axis.min) * scale, t = axis.tickSize * Flotr.Date.timeUnits[axis.tickUnit]; @@ -1166,7 +1166,7 @@ Flotr.Date = { case "month": setTick('Month'); break; case "year": setTick('FullYear'); break; } - + // reset smaller components if (step >= timeUnits.second) set(d, 'Milliseconds', mode, 0); if (step >= timeUnits.minute) set(d, 'Seconds', mode, 0); @@ -1216,9 +1216,9 @@ Flotr.Date = { }, // the allowed tick sizes, after 1 year we use an integer algorithm spec: [ - [1, "millisecond"], [20, "millisecond"], [50, "millisecond"], [100, "millisecond"], [200, "millisecond"], [500, "millisecond"], - [1, "second"], [2, "second"], [5, "second"], [10, "second"], [30, "second"], - [1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"], [30, "minute"], + [1, "millisecond"], [20, "millisecond"], [50, "millisecond"], [100, "millisecond"], [200, "millisecond"], [500, "millisecond"], + [1, "second"], [2, "second"], [5, "second"], [10, "second"], [30, "second"], + [1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"], [30, "minute"], [1, "hour"], [2, "hour"], [4, "hour"], [8, "hour"], [12, "hour"], [1, "day"], [2, "day"], [3, "day"], [0.25, "month"], [0.5, "month"], [1, "month"], [2, "month"], [3, "month"], [6, "month"], @@ -1406,9 +1406,9 @@ Text.prototype = { dimensions : function (text, canvasStyle, htmlStyle, className) { if (!text) return { width : 0, height : 0 }; - + return (this.o.html) ? - this.html(text, this.o.element, htmlStyle, className) : + this.html(text, this.o.element, htmlStyle, className) : this.canvas(text, canvasStyle); }, @@ -2316,7 +2316,7 @@ Axis.prototype = { this.ticks = []; this.minorTicks = []; - + // User Ticks if(options.ticks){ this._cleanUserTicks(options.ticks, this.ticks); @@ -2349,7 +2349,7 @@ Axis.prototype = { min = o.min !== null ? o.min : axis.datamin, max = o.max !== null ? o.max : axis.datamax, margin = o.autoscaleMargin; - + if (o.scaling == 'logarithmic') { if (min <= 0) min = axis.datamin; @@ -2373,9 +2373,9 @@ Axis.prototype = { var minexp = Math.log(min); if (o.base != Math.E) minexp /= Math.log(o.base); minexp = Math.ceil(minexp); - + axis.tickSize = Flotr.getTickSize(o.noTicks, minexp, maxexp, o.tickDecimals === null ? 0 : o.tickDecimals); - + // Try to determine a suitable amount of miniticks based on the length of a decade if (o.minorTickFreq === null) { if (maxexp - minexp > 10) @@ -2399,10 +2399,10 @@ Axis.prototype = { if(axis.min < 0 && axis.datamin >= 0) axis.min = 0; axis.min = axis.tickSize * Math.floor(axis.min / axis.tickSize); } - + if(o.max === null && o.autoscale){ axis.max += axis.tickSize * margin; - if(axis.max > 0 && axis.datamax <= 0 && axis.datamax != axis.datamin) axis.max = 0; + if(axis.max > 0 && axis.datamax <= 0 && axis.datamax != axis.datamin) axis.max = 0; axis.max = axis.tickSize * Math.ceil(axis.max / axis.tickSize); } @@ -2432,7 +2432,7 @@ Axis.prototype = { ); this.titleSize = T.dimensions( - this.options.title, + this.options.title, {size:options.fontSize*1.2, angle: Flotr.toRad(this.options.titleAngle)}, 'font-weight:bold;', 'flotr-axis-title' @@ -2477,18 +2477,18 @@ Axis.prototype = { var min = Math.log(axis.min); if (o.base != Math.E) min /= Math.log(o.base); min = Math.ceil(min); - + for (i = min; i < max; i += axis.tickSize) { decadeStart = (o.base == Math.E) ? Math.exp(i) : Math.pow(o.base, i); // Next decade begins here: var decadeEnd = decadeStart * ((o.base == Math.E) ? Math.exp(axis.tickSize) : Math.pow(o.base, axis.tickSize)); var stepSize = (decadeEnd - decadeStart) / o.minorTickFreq; - + axis.ticks.push({v: decadeStart, label: o.tickFormatter(decadeStart, {min : axis.min, max : axis.max})}); for (v = decadeStart + stepSize; v < decadeEnd; v += stepSize) axis.minorTicks.push({v: v, label: o.tickFormatter(v, {min : axis.min, max : axis.max})}); } - + // Always show the value at the would-be start of next decade (end of this decade) decadeStart = (o.base == Math.E) ? Math.exp(i) : Math.pow(o.base, i); axis.ticks.push({v: decadeStart, label: o.tickFormatter(decadeStart, {min : axis.min, max : axis.max})}); @@ -2506,18 +2506,18 @@ Axis.prototype = { minorTickSize, v, v2, i, j; - + if (o.minorTickFreq) minorTickSize = tickSize / o.minorTickFreq; - + // Then store all possible ticks. for (i = 0; (v = v2 = start + i * tickSize) <= max; ++i){ - + // Round (this is always needed to fix numerical instability). decimals = o.tickDecimals; if (decimals === null) decimals = 1 - Math.floor(Math.log(tickSize) / Math.LN10); if (decimals < 0) decimals = 0; - + v = v.toFixed(decimals); axis.ticks.push({ v: v, label: o.tickFormatter(v, {min : axis.min, max : axis.max}) }); @@ -2551,7 +2551,7 @@ _.extend(Axis, { function log (value, base) { value = Math.log(Math.max(value, Number.MIN_VALUE)); - if (base !== Math.E) + if (base !== Math.E) value /= Math.log(base); return value; } @@ -2620,7 +2620,7 @@ Series.prototype = { _.extend(Series, { /** - * Collects dataseries from input and parses the series into the right format. It returns an Array + * Collects dataseries from input and parses the series into the right format. It returns an Array * of Objects each having at least the 'data' key set. * @param {Array, Object} data - Object or array of dataseries * @return {Array} Array of Objects parsed into the right format ({(...,) data: [[x1,y1], [x2,y2], ...] (, ...)}) @@ -2679,7 +2679,7 @@ Flotr.addType('lines', { context.lineWidth = shadowSize / 2; offset = lineWidth / 2 + context.lineWidth / 2; - + // @TODO do this instead with a linear gradient context.strokeStyle = "rgba(0,0,0,0.1)"; this.plot(options, offset + shadowSize / 2, false); @@ -2700,11 +2700,11 @@ Flotr.addType('lines', { var context = options.context, - width = options.width, + width = options.width, height = options.height, xScale = options.xScale, yScale = options.yScale, - data = options.data, + data = options.data, stack = options.stacked ? this.stack : false, length = data.length - 1, prevx = null, @@ -2712,7 +2712,7 @@ Flotr.addType('lines', { zero = yScale(0), start = null, x1, x2, y1, y2, stack1, stack2, i; - + if (length < 1) return; context.beginPath(); @@ -2737,12 +2737,12 @@ Flotr.addType('lines', { // TODO handle zero for logarithmic // if (xa.options.scaling === 'logarithmic' && (data[i][0] <= 0 || data[i+1][0] <= 0)) continue; // if (ya.options.scaling === 'logarithmic' && (data[i][1] <= 0 || data[i+1][1] <= 0)) continue; - + x1 = xScale(data[i][0]); x2 = xScale(data[i+1][0]); if (start === null) start = data[i]; - + if (stack) { stack1 = stack.values[data[i][0]] || 0; stack2 = stack.values[data[i+1][0]] || stack.values[data[i][0]] || 0; @@ -2771,7 +2771,7 @@ Flotr.addType('lines', { if ((prevx != x1) || (prevy != y1 + shadowOffset)) { context.moveTo(x1, y1 + shadowOffset); } - + prevx = x2; prevy = y2 + shadowOffset; if (options.steps) { @@ -2781,7 +2781,7 @@ Flotr.addType('lines', { context.lineTo(prevx, prevy); } } - + if (!options.fill || options.fill && !options.fillBorder) context.stroke(); fill(); @@ -2953,7 +2953,7 @@ Flotr.addType('bars', { grouped: false // => groups bars together which share x value, hit not supported. }, - stack : { + stack : { positive : [], negative : [], _positive : [], // Shadow @@ -2972,7 +2972,7 @@ Flotr.addType('bars', { context.lineWidth = options.lineWidth; context.strokeStyle = options.color; if (options.fill) context.fillStyle = options.fillStyle; - + this.plot(options); context.restore(); @@ -3229,7 +3229,7 @@ Flotr.addType('bars', { var max = axis.options.max; - if (_.isNumber(max) || _.isString(max)) return; + if (_.isNumber(max) || _.isString(max)) return; var newmin = axis.min, @@ -3248,7 +3248,7 @@ Flotr.addType('bars', { } } - if (options.stacked && + if (options.stacked && ((orientation == 1 && horizontal) || (orientation == -1 && !horizontal))){ for (j = data.length; j--;) { @@ -3303,7 +3303,7 @@ Flotr.addType('bubbles', { context.save(); context.lineWidth = options.lineWidth; - + // Shadows context.fillStyle = 'rgba(0,0,0,0.05)'; context.strokeStyle = 'rgba(0,0,0,0.05)'; @@ -3315,7 +3315,7 @@ Flotr.addType('bubbles', { context.strokeStyle = options.color; context.fillStyle = options.fillStyle; this.plot(options); - + context.restore(); }, plot : function (options, offset) { @@ -3327,7 +3327,7 @@ Flotr.addType('bubbles', { i, x, y, z; offset = offset || 0; - + for (i = 0; i < data.length; ++i){ geometry = this.getGeometry(data[i], options); @@ -3402,7 +3402,7 @@ Flotr.addType('bubbles', { context.save(); context.clearRect( - geometry.x - offset, + geometry.x - offset, geometry.y - offset, 2 * offset, 2 * offset @@ -3519,7 +3519,7 @@ Flotr.addType('candles', { context.moveTo(x, Math.floor(bottom2 + lineWidth)); context.lineTo(x, Math.floor(bottom + lineWidth)); } - + context.closePath(); context.stroke(); } @@ -3623,7 +3623,7 @@ Flotr.addType('gantt', { var ctx = this.ctx, bw = series.gantt.barWidth, lw = Math.min(series.gantt.lineWidth, bw); - + ctx.save(); ctx.translate(this.plotOffset.left, this.plotOffset.top); ctx.lineJoin = 'miter'; @@ -3633,23 +3633,23 @@ Flotr.addType('gantt', { */ ctx.lineWidth = lw; ctx.strokeStyle = series.color; - + ctx.save(); this.gantt.plotShadows(series, bw, 0, series.gantt.fill); ctx.restore(); - + if(series.gantt.fill){ var color = series.gantt.fillColor || series.color; ctx.fillStyle = this.processColor(color, {opacity: series.gantt.fillOpacity}); } - + this.gantt.plot(series, bw, 0, series.gantt.fill); ctx.restore(); }, plot: function(series, barWidth, offset, fill){ var data = series.data; if(data.length < 1) return; - + var xa = series.xaxis, ya = series.yaxis, ctx = this.ctx, i; @@ -3659,14 +3659,14 @@ Flotr.addType('gantt', { s = data[i][1], d = data[i][2], drawLeft = true, drawTop = true, drawRight = true; - + if (s === null || d === null) continue; - var left = s, + var left = s, right = s + d, - bottom = y - (series.gantt.centered ? barWidth/2 : 0), + bottom = y - (series.gantt.centered ? barWidth/2 : 0), top = y + barWidth - (series.gantt.centered ? barWidth/2 : 0); - + if(right < xa.min || left > xa.max || top < ya.min || bottom > ya.max) continue; @@ -3689,7 +3689,7 @@ Flotr.addType('gantt', { if (ya.lastSerie != series) drawTop = false; } - + /** * Fill the bar. */ @@ -3709,11 +3709,11 @@ Flotr.addType('gantt', { if(series.gantt.lineWidth && (drawLeft || drawRight || drawTop)){ ctx.beginPath(); ctx.moveTo(xa.d2p(left), ya.d2p(bottom) + offset); - + ctx[drawLeft ?'lineTo':'moveTo'](xa.d2p(left), ya.d2p(top) + offset); ctx[drawTop ?'lineTo':'moveTo'](xa.d2p(right), ya.d2p(top) + offset); ctx[drawRight?'lineTo':'moveTo'](xa.d2p(right), ya.d2p(bottom) + offset); - + ctx.stroke(); ctx.closePath(); } @@ -3722,36 +3722,36 @@ Flotr.addType('gantt', { plotShadows: function(series, barWidth, offset){ var data = series.data; if(data.length < 1) return; - + var i, y, s, d, xa = series.xaxis, ya = series.yaxis, ctx = this.ctx, sw = this.options.shadowSize; - + for(i = 0; i < data.length; i++){ y = data[i][0]; s = data[i][1]; d = data[i][2]; - + if (s === null || d === null) continue; - - var left = s, + + var left = s, right = s + d, - bottom = y - (series.gantt.centered ? barWidth/2 : 0), + bottom = y - (series.gantt.centered ? barWidth/2 : 0), top = y + barWidth - (series.gantt.centered ? barWidth/2 : 0); - + if(right < xa.min || left > xa.max || top < ya.min || bottom > ya.max) continue; - + if(left < xa.min) left = xa.min; if(right > xa.max) right = xa.max; if(bottom < ya.min) bottom = ya.min; if(top > ya.max) top = ya.max; - + var width = xa.d2p(right)-xa.d2p(left)-((xa.d2p(right)+sw <= this.plotWidth) ? 0 : sw); var height = ya.d2p(bottom)-ya.d2p(top)-((ya.d2p(bottom)+sw <= this.plotHeight) ? 0 : sw ); - + ctx.fillStyle = 'rgba(0,0,0,0.05)'; ctx.fillRect(Math.min(xa.d2p(left)+sw, this.plotWidth), Math.min(ya.d2p(top)+sw, this.plotHeight), width, height); } @@ -3768,7 +3768,7 @@ Flotr.addType('gantt', { for(i = 0; i < this.series.length; ++i){ s = this.series[i]; g = s.gantt; - + if(g.show && s.xaxis == axis) { for (j = 0; j < s.data.length; j++) { if (g.show) { @@ -3795,18 +3795,18 @@ Flotr.addType('gantt', { stackedSumsPos = {}, stackedSumsNeg = {}, lastSerie = null; - + for(i = 0; i < this.series.length; ++i){ s = this.series[i]; g = s.gantt; - + if (g.show && !s.hide && s.yaxis == axis) { var datamax = Number.MIN_VALUE, datamin = Number.MAX_VALUE; for(j=0; j < s.data.length; j++){ datamax = Math.max(datamax,s.data[j][0]); datamin = Math.min(datamin,s.data[j][0]); } - + if (g.centered) { newmax = Math.max(datamax + 0.5, newmax); newmin = Math.min(datamin - 0.5, newmin); @@ -3897,10 +3897,10 @@ Flotr.addType('markers', { } for (i = 0; i < data.length; ++i) { - + x = data[i][0]; y = data[i][1]; - + if (stack) { if (stackType == 'b') { if (options.horizontal) y = stackPos(y, x); @@ -3943,20 +3943,20 @@ Flotr.addType('markers', { if (options.position.indexOf('c') != -1) left -= dim.width/2 + margin; else if (options.position.indexOf('l') != -1) left -= dim.width; - + if (options.position.indexOf('m') != -1) top -= dim.height/2 + margin; else if (options.position.indexOf('t') != -1) top -= dim.height + options.verticalMargin; else top += options.verticalMargin; - + left = Math.floor(left)+0.5; top = Math.floor(top)+0.5; - + if(options.fill) context.fillRect(left, top, dim.width, dim.height); - + if(options.stroke) context.strokeRect(left, top, dim.width, dim.height); - + if (isImage(label)) context.drawImage(label, parseInt(left+margin, 10), parseInt(top+margin, 10)); else @@ -3994,10 +3994,10 @@ Flotr.addType('pie', { fillColor: null, // => fill color fillOpacity: 0.6, // => opacity of the fill color, set to 1 for a solid fill, 0 hides the fill explode: 6, // => the number of pixels the splices will be far from the center - sizeRatio: 0.6, // => the size ratio of the pie relative to the plot + sizeRatio: 0.6, // => the size ratio of the pie relative to the plot startAngle: Math.PI/4, // => the first slice start angle labelFormatter: Flotr.defaultPieLabelFormatter, - pie3D: false, // => whether to draw the pie in 3 dimenstions or not (ineffective) + pie3D: false, // => whether to draw the pie in 3 dimenstions or not (ineffective) pie3DviewAngle: (Math.PI/2 * 0.8), pie3DspliceThickness: 20, epsilon: 0.1 // => how close do you have to get to hit empty slice @@ -4035,7 +4035,7 @@ Flotr.addType('pie', { textBaseline = distY > 0 ? 'top' : 'bottom', style, x, y; - + context.save(); context.translate(width / 2, height / 2); context.scale(1, vScale); @@ -4079,13 +4079,13 @@ Flotr.addType('pie', { Flotr.drawText(context, label, distX, distY, style); } } - + if (options.htmlText || !options.textEnabled) { var div = Flotr.DOM.node('
'); Flotr.DOM.insert(div, html.join('')); Flotr.DOM.insert(options.element, div); } - + context.restore(); // New start angle @@ -4139,7 +4139,7 @@ Flotr.addType('pie', { // TODO: Document the two cases at the end: (start === end && ((slice.start === slice.end && Math.abs(theta - start) < epsilon) || (slice.start !== slice.end && Math.abs(theta-start) > epsilon))) ) { - + // TODO Decouple this from hit plugin (chart shouldn't know what n means) n.x = data[0]; n.y = data[1]; @@ -4175,7 +4175,7 @@ Flotr.addType('pie', { slice.x - radius, slice.y - radius, 2 * radius + padding, - 2 * radius + padding + 2 * radius + padding ); context.restore(); }, @@ -4207,7 +4207,7 @@ Flotr.addType('points', { if (shadowSize > 0) { context.lineWidth = shadowSize / 2; - + context.strokeStyle = 'rgba(0,0,0,0.1)'; this.plot(options, shadowSize / 2 + context.lineWidth / 2); @@ -4230,7 +4230,7 @@ Flotr.addType('points', { xScale = options.xScale, yScale = options.yScale, i, x, y; - + for (i = data.length - 1; i > -1; --i) { y = data[i][1]; if (y === null) continue; @@ -4239,7 +4239,7 @@ Flotr.addType('points', { y = yScale(y); if (x < 0 || x > options.width || y < 0 || y > options.height) continue; - + context.beginPath(); if (offset) { context.arc(x, y + offset, options.radius, 0, Math.PI, false); @@ -4271,7 +4271,7 @@ Flotr.addType('radar', { context.save(); context.translate(options.width / 2, options.height / 2); context.lineWidth = options.lineWidth; - + // Shadow context.fillStyle = 'rgba(0,0,0,0.05)'; context.strokeStyle = 'rgba(0,0,0,0.05)'; @@ -4283,7 +4283,7 @@ Flotr.addType('radar', { context.strokeStyle = options.color; context.fillStyle = options.fillStyle; this.plot(options); - + context.restore(); }, plot : function (options, offset) { @@ -4440,7 +4440,7 @@ Flotr.addType('timeline', { Flotr._.each(data, function (timeline) { - var + var x = timeline[0], y = timeline[1], w = timeline[2], @@ -4509,7 +4509,7 @@ Flotr.addPlugin('crosshair', { } } }, - /** + /** * Draws the selection box. */ drawCrosshair: function(pos) { @@ -4518,33 +4518,33 @@ Flotr.addPlugin('crosshair', { plotOffset = this.plotOffset, x = plotOffset.left + Math.round(pos.relX) + 0.5, y = plotOffset.top + Math.round(pos.relY) + 0.5; - + if (pos.relX < 0 || pos.relY < 0 || pos.relX > this.plotWidth || pos.relY > this.plotHeight) { this.el.style.cursor = null; D.removeClass(this.el, 'flotr-crosshair'); - return; + return; } - + if (options.hideCursor) { this.el.style.cursor = 'none'; D.addClass(this.el, 'flotr-crosshair'); } - + octx.save(); octx.strokeStyle = options.color; octx.lineWidth = 1; octx.beginPath(); - + if (options.mode.indexOf('x') != -1) { octx.moveTo(x, plotOffset.top); octx.lineTo(x, plotOffset.top + this.plotHeight); } - + if (options.mode.indexOf('y') != -1) { octx.moveTo(plotOffset.left, y); octx.lineTo(plotOffset.left + this.plotWidth, y); } - + octx.stroke(); octx.restore(); }, @@ -4570,7 +4570,7 @@ Flotr.addPlugin('crosshair', { Math.round(position.relY) + plotOffset.top, this.plotWidth + 1, 1 - ); + ); } } }); @@ -4674,15 +4674,15 @@ Flotr.addPlugin('graphGrid', { plotHeight = this.plotHeight, plotWidth = this.plotWidth, a, v, i, j; - - if(verticalLines || minorVerticalLines || + + if(verticalLines || minorVerticalLines || horizontalLines || minorHorizontalLines){ E.fire(this.el, 'flotr:beforegrid', [this.axes.x, this.axes.y, options, this]); } ctx.save(); ctx.lineWidth = 1; ctx.strokeStyle = grid.tickColor; - + function circularHorizontalTicks (ticks) { for(i = 0; i < ticks.length; ++i){ var ratio = ticks[i].v / a.max; @@ -4697,7 +4697,7 @@ Flotr.addPlugin('graphGrid', { function drawGridLines (ticks, callback) { _.each(_.pluck(ticks, 'v'), function(v){ // Don't show lines on upper and lower bounds. - if ((v <= a.min || v >= a.max) || + if ((v <= a.min || v >= a.max) || (v == a.min || v == a.max) && grid.outlineWidth) return; callback(Math.floor(a.d2p(v)) + ctx.lineWidth/2); @@ -4718,10 +4718,10 @@ Flotr.addPlugin('graphGrid', { sides = this.axes.x.ticks.length, coeff = 2*(Math.PI/sides), angle = -Math.PI/2; - + // Draw grid lines in vertical direction. ctx.beginPath(); - + a = this.axes.y; if(horizontalLines){ @@ -4730,7 +4730,7 @@ Flotr.addPlugin('graphGrid', { if(minorHorizontalLines){ circularHorizontalTicks(a.minorTicks); } - + if(verticalLines){ _.times(sides, function(i){ ctx.moveTo(0, 0); @@ -4741,13 +4741,13 @@ Flotr.addPlugin('graphGrid', { } else { ctx.translate(this.plotOffset.left, this.plotOffset.top); - + // Draw grid background, if present in options. if(grid.backgroundColor){ ctx.fillStyle = this.processColor(grid.backgroundColor, {x1: 0, y1: 0, x2: plotWidth, y2: plotHeight}); ctx.fillRect(0, 0, plotWidth, plotHeight); } - + ctx.beginPath(); a = this.axes.x; @@ -4760,13 +4760,13 @@ Flotr.addPlugin('graphGrid', { ctx.stroke(); } - + ctx.restore(); if(verticalLines || minorVerticalLines || horizontalLines || minorHorizontalLines){ E.fire(this.el, 'flotr:aftergrid', [this.axes.x, this.axes.y, options, this]); } - }, + }, drawOutline: function(){ var @@ -4782,24 +4782,24 @@ Flotr.addPlugin('graphGrid', { plotWidth = that.plotWidth, plotHeight = that.plotHeight, v, img, src, left, top, globalAlpha; - + if (!grid.outlineWidth) return; - + ctx.save(); - + if (grid.circular) { ctx.translate(leftOffset + plotWidth / 2, topOffset + plotHeight / 2); var radius = Math.min(plotHeight, plotWidth) * options.radar.radiusRatio / 2, sides = this.axes.x.ticks.length, coeff = 2*(Math.PI/sides), angle = -Math.PI/2; - + // Draw axis/grid border. ctx.beginPath(); ctx.lineWidth = grid.outlineWidth; ctx.strokeStyle = grid.color; ctx.lineJoin = 'round'; - + for(i = 0; i <= sides; ++i){ ctx[i === 0 ? 'moveTo' : 'lineTo'](Math.cos(i*coeff+angle)*radius, Math.sin(i*coeff+angle)*radius); } @@ -4809,7 +4809,7 @@ Flotr.addPlugin('graphGrid', { } else { ctx.translate(leftOffset, topOffset); - + // Draw axis/grid border. var lw = grid.outlineWidth, orig = 0.5-lw+((lw+1)%2/2), @@ -4829,7 +4829,7 @@ Flotr.addPlugin('graphGrid', { ctx.stroke(); ctx.closePath(); } - + ctx.restore(); if (backgroundImage) { @@ -5143,9 +5143,9 @@ Flotr.addPlugin('hit', { drawMouseTrack : function (n) { var - pos = '', + pos = '', s = n.series, - p = n.mouse.position, + p = n.mouse.position, m = n.mouse.margin, x = n.x, y = n.y, @@ -5228,7 +5228,7 @@ Flotr.addPlugin('hit', { }, radius = (Math.min(this.canvasWidth, this.canvasHeight) * s.pie.sizeRatio), // EspoCRM fix line bisection = n.sAngle this.plotHeight * 3 / 4) { @@ -5249,6 +5255,11 @@ Flotr.addPlugin('hit', { } else { p = 'n'; } + + if (n.y < 0 && this.plotHeight - n.yaxis.d2p(n.y) > this.plotHeight * 1 / 4) { + p = 's'; + } + if (this.plotWidth - n.xaxis.d2p(n.x) < 42) { p += 'w;' } @@ -5308,7 +5319,7 @@ Flotr.addPlugin('hit', { }); })(); -/** +/** * Selection Handles Plugin * * @@ -5450,14 +5461,14 @@ Flotr.addPlugin('selection', { selX = options.selection.mode.indexOf('x') != -1, selY = options.selection.mode.indexOf('y') != -1, s = this.selection.selection; - + this.selection.clearSelection(); s.first.y = boundY((selX && !selY) ? 0 : (ya.max - area.y1) * vertScale, this); s.second.y = boundY((selX && !selY) ? this.plotHeight - 1: (ya.max - area.y2) * vertScale, this); s.first.x = boundX((selY && !selX) ? 0 : (area.x1 - xa.min) * hozScale, this); s.second.x = boundX((selY && !selX) ? this.plotWidth : (area.x2 - xa.min) * hozScale, this); - + this.selection.drawSelection(); if (!preventEvent) this.selection.fireSelectEvent(); @@ -5473,7 +5484,7 @@ Flotr.addPlugin('selection', { selection = this.selection.selection; if(mode.indexOf('x') == -1) { - pos.x = (pos == selection.first) ? 0 : this.plotWidth; + pos.x = (pos == selection.first) ? 0 : this.plotWidth; }else{ pos.x = boundX(pointer.relX, this); } @@ -5496,10 +5507,10 @@ Flotr.addPlugin('selection', { options = this.options, plotOffset = this.plotOffset, prevSelection = this.selection.prevSelection; - + if (prevSelection && s.first.x == prevSelection.first.x && - s.first.y == prevSelection.first.y && + s.first.y == prevSelection.first.y && s.second.x == prevSelection.second.x && s.second.y == prevSelection.second.y) { return; @@ -5545,7 +5556,7 @@ Flotr.addPlugin('selection', { } this.selection.clearSelection(); - + if(this.selection.selectionIsSane()) { this.selection.drawSelection(); } @@ -5556,7 +5567,7 @@ Flotr.addPlugin('selection', { */ clearSelection: function() { if (!this.selection.prevSelection) return; - + var prevSelection = this.selection.prevSelection, lw = 1, plotOffset = this.plotOffset, @@ -5564,12 +5575,12 @@ Flotr.addPlugin('selection', { y = Math.min(prevSelection.first.y, prevSelection.second.y), w = Math.abs(prevSelection.second.x - prevSelection.first.x), h = Math.abs(prevSelection.second.y - prevSelection.first.y); - + this.octx.clearRect(x + plotOffset.left - lw + 0.5, y + plotOffset.top - lw, w + 2 * lw + 0.5, h + 2 * lw + 0.5); - + this.selection.prevSelection = null; }, /** @@ -5578,7 +5589,7 @@ Flotr.addPlugin('selection', { */ selectionIsSane: function(){ var s = this.selection.selection; - return Math.abs(s.second.x - s.first.x) >= 5 || + return Math.abs(s.second.x - s.first.x) >= 5 || Math.abs(s.second.y - s.first.y) >= 5; } @@ -5637,7 +5648,7 @@ Flotr.addPlugin('labels', { drawLabelNoHtmlText(this, a.x2, 'center', 'bottom'); drawLabelNoHtmlText(this, a.y, 'right', 'middle'); drawLabelNoHtmlText(this, a.y2, 'left', 'middle'); - + } else if (( a.x.options.showLabels || a.x2.options.showLabels || @@ -5801,7 +5812,7 @@ Flotr.addPlugin('labels', { axis.options.color ? ('color:' + axis.options.color + '; ') : ' ', '" class="flotr-grid-label' + name + '">' + tick.label + '' ].join(' '); - + if (!isX && !isFirst) { ctx.moveTo(offset.left + graph.plotWidth - 8, offset.top + axis.d2p(tick.v)); ctx.lineTo(offset.left + graph.plotWidth, offset.top + axis.d2p(tick.v)); @@ -5860,10 +5871,10 @@ Flotr.addPlugin('legend', { options = this.options, legend = options.legend, fragments = [], - rowStarted = false, + rowStarted = false, ctx = this.ctx, itemCount = _.filter(series, function(s) {return (s.label && !s.hide);}).length, - p = legend.position, + p = legend.position, m = legend.margin, opacity = legend.backgroundOpacity, i, label, color; @@ -5897,11 +5908,11 @@ Flotr.addPlugin('legend', { } if (!options.HtmlText && this.textEnabled && !legend.container) { - + if(p.charAt(0) == 's') offsetY = plotOffset.top + this.plotHeight - (m + legendHeight); if(p.charAt(0) == 'c') offsetY = plotOffset.top + (this.plotHeight/2) - (m + (legendHeight/2)); if(p.charAt(1) == 'e') offsetX = plotOffset.left + this.plotWidth - (m + legendWidth); - + // Legend box color = this.processColor(legend.backgroundColor, { opacity : opacity }); @@ -5909,31 +5920,31 @@ Flotr.addPlugin('legend', { ctx.fillRect(offsetX, offsetY, legendWidth, legendHeight); ctx.strokeStyle = legend.labelBoxBorderColor; ctx.strokeRect(Flotr.toPixel(offsetX), Flotr.toPixel(offsetY), legendWidth, legendHeight); - + // Legend labels var x = offsetX + lbm; var y = offsetY + lbm; for(i = 0; i < series.length; i++){ if(!series[i].label || series[i].hide) continue; label = legend.labelFormatter(series[i].label); - + ctx.fillStyle = series[i].color; ctx.fillRect(x, y, lbw-1, lbh-1); - + ctx.strokeStyle = legend.labelBoxBorderColor; ctx.lineWidth = 1; ctx.strokeRect(Math.ceil(x)-1.5, Math.ceil(y)-1.5, lbw+2, lbh+2); - + // Legend text Flotr.drawText(ctx, label, x + lbw + lbm, y + lbh, style); - + y += lbh + lbm; } } else { for(i = 0; i < series.length; ++i){ if(!series[i].label || series[i].hide) continue; - + if(i % legend.noColumns === 0){ fragments.push(rowStarted ? '' : ''); rowStarted = true; @@ -5945,7 +5956,7 @@ Flotr.addPlugin('legend', { label = legend.labelFormatter(s.label); color = 'background-color:' + ((s.bars && s.bars.show && s.bars.fillColor && s.bars.fill) ? s.bars.fillColor : s.color) + ';'; - + fragments.push( '', '
', @@ -5958,7 +5969,7 @@ Flotr.addPlugin('legend', { ); } if(rowStarted) fragments.push(''); - + if(fragments.length > 0){ var table = '' + fragments.join('') + '
'; if(legend.container){ @@ -5980,7 +5991,7 @@ Flotr.addPlugin('legend', { D.setStyles(div, styles); D.insert(div, table); D.insert(this.el, div); - + if (!opacity) return; var c = legend.backgroundColor || options.grid.backgroundColor || '#ffffff'; @@ -6048,9 +6059,9 @@ Flotr.addPlugin('spreadsheet', { 'flotr:afterconstruct': function(){ // @TODO necessary? //this.el.select('.flotr-tabs-group,.flotr-datagrid-container').invoke('remove'); - + if (!this.options.spreadsheet.show) return; - + var ss = this.spreadsheet, container = D.node('
'), graph = D.node('
'+this.options.spreadsheet.tabGraphLabel+'
'), @@ -6121,12 +6132,12 @@ Flotr.addPlugin('spreadsheet', { constructDataGrid: function(){ // If the data grid has already been built, nothing to do here if (this.spreadsheet.datagrid) return this.spreadsheet.datagrid; - + var s = this.series, datagrid = this.spreadsheet.loadDataGrid(), colgroup = [''], buttonDownload, buttonSelect, t; - + // First row : series' labels var html = ['']; html.push(''); @@ -6206,7 +6217,7 @@ Flotr.addPlugin('spreadsheet', { this.spreadsheet.container = container; return t; - }, + }, /** * Shows the specified tab, by its name * @todo make a tab manager (Flotr.Tabs) @@ -6242,19 +6253,19 @@ Flotr.addPlugin('spreadsheet', { var selection, range, doc, win, node = this.spreadsheet.constructDataGrid(); this.spreadsheet.showTab('data'); - + // deferred to be able to select the table setTimeout(function () { - if ((doc = node.ownerDocument) && (win = doc.defaultView) && - win.getSelection && doc.createRange && - (selection = window.getSelection()) && + if ((doc = node.ownerDocument) && (win = doc.defaultView) && + win.getSelection && doc.createRange && + (selection = window.getSelection()) && selection.removeAllRanges) { range = doc.createRange(); range.selectNode(node); selection.removeAllRanges(); selection.addRange(range); } - else if (document.body && document.body.createTextRange && + else if (document.body && document.body.createTextRange && (range = document.body.createTextRange())) { range.moveToElementText(node); range.select(); @@ -6273,18 +6284,18 @@ Flotr.addPlugin('spreadsheet', { options = this.options, dg = this.spreadsheet.loadDataGrid(), separator = encodeURIComponent(options.spreadsheet.csvFileSeparator); - + if (options.spreadsheet.decimalSeparator === options.spreadsheet.csvFileSeparator) { throw "The decimal separator is the same as the column separator ("+options.spreadsheet.decimalSeparator+")"; } - + // The first row _.each(series, function(serie, i){ csv += separator+'"'+(serie.label || String.fromCharCode(65+i)).replace(/\"/g, '\\"')+'"'; }); csv += "%0D%0A"; // \r\n - + // For each row csv += _.reduce(dg, function(memo, row){ var rowLabel = getRowLabel.call(this, row[0]) || ''; @@ -6324,40 +6335,40 @@ Flotr.addPlugin('titles', { margin = options.grid.labelMargin, ctx = this.ctx, a = this.axes; - + if (!options.HtmlText && this.textEnabled) { var style = { size: options.fontSize, color: options.grid.color, textAlign: 'center' }; - + // Add subtitle if (options.subtitle){ Flotr.drawText( ctx, options.subtitle, - this.plotOffset.left + this.plotWidth/2, + this.plotOffset.left + this.plotWidth/2, this.titleHeight + this.subtitleHeight - 2, style ); } - + style.weight = 1.5; style.size *= 1.5; - + // Add title if (options.title){ Flotr.drawText( ctx, options.title, - this.plotOffset.left + this.plotWidth/2, + this.plotOffset.left + this.plotWidth/2, this.titleHeight - 2, style ); } - + style.weight = 1.8; style.size *= 0.8; - + // Add x axis title if (a.x.options.title && a.x.used){ style.textAlign = a.x.options.titleAlign || 'center'; @@ -6366,12 +6377,12 @@ Flotr.addPlugin('titles', { style = Flotr.getBestTextAlign(style.angle, style); Flotr.drawText( ctx, a.x.options.title, - this.plotOffset.left + this.plotWidth/2, + this.plotOffset.left + this.plotWidth/2, this.plotOffset.top + a.x.maxLabel.height + this.plotHeight + 2 * margin, style ); } - + // Add x2 axis title if (a.x2.options.title && a.x2.used){ style.textAlign = a.x2.options.titleAlign || 'center'; @@ -6380,12 +6391,12 @@ Flotr.addPlugin('titles', { style = Flotr.getBestTextAlign(style.angle, style); Flotr.drawText( ctx, a.x2.options.title, - this.plotOffset.left + this.plotWidth/2, + this.plotOffset.left + this.plotWidth/2, this.plotOffset.top - a.x2.maxLabel.height - 2 * margin, style ); } - + // Add y axis title if (a.y.options.title && a.y.used){ style.textAlign = a.y.options.titleAlign || 'right'; @@ -6394,12 +6405,12 @@ Flotr.addPlugin('titles', { style = Flotr.getBestTextAlign(style.angle, style); Flotr.drawText( ctx, a.y.options.title, - this.plotOffset.left - a.y.maxLabel.width - 2 * margin, + this.plotOffset.left - a.y.maxLabel.width - 2 * margin, this.plotOffset.top + this.plotHeight / 2, style ); } - + // Add y2 axis title if (a.y2.options.title && a.y2.used){ style.textAlign = a.y2.options.titleAlign || 'left'; @@ -6408,72 +6419,72 @@ Flotr.addPlugin('titles', { style = Flotr.getBestTextAlign(style.angle, style); Flotr.drawText( ctx, a.y2.options.title, - this.plotOffset.left + this.plotWidth + a.y2.maxLabel.width + 2 * margin, + this.plotOffset.left + this.plotWidth + a.y2.maxLabel.width + 2 * margin, this.plotOffset.top + this.plotHeight / 2, style ); } - } + } else { html = []; - + // Add title if (options.title) html.push( - '
', options.title, '
' ); - + // Add subtitle if (options.subtitle) html.push( - '
', options.subtitle, '
' ); html.push(''); - + html.push('
'); - + // Add x axis title if (a.x.options.title && a.x.used) html.push( - '
', a.x.options.title, '
' ); - + // Add x2 axis title if (a.x2.options.title && a.x2.used) html.push( - '
', a.x2.options.title, '
' ); - + // Add y axis title if (a.y.options.title && a.y.used) html.push( - '
', a.y.options.title, '
' ); - + // Add y2 axis title if (a.y2.options.title && a.y2.used) html.push( - '
', a.y2.options.title, '
' ); - + html = html.join(''); var div = D.create('div'); D.setStyles({ - color: options.grid.color + color: options.grid.color }); div.className = 'flotr-titles'; D.insert(this.el, div); diff --git a/install/core/SystemHelper.php b/install/core/SystemHelper.php index ac6a9d5a3f..bb717957a0 100644 --- a/install/core/SystemHelper.php +++ b/install/core/SystemHelper.php @@ -82,12 +82,24 @@ class SystemHelper extends \Espo\Core\Utils\System public function getBaseUrl() { - $pageUrl = ($_SERVER["HTTPS"] == 'on') ? 'https://' : 'http://'; + $pageUrl = 'http://'; - if ($_SERVER["SERVER_PORT"] != "80") { - $pageUrl .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; - } else { + if (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https') { + $pageUrl = 'https://'; + } + + if (isset($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == 'on') { + $pageUrl = 'https://'; + } + + if ($_SERVER["SERVER_PORT"] == '443') { + $pageUrl = 'https://'; + } + + if (in_array($_SERVER["SERVER_PORT"], ['80', '443'])) { $pageUrl .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; + } else { + $pageUrl .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } $baseUrl = str_ireplace('/install/index.php', '', $pageUrl); diff --git a/install/core/tpl/setupConfirmation.tpl b/install/core/tpl/setupConfirmation.tpl index cd1236fb8d..4519a478bb 100644 --- a/install/core/tpl/setupConfirmation.tpl +++ b/install/core/tpl/setupConfirmation.tpl @@ -13,10 +13,10 @@ {foreach from=$phpRequirementList key=name item=value}
@@ -41,10 +41,10 @@ {foreach from=$mysqlRequirementList key=name item=value} @@ -68,10 +68,10 @@ {foreach from=$permissionRequirementList key=name item=value} diff --git a/install/vendor/smarty/libs/sysplugins/smarty_internal_compilebase.php b/install/vendor/smarty/libs/sysplugins/smarty_internal_compilebase.php index 8f142e250c..487482280b 100644 --- a/install/vendor/smarty/libs/sysplugins/smarty_internal_compilebase.php +++ b/install/vendor/smarty/libs/sysplugins/smarty_internal_compilebase.php @@ -72,30 +72,31 @@ abstract class Smarty_Internal_CompileBase } // named attribute } else { - $kv = each($mixed); - // option flag? - if (in_array($kv['key'], $this->option_flags)) { - if (is_bool($kv['value'])) { - $_indexed_attr[$kv['key']] = $kv['value']; - } elseif (is_string($kv['value']) && in_array(trim($kv['value'], '\'"'), array('true', 'false'))) { - if (trim($kv['value']) == 'true') { - $_indexed_attr[$kv['key']] = true; + foreach ($mixed as $k => $v) { + // option flag? + if (in_array($k, $this->option_flags)) { + if (is_bool($v)) { + $_indexed_attr[$k] = $v; + } elseif (is_string($v) && in_array(trim($v, '\'"'), array('true', 'false'))) { + if (trim($v) == 'true') { + $_indexed_attr[$k] = true; + } else { + $_indexed_attr[$k] = false; + } + } elseif (is_numeric($v) && in_array($v, array(0, 1))) { + if ($v == 1) { + $_indexed_attr[$k] = true; + } else { + $_indexed_attr[$k] = false; + } } else { - $_indexed_attr[$kv['key']] = false; - } - } elseif (is_numeric($kv['value']) && in_array($kv['value'], array(0, 1))) { - if ($kv['value'] == 1) { - $_indexed_attr[$kv['key']] = true; - } else { - $_indexed_attr[$kv['key']] = false; + $compiler->trigger_template_error("illegal value of option flag \"{$k}\"", $compiler->lex->taglineno); } + // must be named attribute } else { - $compiler->trigger_template_error("illegal value of option flag \"{$kv['key']}\"", $compiler->lex->taglineno); + reset($mixed); + $_indexed_attr[key($mixed)] = $mixed[key($mixed)]; } - // must be named attribute - } else { - reset($mixed); - $_indexed_attr[key($mixed)] = $mixed[key($mixed)]; } } }
 
- {if $langs['systemRequirements'][$name] eq ''} - {$name} + {if isset($langs['systemRequirements'][$name])} + {$langs['systemRequirements'][{$name}]} {else} - {$langs['systemRequirements'][{$name}]} + {$name} {/if} {$value['actual']}
- {if $langs['systemRequirements'][$name] eq ''} - {$name} + {if isset($langs['systemRequirements'][$name])} + {$langs['systemRequirements'][{$name}]} {else} - {$langs['systemRequirements'][{$name}]} + {$name} {/if} {$value['actual']}
- {if $langs['systemRequirements'][$name] eq ''} - {$name} + {if isset($langs['systemRequirements'][$name])} + {$langs['systemRequirements'][{$name}]} {else} - {$langs['systemRequirements'][{$name}]} + {$name} {/if} {$langs['systemRequirements'][{$value['type']}]}