merge with develop
This commit is contained in:
commit
af8edb29ca
10
.travis.yml
Normal file
10
.travis.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
dist: trusty
|
||||
language: node_js
|
||||
node_js:
|
||||
- '6'
|
||||
before_install: npm install -g grunt-cli
|
||||
before_script:
|
||||
- cd build
|
||||
script:
|
||||
- npm install
|
||||
- grunt --level=ADVANCED
|
19
CHANGELOG.md
Normal file
19
CHANGELOG.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Change log
|
||||
## 5.1.1
|
||||
### All Editors
|
||||
* Customize initial zoom for the embedded editors
|
||||
* Replace image from context menu (bug #11493)
|
||||
* Customize availability of help in the editor
|
||||
|
||||
### Document Editor
|
||||
* Create and manage bookmarks
|
||||
* Create internal hyperlinks to bookmarks and headings
|
||||
* Export to RTF format
|
||||
|
||||
### Spreadsheet Editor
|
||||
* Add Spanish, French formula translations
|
||||
* Set options for saving in PDF format (bug #34914)
|
||||
* Change cell format from context menu (bug #16272)
|
||||
|
||||
### Presentation Editor
|
||||
* Add hints to presentation themes (bug #21362)
|
|
@ -45,6 +45,7 @@
|
|||
changeHistory: <can change history>, // default = false
|
||||
comment: <can comment in view mode> // default = edit,
|
||||
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
|
||||
modifyContentControl: <can modify content controls in documenteditor> // default = true
|
||||
}
|
||||
},
|
||||
editorConfig: {
|
||||
|
@ -119,7 +120,8 @@
|
|||
autosave: true,
|
||||
forcesave: false,
|
||||
commentAuthorOnly: false,
|
||||
showReviewChanges: false
|
||||
showReviewChanges: false,
|
||||
help: true
|
||||
},
|
||||
plugins: {
|
||||
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
|
||||
|
@ -191,6 +193,7 @@
|
|||
_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.editorConfig.canRename = _config.events && !!_config.events.onRequestRename;
|
||||
_config.frameEditorId = placeholderId;
|
||||
|
||||
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
|
||||
|
@ -324,7 +327,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.");
|
||||
|
@ -362,10 +365,11 @@
|
|||
if (!!result && result.length) {
|
||||
if (result[1] == 'desktop') {
|
||||
_config.editorConfig.targetApp = result[1];
|
||||
_config.editorConfig.canBackToFolder = false;
|
||||
_config.editorConfig.canUseHistory = false;
|
||||
// _config.editorConfig.canBackToFolder = false;
|
||||
if (!_config.editorConfig.customization) _config.editorConfig.customization = {};
|
||||
_config.editorConfig.customization.about = false;
|
||||
|
||||
if ( window.AscDesktopEditor ) window.AscDesktopEditor.execCommand('webapps:events', 'loading');
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -55,7 +55,10 @@
|
|||
height: '100%',
|
||||
documentType: urlParams['doctype'] || 'text',
|
||||
document: doc,
|
||||
editorConfig: cfg
|
||||
editorConfig: cfg,
|
||||
events: {
|
||||
onInternalMessage: onInternalMessage,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -91,6 +94,9 @@
|
|||
|
||||
function getEditorConfig(urlParams) {
|
||||
return {
|
||||
customization : {
|
||||
goback: { url: "onlyoffice.com" }
|
||||
},
|
||||
mode : urlParams["mode"] || 'edit',
|
||||
lang : urlParams["lang"] || 'en',
|
||||
user: {
|
||||
|
@ -144,6 +150,21 @@
|
|||
}
|
||||
};
|
||||
|
||||
function onInternalMessage(event) {
|
||||
let info = event.data;
|
||||
if ( info.type == 'goback' ) {
|
||||
if ( window.AscDesktopEditor ) {
|
||||
window.AscDesktopEditor.execCommand('go:folder', info.data.status);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function onDocumentReady() {
|
||||
if ( window.AscDesktopEditor ) {
|
||||
window.AscDesktopEditor.execCommand('doc:onready', '');
|
||||
}
|
||||
}
|
||||
|
||||
if (isMobile()){
|
||||
window.addEventListener('load', fixSize);
|
||||
window.addEventListener('resize', fixSize);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -61,12 +61,11 @@ define([
|
|||
},
|
||||
|
||||
getEditingCount: function() {
|
||||
var count = 0;
|
||||
this.each(function(user){
|
||||
user.get('online') && !user.get('view') && ++count;
|
||||
});
|
||||
return this.filter(function(item){return item.get('online') && !item.get('view')}).length;
|
||||
},
|
||||
|
||||
return count;
|
||||
getEditingOriginalCount: function() {
|
||||
return this.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).size().value();
|
||||
},
|
||||
|
||||
findUser: function(id) {
|
||||
|
@ -74,6 +73,13 @@ define([
|
|||
function(model){
|
||||
return model.get('id') == id;
|
||||
});
|
||||
},
|
||||
|
||||
findOriginalUser: function(id) {
|
||||
return this.find(
|
||||
function(model){
|
||||
return model.get('idOriginal') == id;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -119,6 +119,68 @@ define([
|
|||
], function () {
|
||||
'use strict';
|
||||
|
||||
window.createButtonSet = function() {
|
||||
function ButtonsArray(args) {};
|
||||
ButtonsArray.prototype = new Array;
|
||||
ButtonsArray.prototype.constructor = ButtonsArray;
|
||||
|
||||
var _disabled = false;
|
||||
|
||||
ButtonsArray.prototype.add = function(button) {
|
||||
button.setDisabled(_disabled);
|
||||
this.push(button);
|
||||
};
|
||||
|
||||
ButtonsArray.prototype.setDisabled = function(disable) {
|
||||
if ( _disabled != disable ) {
|
||||
_disabled = disable;
|
||||
|
||||
this.forEach( function(button) {
|
||||
button.setDisabled(disable);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ButtonsArray.prototype.toggle = function(state, suppress) {
|
||||
this.forEach(function(button) {
|
||||
button.toggle(state, suppress);
|
||||
});
|
||||
};
|
||||
|
||||
ButtonsArray.prototype.pressed = function() {
|
||||
return this.some(function(button) {
|
||||
return button.pressed;
|
||||
});
|
||||
};
|
||||
|
||||
ButtonsArray.prototype.contains = function(id) {
|
||||
return this.some(function(button) {
|
||||
return button.id == id;
|
||||
});
|
||||
};
|
||||
|
||||
ButtonsArray.prototype.concat = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var result = Array.prototype.slice.call(this);
|
||||
|
||||
args.forEach(function(sub){
|
||||
if (sub instanceof Array )
|
||||
Array.prototype.push.apply(result, sub);
|
||||
else if (sub)
|
||||
result.push(sub);
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var _out_array = Object.create(ButtonsArray.prototype);
|
||||
for ( var i in arguments ) {
|
||||
_out_array.add(arguments[i]);
|
||||
}
|
||||
|
||||
return _out_array;
|
||||
};
|
||||
|
||||
var templateBtnIcon =
|
||||
'<% if ( iconImg ) { %>' +
|
||||
'<img src="<%= iconImg %>">' +
|
||||
|
@ -292,6 +354,7 @@ define([
|
|||
me.menu.render(me.cmpEl);
|
||||
|
||||
parentEl.html(me.cmpEl);
|
||||
me.$icon = me.$el.find('.icon');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,6 +600,13 @@ define([
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !!me.options.signals ) {
|
||||
var opts = me.options.signals;
|
||||
if ( !(opts.indexOf('disabled') < 0) ) {
|
||||
me.trigger('disabled', me, disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.disabled = disabled;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -193,6 +193,15 @@ define([
|
|||
if (modalParents.length > 0) {
|
||||
el.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
|
||||
}
|
||||
|
||||
el.find('.dropdown-menu').on('mouseenter', function(){ // hide tooltip when mouse is over menu
|
||||
var tip = el.data('bs.tooltip');
|
||||
if (tip) {
|
||||
if (tip.dontShow===undefined)
|
||||
tip.dontShow = true;
|
||||
tip.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
@ -211,6 +213,8 @@ define([
|
|||
}, 10);
|
||||
} else
|
||||
me._skipInputChange = false;
|
||||
} else if (e.keyCode == Common.UI.Keys.RETURN && this._input.val() === me.lastValue){
|
||||
this._input.trigger('change', { reapply: true });
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -231,7 +235,7 @@ define([
|
|||
var val = $(e.target).val(),
|
||||
record = {};
|
||||
|
||||
if (this.lastValue === val) {
|
||||
if (this.lastValue === val && !(extra && extra.reapply)) {
|
||||
if (extra && extra.onkeydown)
|
||||
this.trigger('combo:blur', this, e);
|
||||
return;
|
||||
|
@ -318,6 +322,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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -140,9 +140,10 @@ define([
|
|||
el.html(this.template(this.model.toJSON()));
|
||||
el.addClass('item');
|
||||
el.toggleClass('selected', this.model.get('selected') && this.model.get('allowSelected'));
|
||||
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.off('click dblclick contextmenu');
|
||||
el.on({ 'click': _.bind(this.onClick, this),
|
||||
'dblclick': _.bind(this.onDblClick, this),
|
||||
'contextmenu': _.bind(this.onContextMenu, this) });
|
||||
el.toggleClass('disabled', !!this.model.get('disabled'));
|
||||
|
||||
if (!_.isUndefined(this.model.get('cls')))
|
||||
|
@ -197,6 +198,7 @@ define([
|
|||
emptyText: '',
|
||||
listenStoreEvents: true,
|
||||
allowScrollbar: true,
|
||||
scrollAlwaysVisible: false,
|
||||
showLast: true,
|
||||
useBSKeydown: false
|
||||
},
|
||||
|
@ -239,6 +241,7 @@ 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;
|
||||
|
@ -275,6 +278,13 @@ define([
|
|||
}));
|
||||
}
|
||||
|
||||
var modalParents = this.cmpEl.closest('.asc-window');
|
||||
if (modalParents.length < 1)
|
||||
modalParents = this.cmpEl.closest('[id^="menu-container-"]'); // context menu
|
||||
if (modalParents.length > 0) {
|
||||
this.tipZIndex = parseInt(modalParents.css('z-index')) + 10;
|
||||
}
|
||||
|
||||
if (!this.rendered) {
|
||||
if (this.listenStoreEvents) {
|
||||
this.listenTo(this.store, 'add', this.onAddItem);
|
||||
|
@ -308,15 +318,11 @@ define([
|
|||
el: $(this.el).find('.inner').addBack().filter('.inner'),
|
||||
useKeyboard: this.enableKeyEvents && !this.handleSelect,
|
||||
minScrollbarLength : 40,
|
||||
wheelSpeed: 10
|
||||
wheelSpeed: 10,
|
||||
alwaysVisibleY: this.scrollAlwaysVisible
|
||||
});
|
||||
}
|
||||
|
||||
var modalParents = this.cmpEl.closest('.asc-window');
|
||||
if (modalParents.length > 0) {
|
||||
this.tipZIndex = parseInt(modalParents.css('z-index')) + 10;
|
||||
}
|
||||
|
||||
this.rendered = true;
|
||||
|
||||
this.cmpEl.on('click', function(e){
|
||||
|
@ -361,11 +367,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);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -480,7 +487,8 @@ define([
|
|||
el: $(this.el).find('.inner').addBack().filter('.inner'),
|
||||
useKeyboard: this.enableKeyEvents && !this.handleSelect,
|
||||
minScrollbarLength : 40,
|
||||
wheelSpeed: 10
|
||||
wheelSpeed: 10,
|
||||
alwaysVisibleY: this.scrollAlwaysVisible
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -547,7 +555,7 @@ define([
|
|||
|
||||
window._event = e; // for FireFox only
|
||||
|
||||
this.selectRecord(record);
|
||||
if (this.showLast) this.selectRecord(record);
|
||||
this.lastSelectedRec = null;
|
||||
|
||||
if (!this.isSuspendEvents) {
|
||||
|
@ -568,18 +576,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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -716,14 +727,16 @@ define([
|
|||
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 (top + menuH > docH ) {
|
||||
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
|
||||
if (this.allowScrollbar) this.scroller.update({minScrollbarLength : 40});
|
||||
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({minScrollbarLength : 40});
|
||||
if (this.allowScrollbar) this.scroller.update(props);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
@ -186,6 +187,13 @@ define([
|
|||
return parseInt(el.css('width'));
|
||||
},
|
||||
|
||||
getItem: function (alias) {
|
||||
for (var p in this.panels) {
|
||||
var panel = this.panels[p];
|
||||
if ( panel.alias == alias ) return panel;
|
||||
}
|
||||
},
|
||||
|
||||
onSelectStart: function(e) {
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
return false;
|
||||
|
@ -224,6 +232,8 @@ define([
|
|||
},
|
||||
|
||||
resizeStart: function(e) {
|
||||
if (this.freeze) return;
|
||||
|
||||
this.clearSelection();
|
||||
this.addHandler(window.document, 'selectstart', this.onSelectStart);
|
||||
|
||||
|
@ -369,7 +379,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,
|
||||
|
@ -404,6 +414,7 @@ define([
|
|||
if (resize.value != value) {
|
||||
this.doLayout();
|
||||
}
|
||||
return (Math.abs(oldValue-value)>0.99);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -492,7 +503,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) {
|
||||
|
@ -514,10 +528,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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -71,7 +71,7 @@ define([
|
|||
|
||||
function onClickDocument(e) {
|
||||
if ( this.isFolded ) {
|
||||
if ( $(e.target).parents('.toolbar').length ){
|
||||
if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){
|
||||
} else {
|
||||
this.collapse();
|
||||
}
|
||||
|
@ -86,15 +86,30 @@ define([
|
|||
initialize : function(options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
var _template_tabs =
|
||||
'<section class="tabs">' +
|
||||
'<a class="scroll left"><i class="icon"><</i></a>' +
|
||||
'<ul>' +
|
||||
'<% for(var i in items) { %>' +
|
||||
'<li class="ribtab' +
|
||||
'<% if (items[i].haspanel===false) print(" x-lone") %>' +
|
||||
'<% if (items[i].extcls) print(\' \' + items[i].extcls) %>">' +
|
||||
'<a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>"><%= items[i].caption %></a>' +
|
||||
'</li>' +
|
||||
'<% } %>' +
|
||||
'</ul>' +
|
||||
'<a class="scroll right"><i class="icon">></i></a>' +
|
||||
'</section>';
|
||||
|
||||
this.$layout = $(options.template({
|
||||
tabs: options.tabs
|
||||
tabsmarkup: _.template(_template_tabs)({items: options.tabs})
|
||||
}));
|
||||
|
||||
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.setVisible(action, visible);
|
||||
}, this));
|
||||
},
|
||||
|
||||
|
@ -127,8 +142,12 @@ define([
|
|||
if ( this.isFolded ) {
|
||||
if (!optsFold.$box) optsFold.$box = me.$el.find('.box-controls');
|
||||
|
||||
optsFold.$bar.addClass('folded').toggleClass('expanded', false);
|
||||
optsFold.$bar.addClass('folded z-clear').toggleClass('expanded', false);
|
||||
optsFold.$bar.find('.tabs .ribtab').removeClass('active');
|
||||
optsFold.$bar.on($.support.transition.end, function (e) {
|
||||
if ( optsFold.$bar.hasClass('folded') && !optsFold.$bar.hasClass('expanded') )
|
||||
optsFold.$bar.toggleClass('z-clear', true);
|
||||
});
|
||||
optsFold.$box.on({
|
||||
mouseleave: function (e) {
|
||||
// optsFold.timer = setTimeout( function(e) {
|
||||
|
@ -167,13 +186,16 @@ define([
|
|||
|
||||
} else {
|
||||
// clearTimeout(optsFold.timer);
|
||||
optsFold.$bar.removeClass('folded');
|
||||
optsFold.$bar.removeClass('folded z-clear');
|
||||
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);
|
||||
} else {
|
||||
tab = me.$tabs.siblings(':not(.x-lone)').first().find('> a[data-tab]').data('tab');
|
||||
me.setTab(tab);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -191,6 +213,7 @@ define([
|
|||
expand: function() {
|
||||
// clearTimeout(optsFold.timer);
|
||||
|
||||
optsFold.$bar.removeClass('z-clear');
|
||||
optsFold.$bar.addClass('expanded');
|
||||
// optsFold.timer = setTimeout(this.collapse, optsFold.timeout);
|
||||
},
|
||||
|
@ -206,28 +229,40 @@ define([
|
|||
},
|
||||
|
||||
onTabClick: function (e) {
|
||||
var _is_active = $(e.currentTarget).hasClass('active');
|
||||
if ( _is_active ) {
|
||||
if ( this.isFolded ) {
|
||||
// this.collapse();
|
||||
var me = this;
|
||||
|
||||
var $target = $(e.currentTarget);
|
||||
var tab = $target.find('> a[data-tab]').data('tab');
|
||||
var islone = $target.hasClass('x-lone');
|
||||
if ( me.isFolded ) {
|
||||
if ( $target.hasClass('x-lone') ) {
|
||||
me.collapse();
|
||||
// me.fireEvent('')
|
||||
} else
|
||||
if ( $target.hasClass('active') ) {
|
||||
me.collapse();
|
||||
} else {
|
||||
me.setTab(tab);
|
||||
}
|
||||
} else {
|
||||
var tab = $(e.target).data('tab');
|
||||
this.setTab(tab);
|
||||
if ( !$target.hasClass('active') && !islone ) {
|
||||
me.setTab(tab);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setTab: function (tab) {
|
||||
var me = this;
|
||||
if ( !tab ) {
|
||||
onShowFullviewPanel.call(this, false);
|
||||
// onShowFullviewPanel.call(this, false);
|
||||
|
||||
if ( this.isFolded ) { this.collapse(); }
|
||||
else tab = this.lastPanel;
|
||||
}
|
||||
|
||||
if ( tab ) {
|
||||
this.$tabs.removeClass('active');
|
||||
this.$panels.removeClass('active');
|
||||
me.$tabs.removeClass('active');
|
||||
me.$panels.removeClass('active');
|
||||
|
||||
var panel = this.$panels.filter('[data-tab=' + tab + ']');
|
||||
if ( panel.length ) {
|
||||
|
@ -236,10 +271,10 @@ define([
|
|||
}
|
||||
|
||||
if ( panel.length ) {
|
||||
if ( this.isFolded ) this.expand();
|
||||
if ( me.isFolded ) me.expand();
|
||||
} else {
|
||||
onShowFullviewPanel.call(this, true);
|
||||
if ( this.isFolded ) this.collapse();
|
||||
// onShowFullviewPanel.call(this, true);
|
||||
if ( me.isFolded ) me.collapse();
|
||||
}
|
||||
|
||||
var $tp = this.$tabs.find('> a[data-tab=' + tab + ']').parent();
|
||||
|
@ -257,7 +292,7 @@ define([
|
|||
return config.tabs[index].action;
|
||||
}
|
||||
|
||||
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
|
||||
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
|
||||
|
||||
config.tabs[after + 1] = tab;
|
||||
var _after_action = _get_tab_action(after);
|
||||
|
@ -273,6 +308,8 @@ define([
|
|||
|
||||
if ($target.length) {
|
||||
$target.after(panel);
|
||||
} else {
|
||||
panel.appendTo(this.$layout.find('.box-panels'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
@ -48,7 +48,7 @@ define([
|
|||
},
|
||||
|
||||
template: _.template([
|
||||
'<div class="synch-tip-root <%= scope.placement %>">',
|
||||
'<div class="synch-tip-root <% if (!!scope.options.extCls) {print(scope.options.extCls + \" \");} %><%= scope.placement %>">',
|
||||
'<div class="asc-synchronizetip">',
|
||||
'<div class="tip-arrow <%= scope.placement %>"></div>',
|
||||
'<div>',
|
||||
|
@ -103,13 +103,20 @@ define([
|
|||
},
|
||||
|
||||
applyPlacement: function () {
|
||||
var showxy = this.target.offset();
|
||||
var showxy = this.target.offset(),
|
||||
innerHeight = Common.Utils.innerHeight();
|
||||
if (this.placement == 'top')
|
||||
this.cmpEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
|
||||
else if (this.placement == 'left')
|
||||
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
|
||||
else // right
|
||||
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'});
|
||||
this.cmpEl.css({bottom : innerHeight - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
|
||||
else {// left or right
|
||||
var top = showxy.top + this.target.height()/2,
|
||||
height = this.cmpEl.height();
|
||||
if (top+height>innerHeight)
|
||||
top = innerHeight - height;
|
||||
if (this.placement == 'left')
|
||||
this.cmpEl.css({top : top + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
|
||||
else
|
||||
this.cmpEl.css({top : top + 'px', left: showxy.left + this.target.width() + 'px'});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function() {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
|
|
|
@ -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)
|
||||
|
@ -158,6 +158,7 @@ define([
|
|||
handleSelect: true,
|
||||
showLast: true,
|
||||
allowScrollbar: true,
|
||||
scrollAlwaysVisible: true,
|
||||
emptyItemText: ''
|
||||
},
|
||||
|
||||
|
@ -245,24 +246,24 @@ define([
|
|||
var isExpanded = !record.get('isExpanded');
|
||||
record.set('isExpanded', isExpanded);
|
||||
this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record);
|
||||
this.scroller.update({minScrollbarLength: 40});
|
||||
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});
|
||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
|
||||
},
|
||||
|
||||
collapseAll: function() {
|
||||
this.store.collapseAll();
|
||||
this.scroller.update({minScrollbarLength: 40});
|
||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
|
||||
},
|
||||
|
||||
expandToLevel: function(expandLevel) {
|
||||
this.store.expandToLevel(expandLevel);
|
||||
this.scroller.update({minScrollbarLength: 40});
|
||||
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
|
||||
}
|
||||
}
|
||||
})());
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -148,6 +148,7 @@ define([
|
|||
if (user) {
|
||||
var usermodel = new Common.Models.User({
|
||||
id : user.asc_getId(),
|
||||
idOriginal : user.asc_getIdOriginal(),
|
||||
username : user.asc_getUserName(),
|
||||
online : true,
|
||||
color : user.asc_getColor(),
|
||||
|
@ -170,6 +171,7 @@ define([
|
|||
if (!user) {
|
||||
usersStore.add(new Common.Models.User({
|
||||
id : change.asc_getId(),
|
||||
idOriginal : change.asc_getIdOriginal(),
|
||||
username : change.asc_getUserName(),
|
||||
online : change.asc_getState(),
|
||||
color : change.asc_getColor(),
|
||||
|
@ -188,7 +190,7 @@ define([
|
|||
var array = [];
|
||||
messages.forEach(function(msg) {
|
||||
array.push(new Common.Models.ChatMessage({
|
||||
userid : msg.user,
|
||||
userid : msg.useridoriginal,
|
||||
message : msg.message,
|
||||
username : msg.username
|
||||
}));
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -46,7 +46,8 @@ define([
|
|||
'core',
|
||||
'common/main/lib/model/Comment',
|
||||
'common/main/lib/collection/Comments',
|
||||
'common/main/lib/view/Comments'
|
||||
'common/main/lib/view/Comments',
|
||||
'common/main/lib/view/ReviewPopover'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -67,7 +68,7 @@ define([
|
|||
],
|
||||
views : [
|
||||
'Common.Views.Comments',
|
||||
'Common.Views.CommentsPopover'
|
||||
'Common.Views.ReviewPopover'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
subEditStrings : {},
|
||||
|
@ -101,6 +102,27 @@ define([
|
|||
|
||||
// work handlers
|
||||
|
||||
'comment:closeEditing': _.bind(this.closeEditing, this)
|
||||
},
|
||||
|
||||
'Common.Views.ReviewPopover': {
|
||||
|
||||
// comments handlers
|
||||
|
||||
'comment:change': _.bind(this.onChangeComment, this),
|
||||
'comment:remove': _.bind(this.onRemoveComment, this),
|
||||
'comment:resolve': _.bind(this.onResolveComment, this),
|
||||
'comment:show': _.bind(this.onShowComment, this),
|
||||
|
||||
// reply handlers
|
||||
|
||||
'comment:addReply': _.bind(this.onAddReplyComment, this),
|
||||
'comment:changeReply': _.bind(this.onChangeReplyComment, this),
|
||||
'comment:removeReply': _.bind(this.onRemoveReplyComment, this),
|
||||
'comment:editReply': _.bind(this.onShowEditReplyComment, this),
|
||||
|
||||
// work handlers
|
||||
|
||||
'comment:closeEditing': _.bind(this.closeEditing, this),
|
||||
'comment:disableHint': _.bind(this.disableHint, this),
|
||||
'comment:addDummyComment': _.bind(this.onAddDummyComment, this)
|
||||
|
@ -128,12 +150,13 @@ define([
|
|||
this.popoverComments.comparator = function (collection) { return -collection.get('time'); };
|
||||
}
|
||||
|
||||
this.view = this.createView('Common.Views.Comments', {
|
||||
store : this.collection,
|
||||
popoverComments : this.popoverComments
|
||||
});
|
||||
this.view = this.createView('Common.Views.Comments', { store: this.collection });
|
||||
this.view.render();
|
||||
|
||||
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
||||
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
||||
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
||||
|
||||
this.bindViewEvents(this.view, this.events);
|
||||
},
|
||||
setConfig: function (data, api) {
|
||||
|
@ -162,7 +185,6 @@ define([
|
|||
this.api.asc_registerCallback('asc_onShowComment', _.bind(this.onApiShowComment, this));
|
||||
this.api.asc_registerCallback('asc_onHideComment', _.bind(this.onApiHideComment, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateCommentPosition', _.bind(this.onApiUpdateCommentPosition, this));
|
||||
|
||||
this.api.asc_registerCallback('asc_onDocumentPlaceChanged', _.bind(this.onDocumentPlaceChanged, this));
|
||||
}
|
||||
},
|
||||
|
@ -267,7 +289,7 @@ define([
|
|||
|
||||
if (comment.get('unattached')) {
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +315,7 @@ define([
|
|||
}
|
||||
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
|
||||
this.isSelectedComment = false;
|
||||
|
@ -667,7 +689,7 @@ define([
|
|||
this.popoverComments.remove(model);
|
||||
if (0 === this.popoverComments.length) {
|
||||
if (this.getPopover()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -703,9 +725,11 @@ define([
|
|||
date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) :
|
||||
((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
|
||||
|
||||
var user = this.userCollection.findOriginalUser(data.asc_getUserId());
|
||||
comment.set('comment', data.asc_getText());
|
||||
comment.set('userid', data.asc_getUserId());
|
||||
comment.set('username', data.asc_getUserName());
|
||||
comment.set('usercolor', (user) ? user.get('color') : null);
|
||||
comment.set('resolved', data.asc_getSolved());
|
||||
comment.set('quote', data.asc_getQuoteText());
|
||||
comment.set('time', date.getTime());
|
||||
|
@ -721,10 +745,12 @@ define([
|
|||
dateReply = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) :
|
||||
((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())));
|
||||
|
||||
user = this.userCollection.findOriginalUser(data.asc_getReply(i).asc_getUserId());
|
||||
replies.push(new Common.Models.Reply({
|
||||
id : Common.UI.getId(),
|
||||
userid : data.asc_getReply(i).asc_getUserId(),
|
||||
username : data.asc_getReply(i).asc_getUserName(),
|
||||
usercolor : (user) ? user.get('color') : null,
|
||||
date : t.dateToLocaleTimeString(dateReply),
|
||||
reply : data.asc_getReply(i).asc_getText(),
|
||||
time : dateReply.getTime(),
|
||||
|
@ -742,24 +768,23 @@ define([
|
|||
if (!silentUpdate) {
|
||||
this.updateComments(false, true);
|
||||
|
||||
if (this.getPopover() && this.getPopover().isVisible()) {
|
||||
this._dontScrollToComment = true;
|
||||
this.api.asc_showComment(id, true);
|
||||
}
|
||||
// if (this.getPopover() && this.getPopover().isVisible()) {
|
||||
// this._dontScrollToComment = true;
|
||||
// this.api.asc_showComment(id, true);
|
||||
// }
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiLockComment: function (id,userId) {
|
||||
var cur = this.findComment(id),
|
||||
usersStore = null,
|
||||
user = null;
|
||||
|
||||
if (cur) {
|
||||
usersStore = this.getApplication().getCollection('Common.Collections.Users');
|
||||
if (usersStore) {
|
||||
user = usersStore.findWhere({id: userId});
|
||||
if (this.userCollection) {
|
||||
user = this.userCollection.findUser(userId);
|
||||
if (user) {
|
||||
this.getPopover() && this.getPopover().saveText();
|
||||
this.view.saveText();
|
||||
cur.set('lock', true);
|
||||
cur.set('lockuserid', this.view.getUserName(user.get('username')));
|
||||
}
|
||||
|
@ -771,13 +796,15 @@ define([
|
|||
if (cur) {
|
||||
cur.set('lock', false);
|
||||
this.getPopover() && this.getPopover().loadText();
|
||||
this.view.loadText();
|
||||
}
|
||||
},
|
||||
onApiShowComment: function (uids, posX, posY, leftX, opts, hint) {
|
||||
if (this.previewmode) return;
|
||||
this.isModeChanged = false;
|
||||
var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length);
|
||||
|
||||
if (hint && this.isSelectedComment && (0 === _.difference(this.uids, uids).length)) {
|
||||
if (hint && this.isSelectedComment && same_uids) {
|
||||
// хотим показать тот же коментарий что был и выбран
|
||||
return;
|
||||
}
|
||||
|
@ -788,7 +815,7 @@ define([
|
|||
if (popover) {
|
||||
this.clearDummyComment();
|
||||
|
||||
if (this.isSelectedComment && (0 === _.difference(this.uids, uids).length)) {
|
||||
if (this.isSelectedComment && same_uids) {
|
||||
//NOTE: click to sdk view ?
|
||||
if (this.api) {
|
||||
//this.view.txtComment.blur();
|
||||
|
@ -827,10 +854,10 @@ define([
|
|||
comment.set('hint', !_.isUndefined(hint) ? hint : false);
|
||||
|
||||
if (!hint && this.hintmode) {
|
||||
if (0 === _.difference(this.uids, uids).length && (this.uids.length === 0))
|
||||
if (same_uids && (this.uids.length === 0))
|
||||
animate = false;
|
||||
|
||||
if (this.oldUids.length && (0 === _.difference(this.oldUids, uids).length)) {
|
||||
if (this.oldUids.length && (0 === _.difference(this.oldUids, uids).length) && (0 === _.difference(uids, this.oldUids).length)) {
|
||||
animate = false;
|
||||
this.oldUids = [];
|
||||
}
|
||||
|
@ -855,7 +882,7 @@ define([
|
|||
}
|
||||
|
||||
popover.setLeftTop(posX, posY, leftX);
|
||||
popover.show(animate, false, true, text);
|
||||
popover.showComments(animate, false, true, text);
|
||||
}
|
||||
},
|
||||
onApiHideComment: function (hint) {
|
||||
|
@ -879,7 +906,7 @@ define([
|
|||
});
|
||||
|
||||
this.getPopover().saveText(true);
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
|
||||
this.collection.clearEditing();
|
||||
this.popoverComments.clearEditing();
|
||||
|
@ -933,9 +960,9 @@ define([
|
|||
}
|
||||
|
||||
useAnimation = true;
|
||||
this.getPopover().show(useAnimation, undefined, undefined, text);
|
||||
this.getPopover().showComments(useAnimation, undefined, undefined, text);
|
||||
} else if (!this.getPopover().isVisible()) {
|
||||
this.getPopover().show(false, undefined, undefined, text);
|
||||
this.getPopover().showComments(false, undefined, undefined, text);
|
||||
}
|
||||
|
||||
this.getPopover().setLeftTop(posX, posY, leftX, undefined, true);
|
||||
|
@ -1070,19 +1097,45 @@ define([
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
getPopover: function () {
|
||||
return this.view.getPopover(this.sdkViewName);
|
||||
if (_.isUndefined(this.popover)) {
|
||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||
commentsStore : this.popoverComments,
|
||||
renderTo : this.sdkViewName
|
||||
});
|
||||
this.popover.setCommentsStore(this.popoverComments);
|
||||
}
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
// helpers
|
||||
|
||||
onUpdateUsers: function() {
|
||||
var users = this.userCollection;
|
||||
this.collection.each(function (model) {
|
||||
var user = users.findOriginalUser(model.get('userid'));
|
||||
model.set('usercolor', (user) ? user.get('color') : null, {silent: true});
|
||||
|
||||
model.get('replys').forEach(function (reply) {
|
||||
user = users.findOriginalUser(reply.get('userid'));
|
||||
reply.set('usercolor', (user) ? user.get('color') : null, {silent: true});
|
||||
});
|
||||
});
|
||||
this.updateComments(true);
|
||||
if (this.getPopover().isVisible())
|
||||
this.getPopover().update(true);
|
||||
},
|
||||
|
||||
readSDKComment: function (id, data) {
|
||||
var date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) :
|
||||
((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
|
||||
var user = this.userCollection.findOriginalUser(data.asc_getUserId());
|
||||
var comment = new Common.Models.Comment({
|
||||
uid : id,
|
||||
userid : data.asc_getUserId(),
|
||||
username : data.asc_getUserName(),
|
||||
usercolor : (user) ? user.get('color') : null,
|
||||
date : this.dateToLocaleTimeString(date),
|
||||
quote : data.asc_getQuoteText(),
|
||||
comment : data.asc_getText(),
|
||||
|
@ -1118,10 +1171,12 @@ define([
|
|||
date = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) :
|
||||
((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())));
|
||||
|
||||
var user = this.userCollection.findOriginalUser(data.asc_getReply(i).asc_getUserId());
|
||||
replies.push(new Common.Models.Reply({
|
||||
id : Common.UI.getId(),
|
||||
userid : data.asc_getReply(i).asc_getUserId(),
|
||||
username : data.asc_getReply(i).asc_getUserName(),
|
||||
usercolor : (user) ? user.get('color') : null,
|
||||
date : this.dateToLocaleTimeString(date),
|
||||
reply : data.asc_getReply(i).asc_getText(),
|
||||
time : date.getTime(),
|
||||
|
@ -1154,12 +1209,14 @@ define([
|
|||
return;
|
||||
}
|
||||
|
||||
var user = this.userCollection.findOriginalUser(this.currentUserId);
|
||||
var comment = new Common.Models.Comment({
|
||||
id: -1,
|
||||
time: date.getTime(),
|
||||
date: this.dateToLocaleTimeString(date),
|
||||
userid: this.currentUserId,
|
||||
username: this.currentUserName,
|
||||
usercolor: (user) ? user.get('color') : null,
|
||||
editTextInPopover: true,
|
||||
showReplyInPopover: false,
|
||||
hideAddReply: true,
|
||||
|
@ -1195,7 +1252,7 @@ define([
|
|||
anchor.asc_getY(),
|
||||
this.hintmode ? anchor.asc_getX() : undefined);
|
||||
|
||||
dialog.show(true, false, true);
|
||||
dialog.showComments(true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1213,7 +1270,7 @@ define([
|
|||
|
||||
this.popoverComments.reset();
|
||||
if (this.getPopover().isVisible()) {
|
||||
this.getPopover().hide();
|
||||
this.getPopover().hideComments();
|
||||
}
|
||||
comment.asc_putText(commentVal);
|
||||
comment.asc_putTime(this.utcDateToString(new Date()));
|
||||
|
@ -1250,7 +1307,7 @@ define([
|
|||
});
|
||||
|
||||
if (dialog.isVisible()) {
|
||||
dialog.hide();
|
||||
dialog.hideComments();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1352,7 @@ define([
|
|||
anchor.asc_getY(),
|
||||
this.hintmode ? anchor.asc_getX() : undefined);
|
||||
|
||||
this.getPopover().show(true, false, true);
|
||||
this.getPopover().showComments(true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
78
apps/common/main/lib/controller/Desktop.js
Normal file
78
apps/common/main/lib/controller/Desktop.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Controller wraps up interaction with desktop app
|
||||
*
|
||||
* Created by Maxim.Kadushkin on 2/16/2018.
|
||||
*/
|
||||
|
||||
define([
|
||||
'core'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
var Desktop = function () {
|
||||
var config = {};
|
||||
var app = window.AscDesktopEditor;
|
||||
|
||||
return {
|
||||
init: function (opts) {
|
||||
_.extend(config, opts);
|
||||
|
||||
if ( config.isDesktopApp ) {
|
||||
Common.NotificationCenter.on('app:ready', function (opts) {
|
||||
_.extend(config, opts);
|
||||
!!app && app.execCommand('doc:onready', '');
|
||||
});
|
||||
}
|
||||
},
|
||||
process: function (opts) {
|
||||
if ( config.isDesktopApp && !!app ) {
|
||||
if ( opts == 'goback' ) {
|
||||
app.execCommand('go:folder',
|
||||
config.isOffline ? 'offline' : config.customization.goback.url);
|
||||
return true;
|
||||
} else
|
||||
if ( opts == 'preloader:hide' ) {
|
||||
app.execCommand('editor:onready', '');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Common.Controllers.Desktop = new Desktop();
|
||||
});
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -159,7 +159,6 @@ define([
|
|||
onSetHistoryData: function(opts) {
|
||||
if (opts.data.error) {
|
||||
var config = {
|
||||
closable: false,
|
||||
title: this.notcriticalErrorTitle,
|
||||
msg: opts.data.error,
|
||||
iconCls: 'warn',
|
||||
|
|
|
@ -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)
|
||||
|
@ -59,7 +59,7 @@ define([
|
|||
'render:before' : function (toolbar) {
|
||||
var appOptions = me.getApplication().getController('Main').appOptions;
|
||||
|
||||
if ( appOptions.isEdit && !appOptions.isEditMailMerge && !appOptions.isEditDiagram ) {
|
||||
if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram ) {
|
||||
var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption};
|
||||
me.$toolbarPanelPlugins = me.panelPlugins.getPanel();
|
||||
|
||||
|
@ -195,19 +195,22 @@ define([
|
|||
me.$toolbarPanelPlugins.empty();
|
||||
|
||||
var _group = $('<div class="group"></div>'),
|
||||
rank = -1;
|
||||
rank = -1,
|
||||
rank_plugins = 0;
|
||||
collection.each(function (model) {
|
||||
var new_rank = model.get('groupRank');
|
||||
if (new_rank!==rank && rank>-1) {
|
||||
if (new_rank!==rank && rank>-1 && rank_plugins>0) {
|
||||
_group.appendTo(me.$toolbarPanelPlugins);
|
||||
$('<div class="separator long"></div>').appendTo(me.$toolbarPanelPlugins);
|
||||
_group = $('<div class="group"></div>');
|
||||
rank_plugins = 0;
|
||||
}
|
||||
|
||||
var btn = me.panelPlugins.createPluginButton(model);
|
||||
if (btn) {
|
||||
var $slot = $('<span class="slot"></span>').appendTo(_group);
|
||||
btn.render($slot);
|
||||
rank_plugins++;
|
||||
}
|
||||
rank = new_rank;
|
||||
});
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -110,8 +110,8 @@ define([
|
|||
return this;
|
||||
},
|
||||
|
||||
onDocumentPassword: function(hasPassword) {
|
||||
this.view && this.view.onDocumentPassword(hasPassword);
|
||||
onDocumentPassword: function(hasPassword, disabled) {
|
||||
this.view && this.view.onDocumentPassword(hasPassword, disabled);
|
||||
},
|
||||
|
||||
SetDisabled: function(state, canProtect) {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -47,6 +47,7 @@ define([
|
|||
'common/main/lib/model/ReviewChange',
|
||||
'common/main/lib/collection/ReviewChanges',
|
||||
'common/main/lib/view/ReviewChanges',
|
||||
'common/main/lib/view/ReviewPopover',
|
||||
'common/main/lib/view/LanguageDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
@ -58,7 +59,7 @@ define([
|
|||
],
|
||||
views : [
|
||||
'Common.Views.ReviewChanges',
|
||||
'Common.Views.ReviewChangesPopover'
|
||||
'Common.Views.ReviewPopover'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
|
||||
|
@ -69,8 +70,6 @@ define([
|
|||
'settings:apply': this.applySettings.bind(this)
|
||||
},
|
||||
'Common.Views.ReviewChanges': {
|
||||
|
||||
// comments handlers
|
||||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:delete': _.bind(this.onDeleteClick, this),
|
||||
|
@ -83,6 +82,11 @@ define([
|
|||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this)
|
||||
},
|
||||
'Common.Views.ReviewPopover': {
|
||||
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
||||
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
||||
'reviewchange:delete': _.bind(this.onDeleteClick, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -96,6 +100,9 @@ define([
|
|||
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.onCoAuthoringDisconnect, this));
|
||||
|
||||
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
||||
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
||||
},
|
||||
setConfig: function (data, api) {
|
||||
this.setApi(api);
|
||||
|
@ -119,12 +126,7 @@ define([
|
|||
setMode: function(mode) {
|
||||
this.appConfig = mode;
|
||||
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||
|
||||
this.view = this.createView('Common.Views.ReviewChanges', {
|
||||
// store : this.collection,
|
||||
popoverChanges : this.popoverChanges,
|
||||
mode : mode
|
||||
});
|
||||
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -150,10 +152,10 @@ define([
|
|||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
this.getPopover().setLeftTop(posX+25, posY);
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
|
||||
this.getPopover().show(animate, lock, lockUser);
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
|
||||
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
||||
this.view.btnAccept.setDisabled(lock==true);
|
||||
|
@ -172,8 +174,8 @@ define([
|
|||
this._state.posx = this._state.posy = -1000;
|
||||
this._state.changes_length = 0;
|
||||
this._state.popoverVisible = false;
|
||||
this.getPopover().hide();
|
||||
this.popoverChanges.reset();
|
||||
this.getPopover().hideReview();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -191,7 +193,7 @@ define([
|
|||
} else if (this.popoverChanges.length>0) {
|
||||
if (!this.getPopover().isVisible())
|
||||
this.getPopover().show(false);
|
||||
this.getPopover().setLeftTop(posX+25, posY);
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -205,7 +207,14 @@ define([
|
|||
},
|
||||
|
||||
getPopover: function () {
|
||||
return this.view.getPopover(this.sdkViewName);
|
||||
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
|
||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||
reviewStore : this.popoverChanges,
|
||||
renderTo : this.sdkViewName
|
||||
});
|
||||
this.popover.setReviewStore(this.popoverChanges);
|
||||
}
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
// helpers
|
||||
|
@ -386,12 +395,12 @@ define([
|
|||
|
||||
}
|
||||
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
|
||||
color = item.get_UserColor(),
|
||||
user = me.userCollection.findOriginalUser(item.get_UserId()),
|
||||
change = new Common.Models.ReviewChange({
|
||||
uid : Common.UI.getId(),
|
||||
userid : item.get_UserId(),
|
||||
username : item.get_UserName(),
|
||||
usercolor : '#'+Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()),
|
||||
usercolor : (user) ? user.get('color') : null,
|
||||
date : me.dateToLocaleTimeString(date),
|
||||
changetext : changetext,
|
||||
id : Common.UI.getId(),
|
||||
|
@ -557,6 +566,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;
|
||||
|
@ -685,6 +695,14 @@ define([
|
|||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
onUpdateUsers: function() {
|
||||
var users = this.userCollection;
|
||||
this.popoverChanges && this.popoverChanges.each(function (model) {
|
||||
var user = users.findOriginalUser(model.get('userid'));
|
||||
model.set('usercolor', (user) ? user.get('color') : null);
|
||||
});
|
||||
},
|
||||
|
||||
textInserted: '<b>Inserted:</b>',
|
||||
textDeleted: '<b>Deleted:</b>',
|
||||
textParaInserted: '<b>Paragraph Inserted</b> ',
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -55,6 +55,7 @@ define([
|
|||
uid : 0, // asc
|
||||
userid : 0,
|
||||
username : 'Guest',
|
||||
usercolor : null,
|
||||
date : undefined,
|
||||
quote : '',
|
||||
comment : '',
|
||||
|
@ -84,6 +85,7 @@ define([
|
|||
time : 0, // acs
|
||||
userid : 0,
|
||||
username : 'Guest',
|
||||
usercolor : null,
|
||||
reply : '',
|
||||
date : undefined,
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -55,7 +55,7 @@ define([
|
|||
uid : 0, // asc
|
||||
userid : 0,
|
||||
username : 'Guest',
|
||||
usercolor : '#ee3525',
|
||||
usercolor : null,
|
||||
date : undefined,
|
||||
changetext : '',
|
||||
lock : false,
|
||||
|
|
|
@ -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,34 @@
|
|||
* 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,
|
||||
idOriginal : undefined,
|
||||
username : 'Guest',
|
||||
color : '#fff',
|
||||
colorval : null,
|
||||
online : false,
|
||||
view : false
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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.hasAttribute('readonly') || e.target.type === 'input')) {
|
||||
if (e && e.target && (e.target.type === 'textarea' || e.target.type === 'input')) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
<!-- comment block -->
|
||||
|
||||
<div class="user-name"><%=scope.getUserName(username)%></div>
|
||||
<div class="user-name">
|
||||
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>
|
||||
</div>
|
||||
<div class="user-date"><%=date%></div>
|
||||
<% if (quote!==null && quote!=='') { %>
|
||||
<div class="user-quote"><%=scope.getFixedQuote(quote)%></div>
|
||||
|
@ -24,7 +26,9 @@
|
|||
<div class="reply-arrow img-commonctrl"></div>
|
||||
<% _.each(replys, function (item) { %>
|
||||
<div class="reply-item-ct">
|
||||
<div class="user-name"><%=scope.getUserName(item.get("username"))%></div>
|
||||
<div class="user-name">
|
||||
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
|
||||
</div>
|
||||
<div class="user-date"><%=item.get("date")%></div>
|
||||
<% if (!item.get("editText")) { %>
|
||||
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
<!-- comment block -->
|
||||
|
||||
<div class="user-name"><%=scope.getUserName(username)%></div>
|
||||
<div class="user-name">
|
||||
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>
|
||||
</div>
|
||||
<div class="user-date"><%=date%></div>
|
||||
<% if (!editTextInPopover || hint) { %>
|
||||
<textarea readonly class="user-message user-select"><%=scope.pickLink(comment)%></textarea>
|
||||
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>
|
||||
<% } else { %>
|
||||
<div class="inner-edit-ct">
|
||||
<textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>
|
||||
|
@ -24,10 +26,12 @@
|
|||
<div class="reply-arrow img-commonctrl"></div>
|
||||
<% _.each(replys, function (item) { %>
|
||||
<div class="reply-item-ct">
|
||||
<div class="user-name"><%=scope.getUserName(item.get("username"))%></div>
|
||||
<div class="user-name">
|
||||
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
|
||||
</div>
|
||||
<div class="user-date"><%=item.get("date")%></div>
|
||||
<% if (!item.get("editTextInPopover")) { %>
|
||||
<textarea readonly class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></textarea>
|
||||
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></div>
|
||||
<% if (!hint) { %>
|
||||
<div class="btns-reply-ct">
|
||||
<% if (item.get("editable")) { %>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<div id="<%=id%>" class="user-comment-item">
|
||||
<div class="user-name-colored"><span style="background-color:<%=usercolor%>;"><%=scope.getUserName(username)%></span></div>
|
||||
<div class="user-name">
|
||||
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>
|
||||
</div>
|
||||
<div class="user-date"><%=date%></div>
|
||||
<div class="user-message limit-height"><%=changetext%></div>
|
||||
<div class="edit-ct">
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
@ -103,7 +103,8 @@ Common.Utils = _.extend(new(function() {
|
|||
Chart : 7,
|
||||
MailMerge : 8,
|
||||
Signature : 9,
|
||||
Pivot : 10
|
||||
Pivot : 10,
|
||||
Cell : 11
|
||||
},
|
||||
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,
|
||||
|
@ -759,14 +760,22 @@ Common.Utils.InternalSettings = new(function() {
|
|||
var settings = {};
|
||||
|
||||
var _get = function(name) {
|
||||
return settings[name];
|
||||
},
|
||||
_set = function(name, value) {
|
||||
settings[name] = value;
|
||||
};
|
||||
return settings[name];
|
||||
},
|
||||
_set = function(name, value) {
|
||||
settings[name] = value;
|
||||
};
|
||||
|
||||
return {
|
||||
get: _get,
|
||||
set: _set
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Common.Utils.InternalSettings.set('toolbar-height-tabs', 32);
|
||||
Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28);
|
||||
Common.Utils.InternalSettings.set('toolbar-height-controls', 67);
|
||||
Common.Utils.InternalSettings.set('document-title-height', 28);
|
||||
|
||||
Common.Utils.InternalSettings.set('toolbar-height-compact', Common.Utils.InternalSettings.get('toolbar-height-tabs'));
|
||||
Common.Utils.InternalSettings.set('toolbar-height-normal', Common.Utils.InternalSettings.get('toolbar-height-tabs') + Common.Utils.InternalSettings.get('toolbar-height-controls'));
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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,23 +59,25 @@ 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(''),
|
||||
|
||||
templateUserList: _.template('<ul>' +
|
||||
'<% _.each(users, function(item) { %>' +
|
||||
'<%= _.template(usertpl)({user: item, scope: scope}) %>' +
|
||||
'<% }); %>' +
|
||||
'<% for (originalId in users) { %>' +
|
||||
'<%= _.template(usertpl)({user: users[originalId][0], scope: scope}) %>' +
|
||||
'<% } %>' +
|
||||
'</ul>'),
|
||||
|
||||
tplMsg: ['<li>',
|
||||
'<% if (msg.get("type")==1) { %>',
|
||||
'<div class="message service" data-can-copy="true"><%= msg.get("message") %></div>',
|
||||
'<% } else { %>',
|
||||
'<div class="user" data-can-copy="true" style="color: <%= msg.get("usercolor") %>;"><%= scope.getUserName(msg.get("username")) %></div>',
|
||||
'<div class="user-name" data-can-copy="true">',
|
||||
'<div class="color" style="display: inline-block; background-color: <% if (msg.get("usercolor")!==null) { %><%=msg.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(msg.get("username")) %>',
|
||||
'</div>',
|
||||
'<label class="message user-select" data-can-copy="true"><%= msg.get("message") %></label>',
|
||||
'<% } %>',
|
||||
'</li>'].join(''),
|
||||
|
@ -98,8 +100,8 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this, arguments);
|
||||
|
||||
this.storeUsers.bind({
|
||||
add : _.bind(this._onAddUser, this),
|
||||
change : _.bind(this._onUsersChanged, this),
|
||||
add : _.bind(this._onResetUsers, this),
|
||||
change : _.bind(this._onResetUsers, this),
|
||||
reset : _.bind(this._onResetUsers, this)
|
||||
});
|
||||
|
||||
|
@ -160,23 +162,10 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
_onAddUser: function(m, c, opts) {
|
||||
if (this.panelUsers) {
|
||||
this.panelUsers.find('ul').append(_.template(this.tplUser)({user: m, scope: this}));
|
||||
this.panelUsers.scroller.update({minScrollbarLength : 25, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
_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.scroller.update({minScrollbarLength : 25, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
_onResetUsers: function(c, opts) {
|
||||
if (this.panelUsers) {
|
||||
this.panelUsers.html(this.templateUserList({users: c.models, usertpl: this.tplUser, scope: this}));
|
||||
this.panelUsers.html(this.templateUserList({users: this.storeUsers.chain().filter(function(item){return item.get('online');}).groupBy(function(item) {return item.get('idOriginal');}).value(),
|
||||
usertpl: this.tplUser, scope: this}));
|
||||
this.panelUsers.scroller.update({minScrollbarLength : 25, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
@ -217,9 +206,9 @@ define([
|
|||
},
|
||||
|
||||
_prepareMessage: function(m) {
|
||||
var user = this.storeUsers.findUser(m.get('userid'));
|
||||
var user = this.storeUsers.findOriginalUser(m.get('userid'));
|
||||
m.set({
|
||||
usercolor : user ? user.get('color') : '#000',
|
||||
usercolor : user ? user.get('color') : null,
|
||||
message : this._pickLink(Common.Utils.String.htmlEncode(m.get('message')))
|
||||
}, {silent:true});
|
||||
},
|
||||
|
@ -389,6 +378,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 +399,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 () {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -48,14 +48,13 @@ Common.Views = Common.Views || {};
|
|||
define([
|
||||
'text!common/main/lib/template/Comments.template',
|
||||
'text!common/main/lib/template/CommentsPanel.template',
|
||||
'text!common/main/lib/template/CommentsPopover.template',
|
||||
'common/main/lib/util/utils',
|
||||
'common/main/lib/component/Button',
|
||||
'common/main/lib/component/ComboBox',
|
||||
'common/main/lib/component/DataView',
|
||||
'common/main/lib/component/Layout',
|
||||
'common/main/lib/component/Window'
|
||||
], function (commentsTemplate, panelTemplate, popoverTemplate) {
|
||||
], function (commentsTemplate, panelTemplate) {
|
||||
'use strict';
|
||||
|
||||
function replaceWords (template, words) {
|
||||
|
@ -73,767 +72,6 @@ define([
|
|||
return tpl;
|
||||
}
|
||||
|
||||
Common.Views.CommentsPopover = Common.UI.Window.extend({
|
||||
|
||||
// Window
|
||||
|
||||
initialize : function (options) {
|
||||
var _options = {};
|
||||
|
||||
_.extend(_options, {
|
||||
closable : false,
|
||||
width : 265,
|
||||
height : 120,
|
||||
header : false,
|
||||
modal : false
|
||||
}, options);
|
||||
|
||||
this.template = options.template || [
|
||||
'<div class="box">',
|
||||
'<div id="id-comments-popover" class="comments-popover"></div>',
|
||||
'<div id="id-comments-arrow" class="comments-arrow"></div>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
this.store = options.store;
|
||||
this.delegate = options.delegate;
|
||||
|
||||
_options.tpl = _.template(this.template)(_options);
|
||||
|
||||
this.arrow = {margin: 20, width: 12, height: 34};
|
||||
this.sdkBounds = {width: 0, height: 0, padding: 10, paddingTop: 20};
|
||||
|
||||
Common.UI.Window.prototype.initialize.call(this, _options);
|
||||
},
|
||||
render: function () {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
|
||||
var me = this,
|
||||
t = this.delegate,
|
||||
window = this.$window;
|
||||
|
||||
window.css({
|
||||
height: '',
|
||||
minHeight: '',
|
||||
overflow: 'hidden',
|
||||
position: 'absolute',
|
||||
zIndex: '990'
|
||||
});
|
||||
|
||||
// for spreadsheets - bug 23127
|
||||
|
||||
// if ($('#ws-h-scrollbar').length) {
|
||||
// window.css({zIndex: '5'});
|
||||
// }
|
||||
|
||||
var body = window.find('.body');
|
||||
if (body) {
|
||||
body.css('position', 'relative');
|
||||
}
|
||||
|
||||
window.on('click', _.bind(function() {
|
||||
window.css({zIndex: '991'});
|
||||
Common.NotificationCenter.trigger('comments:click');
|
||||
}, this));
|
||||
Common.NotificationCenter.on('review:click', function() {
|
||||
window.css({zIndex: '990'});
|
||||
});
|
||||
|
||||
var PopoverDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
|
||||
options : {
|
||||
handleSelect: false,
|
||||
scrollable: true,
|
||||
template: _.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div>')
|
||||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function (blur) {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
if (blur) {
|
||||
text.blur();
|
||||
} else {
|
||||
if (text && text.length) {
|
||||
var val = text.val();
|
||||
text.focus();
|
||||
text.val('');
|
||||
text.val(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
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,
|
||||
$domTextBox = null,
|
||||
lineHeight = 0,
|
||||
minHeight = 50,
|
||||
scrollPos = 0,
|
||||
oldHeight = 0,
|
||||
newHeight = 0;
|
||||
|
||||
function updateTextBoxHeight() {
|
||||
scrollPos = $(view.scroller.el).scrollTop();
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
$domTextBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
} else {
|
||||
oldHeight = domTextBox.clientHeight;
|
||||
if (oldHeight >= minHeight) {
|
||||
$domTextBox.css({height: minHeight + 'px'});
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
|
||||
$domTextBox.css({height: newHeight + 'px'});
|
||||
}
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
parentView.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
parentView.calculateSizeOfContent();
|
||||
}
|
||||
}
|
||||
|
||||
view.scroller.scrollTop(scrollPos);
|
||||
view.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
this.textBox = undefined;
|
||||
if (textBox && textBox.length) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
clearTextBoxBind: function () {
|
||||
if (this.textBox) {
|
||||
this.textBox.unbind('input propertychange');
|
||||
this.textBox = undefined;
|
||||
}
|
||||
},
|
||||
autoScrollToEditButtons: function () {
|
||||
var button = $('#id-comments-change-popover'), // TODO: add to cache
|
||||
btnBounds = null,
|
||||
contentBounds = this.el.getBoundingClientRect(),
|
||||
moveY = 0,
|
||||
padding = 7;
|
||||
|
||||
if (button.length) {
|
||||
btnBounds = button.get(0).getBoundingClientRect();
|
||||
if (btnBounds && contentBounds) {
|
||||
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
|
||||
if (moveY < 0) {
|
||||
this.scroller.scrollTop(this.scroller.getScrollTop() - moveY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})());
|
||||
if (PopoverDataView) {
|
||||
if (this.commentsView) {
|
||||
this.commentsView.render($('#id-comments-popover'));
|
||||
this.commentsView.onResetItems();
|
||||
} else {
|
||||
this.commentsView = new PopoverDataView({
|
||||
el: $('#id-comments-popover'),
|
||||
store: me.store,
|
||||
itemTemplate: _.template(replaceWords(popoverTemplate, {
|
||||
textAddReply: t.textAddReply,
|
||||
textAdd: t.textAdd,
|
||||
textCancel: t.textCancel,
|
||||
textEdit: t.textEdit,
|
||||
textReply: t.textReply,
|
||||
textClose: t.textClose,
|
||||
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
var addtooltip = function (dataview, view, record) {
|
||||
if (view.tipsArray) {
|
||||
view.tipsArray.forEach(function(item){
|
||||
item.remove();
|
||||
});
|
||||
}
|
||||
|
||||
var arr = [],
|
||||
btns = $(view.el).find('.btn-resolve');
|
||||
btns.tooltip({title: t.textResolve, placement: 'cursor'});
|
||||
btns.each(function(idx, item){
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
btns = $(view.el).find('.btn-resolve-check');
|
||||
btns.tooltip({title: t.textOpenAgain, placement: 'cursor'});
|
||||
btns.each(function(idx, item){
|
||||
arr.push($(item).data('bs.tooltip').tip());
|
||||
});
|
||||
view.tipsArray = arr;
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOver = function() {
|
||||
me._isMouseOver = true;
|
||||
};
|
||||
|
||||
var onCommentsViewMouseOut = function() {
|
||||
me._isMouseOver = false;
|
||||
};
|
||||
|
||||
this.commentsView.on('item:add', addtooltip);
|
||||
this.commentsView.on('item:remove', addtooltip);
|
||||
this.commentsView.on('item:change', addtooltip);
|
||||
this.commentsView.cmpEl.on('mouseover', onCommentsViewMouseOver).on('mouseout', onCommentsViewMouseOut);
|
||||
|
||||
this.commentsView.on('item:click', function (picker, item, record, e) {
|
||||
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
|
||||
|
||||
function readdresolves() {
|
||||
me.update();
|
||||
}
|
||||
|
||||
btn = $(e.target);
|
||||
if (btn) {
|
||||
showEditBox = record.get('editTextInPopover');
|
||||
showReplyBox = record.get('showReplyInPopover');
|
||||
hideAddReply = record.get('hideAddReply');
|
||||
commentId = record.get('uid');
|
||||
replyId = btn.attr('data-value');
|
||||
|
||||
if (record.get('hint')) {
|
||||
t.fireEvent('comment:disableHint', [record]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (btn.hasClass('btn-edit')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
t.fireEvent('comment:editReply', [commentId, replyId, true]);
|
||||
|
||||
this.replyId = replyId;
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else {
|
||||
if (!showEditBox) {
|
||||
t.fireEvent('comment:closeEditing');
|
||||
record.set('editTextInPopover', true);
|
||||
|
||||
t.fireEvent('comment:show', [commentId]);
|
||||
|
||||
this.autoHeightTextBox();
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
}
|
||||
}
|
||||
} else if (btn.hasClass('btn-delete')) {
|
||||
if (!_.isUndefined(replyId)) {
|
||||
t.fireEvent('comment:removeReply', [commentId, replyId]);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
} else {
|
||||
t.fireEvent('comment:remove', [commentId]);
|
||||
}
|
||||
|
||||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('user-reply')) {
|
||||
t.fireEvent('comment:closeEditing');
|
||||
record.set('showReplyInPopover', true);
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
|
||||
this.autoHeightTextBox();
|
||||
me.hookTextBox();
|
||||
|
||||
this.autoScrollToEditButtons();
|
||||
this.setFocusToTextBox();
|
||||
} else if (btn.hasClass('btn-reply', false)) {
|
||||
if (showReplyBox) {
|
||||
this.clearTextBoxBind();
|
||||
|
||||
t.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
|
||||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
}
|
||||
} else if (btn.hasClass('btn-close', false)) {
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
me.calculateSizeOfContent();
|
||||
t.fireEvent('comment:show', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-edit', false)) {
|
||||
|
||||
if (record.get('dummy')) {
|
||||
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;
|
||||
}
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
if (!_.isUndefined(this.replyId)) {
|
||||
t.fireEvent('comment:changeReply', [commentId, this.replyId, this.getActiveTextBoxVal()]);
|
||||
this.replyId = undefined;
|
||||
t.fireEvent('comment:closeEditing');
|
||||
} else if (showEditBox) {
|
||||
t.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
|
||||
t.fireEvent('comment:closeEditing');
|
||||
me.calculateSizeOfContent();
|
||||
}
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-close', false)) {
|
||||
if (record.get('dummy')) {
|
||||
me.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hideAddReply && this.getActiveTextBoxVal().length > 0) {
|
||||
me.saveText();
|
||||
record.set('hideAddReply', false);
|
||||
this.getTextBox().val(me.textVal);
|
||||
} else {
|
||||
this.clearTextBoxBind();
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
}
|
||||
|
||||
this.replyId = undefined;
|
||||
|
||||
me.calculateSizeOfContent();
|
||||
me.setLeftTop(me.arrowPosX, me.arrowPosY, me.leftX);
|
||||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-resolve', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
||||
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;
|
||||
|
||||
t.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
}
|
||||
}
|
||||
});
|
||||
me.on({
|
||||
'show': function () {
|
||||
me.$window.find('textarea:not(.user-message)').keydown(function (event) {
|
||||
if (event.keyCode == Common.UI.Keys.ESC) {
|
||||
me.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
'animate:before': function () {
|
||||
me.commentsView.autoHeightTextBox();
|
||||
var text = me.$window.find('textarea:not(.user-message)');
|
||||
if (text && text.length)
|
||||
text.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
show: function (animate, loadText, focus, showText) {
|
||||
this.options.animate = animate;
|
||||
|
||||
var me = this,textBox = this.commentsView.getTextBox();
|
||||
|
||||
if (loadText && this.textVal) {
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
|
||||
if (showText && showText.length) {
|
||||
textBox && textBox.val(showText);
|
||||
}
|
||||
|
||||
// this.calculateSizeOfContent();
|
||||
// this.commentsView.autoHeightTextBox();
|
||||
|
||||
Common.UI.Window.prototype.show.call(this);
|
||||
|
||||
if (this.commentsView.scroller) {
|
||||
this.commentsView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
this.hookTextBox();
|
||||
},
|
||||
hide: function () {
|
||||
if (this.handlerHide) {
|
||||
this.handlerHide ();
|
||||
}
|
||||
this.hideTips();
|
||||
Common.UI.Window.prototype.hide.call(this);
|
||||
|
||||
if (!_.isUndefined(this.e) && this.e.keyCode == Common.UI.Keys.ESC) {
|
||||
this.e.preventDefault();
|
||||
this.e.stopImmediatePropagation();
|
||||
this.e = undefined;
|
||||
}
|
||||
},
|
||||
|
||||
// CommentsPopover
|
||||
|
||||
update: function () {
|
||||
if (this.commentsView && this.commentsView.scroller) {
|
||||
this.commentsView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
return (this.$window && this.$window.is(':visible'));
|
||||
},
|
||||
setLeftTop: function (posX, posY, leftX, loadInnerValues, retainContent) {
|
||||
if (!this.$window)
|
||||
this.render();
|
||||
|
||||
if (loadInnerValues) {
|
||||
posX = this.arrowPosX;
|
||||
posY = this.arrowPosY;
|
||||
leftX = this.leftX;
|
||||
}
|
||||
|
||||
if (_.isUndefined(posX) && _.isUndefined(posY))
|
||||
return;
|
||||
|
||||
this.arrowPosX = posX;
|
||||
this.arrowPosY = posY;
|
||||
this.leftX = leftX;
|
||||
|
||||
var commentsView = $('#id-comments-popover'),
|
||||
arrowView = $('#id-comments-arrow'),
|
||||
editorView = $('#editor_sdk'),
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelRight = '',
|
||||
sdkPanelRightWidth = 0,
|
||||
sdkPanelLeft = '',
|
||||
sdkPanelLeftWidth = 0,
|
||||
sdkPanelThumbs = '', // for PE
|
||||
sdkPanelThumbsWidth = 0, // for PE
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
leftPos = 0,
|
||||
windowWidth = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
|
||||
this.$window.css({maxHeight: sdkBoundsHeight + 'px'});
|
||||
|
||||
this.sdkBounds.width = editorBounds.width;
|
||||
this.sdkBounds.height = editorBounds.height;
|
||||
|
||||
// LEFT CORNER
|
||||
|
||||
if (!_.isUndefined(posX)) {
|
||||
|
||||
sdkPanelRight = $('#id_vertical_scroll');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
} else {
|
||||
sdkPanelRight = $('#ws-v-scrollbar');
|
||||
if (sdkPanelRight.length) {
|
||||
sdkPanelRightWidth = (sdkPanelRight.css('display') !== 'none') ? sdkPanelRight.width() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.width -= sdkPanelRightWidth;
|
||||
|
||||
sdkPanelLeft = $('#id_panel_left');
|
||||
if (sdkPanelLeft.length) {
|
||||
sdkPanelLeftWidth = (sdkPanelLeft.css('display') !== 'none') ? sdkPanelLeft.width() : 0;
|
||||
}
|
||||
sdkPanelThumbs = $('#id_panel_thumbnails');
|
||||
if (sdkPanelThumbs.length) {
|
||||
sdkPanelThumbsWidth = (sdkPanelThumbs.css('display') !== 'none') ? sdkPanelThumbs.width() : 0;
|
||||
this.sdkBounds.width -= sdkPanelThumbsWidth;
|
||||
}
|
||||
|
||||
leftPos = Math.min(sdkBoundsLeft + posX + this.arrow.width, sdkBoundsLeft + this.sdkBounds.width - this.$window.outerWidth() - 25);
|
||||
leftPos = Math.max(sdkBoundsLeft + sdkPanelLeftWidth + this.arrow.width, leftPos);
|
||||
|
||||
arrowView.removeClass('right').addClass('left');
|
||||
|
||||
if (!_.isUndefined(leftX)) {
|
||||
windowWidth = this.$window.outerWidth();
|
||||
if (windowWidth) {
|
||||
if ((posX + windowWidth > this.sdkBounds.width - this.arrow.width + 5) && (this.leftX > windowWidth)) {
|
||||
leftPos = this.leftX - windowWidth + sdkBoundsLeft - this.arrow.width;
|
||||
arrowView.removeClass('left').addClass('right');
|
||||
} else {
|
||||
leftPos = sdkBoundsLeft + posX + this.arrow.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css('left', leftPos + 'px');
|
||||
}
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
if (!_.isUndefined(posY)) {
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.sdkBounds.height -= sdkPanelHeight;
|
||||
|
||||
outerHeight = this.$window.outerHeight();
|
||||
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css('top', topPos + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!retainContent)
|
||||
this.calculateSizeOfContent();
|
||||
},
|
||||
calculateSizeOfContent: function (testVisible) {
|
||||
if (testVisible && !this.$window.is(':visible'))
|
||||
return;
|
||||
|
||||
this.$window.css({overflow: 'hidden'});
|
||||
|
||||
var arrowView = $('#id-comments-arrow'),
|
||||
commentsView = $('#id-comments-popover'),
|
||||
contentBounds = null,
|
||||
editorView = null,
|
||||
editorBounds = null,
|
||||
sdkBoundsHeight = 0,
|
||||
sdkBoundsTop = 0,
|
||||
sdkBoundsLeft = 0,
|
||||
sdkPanelTop = '',
|
||||
sdkPanelHeight = 0,
|
||||
arrowPosY = 0,
|
||||
windowHeight = 0,
|
||||
outerHeight = 0,
|
||||
topPos = 0,
|
||||
sdkBoundsTopPos = 0;
|
||||
|
||||
if (commentsView && arrowView && commentsView.get(0)) {
|
||||
commentsView.css({height: '100%'});
|
||||
|
||||
contentBounds = commentsView.get(0).getBoundingClientRect();
|
||||
if (contentBounds) {
|
||||
editorView = $('#editor_sdk');
|
||||
if (editorView && editorView.get(0)) {
|
||||
editorBounds = editorView.get(0).getBoundingClientRect();
|
||||
if (editorBounds) {
|
||||
sdkBoundsHeight = editorBounds.height - this.sdkBounds.padding * 2;
|
||||
sdkBoundsTopPos = sdkBoundsTop;
|
||||
windowHeight = this.$window.outerHeight();
|
||||
|
||||
// TOP CORNER
|
||||
|
||||
sdkPanelTop = $('#id_panel_top');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
sdkBoundsTopPos += this.sdkBounds.paddingTop;
|
||||
} else {
|
||||
sdkPanelTop = $('#ws-h-scrollbar');
|
||||
if (sdkPanelTop.length) {
|
||||
sdkPanelHeight = (sdkPanelTop.css('display') !== 'none') ? sdkPanelTop.height() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
outerHeight = Math.max(commentsView.outerHeight(), this.$window.outerHeight());
|
||||
|
||||
if (sdkBoundsHeight <= outerHeight) {
|
||||
this.$window.css({
|
||||
maxHeight: sdkBoundsHeight - sdkPanelHeight + 'px',
|
||||
top: sdkBoundsTop + sdkPanelHeight + 'px'});
|
||||
|
||||
commentsView.css({height: sdkBoundsHeight - sdkPanelHeight - 3 + 'px'});
|
||||
|
||||
// arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - sdkPanelHeight - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
} else {
|
||||
|
||||
outerHeight = windowHeight;
|
||||
|
||||
if (outerHeight > 0) {
|
||||
if (contentBounds.top + outerHeight > sdkBoundsHeight + sdkBoundsTop || contentBounds.height === 0) {
|
||||
topPos = Math.min(sdkBoundsTop + sdkBoundsHeight - outerHeight, this.arrowPosY + sdkBoundsTop - this.arrow.height);
|
||||
topPos = Math.max(topPos, sdkBoundsTopPos);
|
||||
|
||||
this.$window.css({top: topPos + 'px'});
|
||||
}
|
||||
}
|
||||
|
||||
arrowPosY = Math.max(this.arrow.margin, this.arrowPosY - (sdkBoundsHeight - outerHeight) - this.arrow.width);
|
||||
arrowPosY = Math.min(arrowPosY, outerHeight - this.arrow.margin - this.arrow.width);
|
||||
|
||||
arrowView.css({top: arrowPosY + 'px'});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$window.css({overflow: ''});
|
||||
},
|
||||
saveText: function (clear) {
|
||||
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length<1) {
|
||||
this.textVal = undefined;
|
||||
if (!clear) {
|
||||
this.textVal = this.commentsView.getActiveTextBoxVal();
|
||||
} else {
|
||||
this.commentsView.clearTextBoxBind();
|
||||
}
|
||||
}
|
||||
},
|
||||
loadText: function () {
|
||||
if (this.textVal && this.commentsView) {
|
||||
var textBox = this.commentsView.getTextBox();
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
},
|
||||
getEditText: function () {
|
||||
if (this.commentsView) {
|
||||
return this.commentsView.getActiveTextBoxVal();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
hookTextBox: function () {
|
||||
var me = this, textBox = this.commentsView.getTextBox();
|
||||
|
||||
textBox && textBox.keydown(function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode === Common.UI.Keys.RETURN) {
|
||||
var buttonChangeComment = $('#id-comments-change-popover');
|
||||
if (buttonChangeComment && buttonChangeComment.length) {
|
||||
buttonChangeComment.click();
|
||||
}
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
} else if (event.keyCode === Common.UI.Keys.TAB) {
|
||||
var $this, end, start;
|
||||
start = this.selectionStart;
|
||||
end = this.selectionEnd;
|
||||
$this = $(this);
|
||||
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
me.e = event;
|
||||
});
|
||||
},
|
||||
|
||||
hideTips: function() {
|
||||
if (this.commentsView)
|
||||
_.each(this.commentsView.dataViewItems, function(item) {
|
||||
if (item.tipsArray) {
|
||||
item.tipsArray.forEach(function(item){
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
isCommentsViewMouseOver: function() {
|
||||
return this._isMouseOver;
|
||||
}
|
||||
});
|
||||
|
||||
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
|
||||
el: '#left-panel-comments',
|
||||
template: _.template(panelTemplate),
|
||||
|
@ -846,59 +84,57 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
this.store = this.options.store;
|
||||
this.popoverComments = this.options.popoverComments;
|
||||
},
|
||||
render: function () {
|
||||
var me = this;
|
||||
|
||||
this.$el.html(this.template({
|
||||
textAddCommentToDoc: me.textAddCommentToDoc,
|
||||
textAddComment: me.textAddComment,
|
||||
textCancel: me.textCancel,
|
||||
textEnterCommentHint: me.textEnterCommentHint,
|
||||
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
|
||||
}));
|
||||
if (!this.rendered) {
|
||||
this.$el.html(this.template({
|
||||
textAddCommentToDoc: me.textAddCommentToDoc,
|
||||
textAddComment: me.textAddComment,
|
||||
textCancel: me.textCancel,
|
||||
textEnterCommentHint: me.textEnterCommentHint,
|
||||
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
|
||||
}));
|
||||
|
||||
this.buttonAddCommentToDoc = new Common.UI.Button({
|
||||
el: $('.btn.new',this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
this.buttonAdd = new Common.UI.Button({
|
||||
action: 'add',
|
||||
el: $('.btn.add', this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
this.buttonCancel = new Common.UI.Button({
|
||||
el: $('.btn.cancel', this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
this.buttonAddCommentToDoc = new Common.UI.Button({
|
||||
el: $('.btn.new', this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
this.buttonAdd = new Common.UI.Button({
|
||||
action: 'add',
|
||||
el: $('.btn.add', this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
this.buttonCancel = new Common.UI.Button({
|
||||
el: $('.btn.cancel', this.$el),
|
||||
enableToggle: false
|
||||
});
|
||||
|
||||
this.buttonAddCommentToDoc.on('click', _.bind(this.onClickShowBoxDocumentComment, this));
|
||||
this.buttonAdd.on('click', _.bind(this.onClickAddDocumentComment, this));
|
||||
this.buttonCancel.on('click', _.bind(this.onClickCancelDocumentComment, this));
|
||||
this.buttonAddCommentToDoc.on('click', _.bind(this.onClickShowBoxDocumentComment, this));
|
||||
this.buttonAdd.on('click', _.bind(this.onClickAddDocumentComment, this));
|
||||
this.buttonCancel.on('click', _.bind(this.onClickCancelDocumentComment, this));
|
||||
|
||||
this.txtComment = $('#comment-msg-new', this.el);
|
||||
this.txtComment.keydown(function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode == Common.UI.Keys.RETURN) {
|
||||
me.onClickAddDocumentComment();
|
||||
event.stopImmediatePropagation();
|
||||
} else if (event.keyCode === Common.UI.Keys.TAB) {
|
||||
var $this, end, start;
|
||||
start = this.selectionStart;
|
||||
end = this.selectionEnd;
|
||||
$this = $(this);
|
||||
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
this.txtComment = $('#comment-msg-new', this.el);
|
||||
this.txtComment.keydown(function (event) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.keyCode == Common.UI.Keys.RETURN) {
|
||||
me.onClickAddDocumentComment();
|
||||
event.stopImmediatePropagation();
|
||||
} else if (event.keyCode === Common.UI.Keys.TAB) {
|
||||
var $this, end, start;
|
||||
start = this.selectionStart;
|
||||
end = this.selectionEnd;
|
||||
$this = $(this);
|
||||
$this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
|
||||
|
||||
var parentView = me;
|
||||
|
||||
return {
|
||||
|
||||
options : {
|
||||
|
@ -909,11 +145,11 @@ define([
|
|||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
if (text && text.length) {
|
||||
var val = text.val();
|
||||
text.focus();
|
||||
|
@ -922,7 +158,7 @@ define([
|
|||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
|
@ -993,7 +229,6 @@ define([
|
|||
})());
|
||||
if (CommentsPanelDataView) {
|
||||
if (this.commentsView) {
|
||||
this.commentsView.render($('.messages-ct',me.el));
|
||||
this.commentsView.onResetItems();
|
||||
} else {
|
||||
this.commentsView = new CommentsPanelDataView({
|
||||
|
@ -1149,8 +384,9 @@ define([
|
|||
}
|
||||
}
|
||||
|
||||
this.setupLayout();
|
||||
if (!this.rendered) this.setupLayout();
|
||||
this.update();
|
||||
this.rendered = true;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -1164,19 +400,6 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
getPopover: function (sdkViewName) {
|
||||
|
||||
if (_.isUndefined(this.popover)) {
|
||||
this.popover = new Common.Views.CommentsPopover({
|
||||
store : this.popoverComments,
|
||||
delegate : this,
|
||||
renderTo : sdkViewName
|
||||
});
|
||||
}
|
||||
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
showEditContainer: function (show) {
|
||||
var addCommentLink = $('.add-link-ct', this.el),
|
||||
newCommentBlock = $('.new-comment-ct', this.el),
|
||||
|
@ -1214,6 +437,23 @@ define([
|
|||
this.showEditContainer(false);
|
||||
},
|
||||
|
||||
saveText: function (clear) {
|
||||
if (this.commentsView && this.commentsView.cmpEl.find('.lock-area').length<1) {
|
||||
this.textVal = undefined;
|
||||
if (!clear) {
|
||||
this.textVal = this.commentsView.getActiveTextBoxVal();
|
||||
} else {
|
||||
this.commentsView.clearTextBoxBind();
|
||||
}
|
||||
}
|
||||
},
|
||||
loadText: function () {
|
||||
if (this.textVal && this.commentsView) {
|
||||
var textBox = this.commentsView.getTextBox();
|
||||
textBox && textBox.val(this.textVal);
|
||||
}
|
||||
},
|
||||
|
||||
hookTextBox: function () {
|
||||
var me = this,
|
||||
textBox = this.commentsView.getTextBox();
|
||||
|
@ -1369,7 +609,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) {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -119,10 +119,11 @@ define([
|
|||
},
|
||||
|
||||
_onMessage: function(msg) {
|
||||
if (msg && msg.needUpdate) {
|
||||
this.trigger('accessrights', this, msg.sharingSettings);
|
||||
if (msg && msg.Referer == "onlyoffice") {
|
||||
if (msg.needUpdate)
|
||||
this.trigger('accessrights', this, msg.sharingSettings);
|
||||
Common.NotificationCenter.trigger('window:close', this);
|
||||
}
|
||||
Common.NotificationCenter.trigger('window:close', this);
|
||||
},
|
||||
|
||||
_onLoad: function() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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,22 +56,24 @@ define([
|
|||
var $saveStatus;
|
||||
|
||||
var templateUserItem =
|
||||
'<li id="status-chat-user-<%= user.get("id") %>" 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>' +
|
||||
'<li id="<%= user.get("iid") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
|
||||
'<div class="user-name">' +
|
||||
'<div class="color" style="background-color: <%= user.get("color") %>;"></div>'+
|
||||
'<label><%= fnEncode(user.get("username")) %></label>' +
|
||||
'<% if (len>1) { %><label style="margin-left:3px;">(<%=len%>)</label><% } %>' +
|
||||
'</div>'+
|
||||
'</li>';
|
||||
|
||||
var templateUserList = _.template(
|
||||
'<ul>' +
|
||||
'<% _.each(users, function(item) { %>' +
|
||||
'<%= usertpl({user: item, fnEncode: fnEncode}) %>' +
|
||||
'<% }); %>' +
|
||||
'<% for (originalId in users) { %>' +
|
||||
'<%= usertpl({user: users[originalId][0], fnEncode: fnEncode, len: users[originalId].length}) %>' +
|
||||
'<% } %>' +
|
||||
'</ul>');
|
||||
|
||||
var templateRightBox = '<section>' +
|
||||
'<section id="box-doc-name">' +
|
||||
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false"></input>' +
|
||||
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
|
||||
'</section>' +
|
||||
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
|
||||
'<div class="hedset">' +
|
||||
|
@ -98,6 +100,7 @@ define([
|
|||
'</div>' +
|
||||
'<div class="hedset">' +
|
||||
'<div class="btn-slot" id="slot-btn-back"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-options"></div>' +
|
||||
'</div>' +
|
||||
'</section>';
|
||||
|
||||
|
@ -105,64 +108,51 @@ define([
|
|||
'<div id="header-logo"><i /></div>' +
|
||||
'</section>';
|
||||
|
||||
function onAddUser(model, collection, opts) {
|
||||
if ( $userList ) {
|
||||
var $ul = $userList.find('ul');
|
||||
if ( !$ul.length ) {
|
||||
$userList.html( templateUserList({
|
||||
users: collection.models,
|
||||
usertpl: _.template(templateUserItem),
|
||||
fnEncode: Common.Utils.String.htmlEncode
|
||||
})
|
||||
);
|
||||
} else {
|
||||
$ul.append( _.template(templateUserItem)({
|
||||
user: model,
|
||||
fnEncode: Common.Utils.String.htmlEncode
|
||||
}) );
|
||||
}
|
||||
|
||||
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
applyUsers( collection.getEditingCount() );
|
||||
};
|
||||
|
||||
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.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
applyUsers(model.collection.getEditingCount());
|
||||
};
|
||||
var templateTitleBox = '<section id="box-document-title">' +
|
||||
'<div class="hedset">' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-save"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-print"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-undo"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-redo"></div>' +
|
||||
'</div>' +
|
||||
'<div class="lr-separator"></div>' +
|
||||
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
|
||||
'<label id="title-user-name" style="pointer-events: none;"></label>' +
|
||||
'</section>';
|
||||
|
||||
function onResetUsers(collection, opts) {
|
||||
var usercount = collection.getEditingCount();
|
||||
if ( $userList ) {
|
||||
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit) {
|
||||
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments) {
|
||||
$userList.html(templateUserList({
|
||||
users: collection.models,
|
||||
users: collection.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).value(),
|
||||
usertpl: _.template(templateUserItem),
|
||||
fnEncode: Common.Utils.String.htmlEncode
|
||||
}));
|
||||
|
||||
$userList.scroller = new Common.UI.Scroller({
|
||||
el: $userList.find('ul'),
|
||||
useKeyboard: true,
|
||||
minScrollbarLength: 40,
|
||||
alwaysVisibleY: true
|
||||
});
|
||||
if (!$userList.scroller)
|
||||
$userList.scroller = new Common.UI.Scroller({
|
||||
el: $userList.find('ul'),
|
||||
useKeyboard: true,
|
||||
minScrollbarLength: 40,
|
||||
alwaysVisibleY: true
|
||||
});
|
||||
$userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||
} else {
|
||||
$userList.empty();
|
||||
}
|
||||
}
|
||||
|
||||
applyUsers( usercount );
|
||||
applyUsers( usercount, collection.getEditingOriginalCount() );
|
||||
};
|
||||
|
||||
function applyUsers(count) {
|
||||
if ( count > 1 || count > 0 && appConfig && !appConfig.isEdit) {
|
||||
function onUsersChanged(model) {
|
||||
onResetUsers(model.collection);
|
||||
};
|
||||
|
||||
function applyUsers(count, originalCount) {
|
||||
var has_edit_users = count > 1 || count > 0 && appConfig && !appConfig.isEdit && !appConfig.canComments; // has other user(s) who edit document
|
||||
if ( has_edit_users ) {
|
||||
$btnUsers
|
||||
.attr('data-toggle', 'dropdown')
|
||||
.addClass('dropdown-toggle')
|
||||
|
@ -179,13 +169,13 @@ define([
|
|||
}
|
||||
|
||||
$btnUsers.find('.caption')
|
||||
.css({'font-size': ((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? '12px' : '14px'),
|
||||
'margin-top': ((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? '0' : '-1px')})
|
||||
.html((count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? count : '+');
|
||||
.css({'font-size': ((has_edit_users) ? '12px' : '14px'),
|
||||
'margin-top': ((has_edit_users) ? '0' : '-1px')})
|
||||
.html((has_edit_users) ? originalCount : '+');
|
||||
|
||||
var usertip = $btnUsers.data('bs.tooltip');
|
||||
if ( usertip ) {
|
||||
usertip.options.title = (count > 1 || count > 0 && appConfig && !appConfig.isEdit) ? usertip.options.titleExt : usertip.options.titleNorm;
|
||||
usertip.options.title = (has_edit_users) ? usertip.options.titleExt : usertip.options.titleNorm;
|
||||
usertip.setContent();
|
||||
}
|
||||
}
|
||||
|
@ -207,12 +197,12 @@ define([
|
|||
}
|
||||
}
|
||||
|
||||
function onAppShowed(config) {}
|
||||
|
||||
function onAppReady(mode) {
|
||||
appConfig = mode;
|
||||
|
||||
var me = this;
|
||||
if ( !(me.branding && me.branding.goback && me.branding.goback.text) )
|
||||
me.btnGoBack.updateHint(me.textBack);
|
||||
me.btnGoBack.on('click', function (e) {
|
||||
Common.NotificationCenter.trigger('goback');
|
||||
});
|
||||
|
@ -237,7 +227,7 @@ define([
|
|||
|
||||
var editingUsers = storeUsers.getEditingCount();
|
||||
$btnUsers.tooltip({
|
||||
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit) ? me.tipViewUsers : me.tipAccessRights,
|
||||
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.canComments) ? me.tipViewUsers : me.tipAccessRights,
|
||||
titleNorm: me.tipAccessRights,
|
||||
titleExt: me.tipViewUsers,
|
||||
placement: 'bottom',
|
||||
|
@ -253,7 +243,7 @@ define([
|
|||
});
|
||||
|
||||
$labelChangeRights[(!mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length)?'show':'hide']();
|
||||
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
|
||||
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.canComments || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
|
||||
|
||||
if ( $saveStatus ) {
|
||||
$saveStatus.attr('data-width', me.textSaveExpander);
|
||||
|
@ -266,6 +256,34 @@ define([
|
|||
}
|
||||
}
|
||||
|
||||
if ( me.btnPrint ) {
|
||||
me.btnPrint.updateHint(me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'));
|
||||
me.btnPrint.on('click', function (e) {
|
||||
me.fireEvent('print', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( me.btnSave ) {
|
||||
me.btnSave.updateHint(me.tipSave + Common.Utils.String.platformKey('Ctrl+S'));
|
||||
me.btnSave.on('click', function (e) {
|
||||
me.fireEvent('save', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( me.btnUndo ) {
|
||||
me.btnUndo.updateHint(me.tipUndo + Common.Utils.String.platformKey('Ctrl+Z'));
|
||||
me.btnUndo.on('click', function (e) {
|
||||
me.fireEvent('undo', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( me.btnRedo ) {
|
||||
me.btnRedo.updateHint(me.tipRedo + Common.Utils.String.platformKey('Ctrl+Y'));
|
||||
me.btnRedo.on('click', function (e) {
|
||||
me.fireEvent('redo', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( !mode.isEdit ) {
|
||||
if ( me.btnDownload ) {
|
||||
me.btnDownload.updateHint(me.tipDownload);
|
||||
|
@ -274,13 +292,6 @@ define([
|
|||
});
|
||||
}
|
||||
|
||||
if ( me.btnPrint ) {
|
||||
me.btnPrint.updateHint(me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'));
|
||||
me.btnPrint.on('click', function (e) {
|
||||
me.fireEvent('print', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( me.btnEdit ) {
|
||||
me.btnEdit.updateHint(me.tipGoEdit);
|
||||
me.btnEdit.on('click', function (e) {
|
||||
|
@ -288,6 +299,9 @@ define([
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ( me.btnOptions )
|
||||
me.btnOptions.updateHint(me.tipViewSettings);
|
||||
}
|
||||
|
||||
function onDocNameKeyDown(e) {
|
||||
|
@ -327,7 +341,6 @@ define([
|
|||
return {
|
||||
options: {
|
||||
branding: {},
|
||||
headerCaption: 'Default Caption',
|
||||
documentCaption: '',
|
||||
canBack: false
|
||||
},
|
||||
|
@ -344,11 +357,9 @@ define([
|
|||
|
||||
initialize: function (options) {
|
||||
var me = this;
|
||||
this.options = this.options ? _({}).extend(this.options, options) : options;
|
||||
this.options = this.options ? _.extend(this.options, options) : options;
|
||||
|
||||
this.headerCaption = this.options.headerCaption;
|
||||
this.documentCaption = this.options.documentCaption;
|
||||
this.canBack = this.options.canBack;
|
||||
this.branding = this.options.customization;
|
||||
this.isModified = false;
|
||||
|
||||
|
@ -361,14 +372,25 @@ define([
|
|||
|
||||
storeUsers = this.options.storeUsers;
|
||||
storeUsers.bind({
|
||||
add : onAddUser,
|
||||
add : onUsersChanged,
|
||||
change : onUsersChanged,
|
||||
reset : onResetUsers
|
||||
});
|
||||
|
||||
me.btnOptions = new Common.UI.Button({
|
||||
cls: 'btn-header no-caret',
|
||||
iconCls: 'svgicon svg-btn-options',
|
||||
menu: true
|
||||
});
|
||||
|
||||
me.mnuZoom = {options: {value: 100}};
|
||||
|
||||
Common.NotificationCenter.on('app:ready', function(mode) {
|
||||
Common.Utils.asyncCall(onAppReady, me, mode);
|
||||
});
|
||||
Common.NotificationCenter.on('app:face', function(mode) {
|
||||
Common.Utils.asyncCall(onAppShowed, me, mode);
|
||||
});
|
||||
},
|
||||
|
||||
render: function (el, role) {
|
||||
|
@ -378,6 +400,16 @@ define([
|
|||
},
|
||||
|
||||
getPanel: function (role, config) {
|
||||
var me = this;
|
||||
|
||||
function createTitleButton(iconid, slot, disabled) {
|
||||
return (new Common.UI.Button({
|
||||
cls: 'btn-header',
|
||||
iconCls: 'svgicon ' + iconid,
|
||||
disabled: disabled === true
|
||||
})).render(slot);
|
||||
}
|
||||
|
||||
if ( role == 'left' && (!config || !config.isDesktopApp)) {
|
||||
$html = $(templateLeftBox);
|
||||
this.logo = $html.find('#header-logo');
|
||||
|
@ -396,65 +428,43 @@ define([
|
|||
textSaveEnd: this.textSaveEnd
|
||||
}));
|
||||
|
||||
if ( this.labelDocName ) this.labelDocName.off();
|
||||
this.labelDocName = $html.find('#rib-doc-name');
|
||||
// this.labelDocName.attr('maxlength', 50);
|
||||
this.labelDocName.text = function (text) {
|
||||
this.val(text).attr('size', text.length);
|
||||
}
|
||||
if ( !me.labelDocName ) {
|
||||
me.labelDocName = $html.find('#rib-doc-name');
|
||||
// this.labelDocName.attr('maxlength', 50);
|
||||
me.labelDocName.text = function (text) {
|
||||
this.val(text).attr('size', text.length);
|
||||
}
|
||||
|
||||
if ( this.documentCaption ) {
|
||||
this.labelDocName.text( this.documentCaption );
|
||||
if ( me.documentCaption ) {
|
||||
me.labelDocName.text(me.documentCaption);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !_.isUndefined(this.options.canRename) ) {
|
||||
this.setCanRename(this.options.canRename);
|
||||
}
|
||||
|
||||
$saveStatus = $html.find('#rib-save-status');
|
||||
$saveStatus.hide();
|
||||
// $saveStatus = $html.find('#rib-save-status');
|
||||
$html.find('#rib-save-status').hide();
|
||||
// if ( config.isOffline ) $saveStatus = false;
|
||||
|
||||
if ( config && config.isDesktopApp ) {
|
||||
$html.addClass('desktop');
|
||||
$html.find('#slot-btn-back').hide();
|
||||
this.labelDocName.hide();
|
||||
|
||||
if ( config.isOffline )
|
||||
$saveStatus = false;
|
||||
if ( this.options.canBack === true ) {
|
||||
me.btnGoBack.render($html.find('#slot-btn-back'));
|
||||
} else {
|
||||
if ( this.canBack === true ) {
|
||||
this.btnGoBack.render($html.find('#slot-btn-back'));
|
||||
} else {
|
||||
$html.find('#slot-btn-back').hide();
|
||||
}
|
||||
$html.find('#slot-btn-back').hide();
|
||||
}
|
||||
|
||||
if ( !config.isEdit ) {
|
||||
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline ) {
|
||||
this.btnDownload = new Common.UI.Button({
|
||||
cls: 'btn-header',
|
||||
iconCls: 'svgicon svg-btn-download'
|
||||
});
|
||||
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline )
|
||||
this.btnDownload = createTitleButton('svg-btn-download', $html.find('#slot-hbtn-download'));
|
||||
|
||||
this.btnDownload.render($html.find('#slot-hbtn-download'));
|
||||
}
|
||||
if ( config.canPrint )
|
||||
this.btnPrint = createTitleButton('svg-btn-print', $html.find('#slot-hbtn-print'));
|
||||
|
||||
if ( config.canPrint ) {
|
||||
this.btnPrint = new Common.UI.Button({
|
||||
cls: 'btn-header',
|
||||
iconCls: 'svgicon svg-btn-print'
|
||||
});
|
||||
|
||||
this.btnPrint.render($html.find('#slot-hbtn-print'));
|
||||
}
|
||||
|
||||
if ( config.canEdit && config.canRequestEditRights ) {
|
||||
(this.btnEdit = new Common.UI.Button({
|
||||
cls: 'btn-header',
|
||||
iconCls: 'svgicon svg-btn-edit'
|
||||
})).render($html.find('#slot-hbtn-edit'));
|
||||
}
|
||||
if ( config.canEdit && config.canRequestEditRights )
|
||||
this.btnEdit = createTitleButton('svg-btn-edit', $html.find('#slot-hbtn-edit'));
|
||||
}
|
||||
me.btnOptions.render($html.find('#slot-btn-options'));
|
||||
|
||||
$userList = $html.find('.cousers-list');
|
||||
$panelUsers = $html.find('.box-cousers');
|
||||
|
@ -462,6 +472,40 @@ define([
|
|||
|
||||
$panelUsers.hide();
|
||||
|
||||
return $html;
|
||||
} else
|
||||
if ( role == 'title' ) {
|
||||
var $html = $(_.template(templateTitleBox)());
|
||||
|
||||
!!me.labelDocName && me.labelDocName.hide().off(); // hide document title if it was created in right box
|
||||
me.labelDocName = $html.find('> #title-doc-name');
|
||||
me.labelDocName.text = function (str) {this.val(str);}; // redefine text function to lock temporaly rename docuemnt option
|
||||
me.labelDocName.text( me.documentCaption );
|
||||
|
||||
me.labelUserName = $('> #title-user-name', $html);
|
||||
me.setUserName(me.options.userName);
|
||||
|
||||
if ( config.canPrint && config.isEdit ) {
|
||||
me.btnPrint = createTitleButton('svg-btn-print', $('#slot-btn-dt-print', $html));
|
||||
}
|
||||
|
||||
me.btnSave = createTitleButton('svg-btn-save', $('#slot-btn-dt-save', $html), true);
|
||||
me.btnUndo = createTitleButton('svg-btn-undo', $('#slot-btn-dt-undo', $html), true);
|
||||
me.btnRedo = createTitleButton('svg-btn-redo', $('#slot-btn-dt-redo', $html), true);
|
||||
|
||||
if ( me.btnSave.$icon.is('svg') ) {
|
||||
me.btnSave.$icon.addClass('icon-save');
|
||||
var _create_use = function (extid, intid) {
|
||||
var _use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
|
||||
_use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', extid);
|
||||
_use.setAttribute('id', intid);
|
||||
|
||||
return $(_use);
|
||||
};
|
||||
|
||||
_create_use('#svg-btn-save-coauth', 'coauth').appendTo(me.btnSave.$icon);
|
||||
_create_use('#svg-btn-save-sync', 'sync').appendTo(me.btnSave.$icon);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
},
|
||||
|
@ -485,23 +529,9 @@ define([
|
|||
element.css({'background-image': 'none', width: 'auto'});
|
||||
}
|
||||
}
|
||||
|
||||
if ( !!value.goback && value.goback.text) {
|
||||
this.btnGoBack.updateHint(value.goback.text);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setHeaderCaption: function (value) {
|
||||
this.headerCaption = value;
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
getHeaderCaption: function () {
|
||||
return this.headerCaption;
|
||||
},
|
||||
|
||||
setDocumentCaption: function(value) {
|
||||
!value && (value = '');
|
||||
|
||||
|
@ -530,14 +560,17 @@ define([
|
|||
this.labelDocName.text(_name);
|
||||
},
|
||||
|
||||
setCanBack: function (value) {
|
||||
this.canBack = value;
|
||||
|
||||
setCanBack: function (value, text) {
|
||||
this.options.canBack = value;
|
||||
this.btnGoBack[value ? 'show' : 'hide']();
|
||||
if (value)
|
||||
this.btnGoBack.updateHint((text && typeof text == 'string') ? text : this.textBack);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getCanBack: function () {
|
||||
return this.canBack;
|
||||
return this.options.canBack;
|
||||
},
|
||||
|
||||
setCanRename: function (rename) {
|
||||
|
@ -588,6 +621,61 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
setUserName: function(name) {
|
||||
if ( !!this.labelUserName ) {
|
||||
if ( !!name ) {
|
||||
this.labelUserName.text(name).show();
|
||||
} else this.labelUserName.hide();
|
||||
} else {
|
||||
this.options.userName = name;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getButton: function(type) {
|
||||
if (type == 'save')
|
||||
return this.btnSave;
|
||||
},
|
||||
|
||||
lockHeaderBtns: function (alias, lock) {
|
||||
var me = this;
|
||||
if ( alias == 'users' ) {
|
||||
if ( lock )
|
||||
$btnUsers.addClass('disabled').attr('disabled', 'disabled'); else
|
||||
$btnUsers.removeClass('disabled').attr('disabled', '');
|
||||
} else {
|
||||
function _lockButton(btn) {
|
||||
if ( btn ) {
|
||||
if ( lock ) {
|
||||
btn.keepState = {
|
||||
disabled: btn.isDisabled()
|
||||
};
|
||||
btn.setDisabled( true );
|
||||
} else {
|
||||
btn.setDisabled( btn.keepState && btn.keepState.disabled || lock);
|
||||
delete btn.keepState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( alias ) {
|
||||
case 'undo': _lockButton(me.btnUndo); break;
|
||||
case 'redo': _lockButton(me.btnRedo); break;
|
||||
case 'opts': _lockButton(me.btnOptions); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fakeMenuItem: function() {
|
||||
return {
|
||||
conf: {checked: false},
|
||||
setChecked: function (val) { this.conf.checked = val; },
|
||||
isChecked: function () { return this.conf.checked; }
|
||||
};
|
||||
},
|
||||
|
||||
textBack: 'Go to Documents',
|
||||
txtRename: 'Rename',
|
||||
textSaveBegin: 'Saving...',
|
||||
|
@ -600,7 +688,16 @@ define([
|
|||
tipViewUsers: 'View users and manage document access rights',
|
||||
tipDownload: 'Download file',
|
||||
tipPrint: 'Print file',
|
||||
tipGoEdit: 'Edit current file'
|
||||
tipGoEdit: 'Edit current file',
|
||||
tipSave: 'Save',
|
||||
tipUndo: 'Undo',
|
||||
tipRedo: 'Redo',
|
||||
textCompactView: 'Hide Toolbar',
|
||||
textHideStatusBar: 'Hide Status Bar',
|
||||
textHideLines: 'Hide Rulers',
|
||||
textZoom: 'Zoom',
|
||||
textAdvSettings: 'Advanced Settings',
|
||||
tipViewSettings: 'View Settings'
|
||||
}
|
||||
}(), Common.Views.Header || {}))
|
||||
});
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -48,23 +48,23 @@ define([
|
|||
Common.Views.InsertTableDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width: 230,
|
||||
height: 170,
|
||||
header: false,
|
||||
height: 156,
|
||||
style: 'min-width: 230px;',
|
||||
cls: 'modal-dlg',
|
||||
split: false
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, options || {});
|
||||
_.extend(this.options, {
|
||||
title: (options.split) ? this.txtTitleSplit : this.txtTitle
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<h4>' + ((options.split) ? this.txtTitleSplit : this.txtTitle) + '</h4>',
|
||||
'<div class="input-row" style="margin: 10px 0;">',
|
||||
'<div class="input-row">',
|
||||
'<label class="text columns-text" style="width: 130px;">' + this.txtColumns + '</label><div class="columns-val" style="float: right;"></div>',
|
||||
'</div>',
|
||||
'<div class="input-row" style="margin: 10px 0;">',
|
||||
'<div class="input-row" style="margin-top: 10px;">',
|
||||
'<label class="text rows-text" style="width: 130px;">' + this.txtRows + '</label><div class="rows-val" style="float: right;"></div>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -55,10 +55,11 @@ define([
|
|||
|
||||
_.extend(_options, {
|
||||
closable : false,
|
||||
width : (options.preview) ? 414 : 262,
|
||||
height : (options.preview) ? 291 : ((options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 205 : 155),
|
||||
header : true,
|
||||
preview : options.preview,
|
||||
warning : options.warning,
|
||||
width : (options.preview) ? 414 : ((options.type == Asc.c_oAscAdvancedOptionsID.DRM && options.warning) ? 370 : 262),
|
||||
height : (options.preview) ? 277 : ((options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 190 : (options.warning ? 187 : 147)),
|
||||
header : true,
|
||||
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'),
|
||||
|
@ -70,8 +71,19 @@ define([
|
|||
'<div class="box" style="height:' + (_options.height - 85) + 'px;">',
|
||||
'<div class="content-panel" >',
|
||||
'<% if (type == Asc.c_oAscAdvancedOptionsID.DRM) { %>',
|
||||
'<label class="header">' + t.txtPassword + '</label>',
|
||||
'<div id="id-password-txt" style="margin-bottom:15px;"></div>',
|
||||
'<% if (warning) { %>',
|
||||
'<div>',
|
||||
'<div class="icon img-commonctrl warn"/>',
|
||||
'<div style="padding-left: 50px;"><div style="font-size: 12px;">' + t.txtProtected+ '</div>',
|
||||
'<label class="header" style="margin-top: 15px;">' + t.txtPassword + '</label>',
|
||||
'<div id="id-password-txt" style="width: 240px;"></div></div>',
|
||||
'</div>',
|
||||
'<% } else { %>',
|
||||
'<div>',
|
||||
'<label class="header">' + t.txtPassword + '</label>',
|
||||
'<div id="id-password-txt"></div>',
|
||||
'</div>',
|
||||
'<% } %>',
|
||||
'<% } else { %>',
|
||||
'<div style="display: inline-block; margin-bottom:15px;margin-right: 10px;">',
|
||||
'<label class="header">' + t.txtEncoding + '</label>',
|
||||
|
@ -105,11 +117,10 @@ define([
|
|||
'<% } %>',
|
||||
'</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>',
|
||||
'<button class="btn normal dlg-btn primary" result="ok">' + t.okButtonText + '</button>',
|
||||
'<% if (closable) { %>',
|
||||
'<button class="btn normal dlg-btn" result="cancel">' + t.closeButtonText + '</button>',
|
||||
'<button class="btn normal dlg-btn" result="cancel" style="margin-left:10px;">' + t.closeButtonText + '</button>',
|
||||
'<% } %>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
@ -117,6 +128,7 @@ define([
|
|||
this.handler = _options.handler;
|
||||
this.type = _options.type;
|
||||
this.preview = _options.preview;
|
||||
this.warning = _options.warning || false;
|
||||
this.closable = _options.closable;
|
||||
this.codepages = _options.codepages;
|
||||
this.settings = _options.settings;
|
||||
|
@ -144,21 +156,29 @@ define([
|
|||
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||
this.inputPwd = new Common.UI.InputField({
|
||||
el: $('#id-password-txt'),
|
||||
type: 'password',
|
||||
type: 'text',
|
||||
validateOnBlur: false,
|
||||
validation : function(value) {
|
||||
return me.txtIncorrectPwd;
|
||||
}
|
||||
});
|
||||
this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
|
||||
this.$window.find('input').on('input', function(){
|
||||
if ($(this).val() !== '') {
|
||||
($(this).attr('type') !== 'password') && $(this).attr('type', 'password');
|
||||
} else {
|
||||
$(this).attr('type', 'text');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.initCodePages();
|
||||
this.updatePreview();
|
||||
if (this.preview)
|
||||
this.updatePreview();
|
||||
this.onPrimary = function() {
|
||||
me._handleInput('ok');
|
||||
return false;
|
||||
};
|
||||
}
|
||||
this.onPrimary = function() {
|
||||
me._handleInput('ok');
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -193,10 +213,12 @@ define([
|
|||
_handleInput: function(state) {
|
||||
if (this.handler) {
|
||||
if (this.cmbEncoding) {
|
||||
var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
|
||||
var encoding = (!this.cmbEncoding.isDisabled()) ? this.cmbEncoding.getValue() :
|
||||
((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : 0),
|
||||
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);
|
||||
this.handler.call(this, encoding, delimiter, delimiterChar);
|
||||
} else {
|
||||
this.handler.call(this, state, this.inputPwd.getValue());
|
||||
}
|
||||
|
@ -206,7 +228,7 @@ define([
|
|||
},
|
||||
|
||||
initCodePages: function () {
|
||||
var i, c, codepage, encodedata = [], listItems = [], length = 0;
|
||||
var i, c, codepage, encodedata = [], listItems = [], length = 0, lcid_width = 0;
|
||||
|
||||
if (this.codepages) {
|
||||
encodedata = [];
|
||||
|
@ -215,218 +237,99 @@ define([
|
|||
c = [];
|
||||
c[0] = codepage.asc_getCodePage();
|
||||
c[1] = codepage.asc_getCodePageName();
|
||||
c[2] = codepage.asc_getLcid();
|
||||
|
||||
encodedata.push(c);
|
||||
}
|
||||
} else {
|
||||
encodedata = [
|
||||
[37, 'IBM EBCDIC (US-Canada)'],
|
||||
[437, 'OEM United States'],
|
||||
[500, 'IBM EBCDIC (International)'],
|
||||
[708, 'Arabic (ASMO 708)'],
|
||||
[720, 'Arabic (DOS)'],
|
||||
[737, 'Greek (DOS)'],
|
||||
[775, 'Baltic (DOS)'],
|
||||
[850, 'Western European (DOS)'],
|
||||
[852, 'Central European (DOS)'],
|
||||
[855, 'OEM Cyrillic'],
|
||||
[857, 'Turkish (DOS)'],
|
||||
[858, 'OEM Multilingual Latin I'],
|
||||
[860, 'Portuguese (DOS)'],
|
||||
[861, 'Icelandic (DOS)'],
|
||||
[862, 'Hebrew (DOS)'],
|
||||
[863, 'French Canadian (DOS)'],
|
||||
[864, 'Arabic (864) '],
|
||||
[865, 'Nordic (DOS)'],
|
||||
[866, 'Cyrillic (DOS)'],
|
||||
[869, 'Greek, Modern (DOS)'],
|
||||
[870, 'IBM EBCDIC (Multilingual Latin-2)'],
|
||||
[874, 'Thai (Windows)'],
|
||||
[875, 'IBM EBCDIC (Greek Modern)'],
|
||||
[932, 'Japanese (Shift-JIS)'],
|
||||
[936, 'Chinese Simplified (GB2312)'],
|
||||
[949, 'Korean'],
|
||||
[950, 'Chinese Traditional (Big5)'],
|
||||
[1026, 'IBM EBCDIC (Turkish Latin-5)'],
|
||||
[1047, 'IBM Latin-1'],
|
||||
[1140, 'IBM EBCDIC (US-Canada-Euro)'],
|
||||
[1141, 'IBM EBCDIC (Germany-Euro)'],
|
||||
[1142, 'IBM EBCDIC (Denmark-Norway-Euro)'],
|
||||
[1143, 'IBM EBCDIC (Finland-Sweden-Euro)'],
|
||||
[1144, 'IBM EBCDIC (Italy-Euro)'],
|
||||
[1145, 'IBM EBCDIC (Spain-Euro)'],
|
||||
[1146, 'IBM EBCDIC (UK-Euro)'],
|
||||
[1147, 'IBM EBCDIC (France-Euro)'],
|
||||
[1148, 'IBM EBCDIC (International-Euro)'],
|
||||
[1149, 'IBM EBCDIC (Icelandic-Euro)'],
|
||||
[1200, 'Unicode'],
|
||||
[1201, 'Unicode (Big-Endian)'],
|
||||
[1250, 'Central European (Windows)'],
|
||||
[1251, 'Cyrillic (Windows)'],
|
||||
[1252, 'Western European (Windows)'],
|
||||
[1253, 'Greek (Windows)'],
|
||||
[1254, 'Turkish (Windows)'],
|
||||
[1255, 'Hebrew (Windows) '],
|
||||
[1256, 'Arabic (Windows) '],
|
||||
[1257, 'Baltic (Windows)'],
|
||||
[1258, 'Vietnamese (Windows)'],
|
||||
[1361, 'Korean (Johab)'],
|
||||
[10000, 'Western European (Mac)'],
|
||||
[10001, 'Japanese (Mac)'],
|
||||
[10002, 'Chinese Traditional (Mac)'],
|
||||
[10003, 'Korean (Mac)'],
|
||||
[10004, 'Arabic (Mac) '],
|
||||
[10005, 'Hebrew (Mac)'],
|
||||
[10006, 'Greek (Mac) '],
|
||||
[10007, 'Cyrillic (Mac)'],
|
||||
[10008, 'Chinese Simplified (Mac)'],
|
||||
[10010, 'Romanian (Mac)'],
|
||||
[10017, 'Ukrainian (Mac)'],
|
||||
[10021, 'Thai (Mac)'],
|
||||
[10029, 'Central European (Mac) '],
|
||||
[10079, 'Icelandic (Mac)'],
|
||||
[10081, 'Turkish (Mac)'],
|
||||
[10082, 'Croatian (Mac)'],
|
||||
[12000, 'Unicode (UTF-32)'],
|
||||
[12001, 'Unicode (UTF-32 Big-Endian)'],
|
||||
[20000, 'Chinese Traditional (CNS)'],
|
||||
[20001, 'TCA Taiwan'],
|
||||
[20002, 'Chinese Traditional (Eten)'],
|
||||
[20003, 'IBM5550 Taiwan'],
|
||||
[20004, 'TeleText Taiwan'],
|
||||
[20005, 'Wang Taiwan'],
|
||||
[20105, 'Western European (IA5)'],
|
||||
[20106, 'German (IA5)'],
|
||||
[20107, 'Swedish (IA5) '],
|
||||
[20108, 'Norwegian (IA5) '],
|
||||
[20127, 'US-ASCII'],
|
||||
[20261, 'T.61 '],
|
||||
[20269, 'ISO-6937'],
|
||||
[20273, 'IBM EBCDIC (Germany)'],
|
||||
[20277, 'IBM EBCDIC (Denmark-Norway) '],
|
||||
[20278, 'IBM EBCDIC (Finland-Sweden)'],
|
||||
[20280, 'IBM EBCDIC (Italy)'],
|
||||
[20284, 'IBM EBCDIC (Spain)'],
|
||||
[20285, 'IBM EBCDIC (UK)'],
|
||||
[20290, 'IBM EBCDIC (Japanese katakana)'],
|
||||
[20297, 'IBM EBCDIC (France)'],
|
||||
[20420, 'IBM EBCDIC (Arabic)'],
|
||||
[20423, 'IBM EBCDIC (Greek)'],
|
||||
[20424, 'IBM EBCDIC (Hebrew)'],
|
||||
[20833, 'IBM EBCDIC (Korean Extended)'],
|
||||
[20838, 'IBM EBCDIC (Thai)'],
|
||||
[20866, 'Cyrillic (KOI8-R)'],
|
||||
[20871, 'IBM EBCDIC (Icelandic) '],
|
||||
[20880, 'IBM EBCDIC (Cyrillic Russian)'],
|
||||
[20905, 'IBM EBCDIC (Turkish)'],
|
||||
[20924, 'IBM Latin-1 '],
|
||||
[20932, 'Japanese (JIS 0208-1990 and 0212-1990)'],
|
||||
[20936, 'Chinese Simplified (GB2312-80) '],
|
||||
[20949, 'Korean Wansung '],
|
||||
[21025, 'IBM EBCDIC (Cyrillic Serbian-Bulgarian)'],
|
||||
[21866, 'Cyrillic (KOI8-U)'],
|
||||
[28591, 'Western European (ISO) '],
|
||||
[28592, 'Central European (ISO)'],
|
||||
[28593, 'Latin 3 (ISO)'],
|
||||
[28594, 'Baltic (ISO)'],
|
||||
[28595, 'Cyrillic (ISO) '],
|
||||
[28596, 'Arabic (ISO)'],
|
||||
[28597, 'Greek (ISO) '],
|
||||
[28598, 'Hebrew (ISO-Visual)'],
|
||||
[28599, 'Turkish (ISO)'],
|
||||
[28603, 'Estonian (ISO)'],
|
||||
[28605, 'Latin 9 (ISO)'],
|
||||
[29001, 'Europa'],
|
||||
[38598, 'Hebrew (ISO-Logical)'],
|
||||
[50220, 'Japanese (JIS)'],
|
||||
[50221, 'Japanese (JIS-Allow 1 byte Kana) '],
|
||||
[50222, 'Japanese (JIS-Allow 1 byte Kana - SO/SI)'],
|
||||
[50225, 'Korean (ISO)'],
|
||||
[50227, 'Chinese Simplified (ISO-2022)'],
|
||||
[51932, 'Japanese (EUC)'],
|
||||
[51936, 'Chinese Simplified (EUC) '],
|
||||
[51949, 'Korean (EUC)'],
|
||||
[52936, 'Chinese Simplified (HZ)'],
|
||||
[54936, 'Chinese Simplified (GB18030)'],
|
||||
[57002, 'ISCII Devanagari '],
|
||||
[57003, 'ISCII Bengali '],
|
||||
[57004, 'ISCII Tamil'],
|
||||
[57005, 'ISCII Telugu '],
|
||||
[57006, 'ISCII Assamese '],
|
||||
[57007, 'ISCII Oriya'],
|
||||
[57008, 'ISCII Kannada'],
|
||||
[57009, 'ISCII Malayalam '],
|
||||
[57010, 'ISCII Gujarati'],
|
||||
[57011, 'ISCII Punjabi'],
|
||||
[65000, 'Unicode (UTF-7)'],
|
||||
[65001, 'Unicode (UTF-8)']
|
||||
];
|
||||
lcid_width = 50;
|
||||
}
|
||||
|
||||
length = encodedata.length;
|
||||
|
||||
if (length) {
|
||||
for (i = 0; i < length; ++i) {
|
||||
listItems.push({
|
||||
value: encodedata[i][0],
|
||||
displayValue: encodedata[i][1] // Common.Utils.String.ellipsis(..., 37)
|
||||
});
|
||||
}
|
||||
|
||||
this.cmbEncoding = new Common.UI.ComboBox({
|
||||
el: $('#id-codepages-combo', this.$window),
|
||||
style: 'width: 230px;',
|
||||
menuStyle: 'min-width: 230px; max-height: 200px;',
|
||||
cls: 'input-group-nr',
|
||||
menuCls: 'scrollable-menu',
|
||||
data: listItems,
|
||||
editable: false
|
||||
for (i = 0; i < length; ++i) {
|
||||
listItems.push({
|
||||
value: encodedata[i][0],
|
||||
displayValue: Common.Utils.String.htmlEncode(encodedata[i][1]),
|
||||
lcid: encodedata[i][2] || ''
|
||||
});
|
||||
this.cmbEncoding.setValue( (this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : encodedata[0][0]);
|
||||
}
|
||||
|
||||
var itemsTemplate =
|
||||
_.template([
|
||||
'<% _.each(items, function(item) { %>',
|
||||
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',
|
||||
'<div style="display: inline-block;"><%= item.displayValue %></div>',
|
||||
'<label style="text-align: right;width:' + lcid_width + 'px;"><%= item.lcid %></label>',
|
||||
'</a></li>',
|
||||
'<% }); %>'
|
||||
].join(''));
|
||||
|
||||
this.cmbEncoding = new Common.UI.ComboBox({
|
||||
el: $('#id-codepages-combo', this.$window),
|
||||
style: 'width: 230px;',
|
||||
menuStyle: 'min-width: 230px; max-height: 200px;',
|
||||
cls: 'input-group-nr',
|
||||
menuCls: 'scrollable-menu',
|
||||
data: listItems,
|
||||
editable: false,
|
||||
disabled: true,
|
||||
itemsTemplate: itemsTemplate
|
||||
});
|
||||
|
||||
if (length) {
|
||||
this.cmbEncoding.setDisabled(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),
|
||||
style: 'width: 100px;',
|
||||
menuStyle: 'min-width: 100px;',
|
||||
cls: 'input-group-nr',
|
||||
data: [
|
||||
{value: 4, displayValue: ','},
|
||||
{value: 2, displayValue: ';'},
|
||||
{value: 3, displayValue: ':'},
|
||||
{value: 1, displayValue: this.txtTab},
|
||||
{value: 5, displayValue: this.txtSpace},
|
||||
{value: -1, displayValue: this.txtOther}],
|
||||
editable: false
|
||||
});
|
||||
this.cmbDelimiter.setValue( (this.settings && this.settings.asc_getDelimiter()) ? this.settings.asc_getDelimiter() : 4);
|
||||
this.cmbDelimiter.on('selected', _.bind(this.onCmbDelimiterSelect, this));
|
||||
var ul = this.cmbEncoding.cmpEl.find('ul'),
|
||||
a = ul.find('li:nth(0) a'),
|
||||
width = ul.width() - parseInt(a.css('padding-left')) - parseInt(a.css('padding-right')) - 50;
|
||||
ul.find('li div').width(width + 10);
|
||||
}
|
||||
|
||||
this.inputDelimiter = new Common.UI.InputField({
|
||||
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));
|
||||
}
|
||||
if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
|
||||
this.cmbDelimiter = new Common.UI.ComboBox({
|
||||
el: $('#id-delimiters-combo', this.$window),
|
||||
style: 'width: 100px;',
|
||||
menuStyle: 'min-width: 100px;',
|
||||
cls: 'input-group-nr',
|
||||
data: [
|
||||
{value: 4, displayValue: this.txtComma},
|
||||
{value: 2, displayValue: this.txtSemicolon},
|
||||
{value: 3, displayValue: this.txtColon},
|
||||
{value: 1, displayValue: this.txtTab},
|
||||
{value: 5, displayValue: this.txtSpace},
|
||||
{value: -1, displayValue: this.txtOther}],
|
||||
editable: false
|
||||
});
|
||||
this.cmbDelimiter.setValue( (this.settings && this.settings.asc_getDelimiter()) ? this.settings.asc_getDelimiter() : 4);
|
||||
this.cmbDelimiter.on('selected', _.bind(this.onCmbDelimiterSelect, this));
|
||||
|
||||
this.inputDelimiter = new Common.UI.InputField({
|
||||
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() {
|
||||
var encoding = (!this.cmbEncoding.isDisabled()) ? this.cmbEncoding.getValue() :
|
||||
((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : 0);
|
||||
|
||||
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));
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this));
|
||||
} else {
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(this.cmbEncoding.getValue()), _.bind(this.previewCallback, this));
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(encoding), _.bind(this.previewCallback, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -441,6 +344,7 @@ define([
|
|||
el: this.previewScrolled,
|
||||
minScrollbarLength : 20,
|
||||
alwaysVisibleY: true,
|
||||
alwaysVisibleX: true,
|
||||
onChange: _.bind(function(){
|
||||
if (this.scrollerY) {
|
||||
var startPos = this.scrollerY.getScrollTop(),
|
||||
|
@ -524,7 +428,11 @@ define([
|
|||
txtOther: 'Other',
|
||||
txtIncorrectPwd: 'Password is incorrect.',
|
||||
closeButtonText: 'Close File',
|
||||
txtPreview: 'Preview'
|
||||
txtPreview: 'Preview',
|
||||
txtComma: 'Comma',
|
||||
txtColon: 'Colon',
|
||||
txtSemicolon: 'Semicolon',
|
||||
txtProtected: 'Once you enter the password and open the file, the current password to the file will be reset.'
|
||||
|
||||
}, Common.Views.OpenDialog || {}));
|
||||
});
|
|
@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue