diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index aa509db4f..25ea36fad 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -109,7 +109,8 @@ goback: { url: 'http://...', text: 'Go to London', - blank: true + blank: true, + requestClose: false // if true - goback send onRequestClose event instead opening url }, chat: true, comments: true, diff --git a/apps/common/main/lib/component/DimensionPicker.js b/apps/common/main/lib/component/DimensionPicker.js index dab30a9d2..c508a90e9 100644 --- a/apps/common/main/lib/component/DimensionPicker.js +++ b/apps/common/main/lib/component/DimensionPicker.js @@ -47,31 +47,6 @@ define([ 'use strict'; Common.UI.DimensionPicker = Common.UI.BaseView.extend((function(){ - var me, - rootEl, - areaMouseCatcher, - areaUnHighLighted, - areaHighLighted, - areaStatus, - curColumns = 0, - curRows = 0; - - var onMouseMove = function(event){ - me.setTableSize( - Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize), - Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize), - event - ); - }; - - var onMouseLeave = function(event){ - me.setTableSize(0, 0, event); - }; - - var onHighLightedMouseClick = function(e){ - me.trigger('select', me, curColumns, curRows, e); - }; - return { options: { itemSize : 18, @@ -95,9 +70,13 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - me = this; + var me = this; - rootEl = me.$el || $(this.el); + this.render(); + + this.cmpEl = me.$el || $(this.el); + + var rootEl = this.cmpEl; me.itemSize = me.options.itemSize; me.minRows = me.options.minRows; @@ -105,31 +84,48 @@ define([ me.maxRows = me.options.maxRows; me.maxColumns = me.options.maxColumns; - this.render(); + me.curColumns = 0; + me.curRows = 0; + + var onMouseMove = function(event){ + me.setTableSize( + Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize), + Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize), + event + ); + }; + + var onMouseLeave = function(event){ + me.setTableSize(0, 0, event); + }; + + var onHighLightedMouseClick = function(e){ + me.trigger('select', me, me.curColumns, me.curRows, e); + }; if (rootEl){ - areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher'); - areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted'); - areaHighLighted = rootEl.find('.dimension-picker-highlighted'); - areaStatus = rootEl.find('.dimension-picker-status'); + var areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher'); + me.areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted'); + me.areaHighLighted = rootEl.find('.dimension-picker-highlighted'); + me.areaStatus = rootEl.find('.dimension-picker-status'); rootEl.css({width: me.minColumns + 'em'}); areaMouseCatcher.css('z-index', 1); areaMouseCatcher.width(me.maxColumns + 'em').height(me.maxRows + 'em'); - areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em'); - areaStatus.html(curColumns + ' x ' + curRows); - areaStatus.width(areaUnHighLighted.width()); - } + me.areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em'); + me.areaStatus.html(me.curColumns + ' x ' + me.curRows); + me.areaStatus.width(me.areaUnHighLighted.width()); - areaMouseCatcher.on('mousemove', onMouseMove); - areaHighLighted.on('mousemove', onMouseMove); - areaUnHighLighted.on('mousemove', onMouseMove); - areaMouseCatcher.on('mouseleave', onMouseLeave); - areaHighLighted.on('mouseleave', onMouseLeave); - areaUnHighLighted.on('mouseleave', onMouseLeave); - areaMouseCatcher.on('click', onHighLightedMouseClick); - areaHighLighted.on('click', onHighLightedMouseClick); - areaUnHighLighted.on('click', onHighLightedMouseClick); + areaMouseCatcher.on('mousemove', onMouseMove); + me.areaHighLighted.on('mousemove', onMouseMove); + me.areaUnHighLighted.on('mousemove', onMouseMove); + areaMouseCatcher.on('mouseleave', onMouseLeave); + me.areaHighLighted.on('mouseleave', onMouseLeave); + me.areaUnHighLighted.on('mouseleave', onMouseLeave); + areaMouseCatcher.on('click', onHighLightedMouseClick); + me.areaHighLighted.on('click', onHighLightedMouseClick); + me.areaUnHighLighted.on('click', onHighLightedMouseClick); + } }, render: function() { @@ -142,38 +138,38 @@ define([ if (columns > this.maxColumns) columns = this.maxColumns; if (rows > this.maxRows) rows = this.maxRows; - if (curColumns != columns || curRows != rows){ - curColumns = columns; - curRows = rows; + if (this.curColumns != columns || this.curRows != rows){ + this.curColumns = columns; + this.curRows = rows; - areaHighLighted.width(curColumns + 'em').height(curRows + 'em'); - areaUnHighLighted.width( - ((curColumns < me.minColumns) - ? me.minColumns - : ((curColumns + 1 > me.maxColumns) - ? me.maxColumns - : curColumns + 1)) + 'em' - ).height(((curRows < me.minRows) - ? me.minRows - : ((curRows + 1 > me.maxRows) - ? me.maxRows - : curRows + 1)) + 'em' + this.areaHighLighted.width(this.curColumns + 'em').height(this.curRows + 'em'); + this.areaUnHighLighted.width( + ((this.curColumns < this.minColumns) + ? this.minColumns + : ((this.curColumns + 1 > this.maxColumns) + ? this.maxColumns + : this.curColumns + 1)) + 'em' + ).height(((this.curRows < this.minRows) + ? this.minRows + : ((this.curRows + 1 > this.maxRows) + ? this.maxRows + : this.curRows + 1)) + 'em' ); - rootEl.width(areaUnHighLighted.width()); - areaStatus.html(curColumns + ' x ' + curRows); - areaStatus.width(areaUnHighLighted.width()); + this.cmpEl.width(this.areaUnHighLighted.width()); + this.areaStatus.html(this.curColumns + ' x ' + this.curRows); + this.areaStatus.width(this.areaUnHighLighted.width()); - me.trigger('change', me, curColumns, curRows, event); + this.trigger('change', this, this.curColumns, this.curRows, event); } }, getColumnsCount: function() { - return curColumns; + return this.curColumns; }, getRowsCount: function() { - return curRows; + return this.curRows; } } })()) diff --git a/apps/common/main/lib/view/InsertTableDialog.js b/apps/common/main/lib/view/InsertTableDialog.js index b4b65d017..a9d1e8501 100644 --- a/apps/common/main/lib/view/InsertTableDialog.js +++ b/apps/common/main/lib/view/InsertTableDialog.js @@ -110,8 +110,8 @@ define([ onBtnClick: function(event) { if (this.options.handler) { this.options.handler.call(this, event.currentTarget.attributes['result'].value, { - columns : this.udColumns.getValue(), - rows : this.udRows.getValue() + columns : this.udColumns.getNumberValue(), + rows : this.udRows.getNumberValue() }); } @@ -121,8 +121,8 @@ define([ onPrimary: function() { if (this.options.handler) { this.options.handler.call(this, 'ok', { - columns : this.udColumns.getValue(), - rows : this.udRows.getValue() + columns : this.udColumns.getNumberValue(), + rows : this.udRows.getNumberValue() }); } diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index db428d1c5..877d5a0dc 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -75,7 +75,7 @@ DE.ApplicationController = new(function(){ $('#editor_sdk').addClass('top'); } - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) { + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) { $('#id-btn-close').hide(); // Hide last separator @@ -266,8 +266,12 @@ DE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#id-btn-zoom-in').on('click', api.zoomIn.bind(this)); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e321b5a20..69fdffc12 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -341,9 +341,10 @@ define([ this.appOptions.mergeFolderUrl = this.editorConfig.mergeFolderUrl; this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; this.appOptions.canAnalytics = false; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; @@ -648,11 +649,16 @@ define([ goBack: function(current) { if ( !Common.Controllers.Desktop.process('goback') ) { - var href = this.appOptions.customization.goback.url; - if (!current && this.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (!current && this.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -1155,7 +1161,6 @@ define([ this.appOptions.isOffline = this.api.asc_isOffline(); this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false; this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index d0717940b..562e7557d 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -105,10 +105,10 @@ define([ updateMetricUnit: function() { var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); }, createDelayedControls: function() { @@ -316,13 +316,13 @@ define([ value = props.get_Width(); if ( Math.abs(this._state.Width-value)>0.001 ) { - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Width = value; } value = props.get_Height(); if ( Math.abs(this._state.Height-value)>0.001 ) { - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -396,8 +396,8 @@ define([ var w = imgsize.get_ImageWidth(); var h = imgsize.get_ImageHeight(); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); @@ -428,8 +428,8 @@ define([ h = pageh; } - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index f1d2b0df2..ed6b2cc54 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -210,9 +210,10 @@ define([ me.appOptions.fileChoiceUrl = me.editorConfig.fileChoiceUrl; me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl; me.appOptions.canAnalytics = false; + me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.customization = me.editorConfig.customization; - me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') - && (typeof (me.editorConfig.customization.goback) == 'object') && !_.isEmpty(me.editorConfig.customization.goback.url); + me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose); me.appOptions.canBack = me.appOptions.canBackToFolder === true; me.appOptions.canPlugins = false; me.plugins = me.editorConfig.plugins; @@ -335,11 +336,15 @@ define([ }, goBack: function(current) { - var href = this.appOptions.customization.goback.url; - if (!current && this.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { + Common.Gateway.requestClose(); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (!current && this.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } }, @@ -730,7 +735,6 @@ define([ me.appOptions.isOffline = me.api.asc_isOffline(); me.appOptions.isReviewOnly = (me.permissions.review === true) && (me.permissions.edit === false); me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; - me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.canEdit = (me.permissions.edit !== false || me.permissions.review === true) && // can edit or review (me.editorConfig.canRequestEditRights || me.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!me.appOptions.isReviewOnly || me.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index d5ed2de7f..9821de2ce 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -51,8 +51,7 @@ define([ DE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private - var _backUrl, - stateDisplayMode = false; + var stateDisplayMode = false; return { models: [], @@ -67,9 +66,7 @@ define([ loadConfig: function (data) { if (data && data.config && data.config.canBackToFolder !== false && - data.config.customization && data.config.customization.goback && data.config.customization.goback.url) { - _backUrl = data.config.customization.goback.url; - + data.config.customization && data.config.customization.goback && (data.config.customization.goback.url || data.config.customization.goback.requestClose && data.config.canRequestClose)) { $('#document-back').show().single('click', _.bind(this.onBack, this)); } }, @@ -116,7 +113,7 @@ define([ { text: me.leaveButtonText, onClick: function() { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } }, { @@ -126,7 +123,7 @@ define([ ] }); } else { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } }, diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 241309afe..82d02a8e7 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -76,7 +76,7 @@ PE.ApplicationController = new(function(){ $('#editor_sdk').addClass('top'); } - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) { + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) { $('#id-btn-close').hide(); // Hide last separator @@ -310,8 +310,12 @@ PE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#btn-left').on('click', function(){ diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 1ed674d98..ea331031d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -310,9 +310,10 @@ define([ this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.canAnalytics = false; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; @@ -447,11 +448,16 @@ define([ goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { - var href = me.appOptions.customization.goback.url; - if (!current && me.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = me.appOptions.customization.goback.url; + if (!current && me.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -899,7 +905,6 @@ define([ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; /** coauthoring end **/ this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = this.permissions.edit !== false && // can edit (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 51a8dabca..4fb7c0db0 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -102,10 +102,10 @@ define([ updateMetricUnit: function() { var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); }, createDelayedControls: function() { @@ -249,13 +249,13 @@ define([ var value = props.get_Width(); if ( Math.abs(this._state.Width-value)>0.001 ) { - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Width = value; } value = props.get_Height(); if ( Math.abs(this._state.Height-value)>0.001 ) { - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -291,8 +291,8 @@ define([ var w = imgsize.get_ImageWidth(); var h = imgsize.get_ImageHeight(); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 8f5562b69..74a1a9c23 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -209,9 +209,10 @@ define([ me.appOptions.fileChoiceUrl = me.editorConfig.fileChoiceUrl; me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl; me.appOptions.canAnalytics = false; + me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.customization = me.editorConfig.customization; - me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') - && (typeof (me.editorConfig.customization.goback) == 'object') && !_.isEmpty(me.editorConfig.customization.goback.url); + me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose); me.appOptions.canBack = me.appOptions.canBackToFolder === true; me.appOptions.canPlugins = false; me.plugins = me.editorConfig.plugins; @@ -322,11 +323,15 @@ define([ }, goBack: function(current) { - var href = this.appOptions.customization.goback.url; - if (!current && this.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { + Common.Gateway.requestClose(); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (!current && this.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } }, @@ -662,7 +667,6 @@ define([ me.appOptions.isOffline = me.api.asc_isOffline(); me.appOptions.isReviewOnly = (me.permissions.review === true) && (me.permissions.edit === false); me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; - me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.canEdit = (me.permissions.edit !== false || me.permissions.review === true) && // can edit or review (me.editorConfig.canRequestEditRights || me.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!me.appOptions.isReviewOnly || me.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true diff --git a/apps/presentationeditor/mobile/app/controller/Toolbar.js b/apps/presentationeditor/mobile/app/controller/Toolbar.js index e9f6a53a0..7c6a829db 100644 --- a/apps/presentationeditor/mobile/app/controller/Toolbar.js +++ b/apps/presentationeditor/mobile/app/controller/Toolbar.js @@ -51,7 +51,6 @@ define([ PE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private - var _backUrl; return { models: [], @@ -66,9 +65,7 @@ define([ loadConfig: function (data) { if (data && data.config && data.config.canBackToFolder !== false && - data.config.customization && data.config.customization.goback && data.config.customization.goback.url) { - _backUrl = data.config.customization.goback.url; - + data.config.customization && data.config.customization.goback && (data.config.customization.goback.url || data.config.customization.goback.requestClose && data.config.canRequestClose)) { $('#document-back').show().single('click', _.bind(this.onBack, this)); } }, @@ -115,7 +112,7 @@ define([ { text: me.leaveButtonText, onClick: function() { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } }, { @@ -125,7 +122,7 @@ define([ ] }); } else { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } }, diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 39c8a3600..7789a9243 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -68,7 +68,7 @@ SSE.ApplicationController = new(function(){ common.controller.modals.init(embedConfig); - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) $('#id-btn-close').hide(); // Docked toolbar @@ -211,8 +211,12 @@ SSE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#id-btn-zoom-in').on('click', function () { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 299b873f9..59b437fb8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -326,9 +326,10 @@ define([ this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram'; this.appOptions.isEditMailMerge = this.editorConfig.mode == 'editmerge'; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; @@ -477,11 +478,16 @@ define([ goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { - var href = me.appOptions.customization.goback.url; - if (!current && me.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = me.appOptions.customization.goback.url; + if (!current && me.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -950,7 +956,6 @@ define([ this.appOptions.canModifyFilter = true; this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = this.permissions.edit !== false && // can edit (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; diff --git a/apps/spreadsheeteditor/main/app/template/CellSettings.template b/apps/spreadsheeteditor/main/app/template/CellSettings.template index bcafb045b..be422118a 100644 --- a/apps/spreadsheeteditor/main/app/template/CellSettings.template +++ b/apps/spreadsheeteditor/main/app/template/CellSettings.template @@ -29,30 +29,19 @@
- -
+ +
-
-
- -
-
-
-
-
-
-
- -
-
-
-
+ +
+
+
diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index bc7e5bf88..093a991f5 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -78,8 +78,7 @@ define([ FillType: Asc.c_oAscFill.FILL_TYPE_SOLID, FGColor: '000000', BGColor: 'ffffff', - GradColor1: '000000', - GradColor2: 'ffffff' + GradColor: '000000' }; this.lockedControls = []; this._locked = true; @@ -88,7 +87,7 @@ define([ this.GradFillType = Asc.c_oAscFillGradType.GRAD_LINEAR; this.GradLinearDirectionType = 0; this.GradRadialDirectionIdx = 0; - this.GradColors = []; + this.GradColor = { values: [0, 100], colors: ['000000', 'ffffff'], currentIdx: 0}; this.fillControls = []; @@ -192,7 +191,21 @@ define([ this.fillControls.push(this.cmbFillSrc); this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); - this._arrGradType = [ + this.numGradientAngle = new Common.UI.MetricSpinner({ + el: $('#cell-spin-gradient-angle'), + step: 1, + width: 90, + defaultUnit : "°", + value: '0 °', + allowDecimal: true, + maxValue: 359.9, + minValue: 0, + disabled: this._locked + }); + this.lockedControls.push(this.numGradientAngle); + this.numGradientAngle.on('change', _.bind(this.onGradientAngleChange, this)); + + /*this._arrGradType = [ {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} ]; @@ -206,7 +219,7 @@ define([ }); this.cmbGradType.setValue(this._arrGradType[0].value); this.fillControls.push(this.cmbGradType); - this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));*/ this._viewDataLinear = [ { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, @@ -219,10 +232,6 @@ define([ { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} ]; - this._viewDataRadial = [ - { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} - ]; - this.btnDirection = new Common.UI.Button({ cls : 'btn-large-dataview', iconCls : 'item-gradient gradient-left', @@ -247,6 +256,48 @@ define([ this.fillControls.push(this.btnDirection); this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#cell-slider-gradient'), + width: 125, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){ + var colors = [], + currentIdx; + _.each (recalc_indexes, function(recalc_index, index) { + colors.push(me.GradColor.colors[recalc_index]); + if (me.GradColor.currentIdx == recalc_index) + currentIdx = index; + }); + me.OriginalFillType = null; + me.GradColor.colors = colors; + me.GradColor.currentIdx = currentIdx; + }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); + this.fillControls.push(this.sldrGradient); + this.cmbPattern = new Common.UI.ComboDataView({ itemWidth: 28, itemHeight: 28, @@ -418,8 +469,13 @@ define([ this.CellColor = {Value: 0, Color: 'transparent'}; this.FGColor = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; this.BGColor = {Value: 1, Color: 'ffffff'}; - this.GradColors[0] = {Value: 1, Color: {color: '4f81bd', effectId: 24}, Position: 0}; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.colors[0] = {color: '4f81bd', effectId: 24}; + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.values = [0, 100]; + this.GradColor.currentIdx = 0; } else if (this.pattern !== null) { if (this.pattern.asc_getType() === -1) { var color = this.pattern.asc_getFgColor(); @@ -437,18 +493,19 @@ define([ Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()) }; } - this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; this.FGColor = { Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color) }; this.BGColor = {Value: 1, Color: 'ffffff'}; - this.GradColors[0] = { - Value: 1, - Color: Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color), - Position: 0 - }; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.values = [0, 100]; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color); + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.currentIdx = 0; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; } else { this.PatternFillType = this.pattern.asc_getType(); if (this._state.PatternFillType !== this.PatternFillType) { @@ -501,19 +558,20 @@ define([ Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color) }; - this.GradColors[0] = { - Value: 1, - Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color), - Position: 0 - }; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.values = [0, 100]; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color); + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.currentIdx = 0; this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_PATT; } } else if (this.gradient !== null) { var gradFillType = this.gradient.asc_getType(); if (this._state.GradFillType !== gradFillType || this.GradFillType !== gradFillType) { this.GradFillType = gradFillType; - rec = undefined; + /*rec = undefined; if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR || this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { this.cmbGradType.setValue(this.GradFillType); rec = this.cmbGradType.store.findWhere({value: this.GradFillType}); @@ -521,7 +579,7 @@ define([ } else { this.cmbGradType.setValue(''); this.btnDirection.setIconCls(''); - } + }*/ this._state.GradFillType = this.GradFillType; } if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { @@ -534,45 +592,45 @@ define([ this.btnDirection.setIconCls('item-gradient ' + record.get('iconcls')); else this.btnDirection.setIconCls(''); + this.numGradientAngle.setValue(value); } } + var me = this; + + var gradientStops; - this.GradColors.length = 0; gradientStops = this.gradient.asc_getGradientStops(); + var length = gradientStops.length; + this.sldrGradient.setThumbs(length); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; gradientStops.forEach(function (color) { var clr = color.asc_getColor(), - position = color.asc_getPosition(), - itemColor; - if (clr.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - itemColor = { - Value: 1, - Color: { - color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), - effectValue: clr.asc_getValue() - }, - Position: position - }; - } else { - itemColor = { - Value: 1, - Color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), - Position: position - }; - } - me.GradColors.push(itemColor); + position = color.asc_getPosition(); + me.GradColor.colors.push( clr.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME ? + {color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), effectValue: clr.asc_getValue()} : + Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB())); + me.GradColor.values.push(position*100); }); - this.GradColors = _.sortBy(this.GradColors, 'Position'); + for (var index=0; index= me.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = { Value: 1, - Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColors[0].Color) + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0]) }; this.BGColor = {Value: 1, Color: 'ffffff'}; this.CellColor = { Value: 1, - Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColors[0].Color) + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0]) }; } @@ -657,60 +715,29 @@ define([ } // Gradient colors - var gradColor1 = this.GradColors[0]; - if (!gradColor1) { - gradColor1 = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; - } - type1 = typeof (gradColor1.Color); - type2 = typeof (this._state.GradColor1); + var gradColor = this.GradColor.colors[this.GradColor.currentIdx]; + type1 = typeof (gradColor); + type2 = typeof (this._state.GradColor); if ((type1 !== type2) || (type1 == 'object' && - (gradColor1.Color.effectValue !== this._state.GradColor1.effectValue || this._state.GradColor1.color.indexOf(gradColor1.Color.color) < 0)) || - (type1 != 'object' && this._state.GradColor1.indexOf(gradColor1.Color) < 0)) { + (gradColor.effectValue !== this._state.GradColor.effectValue || this._state.GradColor.color.indexOf(gradColor.color) < 0)) || + (type1 != 'object' && this._state.GradColor.indexOf(gradColor) < 0)) { - this.btnGradColor1.setColor(gradColor1.Color); - if (typeof (gradColor1.Color) == 'object') { + this.btnGradColor.setColor(gradColor); + if (typeof (gradColor) == 'object') { var isselected = false; for (var i = 0; i < 10; i++) { - if (Common.Utils.ThemeColor.ThemeValues[i] == gradColor1.Color.effectValue) { - this.colorsGrad1.select(gradColor1.Color, true); + if (Common.Utils.ThemeColor.ThemeValues[i] == gradColor.effectValue) { + this.colorsGrad.select(gradColor, true); isselected = true; break; } } - if (!isselected) this.colorsGrad1.clearSelection(); + if (!isselected) this.colorsGrad.clearSelection(); } else - this.colorsGrad1.select(gradColor1.Color, true); + this.colorsGrad.select(gradColor, true); - this._state.GradColor1 = gradColor1.Color; - } - - var gradColor2 = this.GradColors[1]; - if (!gradColor2) { - gradColor2 = {Value: 1, Color: 'ffffff'}; - } - type1 = typeof (gradColor2.Color); - type2 = typeof (this._state.GradColor2); - - if ((type1 !== type2) || (type1 == 'object' && - (gradColor2.Color.effectValue !== this._state.GradColor2.effectValue || this._state.GradColor2.color.indexOf(gradColor2.Color.color) < 0)) || - (type1 != 'object' && this._state.GradColor2.indexOf(gradColor2.Color) < 0)) { - - this.btnGradColor2.setColor(gradColor2.Color); - if (typeof (gradColor2.Color) == 'object') { - var isselected = false; - for (var i = 0; i < 10; i++) { - if (Common.Utils.ThemeColor.ThemeValues[i] == gradColor2.Color.effectValue) { - this.colorsGrad2.select(gradColor2.Color, true); - isselected = true; - break; - } - } - if (!isselected) this.colorsGrad2.clearSelection(); - } else - this.colorsGrad2.select(gradColor2.Color, true); - - this._state.GradColor2 = gradColor2.Color; + this._state.GradColor = gradColor; } this._noApply = false; @@ -747,43 +774,24 @@ define([ this.btnBackColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); this.fillControls.push(this.btnBackColor); - this.btnGradColor1 = new Common.UI.ColorButton({ + this.btnGradColor = new Common.UI.ColorButton({ style: "width:45px;", menu : new Common.UI.Menu({ items: [ - { template: _.template('
') }, - { template: _.template('' + this.textNewColor + '') } + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } ] }) }); - this.btnGradColor1.render( $('#cell-grad-btn-color-1')); - this.btnGradColor1.setColor('000000'); - this.colorsGrad1 = new Common.UI.ThemeColorPalette({ - el: $('#cell-gradient-color1-menu'), + this.btnGradColor.render( $('#cell-gradient-color-btn')); + this.btnGradColor.setColor('000000'); + this.colorsGrad = new Common.UI.ThemeColorPalette({ + el: $('#cell-gradient-color'), value: '000000' }); - this.colorsGrad1.on('select', _.bind(this.onColorsGradientSelect, this)); - this.btnGradColor1.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad1, this.btnGradColor1)); - this.fillControls.push(this.btnGradColor1); - - this.btnGradColor2 = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + this.textNewColor + '') } - ] - }) - }); - this.btnGradColor2.render( $('#cell-grad-btn-color-2')); - this.btnGradColor2.setColor('ffffff'); - this.colorsGrad2 = new Common.UI.ThemeColorPalette({ - el: $('#cell-gradient-color2-menu'), - value: 'ffffff' - }); - this.colorsGrad2.on('select', _.bind(this.onColorsGradientSelect, this)); - this.btnGradColor2.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad2, this.btnGradColor2)); - this.fillControls.push(this.btnGradColor2); + this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this)); + this.btnGradColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); + this.fillControls.push(this.btnGradColor); this.btnFGColor = new Common.UI.ColorButton({ style: "width:45px;", @@ -826,8 +834,7 @@ define([ this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.btnBorderColor.setColor(this.borderColor.getColor()); - this.colorsGrad1.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - this.colorsGrad2.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, @@ -889,21 +896,24 @@ define([ this.gradient.asc_setDegree(this.GradLinearDirectionType); } if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { - var HexColor0 = Common.Utils.ThemeColor.getRgbColor(this.GradColors[0].Color).get_color().get_hex(), - HexColor1 = Common.Utils.ThemeColor.getRgbColor(this.GradColors[1].Color).get_color().get_hex(); - - if (HexColor0 === 'ffffff' && HexColor1 === 'ffffff') { - this.GradColors[0].Color = {color: '4f81bd', effectId: 24}; // color accent1 + this.GradColor.currentIdx = 0; + if (this.GradColor.colors.length === 2) { + var HexColor0 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(), + HexColor1 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex(); + if (HexColor0 === 'ffffff' && HexColor1 === 'ffffff') { + this.GradColors.colors[0] = {color: '4f81bd', effectId: 24}; // color accent1 + } } var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.colors.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); } + this.fill.asc_setGradientFill(this.gradient); this.api.asc_setCellFill(this.fill); } @@ -946,7 +956,7 @@ define([ this.FillGradientContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_GRAD); }, - onGradTypeSelect: function(combo, record) { + /*onGradTypeSelect: function(combo, record) { this.GradFillType = record.value; if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { @@ -994,7 +1004,7 @@ define([ } Common.NotificationCenter.trigger('edit:complete', this); - }, + },*/ onSelectGradient: function(btn, picker, itemView, record) { var me = this; @@ -1015,7 +1025,8 @@ define([ } this.btnDirection.setIconCls('item-gradient ' + rawData.iconcls); - (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; + this.GradLinearDirectionType = rawData.type; + this.numGradientAngle.setValue(rawData.type); if (this.api) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { @@ -1023,10 +1034,10 @@ define([ this.gradient = new Asc.asc_CGradientFill(); this.gradient.asc_setType(this.GradFillType); var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.values.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); @@ -1041,15 +1052,10 @@ define([ }, onColorsGradientSelect: function(picker, color) { - var me = this, - pickerId = picker.el.id; - if (pickerId === "cell-gradient-color1-menu") { - this.btnGradColor1.setColor(color); - this.GradColors[0].Color = color; - } else if (pickerId === "cell-gradient-color2-menu") { - this.btnGradColor2.setColor(color); - this.GradColors[1].Color = color; - } + var me = this; + this.btnGradColor.setColor(color); + this.GradColor.colors[this.GradColor.currentIdx] = color; + this.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(color) == 'object') ? color.color : color)); if (this.api && !this._noApply) { if (this.gradient == null) { @@ -1060,10 +1066,10 @@ define([ } } var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.values.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); @@ -1074,6 +1080,63 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + onGradientAngleChange: function(field, newValue, oldValue, eOpts) { + if (this.api) { + if (this.gradient == null) { + this.gradient = new Asc.asc_CGradientFill(); + this.gradient.asc_setType(this.GradFillType); + } + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.gradient.asc_setDegree(field.getNumberValue()); + } + this.fill.asc_setGradientFill(this.gradient); + this.api.asc_setCellFill(this.fill); + } + }, + + onGradientChange: function(slider, newValue, oldValue) { + this.GradColor.values = slider.getValues(); + this._sliderChanged = true; + if (this.api && !this._noApply) { + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._gradientApplyFunc, this), 100); + } + } + }, + + onGradientChangeComplete: function(slider, newValue, oldValue) { + clearInterval(this.updateslider); + this._sliderChanged = true; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._gradientApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _gradientApplyFunc: function() { + if (this._sliderChanged) { + var me = this; + if (this.gradient == null) + this.gradient = new Asc.asc_CGradientFill(); + var arrGradStop = []; + this.GradColor.colors.forEach(function (item, index) { + var gradientStop = new Asc.asc_CGradientStop(); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); + arrGradStop.push(gradientStop); + }); + this.gradient.asc_putGradientStops(arrGradStop); + + this.fill.asc_setGradientFill(this.gradient); + this.api.asc_setCellFill(this.fill); + + this._sliderChanged = false; + } + }, + onPatternSelect: function(combo, record) { if (this.api && !this._noApply) { this.PatternFillType = record.get('type'); @@ -1145,13 +1208,13 @@ define([ textGradientFill: 'Gradient Fill', textPatternFill: 'Pattern', textColor: 'Color Fill', - textStyle: 'Style', textDirection: 'Direction', textLinear: 'Linear', textRadial: 'Radial', textPattern: 'Pattern', textForeground: 'Foreground color', - textBackground: 'Background color' + textBackground: 'Background color', + textGradient: 'Gradient' }, SSE.Views.CellSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index ff5e1a54f..500720fff 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1190,7 +1190,6 @@ "SSE.Views.CellSettings.textPatternFill": "Pattern", "SSE.Views.CellSettings.textRadial": "Radial", "SSE.Views.CellSettings.textSelectBorders": "Select borders you want to change applying style chosen above", - "SSE.Views.CellSettings.textStyle": "Style", "SSE.Views.CellSettings.tipAll": "Set outer border and all inner lines", "SSE.Views.CellSettings.tipBottom": "Set outer bottom border only", "SSE.Views.CellSettings.tipDiagD": "Set Diagonal Down Border", diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 9e6bb8faf..dec9af8ff 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -217,9 +217,10 @@ define([ me.appOptions.fileChoiceUrl = me.editorConfig.fileChoiceUrl; me.appOptions.mergeFolderUrl = me.editorConfig.mergeFolderUrl; me.appOptions.canAnalytics = false; + me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.customization = me.editorConfig.customization; - me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') - && (typeof (me.editorConfig.customization.goback) == 'object') && !_.isEmpty(me.editorConfig.customization.goback.url); + me.appOptions.canBackToFolder = (me.editorConfig.canBackToFolder!==false) && (typeof (me.editorConfig.customization) == 'object') && (typeof (me.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(me.editorConfig.customization.goback.url) || me.editorConfig.customization.goback.requestClose && me.appOptions.canRequestClose); me.appOptions.canBack = me.appOptions.canBackToFolder === true; me.appOptions.canPlugins = false; me.plugins = me.editorConfig.plugins; @@ -338,11 +339,15 @@ define([ }, goBack: function(current) { - var href = this.appOptions.customization.goback.url; - if (!current && this.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { + Common.Gateway.requestClose(); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (!current && this.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } }, @@ -706,7 +711,6 @@ define([ } me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights; - me.appOptions.canRequestClose = me.editorConfig.canRequestClose; me.appOptions.canEdit = me.permissions.edit !== false && // can edit (me.editorConfig.canRequestEditRights || me.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined me.appOptions.isEdit = (me.appOptions.canLicense || me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) && me.permissions.edit !== false && me.editorConfig.mode !== 'view'; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js index 6f969e151..44a808568 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js @@ -51,7 +51,6 @@ define([ SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend((function() { // private - var _backUrl; var locked = { book: false, sheet: false @@ -70,9 +69,7 @@ define([ loadConfig: function (data) { if (data && data.config && data.config.canBackToFolder !== false && - data.config.customization && data.config.customization.goback && data.config.customization.goback.url) { - _backUrl = data.config.customization.goback.url; - + data.config.customization && data.config.customization.goback && (data.config.customization.goback.url || data.config.customization.goback.requestClose && data.config.canRequestClose)) { $('#document-back').show().single('click', _.bind(this.onBack, this)); } }, @@ -124,7 +121,7 @@ define([ { text: me.leaveButtonText, onClick: function() { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } }, { @@ -134,7 +131,7 @@ define([ ] }); } else { - window.parent.location.href = _backUrl; + Common.NotificationCenter.trigger('goback', true); } },