This commit is contained in:
Alexey Golubev 2018-03-28 12:06:53 +03:00
commit d19081f28d
8335 changed files with 150778 additions and 44181 deletions

View file

@ -43,7 +43,8 @@
print: <can print>, // default = true
rename: <can rename>, // default = false
changeHistory: <can change history>, // default = false
comment: <can comment in view mode> // default = edit
comment: <can comment in view mode> // default = edit,
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
}
},
editorConfig: {
@ -103,7 +104,8 @@
},
goback: {
url: 'http://...',
text: 'Go to London'
text: 'Go to London',
blank: true
},
chat: true,
comments: true,
@ -188,6 +190,7 @@
_config.editorConfig.canHistoryRestore = _config.events && !!_config.events.onRequestRestore;
_config.editorConfig.canSendEmailAddresses = _config.events && !!_config.events.onRequestEmailAddresses;
_config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights;
_config.editorConfig.canRequestClose = _config.events && !!_config.events.onRequestClose;
_config.frameEditorId = placeholderId;
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
@ -321,7 +324,7 @@
}
if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt))$/
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott))$/
.exec(_config.document.fileType);
if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
@ -507,9 +510,10 @@
});
};
var _downloadAs = function() {
var _downloadAs = function(data) {
_sendCommand({
command: 'downloadAs'
command: 'downloadAs',
data: data
});
};

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -80,8 +80,8 @@ if (Common === undefined) {
$me.trigger('processmailmerge', data);
},
'downloadAs': function() {
$me.trigger('downloadas');
'downloadAs': function(data) {
$me.trigger('downloadas', data);
},
'processMouse': function(data) {
@ -250,6 +250,10 @@ if (Common === undefined) {
_postMessage({ event: 'onDocumentReady' });
},
requestClose: function() {
_postMessage({event: 'onRequestClose'});
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -100,13 +100,20 @@ Common.Locale = new(function() {
var langParam = _getUrlParameterByName('lang');
var xhrObj = _createXMLHTTPObject();
if (xhrObj && langParam) {
var lang = langParam.split("-")[0];
var lang = langParam.split(/[\-\_]/)[0];
xhrObj.open('GET', 'locale/' + lang + '.json', false);
xhrObj.send('');
l10n = eval("(" + xhrObj.responseText + ")");
}
}
catch (e) {
catch (e) {
try {
xhrObj.open('GET', 'locale/en.json', false);
xhrObj.send('');
l10n = eval("(" + xhrObj.responseText + ")");
}
catch (e) {
}
}
return {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Collection
*
* Created by Maxim Kadushkin on 01 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Comments.js
*
* Created by Alexey Musinov on 17.01.14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Fonts.js
*
* Created by Alexander Yuzhin on 2/11/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ReviewChanges.js
*
* Created by Julia.Radzhabova on 05.08.15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -32,7 +32,7 @@
*/
/**
* Created by Julia.Radzhabova on 09.07.15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*/
if (Common === undefined)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Collection
*
* Created by Maxim Kadushkin on 27 February 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* BaseView.js
*
* Created by Alexander Yuzhin on 1/17/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Button.js
*
* Created by Alexander Yuzhin on 1/20/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -160,8 +160,8 @@ define([
'</span>' +
'</button>' +
'<button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown">' +
'<span class="caption"><%= caption %></span>' +
'<span class="btn-fixflex-vcenter">' +
'<span class="caption"><%= caption %></span>' +
'<i class="caret img-commonctrl"></i>' +
'</span>' +
'</button>' +

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* CheckBox.js
*
* Created by Julia Radzhabova on 1/24/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -99,10 +99,32 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
if (this.options.el)
this.render();
},
render: function (parentEl) {
var me = this,
el = $(this.el);
if (!me.rendered) {
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.template({
labelText: this.options.labelText
}));
el = $(this.el);
} else {
el.html(this.template({
labelText: this.options.labelText
}));
}
this.render();
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.$chk.on('click', _.bind(this.onItemCheck, this));
}
this.rendered = true;
if (this.options.disabled)
this.setDisabled(this.options.disabled);
@ -111,20 +133,6 @@ define([
this.setValue(this.options.value, true);
// handle events
this.$chk.on('click', _.bind(this.onItemCheck, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
labelText: this.options.labelText
}));
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.rendered = true;
return this;
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ColorPalette.js
*
* Created by Alexander Yuzhin on 2/20/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ColorPaletteExt.js
*
* Created by Julia Radzhabova on 07/21/15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ComboBorderSize.js
*
* Created by Julia Radzhabova on 2/10/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ComboBox.js
*
* Created by Alexander Yuzhin on 1/22/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -146,7 +146,7 @@ define([
scope : me
}));
if (this.itemsTemplate)
this.cmpEl.find('ul').append(
this.cmpEl.find('ul').html(
$(this.itemsTemplate({
items : items,
scope : me

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ComboBoxFonts.js
*
* Created by Alexander Yuzhin on 2/11/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -112,6 +112,8 @@ define([
this._input.on('keyup', _.bind(this.onInputKeyUp, this));
this._input.on('keydown', _.bind(this.onInputKeyDown, this));
this._input.on('focus', _.bind(function() {this.inFormControl = true;}, this));
this._input.on('blur', _.bind(function() {this.inFormControl = false;}, this));
this._modalParents = this.cmpEl.closest('.asc-window');
@ -141,7 +143,7 @@ define([
me.onAfterHideMenu(e);
}, 10);
return false;
} else if ((e.keyCode == Common.UI.Keys.HOME || e.keyCode == Common.UI.Keys.END || e.keyCode == Common.UI.Keys.BACKSPACE) && this.isMenuOpen()) {
} else if ((e.keyCode == Common.UI.Keys.HOME && !e.shiftKey || e.keyCode == Common.UI.Keys.END && !e.shiftKey || e.keyCode == Common.UI.Keys.BACKSPACE && !me._input.is(':focus')) && this.isMenuOpen()) {
me._input.focus();
setTimeout(function() {
me._input[0].selectionStart = me._input[0].selectionEnd = (e.keyCode == Common.UI.Keys.HOME) ? 0 : me._input[0].value.length;
@ -318,6 +320,15 @@ define([
},
onApiChangeFont: function(font) {
var me = this;
setTimeout(function () {
me.onApiChangeFontInternal(font);
}, 100);
},
onApiChangeFontInternal: function(font) {
if (this.inFormControl) return;
var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getName());
if (this.getRawValue() !== name) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ComboDataView.js
*
* Created by Alexander Yuzhin on 2/13/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -401,7 +401,7 @@ define([
fillComboView: function(record, forceSelect, forceFill) {
if (!_.isUndefined(record) && record instanceof Backbone.Model){
this.needFillComboView = false;
this.needFillComboView = !this.isVisible();
var me = this,
store = me.menuPicker.store,

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* A mechanism for displaying data using custom layout templates and formatting.
*
* Created by Alexander Yuzhin on 1/24/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -143,11 +143,17 @@ define([
el.off('click').on('click', _.bind(this.onClick, this));
el.off('dblclick').on('dblclick', _.bind(this.onDblClick, this));
el.off('contextmenu').on('contextmenu', _.bind(this.onContextMenu, this));
el.toggleClass('disabled', this.model.get('disabled'));
el.toggleClass('disabled', !!this.model.get('disabled'));
if (!_.isUndefined(this.model.get('cls')))
el.addClass(this.model.get('cls'));
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
}
this.trigger('change', this, this.model);
return this;
@ -191,6 +197,7 @@ define([
emptyText: '',
listenStoreEvents: true,
allowScrollbar: true,
scrollAlwaysVisible: false,
showLast: true,
useBSKeydown: false
},
@ -233,6 +240,9 @@ define([
me.emptyText = me.options.emptyText || '';
me.listenStoreEvents= (me.options.listenStoreEvents!==undefined) ? me.options.listenStoreEvents : true;
me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true;
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false;
me.dataViewItems = [];
if (me.options.keyMoveDirection=='vertical')
@ -300,7 +310,8 @@ define([
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
@ -353,11 +364,12 @@ define([
if (suspendEvents)
this.resumeEvents();
return record;
},
selectByIndex: function(index, suspendEvents) {
if (this.store.length > 0 && index > -1 && index < this.store.length) {
this.selectRecord(this.store.at(index), suspendEvents);
return this.selectRecord(this.store.at(index), suspendEvents);
}
},
@ -387,7 +399,7 @@ define([
return this.store.where({selected: true});
},
onAddItem: function(record, index, opts) {
onAddItem: function(record, store, opts) {
var view = new Common.UI.DataViewItem({
template: this.itemTemplate,
model: record
@ -410,7 +422,8 @@ define([
innerEl.append(view.render().el);
innerEl.find('.empty-text').remove();
this.dataViewItems.push(view);
var idx = _.indexOf(this.store.models, record);
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
if (record.get('tip')) {
var view_el = $(view.el);
@ -438,7 +451,11 @@ define([
onResetItems: function() {
_.each(this.dataViewItems, function(item) {
var tip = item.$el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
}, this);
$(this.el).html(this.template({
@ -467,10 +484,14 @@ define([
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
if (this.disabled)
this.setDisabled(this.disabled);
this.attachKeyEvents();
this.lastSelectedRec = null;
this._layoutParams = undefined;
@ -483,6 +504,12 @@ define([
},
onRemoveItem: function(view, record) {
var tip = view.$el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
this.stopListening(view);
view.stopListening();
@ -525,7 +552,7 @@ define([
window._event = e; // for FireFox only
this.selectRecord(record);
if (this.showLast) this.selectRecord(record);
this.lastSelectedRec = null;
if (!this.isSuspendEvents) {
@ -546,18 +573,21 @@ define([
},
scrollToRecord: function (record) {
if (!record) return;
var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top,
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;
var div_top = div.offset().top;
if (div_top < inner_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
var div_top = div.offset().top,
div_first = $(this.dataViewItems[0].el),
div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0;
if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
if (this.scroller && this.allowScrollbar) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top, 0);
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
} else {
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top);
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top);
}
}
},
@ -688,21 +718,22 @@ define([
var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu')
? this.parentMenu.cmpEl
: this.parentMenu.cmpEl.find('[role=menu]'),
docH = Common.Utils.innerHeight()-10,
innerEl = $(this.el).find('.inner').addBack().filter('.inner'),
docH = Common.Utils.innerHeight(),
parent = innerEl.parent(),
margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')),
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top'));
top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (menuH > docH) {
innerEl.css('max-height', (docH - parseInt(menuRoot.css('padding-top')) - parseInt(menuRoot.css('padding-bottom'))-5) + 'px');
if (this.allowScrollbar) this.scroller.update({minScrollbarLength : 40});
} else if ( innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - parseInt(menuRoot.css('padding-top')) - parseInt(menuRoot.css('padding-bottom'))-5, this.options.restoreHeight)) + 'px');
menuH = menuRoot.outerHeight();
if (top+menuH > docH) {
menuRoot.css('top', 0);
}
if (this.allowScrollbar) this.scroller.update({minScrollbarLength : 40});
if (top + menuH > docH ) {
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
if (this.allowScrollbar) this.scroller.update(props);
} else if ( top + menuH < docH && innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - top - paddings - margins, this.options.restoreHeight)) + 'px');
if (this.allowScrollbar) this.scroller.update(props);
}
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* DimensionPicker.js
*
* Created by Alexander Yuzhin on 1/29/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* InputField.js
*
* Created by Alexander Yuzhin on 4/10/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Layout.js
*
* Created by Maxim Kadushkin on 10 February 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*
* Configuration
@ -152,7 +152,8 @@ define([
fmin : panel.resize.fmin,
fmax : panel.resize.fmax,
behaviour : panel.behaviour,
index : this.splitters.length
index : this.splitters.length,
offset : panel.resize.offset || 0
};
if (!stretch) {
@ -168,6 +169,7 @@ define([
this.splitters.push({resizer:resizer});
panel.resize.hidden && resizer.el.hide();
Common.Gateway.on('processmouse', this.resize.eventStop);
}
}, this);
@ -223,6 +225,8 @@ define([
},
resizeStart: function(e) {
if (this.freeze) return;
this.clearSelection();
this.addHandler(window.document, 'selectstart', this.onSelectStart);
@ -298,6 +302,11 @@ define([
if (!this.resize.$el) return;
var zoom = (e instanceof jQuery.Event) ? Common.Utils.zoom() : 1;
if (!(e instanceof jQuery.Event) && (e.pageY === undefined || e.pageX === undefined)) {
e.pageY = e.y;
e.pageX = e.x;
}
if (this.resize.type == 'vertical') {
var prop = 'height';
var value = e.pageY*zoom - this.resize.inity;
@ -363,7 +372,7 @@ define([
setResizeValue: function (index, value) {
if (index >= this.splitters.length)
return;
return false;
var panel = null, next = null, oldValue = 0,
resize = this.splitters[index].resizer,
@ -398,6 +407,7 @@ define([
if (resize.value != value) {
this.doLayout();
}
return (Math.abs(oldValue-value)>0.99);
}
});
@ -486,7 +496,10 @@ define([
if ( !panel.stretch ) {
style = panel.el.is(':visible');
if ( style ) {
width += (panel.rely!==true ? panel.width : this.getElementWidth(panel.el));
if (panel.isresizer)
width += panel.offset;
else
width += (panel.rely!==true ? panel.width : this.getElementWidth(panel.el));
}
if (panel.resize && panel.resize.autohide !== false && panel.resize.el) {
@ -508,10 +521,13 @@ define([
width = 0;
this.panels.forEach(function(panel){
if (panel.el.is(':visible')) {
style = {left: width};
style = {left: width - (panel.isresizer ? panel.width : 0)};
panel.rely!==true && (style.width = panel.width);
panel.el.css(style);
width += this.getElementWidth(panel.el);
if (panel.isresizer)
width += panel.offset;
else
width += this.getElementWidth(panel.el);
}
},this);
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ListView.js
*
* Created by Julia Radzhabova on 2/27/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -64,9 +64,10 @@ define([
onResetItems : function() {
this.innerEl = null;
Common.UI.DataView.prototype.onResetItems.call(this);
this.trigger('items:reset', this);
},
onAddItem: function(record, index) {
onAddItem: function(record, store, opts) {
var view = new Common.UI.DataViewItem({
template: this.itemTemplate,
model: record
@ -78,7 +79,8 @@ define([
if (view && this.innerEl) {
this.innerEl.find('.empty-text').remove();
if (this.options.simpleAddMode) {
this.innerEl.append(view.render().el)
this.innerEl.append(view.render().el);
this.dataViewItems.push(view);
} else {
var idx = _.indexOf(this.store.models, record);
var innerDivs = this.innerEl.find('> div');
@ -88,15 +90,24 @@ define([
else {
(innerDivs.length > 0) ? $(innerDivs[idx]).before(view.render().el) : this.innerEl.append(view.render().el);
}
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
}
this.dataViewItems.push(view);
this.listenTo(view, 'change', this.onChangeItem);
this.listenTo(view, 'remove', this.onRemoveItem);
this.listenTo(view, 'click', this.onClickItem);
this.listenTo(view, 'dblclick',this.onDblClickItem);
this.listenTo(view, 'select', this.onSelectItem);
if (record.get('tip')) {
var view_el = $(view.el);
view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : this.tipZIndex
});
}
if (!this.isSuspendEvents)
this.trigger('item:add', this, view, record);
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Displays loading mask over selected element(s) or component. Accepts both single and multiple selectors.
*
* Created by Alexander Yuzhin on 2/7/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* A menu object. This is the container to which you may add {@link Common.UI.MenuItem menu items}.
*
* Created by Alexander Yuzhin on 1/28/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -424,6 +424,9 @@ define([
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.options.restoreHeight && this.scroller)
this.scroller.update({minScrollbarLength : 40});
if (this.$el.find('> ul > .menu-scroll').length) {
var el = this.$el.find('li .checked')[0];
if (el) {
@ -465,14 +468,20 @@ define([
},
onScroll: function(item, e) {
if (this.fromKeyDown) {
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]');
if (this.scroller) return;
menuRoot.find('.menu-scroll.top').css('top', menuRoot.scrollTop() + 'px');
menuRoot.find('.menu-scroll.bottom').css('bottom', (-menuRoot.scrollTop()) + 'px');
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
scrollTop = menuRoot.scrollTop(),
top = menuRoot.find('.menu-scroll.top'),
bottom = menuRoot.find('.menu-scroll.bottom');
if (this.fromKeyDown) {
top.css('top', scrollTop + 'px');
bottom.css('bottom', (-scrollTop) + 'px');
}
top.toggleClass('disabled', scrollTop<1);
bottom.toggleClass('disabled', scrollTop + this.options.maxHeight > menuRoot[0].scrollHeight-1);
},
onItemClick: function(item, e) {
@ -493,6 +502,8 @@ define([
},
onScrollClick: function(e) {
if (/disabled/.test(e.currentTarget.className)) return false;
this.scrollMenu(/top/.test(e.currentTarget.className));
return false;
},
@ -562,17 +573,37 @@ define([
left = docW - menuW;
}
if (top + menuH > docH)
top = docH - menuH;
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
menuH = menuRoot.outerHeight();
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight ) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
menuH = menuRoot.outerHeight();
}
}
} else {
if (top + menuH > docH)
top = docH - menuH;
if (top < 0)
top = 0;
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: left, top: top});
},
clearAll: function() {
_.each(this.items, function(item){
if (item.setChecked)
item.setChecked(false, true);
});
}
}), {
Manager: (function() {
return manager;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -37,7 +37,7 @@
* sub-menus, icons, etc.
*
* Created by Alexander Yuzhin on 1/27/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -262,6 +262,7 @@ define([
return false;
}
e.stopPropagation();
},
onItemClick: function(e) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* MetricSpinner.js
*
* Created by Julia Radzhabova on 1/21/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -448,7 +448,7 @@ define([
if (isNaN(val))
val = this.oldValue;
} else {
val = me.options.defaultValue;
val = me.options.defaultValue - me.options.step;
}
me.setValue((this._add(val, me.options.step, (me.options.allowDecimal) ? 3 : 0) + ' ' + this.options.defaultUnit).trim(), suspend);
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -37,7 +37,7 @@
*
*
* Created by Maxim.Kadushkin on 4/11/2017.
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -92,6 +92,10 @@ define([
config.tabs = options.tabs;
$(document.body).on('click', onClickDocument.bind(this));
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
this.setVisible(action, visible)
}, this));
},
afterRender: function() {
@ -108,6 +112,7 @@ define([
$scrollR.on('click', onScrollTabs.bind(this, 'right'));
$boxTabs.on('dblclick', '> .ribtab', onTabDblclick.bind(this));
$boxTabs.on('click', '> .ribtab', me.onTabClick.bind(this));
},
isTabActive: function(tag) {
@ -164,6 +169,12 @@ define([
// clearTimeout(optsFold.timer);
optsFold.$bar.removeClass('folded');
optsFold.$box.off();
var active_panel = optsFold.$box.find('.panel.active');
if ( active_panel.length ) {
var tab = active_panel.data('tab');
me.$tabs.find('> a[data-tab=' + tab + ']').parent().toggleClass('active', true);
}
}
},
@ -194,6 +205,18 @@ define([
}
},
onTabClick: function (e) {
var _is_active = $(e.currentTarget).hasClass('active');
if ( _is_active ) {
if ( this.isFolded ) {
// this.collapse();
}
} else {
var tab = $(e.target).data('tab');
this.setTab(tab);
}
},
setTab: function (tab) {
if ( !tab ) {
onShowFullviewPanel.call(this, false);
@ -234,7 +257,7 @@ define([
return config.tabs[index].action;
}
var _tabTemplate = _.template('<li class="ribtab"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
config.tabs[after + 1] = tab;
var _after_action = _get_tab_action(after);
@ -269,13 +292,13 @@ define([
var _left_bound_ = Math.round($boxTabs.offset().left),
_right_bound_ = Math.round(_left_bound_ + $boxTabs.width());
var tab = this.$tabs.filter(':first:visible').get(0);
var tab = this.$tabs.filter(':visible:first').get(0);
if ( !tab ) return false;
var rect = tab.getBoundingClientRect();
if ( !(Math.round(rect.left) < _left_bound_) ) {
tab = this.$tabs.filter(':last:visible').get(0);
tab = this.$tabs.filter(':visible:last').get(0);
rect = tab.getBoundingClientRect();
if (!(Math.round(rect.right) > _right_bound_))
@ -296,6 +319,11 @@ define([
}
}
}
},
setVisible: function (tab, visible) {
if ( tab && this.$tabs )
this.$tabs.find('> a[data-tab=' + tab + ']').parent().css('display', visible ? '' : 'none');
}
};
}()));

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* MultiSliderGradient.js
*
* Created by Julia Radzhabova on 2/19/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* RadioBox.js
*
* Created by Julia Radzhabova on 2/26/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
/**

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Scroller.js
*
* Created by Alexander Yuzhin on 3/14/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Slider.js
*
* Created by Julia Radzhabova on 2/18/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Tab.js
*
* Created by Maxim Kadushkin on 01 April 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* TabBar.js
*
* Created by Maxim Kadushkin on 28 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -207,7 +207,7 @@ define([
function dragComplete() {
if (!_.isUndefined(me.drag)) {
me.drag.tab.$el.css('z-index', '');
me.bar.dragging = false;
var tab = null;
for (var i = me.bar.tabs.length - 1; i >= 0; --i) {
tab = me.bar.tabs[i].$el;
@ -254,6 +254,7 @@ define([
_clientX = e.clientX*Common.Utils.zoom();
me.bar = bar;
me.drag = {tab: tab, index: index};
bar.dragging = true;
this.calculateBounds();
this.setAbsTabs();
@ -343,6 +344,8 @@ define([
this.insert(-1, this.saved);
delete this.saved;
Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this));
this.rendered = true;
return this;
},
@ -362,6 +365,14 @@ define([
}
},
onProcessMouse: function(data) {
if (data.type == 'mouseup' && this.dragging) {
var tab = this.getActive(true);
if (tab)
tab.mouseup();
}
},
add: function(tabs) {
return this.insert(-1, tabs) > 0;
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* TableStyler.js
*
* Created by Alexander Yuzhin on 2/28/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ThemeColorPalette.js
*
* Created by Julia Radzhabova on 1/28/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -146,6 +146,13 @@ define([
updateCustomColors: function() {
var el = $(this.el);
if (el) {
var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
if (color) { // custom color was selected
color = color.toUpperCase();
selected.removeClass(this.selectedCls);
}
var colors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom');
colors = colors ? colors.split(',') : [];
@ -156,6 +163,10 @@ define([
colorEl.find('span').css({
'background-color': '#'+colors[i]
});
if (colors[i] == color) {
colorEl.addClass(this.selectedCls);
color = undefined; //select only first found color
}
}
}
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ToggleManager.js
*
* Created by Alexander Yuzhin on 1/28/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Tooltip.js
*
* Created by Maxim Kadushkin on 14 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
/*

View file

@ -0,0 +1,270 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* TreeView.js
*
* Created by Julia Radzhabova on 12/14/17
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/DataView'
], function () {
'use strict';
Common.UI.TreeViewModel = Common.UI.DataViewModel.extend({
defaults: function() {
return {
id: Common.UI.getId(),
name: '',
isNotHeader: false,
hasSubItems: false,
hasParent: false,
isEmptyItem: false,
isExpanded: true,
isVisible: true,
selected: false,
allowSelected: true,
disabled: false,
level: 0,
index: 0
}
}
});
Common.UI.TreeViewStore = Backbone.Collection.extend({
model: Common.UI.TreeViewModel,
expandSubItems: function(record) {
var me = this;
var _expand_sub_items = function(idx, expanded, level) {
for (var i=idx+1; i<me.length; i++) {
var item = me.at(i);
var item_level = item.get('level');
if (item_level>level) {
if (expanded)
item.set('isVisible', true);
if (item.get('hasSubItems'))
i = _expand_sub_items(i, item.get('isExpanded'), item_level );
} else {
return (i-1);
}
}
};
record.set('isExpanded', true);
_expand_sub_items(record.get('index'), true, record.get('level'));
},
collapseSubItems: function(record) {
var start_level = record.get('level'),
index = record.get('index');
for (var i=index+1; i<this.length; i++) {
var item = this.at(i);
var item_level = item.get('level');
if (item_level>start_level) {
item.set('isVisible', false);
} else {
break;
}
}
return i-1;
},
expandAll: function() {
this.each(function(item) {
item.set('isExpanded', true);
item.set('isVisible', true);
});
},
collapseAll: function() {
for (var i=0; i<this.length; i++) {
var item = this.at(i);
if (!item.get('isNotHeader')) {
item.set('isExpanded', false);
i = this.collapseSubItems(item);
}
}
},
expandToLevel: function(expandLevel) {
var me = this;
var _expand_sub_items = function(idx, level) {
var parent = me.at(idx);
parent.set('isExpanded', false);
for (var i=idx+1; i<me.length; i++) {
var item = me.at(i);
var item_level = item.get('level');
if (item_level>level) {
if (item_level<=expandLevel)
parent.set('isExpanded', true);
item.set('isVisible', item_level<=expandLevel);
if (item.get('hasSubItems'))
i = _expand_sub_items(i, item_level );
} else {
return (i-1);
}
}
};
for (var j=0; j<this.length; j++) {
var item = this.at(j);
if (item.get('level')<=expandLevel || !item.get('hasParent')) {
item.set('isVisible', true);
if (!item.get('isNotHeader'))
j = _expand_sub_items(j, item.get('level'));
}
}
}
});
Common.UI.TreeView = Common.UI.DataView.extend((function() {
return {
options: {
handleSelect: true,
showLast: true,
allowScrollbar: true,
scrollAlwaysVisible: true,
emptyItemText: ''
},
template: _.template([
'<div class="treeview inner"></div>'
].join('')),
initialize : function(options) {
options.store = options.store || new Common.UI.TreeViewStore();
options.emptyItemText = options.emptyItemText || '';
options.itemTemplate = options.itemTemplate || _.template([
'<div id="<%= id %>" class="tree-item <% if (!isVisible) { %>' + 'hidden' + '<% } %>" style="display: block;padding-left: <%= level*16 + 24 %>px;">',
'<% if (hasSubItems) { %>',
'<div class="tree-caret img-commonctrl ' + '<% if (!isExpanded) { %>' + 'up' + '<% } %>' + '" style="margin-left: <%= level*16 %>px;"></div>',
'<% } %>',
'<% if (isNotHeader) { %>',
'<div class="name not-header"><%= name %></div>',
'<% } else if (isEmptyItem) { %>',
'<div class="name empty">' + options.emptyItemText + '</div>',
'<% } else { %>',
'<div class="name"><%= name %></div>',
'<% } %>',
'</div>'
].join(''));
Common.UI.DataView.prototype.initialize.call(this, options);
},
onAddItem: function(record, store, opts) {
var view = new Common.UI.DataViewItem({
template: this.itemTemplate,
model: record
});
if (view) {
var innerEl = $(this.el).find('.inner').addBack().filter('.inner');
if (innerEl) {
innerEl.find('.empty-text').remove();
if (opts && opts.at!==undefined) {
var idx = opts.at;
var innerDivs = innerEl.find('> div');
if (idx > 0)
$(innerDivs.get(idx - 1)).after(view.render().el);
else {
(innerDivs.length > 0) ? $(innerDivs[idx]).before(view.render().el) : innerEl.append(view.render().el);
}
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
} else {
innerEl.append(view.render().el);
this.dataViewItems.push(view);
}
var name = record.get('name');
if (name.length > 37 - record.get('level')*2)
record.set('tip', name);
if (record.get('tip')) {
var view_el = $(view.el);
view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : this.tipZIndex
});
}
this.listenTo(view, 'change', this.onChangeItem);
this.listenTo(view, 'remove', this.onRemoveItem);
this.listenTo(view, 'click', this.onClickItem);
this.listenTo(view, 'dblclick', this.onDblClickItem);
this.listenTo(view, 'select', this.onSelectItem);
this.listenTo(view, 'contextmenu', this.onContextMenuItem);
if (!this.isSuspendEvents)
this.trigger('item:add', this, view, record);
}
}
},
onClickItem: function(view, record, e) {
var btn = $(e.target);
if (btn && btn.hasClass('tree-caret')) {
var tip = view.$el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
var isExpanded = !record.get('isExpanded');
record.set('isExpanded', isExpanded);
this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record);
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
} else
Common.UI.DataView.prototype.onClickItem.call(this, view, record, e);
},
expandAll: function() {
this.store.expandAll();
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
},
collapseAll: function() {
this.store.collapseAll();
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
},
expandToLevel: function(expandLevel) {
this.store.expandToLevel(expandLevel);
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
}
}
})());
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Window.js
*
* Created by Maxim Kadushkin on 24 January 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -191,7 +191,10 @@ define([
event.preventDefault();
event.stopPropagation();
if (this.initConfig.closable !== false) {
this.initConfig.toolclose=='hide' ? this.hide() : this.close();
if (this.initConfig.toolcallback)
this.initConfig.toolcallback.call(this);
else
(this.initConfig.toolclose=='hide') ? this.hide() : this.close();
}
return false;
}
@ -294,6 +297,13 @@ define([
}
}
function _onProcessMouse(data) {
if (data.type == 'mouseup' && this.dragging.enabled) {
_mouseup.call(this);
}
}
/* window resize functions */
function _resizestart(event) {
Common.UI.Menu.Manager.hideAll();
@ -580,6 +590,9 @@ define([
};
this.$window.find('.header').on('mousedown', this.binding.dragStart);
this.$window.find('.tool.close').on('click', _.bind(doclose, this));
if (!this.initConfig.modal)
Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this));
} else {
this.$window.find('.body').css({
top:0,

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Controller
*
* Created by Maxim Kadushkin on 27 February 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -112,7 +112,7 @@ define([
return this;
},
onUsersChanged: function(users){
onUsersChanged: function(users, currentUserId){
if (!this.mode.canLicense || !this.mode.canCoAuthoring) {
var len = 0;
for (name in users) {
@ -146,13 +146,14 @@ define([
if (undefined !== name) {
user = users[name];
if (user) {
arrUsers.push(new Common.Models.User({
var usermodel = new Common.Models.User({
id : user.asc_getId(),
username : user.asc_getUserName(),
online : true,
color : user.asc_getColor(),
view : user.asc_getView()
}));
});
arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel);
}
}
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Comments.js
*
* Created by Alexey Musinov on 16.01.14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -572,6 +572,15 @@ define([
onUpdateFilter: function (filter, applyOnly) {
if (filter) {
if (!this.view.isVisible()) {
this.view.needUpdateFilter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
return;
}
this.view.needUpdateFilter = false;
this.filter = {
property : filter.property,
@ -589,11 +598,11 @@ define([
this.collection.each(function (model) {
var prop = model.get(t.filter.property);
if (prop) {
model.set('hide', (null === prop.match(t.filter.value)));
model.set('hide', (null === prop.match(t.filter.value)), {silent: !!applyOnly});
}
if (model.get('last')) {
model.set('last', false);
model.set('last', false, {silent:!!applyOnly});
}
if (!model.get('hide')) {
@ -602,8 +611,10 @@ define([
});
if (endComment) {
endComment.set('last', true);
endComment.set('last', true, {silent: !!applyOnly});
}
if (!applyOnly)
this.view.update();
}
},
onAppAddComment: function (sender, to_doc) {
@ -956,6 +967,11 @@ define([
// internal
updateComments: function (needRender, disableSort) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
return;
}
var me = this;
me.updateCommentsTime = new Date();
if (me.timerUpdateComments===undefined)
@ -990,6 +1006,7 @@ define([
this.onUpdateFilter(this.filter, true);
this.view.render();
this.view.needRender = false;
}
this.view.update();
@ -1291,7 +1308,10 @@ define([
if ('none' !== panel.css('display')) {
this.view.txtComment.focus();
}
if (this.view.needRender)
this.updateComments(true);
else if (this.view.needUpdateFilter)
this.onUpdateFilter(this.view.needUpdateFilter);
this.view.update();
}
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ExternalDiagramEditor.js
*
* Created by Julia Radzhabova on 4/08/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -142,7 +142,6 @@ define([
if (this.isHandlerCalled) return;
this.isHandlerCalled = true;
externalEditor && externalEditor.serviceCommand('queryClose',{mr:result});
return true;
},
setChartData: function() {
@ -210,6 +209,7 @@ define([
}
this.diagramEditorView.hide();
}
this.isHandlerCalled = false;
} else
if (eventData.type == "processMouse") {
if (eventData.data.event == 'mouse:up') {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ExternalDiagramEditor.js
*
* Created by Julia Radzhabova on 4/08/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Fonts.js
*
* Created by Alexander Yuzhin on 2/11/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -173,6 +173,8 @@ define([
arr.push(plugin);
});
this.api.asc_pluginsRegister('', arr);
if (storePlugins.length>0)
Common.NotificationCenter.trigger('tab:visible', 'plugins', true);
},
onAddPlugin: function (model) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,7 +35,7 @@
* Protection.js
*
* Created by Julia Radzhabova on 14.11.2017
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ReviewChanges.js
*
* Created by Julia.Radzhabova on 05.08.15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -76,7 +76,8 @@ define([
'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchanges:view': _.bind(this.onReviewViewClick, this),
'lang:document': _.bind(this.onDocLanguage, this)
'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
},
'Common.Views.ReviewChangesDialog': {
'reviewchange:accept': _.bind(this.onAcceptClick, this),
@ -94,7 +95,7 @@ define([
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setConfig: function (data, api) {
this.setApi(api);
@ -111,7 +112,7 @@ define([
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiServerDisconnect, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
}
},
@ -131,7 +132,7 @@ define([
SetDisabled: function(state) {
if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(state);
this.view && this.view.SetDisabled(state, this.langs);
},
onApiShowChange: function (sdkchange) {
@ -487,7 +488,7 @@ define([
state = (state == 'on');
this.api.asc_SetTrackRevisions(state);
Common.localStorage.setItem("de-track-changes", state ? 1 : 0);
Common.localStorage.setItem(this.view.appPrefix + "track-changes", state ? 1 : 0);
this.view.turnChanges(state);
}
@ -497,8 +498,9 @@ define([
state = (state == 'on');
this.view.turnSpelling(state);
Common.localStorage.setItem("de-settings-spellcheck", state ? 1 : 0);
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
this.api.asc_setSpellCheck(state);
Common.Utils.InternalSettings.set("de-settings-spellcheck", state);
},
onReviewViewClick: function(menu, item, e) {
@ -519,6 +521,35 @@ define([
return this._state.previewMode;
},
onCoAuthMode: function(menu, item, e) {
Common.localStorage.setItem(this.view.appPrefix + "settings-coauthmode", item.value);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-coauthmode", item.value);
if (this.api) {
this.api.asc_SetFastCollaborative(item.value==1);
if (this.api.SetCollaborativeMarksShowType) {
var value = Common.localStorage.getItem(item.value ? this.view.appPrefix + "settings-showchanges-fast" : this.view.appPrefix + "settings-showchanges-strict");
if (value !== null)
this.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
else
this.api.SetCollaborativeMarksShowType(item.value ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
}
value = Common.localStorage.getItem(this.view.appPrefix + "settings-autosave");
if (value===null && this.appConfig.customization && this.appConfig.customization.autosave===false)
value = 0;
value = (!item.value && value!==null) ? parseInt(value) : 1;
Common.localStorage.setItem(this.view.appPrefix + "settings-autosave", value);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-autosave", value);
this.api.asc_setAutoSaveGap(value);
}
Common.NotificationCenter.trigger('edit:complete', this.view);
this.view.fireEvent('settings:apply', [this]);
},
disableEditing: function(disable) {
var app = this.getApplication();
app.getController('RightMenu').getView('RightMenu').clearSelection();
@ -526,6 +557,7 @@ define([
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('DocumentHolder').getView().SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
var leftMenu = app.getController('LeftMenu').leftMenu;
@ -539,6 +571,12 @@ define([
if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(disable || this.langs.length<1);
}
}, this);
}
},
@ -553,7 +591,7 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.view && Common.localStorage.getBool("de-settings-spellcheck", true) )
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) )
me.view.turnSpelling(true);
if ( config.canReview ) {
@ -574,7 +612,7 @@ define([
_setReviewStatus(false);
} else {
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
_setReviewStatus(Common.localStorage.getBool(me.view.appPrefix + "track-changes"));
}
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
@ -588,10 +626,19 @@ define([
}
});
}
if (me.view && me.view.btnChat) {
me.getApplication().getController('LeftMenu').leftMenu.btnChat.on('toggle', function(btn, state){
if (state !== me.view.btnChat.pressed)
me.view.turnChat(state);
});
}
},
applySettings: function(menu) {
this.view && this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck", true) );
this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) );
this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) );
},
synchronizeChanges: function() {
@ -602,7 +649,11 @@ define([
setLanguages: function (array) {
this.langs = array;
this.view.btnDocLang.setDisabled(this.langs.length<1);
this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(this.langs.length<1);
}
}, this);
},
onDocLanguage: function() {
@ -627,7 +678,11 @@ define([
})).show();
},
onApiServerDisconnect: function() {
onLostEditRights: function() {
this.view && this.view.onLostEditRights();
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -37,7 +37,7 @@
* of an application through event-driven architecture.
*
* Created by Alexander Yuzhin on 1/21/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Bootstrap.js
*
* Created by Alexander Yuzhin on 5/27/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -191,6 +191,10 @@ function clearMenus(isFromInputControl) {
$('.dropdown-toggle').each(function (e) {
var $parent = ($(this)).parent();
if (!$parent.hasClass('open')) return;
if ($parent.attr('data-value') == 'prevent-canvas-click') {
$parent.attr('data-value','');
return;
}
$parent.trigger(e = $.Event('hide.bs.dropdown'));
if (e.isDefaultPrevented()) return;
$parent.removeClass('open').trigger('hidden.bs.dropdown', isFromInputControl);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Model
*
* Created by Maxim Kadushkin on 01 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Comments.js
*
* Created by Alexey Musinov on 16.01.14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Font.js
*
* Created by Alexander Yuzhin on 2/11/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ReviewChange.js
*
* Created by Julia.Radzhabova on 05.08.15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,25 +36,33 @@
* Model
*
* Created by Maxim Kadushkin on 27 February 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
Common.Models = Common.Models || {};
define([
'backbone'
], function(Backbone){
'underscore',
'backbone',
'common/main/lib/component/BaseView'
], function(_, Backbone){
'use strict';
Common.Models = Common.Models || {};
Common.Models.User = Backbone.Model.extend({
defaults: {
id : undefined,
username : 'Guest',
color : '#fff',
colorval : null,
online : false,
view : false
defaults: function() {
return {
iid : Common.UI.getId(), // internal id for rendering
id : undefined,
username : 'Guest',
color : '#fff',
colorval : null,
online : false,
view : false
}
}
});
});

View file

@ -80,7 +80,7 @@
// Or generate new perfectScrollbar
// Set class to the container
$this.addClass('ps-container');
$this.addClass('ps-container oo');
var $scrollbarXRail = $("<div class='ps-scrollbar-x-rail'></div>").appendTo($this),
$scrollbarYRail = $("<div class='ps-scrollbar-y-rail'></div>").appendTo($this),
@ -317,7 +317,7 @@
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;
if (e && e.target && (e.target.type === 'textarea' || e.target.type === 'input')) {
if (e && e.target && (e.target.type === 'textarea' && !e.target.hasAttribute('readonly') || e.target.type === 'input')) {
e.stopImmediatePropagation();
e.preventDefault();

View file

@ -5,7 +5,7 @@
<div class="user-name"><%=scope.getUserName(username)%></div>
<div class="user-date"><%=date%></div>
<% if (!editTextInPopover || hint) { %>
<div class="user-message"><%=scope.pickLink(comment)%></div>
<textarea readonly class="user-message user-select" style="overflow: hidden;" maxlength="maxCommLength"><%=scope.pickLink(comment)%></textarea>
<% } else { %>
<div class="inner-edit-ct">
<textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>
@ -27,7 +27,7 @@
<div class="user-name"><%=scope.getUserName(item.get("username"))%></div>
<div class="user-date"><%=item.get("date")%></div>
<% if (!item.get("editTextInPopover")) { %>
<div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>
<textarea readonly class="user-message user-select" maxlength="maxCommLength" style="overflow: hidden;"><%=scope.pickLink(item.get("reply"))%></textarea>
<% if (!hint) { %>
<div class="btns-reply-ct">
<% if (item.get("editable")) { %>

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* LanguageInfo.js
*
* Created by Maxim Kadushkin on 31 January 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* LocalStorage.js
*
* Created by Maxim Kadushkin on 31 July 2015
* Copyright (c) 2015 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Shortcuts.js
*
* Created by Maxim Kadushkin on 05 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
/*

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -154,11 +154,15 @@
if (typeof at == 'object') {
var tp = {top: at[1] + 15, left: at[0] + 18},
innerWidth = Common.Utils.innerWidth();
innerWidth = Common.Utils.innerWidth(),
innerHeight = Common.Utils.innerHeight();
if (tp.left + $tip.width() > innerWidth) {
tp.left = innerWidth - $tip.width() - 30;
}
if (tp.top + $tip.height() > innerHeight) {
tp.top = innerHeight - $tip.height() - 30;
}
$tip.offset(tp).addClass('in');
} else {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -95,14 +95,15 @@ Common.Utils = _.extend(new(function() {
documentSettingsType = {
Paragraph : 0,
Table : 1,
Image : 2,
Header : 3,
TextArt : 4,
Shape : 5,
Header : 2,
TextArt : 3,
Shape : 4,
Image : 5,
Slide : 6,
Chart : 7,
MailMerge : 8,
Signature : 9
Signature : 9,
Pivot : 10
},
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
me = this,
@ -576,7 +577,7 @@ Common.Utils.String = new (function() {
})();
Common.Utils.isBrowserSupported = function() {
return !((Common.Utils.ieVersion != 0 && Common.Utils.ieVersion < 9.0) ||
return !((Common.Utils.ieVersion != 0 && Common.Utils.ieVersion < 10.0) ||
(Common.Utils.safariVersion != 0 && Common.Utils.safariVersion < 5.0) ||
(Common.Utils.firefoxVersion != 0 && Common.Utils.firefoxVersion < 4.0) ||
(Common.Utils.chromeVersion != 0 && Common.Utils.chromeVersion < 7.0) ||
@ -701,7 +702,23 @@ Common.Utils.createXhr = function () {
}
return xmlhttp;
}
};
Common.Utils.getConfigJson = function (url) {
if ( url ) {
try {
var xhrObj = Common.Utils.createXhr();
if ( xhrObj ) {
xhrObj.open('GET', url, false);
xhrObj.send('');
return JSON.parse(xhrObj.responseText);
}
} catch (e) {}
}
return null;
};
Common.Utils.getConfigJson = function (url) {
if ( url ) {
@ -725,7 +742,7 @@ Common.Utils.asyncCall = function (callback, scope, args) {
})).then(function () {
callback.call(scope, args);
});
}
};
// Extend javascript String type
String.prototype.strongMatch = function(regExp){
@ -735,4 +752,20 @@ String.prototype.strongMatch = function(regExp){
}
return false;
};
};
Common.Utils.InternalSettings = new(function() {
var settings = {};
var _get = function(name) {
return settings[name];
},
_set = function(name, value) {
settings[name] = value;
};
return {
get: _get,
set: _set
}
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* About.js
*
* Created by Julia Radzhabova on 3/06/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* AdvancedSettingsWindow.js
*
* Created by Julia Radzhabova on 2/21/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -58,7 +58,7 @@ define([
'<div class="box" style="height:' + (_options.height-85) + 'px;">',
'<div class="menu-panel">',
'<% _.each(items, function(item) { %>',
'<button class="btn btn-category" style="margin-bottom: 2px;" content-target="<%= item.panelId %>"><span class=""><%= item.panelCaption %></span></button>',
'<button class="btn btn-category" content-target="<%= item.panelId %>"><span class=""><%= item.panelCaption %></span></button>',
'<% }); %>',
'</div>',
'<div class="separator"/>',

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* View
*
* Created by Maxim Kadushkin on 27 February 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -59,9 +59,9 @@ define([
storeUsers: undefined,
storeMessages: undefined,
tplUser: ['<li id="chat-user-<%= user.get("id") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>',
'<div class="color" style="background-color: <%= user.get("color") %>;" >',
'<label class="name"><%= scope.getUserName(user.get("username")) %></label>',
tplUser: ['<li id="<%= user.get("iid") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>',
'<div class="name"><%= scope.getUserName(user.get("username")) %>',
'<div class="color" style="background-color: <%= user.get("color") %>;" ></div>',
'</div>',
'</li>'].join(''),
@ -169,7 +169,7 @@ define([
_onUsersChanged: function(m) {
if (m.changed.online != undefined && this.panelUsers) {
this.panelUsers.find('#chat-user-'+ m.get('id'))[m.changed.online?'removeClass':'addClass']('offline');
this.panelUsers.find('#' + m.get('iid'))[m.changed.online?'removeClass':'addClass']('offline');
this.panelUsers.scroller.update({minScrollbarLength : 25, alwaysVisibleY: true});
}
},
@ -389,6 +389,7 @@ define([
if (event && 0 == textBox.val().length) {
this.layout.setResizeValue(1, Math.max(this.addMessageBoxHeight, height - this.addMessageBoxHeight));
this.textBoxAutoSizeLocked = undefined;
this.updateScrolls();
return;
}
@ -409,9 +410,8 @@ define([
height = this.panelBox.height();
this.layout.setResizeValue(1,
Math.max(this.addMessageBoxHeight,
Math.min(height - contentHeight - textBoxMinHeightIndent, height - this.addMessageBoxHeight)));
if (this.layout.setResizeValue(1, Math.max(this.addMessageBoxHeight, Math.min(height - contentHeight - textBoxMinHeightIndent, height - this.addMessageBoxHeight))))
this.updateScrolls(); // update when resize position changed
},
updateScrolls: function () {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* View
*
* Created by Alexey Musinov on 16.01.14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -152,11 +152,11 @@ define([
},
getTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function (blur) {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
if (blur) {
text.blur();
} else {
@ -169,15 +169,16 @@ define([
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = this.$el.find('textarea'),
domTextBox = null,
minHeight = 50,
$domTextBox = null,
lineHeight = 0,
minHeight = 50,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
@ -186,17 +187,17 @@ define([
scrollPos = $(view.scroller.el).scrollTop();
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
$domTextBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
parentView.calculateSizeOfContent();
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
$domTextBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
$domTextBox.css({height: newHeight + 'px'});
}
parentView.calculateSizeOfContent();
@ -209,17 +210,23 @@ define([
view.autoScrollToEditButtons();
}
this.textBox = undefined;
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
textBox.each(function(idx, item){
if (item) {
domTextBox = item;
$domTextBox = $(item);
var isEdited = !$domTextBox.hasClass('user-message');
lineHeight = isEdited ? parseInt($domTextBox.css('lineHeight'), 10) * 0.25 : 0;
minHeight = isEdited ? 50 : 24;
updateTextBoxHeight();
if (isEdited) {
$domTextBox.bind('input propertychange', updateTextBoxHeight);
view.textBox = $domTextBox;
}
}
});
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
@ -285,6 +292,7 @@ define([
arr.push($(item).data('bs.tooltip').tip());
});
view.tipsArray = arr;
this.autoHeightTextBox();
};
var onCommentsViewMouseOver = function() {
@ -375,6 +383,7 @@ define([
t.fireEvent('comment:closeEditing');
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('user-reply')) {
t.fireEvent('comment:closeEditing');
@ -399,6 +408,7 @@ define([
t.fireEvent('comment:closeEditing');
readdresolves();
this.autoHeightTextBox();
}
} else if (btn.hasClass('btn-close', false)) {
t.fireEvent('comment:closeEditing', [commentId]);
@ -406,11 +416,21 @@ define([
t.fireEvent('comment:show', [commentId]);
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-inner-edit', false)) {
if (record.get('dummy')) {
t.fireEvent('comment:addDummyComment', [this.getActiveTextBoxVal()]);
var commentVal = this.getActiveTextBoxVal();
if (commentVal.length>0)
t.fireEvent('comment:addDummyComment', [commentVal]);
else {
var text = me.$window.find('textarea:not(.user-message)');
if (text && text.length)
setTimeout(function(){
text.focus();
}, 10);
}
return;
}
@ -427,6 +447,7 @@ define([
}
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-inner-close', false)) {
if (record.get('dummy')) {
@ -438,11 +459,8 @@ define([
me.saveText();
record.set('hideAddReply', false);
this.getTextBox().val(me.textVal);
this.autoHeightTextBox();
} else {
this.clearTextBoxBind();
t.fireEvent('comment:closeEditing', [commentId]);
}
@ -453,6 +471,7 @@ define([
me.calculateSizeOfContent();
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
@ -461,6 +480,7 @@ define([
t.fireEvent('comment:resolve', [commentId]);
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
@ -468,20 +488,21 @@ define([
t.fireEvent('comment:resolve', [commentId]);
readdresolves();
this.autoHeightTextBox();
}
}
});
me.on({
'show': function () {
me.commentsView.autoHeightTextBox();
me.$window.find('textarea').keydown(function (event) {
me.$window.find('textarea:not(.user-message)').keydown(function (event) {
if (event.keyCode == Common.UI.Keys.ESC) {
me.hide();
}
});
},
'animate:before': function () {
var text = me.$window.find('textarea');
me.commentsView.autoHeightTextBox();
var text = me.$window.find('textarea:not(.user-message)');
if (text && text.length)
text.focus();
}
@ -889,11 +910,11 @@ define([
},
getTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
if (text && text.length) {
var val = text.val();
text.focus();
@ -902,7 +923,7 @@ define([
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
@ -1349,7 +1370,7 @@ define([
return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(quote), 120, true);
},
getUserName: function (username) {
return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(username), 22, true);
return Common.Utils.String.htmlEncode(username);
},
pickLink: function (message) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* CopyWarningDialog.js
*
* Created by Alexander Yuzhin on 4/15/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* DocumentAccessDialog.js
*
* Created by Julia Radzhabova on 3/14/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ExternalDiagramEditor.js
*
* Created by Julia Radzhabova on 4/08/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -111,15 +111,18 @@ define([
},
onDlgBtnClick: function(event) {
var state = event.currentTarget.attributes['result'].value;
if ( this.handler && this.handler.call(this, state) )
if ( this.handler ) {
this.handler.call(this, event.currentTarget.attributes['result'].value);
return;
}
this.hide();
},
onToolClose: function() {
if ( this.handler && this.handler.call(this, 'cancel') )
if ( this.handler ) {
this.handler.call(this, 'cancel');
return;
}
this.hide();
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ExternalDiagramEditor.js
*
* Created by Julia Radzhabova on 4/08/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* Header.js
*
* Created by Alexander Yuzhin on 2/14/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -56,7 +56,7 @@ define([
var $saveStatus;
var templateUserItem =
'<li id="status-chat-user-<%= user.get("id") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
'<li id="<%= user.get("iid") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
'<div class="color" style="background-color: <%= user.get("color") %>;" >' +
'<label class="name"><%= fnEncode(user.get("username")) %></label>' +
'</div>' +
@ -70,7 +70,9 @@ define([
'</ul>');
var templateRightBox = '<section>' +
'<section id="box-doc-name"><input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false"></input></section>' +
'<section id="box-doc-name">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false"></input>' +
'</section>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
@ -125,7 +127,7 @@ define([
function onUsersChanged(model, collection) {
if (model.changed.online != undefined && $userList) {
$userList.find('#status-chat-user-'+ model.get('id'))[model.changed.online ? 'removeClass' : 'addClass']('offline');
$userList.find('#'+ model.get('iid'))[model.changed.online ? 'removeClass' : 'addClass']('offline');
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
}
@ -206,9 +208,8 @@ define([
appConfig = mode;
var me = this;
me.btnGoBack.updateHint(me.textBack);
me.btnGoBack.on('click', function (e) {
Common.NotificationCenter.trigger('goback', true);
Common.NotificationCenter.trigger('goback');
});
if ( me.logo )
@ -316,8 +317,6 @@ define([
} else {
me.labelDocName.attr('size', name.length > 10 ? name.length : 10);
}
console.log('input keydown');
}
return {
@ -394,12 +393,13 @@ define([
if ( this.labelDocName ) this.labelDocName.off();
this.labelDocName = $html.find('#rib-doc-name');
this.labelDocName.on({
'keydown': onDocNameKeyDown.bind(this)
});
// this.labelDocName.attr('maxlength', 50);
this.labelDocName.text = function (text) {
this.val(text).attr('size', text.length);
}
if ( this.documentCaption ) {
this.labelDocName.val( this.documentCaption );
this.labelDocName.text( this.documentCaption );
}
if ( !_.isUndefined(this.options.canRename) ) {
@ -472,11 +472,13 @@ define([
this.branding = value;
if (value && value.logo && value.logo.image) {
element = $('#header-logo');
if ( element ) {
element.html('<img src="' + value.logo.image + '" style="max-width:100px; max-height:20px; margin: 0;"/>');
element.css({'background-image': 'none', width: 'auto'});
if ( value ) {
if ( value.logo && value.logo.image ) {
element = $('#header-logo');
if (element) {
element.html('<img src="' + value.logo.image + '" style="max-width:100px; max-height:20px; margin: 0;"/>');
element.css({'background-image': 'none', width: 'auto'});
}
}
}
},
@ -497,8 +499,8 @@ define([
this.documentCaption = value;
this.isModified && (value += '*');
if ( this.labelDocName ) {
this.labelDocName.val( value );
this.labelDocName.attr('size', value.length);
this.labelDocName.text( value );
// this.labelDocName.attr('size', value.length);
this.setCanRename(true);
}
@ -516,13 +518,15 @@ define([
var _name = this.documentCaption;
changed && (_name += '*');
this.labelDocName.val(_name);
this.labelDocName.text(_name);
},
setCanBack: function (value) {
setCanBack: function (value, text) {
this.canBack = value;
this.btnGoBack[value ? 'show' : 'hide']();
if (value)
this.btnGoBack.updateHint((text && typeof text == 'string') ? text : this.textBack);
},
getCanBack: function () {
@ -541,7 +545,16 @@ define([
title: me.txtRename,
placement: 'cursor'}
);
label.on({
'keydown': onDocNameKeyDown.bind(this),
'blur': function (e) {
}
});
} else {
label.off();
label.attr('disabled', true);
var tip = label.data('bs.tooltip');
if ( tip ) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* ImageFromUrlDialog.js
*
* Created by Alexander Yuzhin on 2/18/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* InsertTableDialog.js
*
* Created by Alexander Yuzhin on 2/17/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,7 +35,7 @@
* LanguageDialog.js
*
* Created by Julia Radzhabova on 04/25/2017
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Select Codepage for open CSV/TXT format file.
*
* Created by Alexey.Musinov on 29/04/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -54,14 +54,15 @@ define([
_options = {};
_.extend(_options, {
closable: false,
width : 250,
height : (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 205 : 155,
contentWidth : 390,
closable : false,
width : (options.preview) ? 414 : 262,
height : (options.preview) ? 291 : ((options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 205 : 155),
header : true,
preview : options.preview,
cls : 'open-dlg',
contentTemplate : '',
title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT')
title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT'),
toolcallback : _.bind(t.onToolClose, t)
}, options);
@ -72,30 +73,55 @@ define([
'<label class="header">' + t.txtPassword + '</label>',
'<div id="id-password-txt" style="margin-bottom:15px;"></div>',
'<% } else { %>',
'<label class="header">' + t.txtEncoding + '</label>',
'<div id="id-codepages-combo" class="input-group-nr" style="margin-bottom:15px;"></div>',
'<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>',
'<label class="header">' + t.txtDelimiter + '</label>',
'<div>',
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 110px;display: inline-block; vertical-align: middle;"></div>',
'<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',
'<div style="display: inline-block; margin-bottom:15px;margin-right: 10px;">',
'<label class="header">' + t.txtEncoding + '</label>',
'<div>',
'<div id="id-codepages-combo" class="input-group-nr" style="display: inline-block; vertical-align: middle;"></div>',
'</div>',
'</div>',
'<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>',
'<div style="display: inline-block; margin-bottom:15px;">',
'<label class="header">' + t.txtDelimiter + '</label>',
'<div>',
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>',
'<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',
'</div>',
'</div>',
'<% } %>',
'<% if (!!preview) { %>',
'<div style="">',
'<label class="header">' + t.txtPreview + '</label>',
'<div style="position: relative;">',
'<div style="width: 100%;">',
'<div id="id-preview">',
'<div>',
'<div style="position: absolute; top: 0;"><div id="id-preview-data"></div></div>',
'</div>',
'</div>',
'</div>',
'</div>',
'</div>',
'<% } %>',
'<% } %>',
'</div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + '</button>',
'<% if (closable) { %>',
'<button class="btn normal dlg-btn" result="cancel">' + t.closeButtonText + '</button>',
'<% } %>',
'</div>'
].join('');
this.handler = options.handler;
this.type = options.type;
this.codepages = options.codepages;
this.settings = options.settings;
this.validatePwd = options.validatePwd || false;
this.handler = _options.handler;
this.type = _options.type;
this.preview = _options.preview;
this.closable = _options.closable;
this.codepages = _options.codepages;
this.settings = _options.settings;
this.api = _options.api;
this.validatePwd = _options.validatePwd || false;
_options.tpl = _.template(this.template)(_options);
@ -106,8 +132,15 @@ define([
if (this.$window) {
var me = this;
this.$window.find('.tool').hide();
if (!this.closable)
this.$window.find('.tool').hide();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.previewPanel = this.$window.find('#id-preview-data');
this.previewParent = this.previewPanel.parent();
this.previewScrolled = this.$window.find('#id-preview');
this.previewInner = this.previewScrolled.find('div:first-child');
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
this.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'),
@ -120,11 +153,12 @@ define([
this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
} else {
this.initCodePages();
this.onPrimary = function() {
me.onBtnClick();
return false;
};
this.updatePreview();
}
this.onPrimary = function() {
me._handleInput('ok');
return false;
};
}
},
@ -141,25 +175,36 @@ define([
}
},
onBtnClick: function (event) {
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
} else if (this.closable && event.keyCode == Common.UI.Keys.ESC)
this._handleInput('cancel');
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
onToolClose: function() {
this._handleInput('cancel');
},
_handleInput: function(state) {
if (this.handler) {
if (this.cmbEncoding) {
var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null);
this.handler.call(this, this.cmbEncoding.getValue(), delimiter, delimiterChar);
} else
this.handler.call(this, this.inputPwd.getValue());
} else {
this.handler.call(this, state, this.inputPwd.getValue());
}
}
this.close();
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN)
this.onBtnClick();
},
initCodePages: function () {
var i, c, codepage, encodedata = [], listItems = [], length = 0;
@ -330,18 +375,22 @@ define([
this.cmbEncoding = new Common.UI.ComboBox({
el: $('#id-codepages-combo', this.$window),
menuStyle: 'min-width: 218px; max-height: 200px;',
style: 'width: 230px;',
menuStyle: 'min-width: 230px; max-height: 200px;',
cls: 'input-group-nr',
menuCls: 'scrollable-menu',
data: listItems,
editable: false
});
this.cmbEncoding.setValue( (this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0]);
if (this.preview)
this.cmbEncoding.on('selected', _.bind(this.onCmbEncodingSelect, this));
if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
this.cmbDelimiter = new Common.UI.ComboBox({
el: $('#id-delimiters-combo', this.$window),
menuStyle: 'min-width: 110px;',
style: 'width: 100px;',
menuStyle: 'min-width: 100px;',
cls: 'input-group-nr',
data: [
{value: 4, displayValue: ','},
@ -359,16 +408,108 @@ define([
el : $('#id-delimiter-other'),
style : 'width: 30px;',
maxLength: 1,
validateOnChange: true,
validateOnBlur: false,
value: (this.settings && this.settings.asc_getDelimiterChar()) ? this.settings.asc_getDelimiterChar() : ''
});
this.inputDelimiter.setVisible(false);
if (this.preview)
this.inputDelimiter.on ('changing', _.bind(this.updatePreview, this));
}
}
},
updatePreview: function() {
if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null);
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(this.cmbEncoding.getValue(), delimiter, delimiterChar), _.bind(this.previewCallback, this));
} else {
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(this.cmbEncoding.getValue()), _.bind(this.previewCallback, this));
}
},
previewCallback: function(data) {
if (!data || !data.length) return;
this.data = data;
this.previewInner.height(data.length*17);
if (!this.scrollerY)
this.scrollerY = new Common.UI.Scroller({
el: this.previewScrolled,
minScrollbarLength : 20,
alwaysVisibleY: true,
onChange: _.bind(function(){
if (this.scrollerY) {
var startPos = this.scrollerY.getScrollTop(),
start = Math.floor(startPos/17+0.5),
end = start+Math.min(6, this.data.length);
if (end>this.data.length) {
end = this.data.length;
start = this.data.length-6;
startPos = start*17;
}
this.previewParent.height(108);
this.previewParent.css({top: startPos});
this.previewDataBlock(this.data.slice(start, end));
}
}, this)
});
this.scrollerY.update();
this.scrollerY.scrollTop(0);
},
previewDataBlock: function(data) {
if (!_.isUndefined(this.scrollerX)) {
this.scrollerX.destroy();
delete this.scrollerX;
}
if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
var maxlength = 0;
for (var i=0; i<data.length; i++) {
if (data[i].length>maxlength)
maxlength = data[i].length;
}
var tpl = '<table>';
for (var i=0; i<data.length; i++) {
tpl += '<tr>';
for (var j=0; j<data[i].length; j++) {
tpl += '<td>' + Common.Utils.String.htmlEncode(data[i][j]) + '</td>';
}
for (j=data[i].length; j<maxlength; j++) {
tpl += '<td></td>';
}
tpl += '</tr>';
}
tpl += '</table>';
} else {
var tpl = '<table>';
for (var i=0; i<data.length; i++) {
tpl += '<tr><td>' + Common.Utils.String.htmlEncode(data[i]) + '</td></tr>';
}
tpl += '</table>';
}
this.previewPanel.html(tpl);
this.scrollerX = new Common.UI.Scroller({
el: this.previewPanel,
suppressScrollY: true,
alwaysVisibleX: true,
minScrollbarLength : 20
});
},
onCmbDelimiterSelect: function(combo, record){
this.inputDelimiter.setVisible(record.value == -1);
if (this.preview)
this.updatePreview();
},
onCmbEncodingSelect: function(combo, record){
this.updatePreview();
},
okButtonText : "OK",
@ -381,7 +522,9 @@ define([
txtPassword : "Password",
txtTitleProtected : "Protected File",
txtOther: 'Other',
txtIncorrectPwd: 'Password is incorrect.'
txtIncorrectPwd: 'Password is incorrect.',
closeButtonText: 'Close File',
txtPreview: 'Preview'
}, Common.Views.OpenDialog || {}));
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* Select Codepage for open CSV/TXT format file.
*
* Created by Alexey.Musinov on 29/04/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -54,7 +54,6 @@ define([
_options = {};
_.extend(_options, {
closable: false,
width : 350,
height : 220,
header : true,
@ -97,7 +96,6 @@ define([
if (this.$window) {
var me = this;
this.$window.find('.tool').hide();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'),

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,7 +35,7 @@
* Protection.js
*
* Created by Julia Radzhabova on 14.11.2017
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* RenameDialog.js
*
* Created by Julia Radzhabova on 9/23/16
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -36,7 +36,7 @@
* View
*
* Created by Julia.Radzhabova on 05.08.15
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
@ -412,35 +412,41 @@ define([
Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section id="review-changes-panel" class="panel" data-tab="review">' +
'<div class="group">' +
'<span id="slot-set-lang" class="btn-slot text x-huge"></span>' +
'<div class="group no-group-mask">' +
'<span id="slot-btn-sharing" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-coauthmode" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="group no-group-mask" style="padding-left: 0;">' +
'<span id="slot-btn-spelling" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long comments"/>' +
'<div class="separator long sharing"/>' +
'<div class="group">' +
'<span class="btn-slot text x-huge slot-comment"></span>' +
'</div>' +
'<div class="separator long review"/>' +
'<div class="separator long comments"/>' +
'<div class="group">' +
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="group no-group-mask" style="padding-left: 0;">' +
'<span id="btn-review-view" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long review"/>' +
'<div class="group move-changes">' +
'<div class="group move-changes" style="padding-left: 0;">' +
'<span id="btn-change-prev" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-next" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-accept" class="btn-slot text x-huge"></span>' +
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long review"/>' +
'<div class="group no-group-mask">' +
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long chat"/>' +
'<div class="group no-group-mask">' +
'<span id="slot-btn-history" class="btn-slot text x-huge"></span>' +
'</div>' +
'</section>';
function _click_turnpreview(btn, e) {
if (this.appConfig.canReview) {
Common.NotificationCenter.trigger('reviewchanges:turn', btn.pressed ? 'on' : 'off');
Common.NotificationCenter.trigger('edit:complete');
}
};
@ -474,7 +480,6 @@ define([
this.btnsTurnReview.forEach(function (button) {
button.on('click', _click_turnpreview.bind(me));
Common.NotificationCenter.trigger('edit:complete', me);
});
this.btnReviewView.menu.on('item:click', function (menu, item, e) {
@ -489,8 +494,26 @@ define([
});
});
this.btnDocLang.on('click', function (btn, e) {
me.fireEvent('lang:document', this);
this.btnsDocLang.forEach(function(button) {
button.on('click', function (b, e) {
me.fireEvent('lang:document', this);
});
});
this.btnSharing && this.btnSharing.on('click', function (btn, e) {
Common.NotificationCenter.trigger('collaboration:sharing');
});
this.btnCoAuthMode && this.btnCoAuthMode.menu.on('item:click', function (menu, item, e) {
me.fireEvent('collaboration:coauthmode', [menu, item]);
});
this.btnHistory && this.btnHistory.on('click', function (btn, e) {
Common.NotificationCenter.trigger('collaboration:history');
});
this.btnChat && this.btnChat.on('click', function (btn, e) {
me.fireEvent('collaboration:chat', [btn.pressed]);
});
}
@ -549,20 +572,45 @@ define([
});
}
this.btnSetSpelling = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-docspell',
caption: this.txtSpelling,
enableToggle: true
});
this.btnsSpelling = [this.btnSetSpelling];
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && this._readonlyRights!==true) {
this.btnSharing = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-sharing',
caption: this.txtSharing
});
}
this.btnDocLang = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-doclang',
caption: this.txtDocLang,
disabled: true
});
if (!this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
this.btnCoAuthMode = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-coedit',
caption: this.txtCoAuthMode,
menu: true
});
}
this.btnsSpelling = [];
this.btnsDocLang = [];
if (this.appConfig.canUseHistory && !this.appConfig.isDisconnected) {
this.btnHistory = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-history',
caption: this.txtHistory
});
}
if (this.appConfig.canCoAuthoring && this.appConfig.canChat) {
this.btnChat = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-chat',
caption: this.txtChat,
enableToggle: true
});
}
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},
@ -579,6 +627,10 @@ define([
(new Promise(function (accept, reject) {
accept();
})).then(function(){
var menuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
'<% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
'<% } %></a>');
if ( config.canReview ) {
me.btnPrev.updateHint(me.hintPrev);
me.btnNext.updateHint(me.hintNext);
@ -621,24 +673,30 @@ define([
cls: 'ppm-toolbar',
items: [
{
caption: me.txtMarkup,
caption: me.txtMarkupCap,
checkable: true,
toggleGroup: 'menuReviewView',
checked: true,
value: 'markup'
value: 'markup',
template: menuTemplate,
description: me.txtMarkup
},
{
caption: me.txtFinal,
caption: me.txtFinalCap,
checkable: true,
toggleGroup: 'menuReviewView',
checked: false,
template: menuTemplate,
description: me.txtFinal,
value: 'final'
},
{
caption: me.txtOriginal,
caption: me.txtOriginalCap,
checkable: true,
toggleGroup: 'menuReviewView',
checked: false,
template: menuTemplate,
description: me.txtOriginal,
value: 'original'
}
]
@ -647,20 +705,78 @@ define([
me.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly);
} else {
me.$el.find('.separator.review')
.hide()
.next('.group').hide();
}
if ( !config.canComments || !config.canCoAuthoring) {
$('.separator.comments', me.$el)
.hide()
.next('.group').hide();
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
me.btnHistory && me.btnHistory.updateHint(me.tipHistory);
me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q'));
if (me.btnCoAuthMode) {
me.btnCoAuthMode.setMenu(
new Common.UI.Menu({
cls: 'ppm-toolbar',
style: 'max-width: 220px;',
items: [
{
caption: me.strFast,
checkable: true,
toggleGroup: 'menuCoauthMode',
checked: true,
template: menuTemplate,
description: me.strFastDesc,
value: 1
},
{
caption: me.strStrict,
checkable: true,
toggleGroup: 'menuCoauthMode',
checked: false,
template: menuTemplate,
description: me.strStrictDesc,
value: 0
}
]
}));
me.btnCoAuthMode.updateHint(me.tipCoAuthMode);
var value = Common.localStorage.getItem(me.appPrefix + "settings-coauthmode");
if (value===null && !Common.localStorage.itemExists(me.appPrefix + "settings-autosave") &&
config.customization && config.customization.autosave===false) {
value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null
}
me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring);
}
me.btnDocLang.updateHint(me.tipSetDocLang);
me.btnSetSpelling.updateHint(me.tipSetSpelling);
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing',
separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments',
separator_review = !config.canReview ? me.$el.find('.separator.review') : '.separator.review',
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
separator_last;
if (typeof separator_sharing == 'object')
separator_sharing.hide().prev('.group').hide();
else
separator_last = separator_sharing;
if (typeof separator_comments == 'object')
separator_comments.hide().prev('.group').hide();
else
separator_last = separator_comments;
if (typeof separator_review == 'object')
separator_review.hide().prevUntil('.separator.comments').hide();
else
separator_last = separator_review;
if (typeof separator_chat == 'object')
separator_chat.hide().prev('.group').hide();
else
separator_last = separator_chat;
if (!me.btnHistory && separator_last)
me.$el.find(separator_last).hide();
Common.NotificationCenter.trigger('tab:visible', 'review', true);
setEvents.call(me);
});
@ -678,8 +794,10 @@ define([
this.btnReviewView.render(this.$el.find('#btn-review-view'));
}
this.btnSetSpelling.render(this.$el.find('#slot-btn-spelling'));
this.btnDocLang.render(this.$el.find('#slot-set-lang'));
this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing'));
this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode'));
this.btnHistory && this.btnHistory.render(this.$el.find('#slot-btn-history'));
this.btnChat && this.btnChat.render(this.$el.find('#slot-btn-chat'));
return this.$el;
},
@ -725,6 +843,17 @@ define([
});
this.btnsSpelling.push(button);
return button;
} else if (type == 'doclang' && parent == 'statusbar' ) {
button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'btn-ic-doclang',
hintAnchor : 'top',
hint: this.tipSetDocLang,
disabled: true
});
this.btnsDocLang.push(button);
return button;
}
},
@ -758,17 +887,42 @@ define([
}, this);
},
SetDisabled: function (state) {
turnCoAuthMode: function (fast) {
if (this.btnCoAuthMode) {
this.btnCoAuthMode.menu.items[0].setChecked(fast, true);
this.btnCoAuthMode.menu.items[1].setChecked(!fast, true);
}
},
turnChat: function (state) {
this.btnChat && this.btnChat.toggle(state, true);
},
SetDisabled: function (state, langs) {
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
this.btnsDocLang && this.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(state || langs && langs.length<1);
}
}, this);
this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
this.btnChat && this.btnChat.setDisabled(state);
},
onLostEditRights: function() {
this._readonlyRights = true;
if (!this.rendered)
return;
this.btnSharing && this.btnSharing.setDisabled(true);
},
txtAccept: 'Accept',
@ -790,12 +944,26 @@ define([
txtAcceptChanges: 'Accept Changes',
txtRejectChanges: 'Reject Changes',
txtView: 'Display Mode',
txtMarkup: 'All changes (Editing)',
txtFinal: 'All changes accepted (Preview)',
txtOriginal: 'All changes rejected (Preview)',
txtMarkup: 'Text with changes (Editing)',
txtFinal: 'All changes like accept (Preview)',
txtOriginal: 'Text without changes (Preview)',
tipReviewView: 'Select the way you want the changes to be displayed',
tipAcceptCurrent: 'Accept current changes',
tipRejectCurrent: 'Reject current changes'
tipRejectCurrent: 'Reject current changes',
txtSharing: 'Sharing',
tipSharing: 'Manage document access rights',
txtCoAuthMode: 'Co-editing Mode',
tipCoAuthMode: 'Set co-editing mode',
strFast: 'Fast',
strStrict: 'Strict',
txtHistory: 'Version History',
tipHistory: 'Show version history',
txtChat: 'Chat',
txtMarkupCap: 'Markup',
txtFinalCap: 'Final',
txtOriginalCap: 'Original',
strFastDesc: 'Real-time co-editing. All changes are saved automatically.',
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.'
}
}()), Common.Views.ReviewChanges || {}));

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* SearchDialog.js
*
* Created by Maxim Kadushkin on 03 March 2014
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
@ -34,7 +34,7 @@
* SignDialog.js
*
* Created by Julia Radzhabova on 5/19/17
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/

Some files were not shown because too many files have changed in this diff Show more