Merge branch 'develop' into feature/svg-icons

# Conflicts:
#	apps/documenteditor/main/index.html
This commit is contained in:
Maxim Kadushkin 2019-10-07 16:55:17 +03:00
commit 1407e01f4c
3142 changed files with 114236 additions and 27338 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
.idea
Thumbs.db
.DS_Store
deploy
/deploy
build/node_modules
apps/documenteditor/embed/resources/less/node_modules
apps/presentationeditor/embed/resources/less/node_modules

View file

@ -1,19 +1,20 @@
# Change log
## 5.1.1
## 5.3
### All Editors
* Customize initial zoom for the embedded editors
* Replace image from context menu (bug #11493)
* Customize availability of help in the editor
* Save to pdfa format
* Add rotation and flip to image and shape settings (bug #19378)
* Save file copy to selected folder (bug #23603, bug #32790)
* Load image from storage
* Add customization parameter 'hideRightMenu' for hiding right panel on first loading (bug #39096)
* Show comments in view mode
### Document Editor
* Create and manage bookmarks
* Create internal hyperlinks to bookmarks and headings
* Export to RTF format
* Search selected text
* Add blank page
### Spreadsheet Editor
* Add Spanish, French formula translations
* Set options for saving in PDF format (bug #34914)
* Change cell format from context menu (bug #16272)
* Set print area
### Presentation Editor
* Add hints to presentation themes (bug #21362)
* Enter the slide number manually for internal hyperlinks
* Add ability to search and replace text

View file

@ -23,9 +23,11 @@
key: 'key',
vkey: 'vkey',
info: {
author: 'author name',
author: 'author name', // must be deprecated, use owner instead
owner: 'owner name',
folder: 'path to document',
created: '<creation date>',
created: '<creation date>', // must be deprecated, use uploaded instead
uploaded: '<uploaded date>',
sharingSettings: [
{
user: 'user name',
@ -46,6 +48,7 @@
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
fillForms: <can edit forms in view mode> // default = edit || review
}
},
editorConfig: {
@ -56,11 +59,13 @@
canBackToFolder: <can return to folder> - deprecated. use "customization.goback" parameter,
createUrl: 'create document url',
sharingSettingsUrl: 'document sharing settings url',
fileChoiceUrl: 'mail merge sources url',
fileChoiceUrl: 'source url', // for mail merge or image from storage
callbackUrl: <url for connection between sdk and portal>,
mergeFolderUrl: 'folder for saving merged file',
mergeFolderUrl: 'folder for saving merged file', // must be deprecated, use saveAsUrl instead
saveAsUrl: 'folder for saving files'
licenseUrl: <url for license>,
customerId: <customer id>,
region: <regional settings> // can be 'en-us' or lang code
user: {
id: 'user id',
@ -88,8 +93,6 @@
imageEmbedded: url,
url: http://...
},
backgroundColor: 'header background color',
textColor: 'header text color',
customer: {
name: 'SuperPuper',
address: 'New-York, 125f-25',
@ -114,18 +117,22 @@
compactToolbar: false,
leftMenu: true,
rightMenu: true,
hideRightMenu: false, // hide or show right panel on first loading
toolbar: true,
header: true,
statusBar: true,
autosave: true,
forcesave: false,
commentAuthorOnly: false,
showReviewChanges: false,
help: true
help: true,
compactHeader: false,
toolbarNoTabs: false,
toolbarHideFileName: false,
reviewDisplay: 'original',
spellcheck: true
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
url: '../../../../sdkjs-plugins/',
pluginsData: [
"helloworld/config.json",
"chess/config.json",
@ -135,7 +142,6 @@
}
},
events: {
'onReady': <application ready callback>, // deprecated
'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onDocumentStateChange': <document state changed callback>
@ -170,7 +176,6 @@
}
},
events: {
'onReady': <application ready callback>, // deprecated
'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onError': <error callback>,
@ -194,11 +199,15 @@
_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.editorConfig.canMakeActionLink = _config.events && !!_config.events.onMakeActionLink;
_config.editorConfig.canRequestUsers = _config.events && !!_config.events.onRequestUsers;
_config.editorConfig.canRequestSendNotify = _config.events && !!_config.events.onRequestSendNotify;
_config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl;
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
_config.frameEditorId = placeholderId;
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
_config.events && (_config.events.onAppReady = _config.events.onAppReady || _config.events.onReady);
var onMouseUp = function (evt) {
_processMouse(evt);
};
@ -368,6 +377,7 @@
// _config.editorConfig.canBackToFolder = false;
if (!_config.editorConfig.customization) _config.editorConfig.customization = {};
_config.editorConfig.customization.about = false;
_config.editorConfig.customization.compactHeader = false;
if ( window.AscDesktopEditor ) window.AscDesktopEditor.execCommand('webapps:events', 'loading');
}
@ -504,6 +514,15 @@
});
};
var _setActionLink = function (data) {
_sendCommand({
command: 'setActionLink',
data: {
url: data
}
});
};
var _processMailMerge = function(enabled, message) {
_sendCommand({
command: 'processMailMerge',
@ -521,6 +540,41 @@
});
};
var _setUsers = function(data) {
_sendCommand({
command: 'setUsers',
data: data
});
};
var _showSharingSettings = function(data) {
_sendCommand({
command: 'showSharingSettings',
data: data
});
};
var _setSharingSettings = function(data) {
_sendCommand({
command: 'setSharingSettings',
data: data
});
};
var _insertImage = function(data) {
_sendCommand({
command: 'insertImage',
data: data
});
};
var _setMailMergeRecipients = function(data) {
_sendCommand({
command: 'setMailMergeRecipients',
data: data
});
};
var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect();
var data = {
@ -554,12 +608,18 @@
refreshHistory : _refreshHistory,
setHistoryData : _setHistoryData,
setEmailAddresses : _setEmailAddresses,
setActionLink : _setActionLink,
processMailMerge : _processMailMerge,
downloadAs : _downloadAs,
serviceCommand : _serviceCommand,
attachMouseEvents : _attachMouseEvents,
detachMouseEvents : _detachMouseEvents,
destroyEditor : _destroyEditor
destroyEditor : _destroyEditor,
setUsers : _setUsers,
showSharingSettings : _showSharingSettings,
setSharingSettings : _setSharingSettings,
insertImage : _insertImage,
setMailMergeRecipients: _setMailMergeRecipients
}
};
@ -662,7 +722,7 @@
app = appMap[config.documentType.toLowerCase()];
} else
if (!!config.document && typeof config.document.fileType === 'string') {
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))$/
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))$/
.exec(config.document.fileType);
if (type) {
if (typeof type[1] === 'string') app = appMap['spreadsheet']; else
@ -676,8 +736,16 @@
: config.type === "embedded"
? "embed"
: "main";
path += "/index.html";
var index = "/index.html";
if (config.editorConfig) {
var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html";
}
}
path += index;
return path;
}
@ -694,6 +762,11 @@
params += "&customer=ONLYOFFICE";
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) {
if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo;
} else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) {
if (config.type=='embedded' && config.editorConfig.customization.logo.imageEmbedded)
params += "&headerlogo=" + config.editorConfig.customization.logo.imageEmbedded;
else if (config.type!='embedded' && config.editorConfig.customization.logo.image)
params += "&headerlogo=" + config.editorConfig.customization.logo.image;
}
}
@ -715,6 +788,13 @@
iframe.allowFullscreen = true;
iframe.setAttribute("allowfullscreen",""); // for IE11
iframe.setAttribute("onmousewheel",""); // for Safari on Mac
if (config.type == "mobile")
{
iframe.style.position = "fixed";
iframe.style.overflow = "hidden";
document.body.style.overscrollBehaviorY = "contain";
}
return iframe;
}

View file

@ -1,346 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>ONLYOFFICE Documents</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<style type="text/css">
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#wrap {
position:absolute;
left:0;
top:0;
right:0;
bottom:0;
}
</style>
</head>
<body>
<div id="wrap">
<div id="placeholder"></div>
</div>
<script type="text/javascript" src="api.js"></script>
<script>
(function() {
// Url parameters
var urlParams = getUrlParams(),
cfg = getEditorConfig(urlParams),
doc = getDocumentData(urlParams);
// Document Editor
var docEditor = new DocsAPI.DocEditor('placeholder', {
type: urlParams['type'],
width: '100%',
height: '100%',
documentType: urlParams['doctype'] || 'text',
document: doc,
editorConfig: cfg,
events: {
'onReady': onDocEditorReady,
'onDocumentStateChange': onDocumentStateChange,
'onRequestEditRights': onRequestEditRights,
'onRequestHistory': onRequestHistory,
'onRequestHistoryData': onRequestHistoryData,
'onRequestEmailAddresses': onRequestEmailAddresses,
'onRequestStartMailMerge': onRequestStartMailMerge,
'onRequestHistoryClose': onRequestHistoryClose,
'onError': onError
}
});
// Document Editor event handlers
function onRequestEmailAddresses() {
docEditor.setEmailAddresses({emailAddresses: ['aaa@mail.ru'], createEmailAccountUrl: 'http://ya.ru'});
}
function onRequestHistory() {
docEditor.refreshHistory({
'currentVersion': 3,
'history': [
{
'user': {
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
name: 'Татьяна Щербакова'
},
'changes': null,
'created': '1/18/2015 6:38 PM',
'version': 1,
'versionGroup': 1,
'key': 'wyX9AwRq_677SWKjhfk='
},
{
'user': {
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
name: 'Татьяна Щербакова'
},
'changes': [
{
'user': {
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
name: 'Татьяна Щербакова'
},
'created': '1/19/2015 6:30 PM'
},
{
'user': {
'id': '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
'name': 'Александр Трофимов'
},
'created': '1/19/2015 6:32 PM'
},
{
'user': {
id: '8952d4ee-e8a5-42bf-86f0-6cd77801ec15',
name: 'Татьяна Щербакова'
},
'created': '1/19/2015 6:38 PM'
}
],
'created': '2/19/2015 6:38 PM',
'version': 2,
'versionGroup': 1,
'key': 'wyX9AwRq_677SWKjhfk='
},
{
'user': {
id: '895255ee-e8a5-42bf-86f0-6cd77801ec15',
name: 'Me'
},
'changes': null,
'created': '2/21/2015 6:38 PM',
'version': 3,
'versionGroup': 2,
'key': 'wyX9AwRq_677SWKjhfk='
},
{
'user': {
id: '8952d4ee-e8a5-42bf-11f0-6cd77801ec15',
name: 'Александр Трофимов'
},
'changes': null,
'created': '2/22/2015 6:37 PM',
'version': 4,
'versionGroup': 3,
'key': 'wyX9AwRq_677SWKjhfk='
},
{
'user': {
id: '8952d4ee-e8a5-42bf-11f0-6cd33801ec15',
name: 'Леонид Орлов'
},
'changes': null,
'created': '2/24/2015 6:29 PM',
'version': 5,
'versionGroup': 3,
'key': 'wyX9AwRq_677SWKjhfk='
}]
});
}
function onRequestHistoryData(revision) {
docEditor.setHistoryData(
{
'version': revision.data,
'url': 'http://isa2',
'urlDiff': 'http://isa2',
'changesUrl': 'http://isa2'
}
);
}
function onRequestStartMailMerge() {
docEditor.processMailMerge(true, 'some error message');
}
function onRequestHistoryClose() {
// reload page
}
function onDocEditorReady(event) {
if (event.target) {
//console.log('Ready! Editor: ', event.target);
}
}
function onDocumentStateChange(event) {
var isModified = event.data;
//console.log(isModified);
}
function onRequestEditRights(event) {
// occurs whenever the user tryes to enter edit mode
docEditor.applyEditRights(true, "Someone is editing this document right now. Please try again later.");
}
function onError(event) {
// critical error happened
// examine event.data.errorCode and event.data.errorDescription for details
}
function onDownloadAs(event) {
// return url of downloaded doc
// console.log(event.data);
}
// helpers
function getUrlParams() {
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1),
urlParams = {};
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
return urlParams;
}
function getDocumentData(urlParams) {
return {
key: urlParams["key"],
url: urlParams["url"] || '_offline_',
title: urlParams["title"],
fileType: urlParams["filetype"],
vkey: urlParams["vkey"],
permissions: {
edit: true,
download: true,
reader: true
}
};
}
function getEditorConfig(urlParams) {
return {
mode : urlParams["mode"] || 'edit',
lang : urlParams["lang"] || 'en',
canCoAuthoring : true,
createUrl : 'http://www.example.com/create',
user: {
id: urlParams["userid"] || 'uid-901', firstname: urlParams["userfname"] || 'Mitchell', lastname: urlParams["userlname"] || 'Hamish'
},
recent : [
{title: 'Memory.docx', url: 'http://onlyoffice.com', folder: 'Document Editor'},
{title: 'Description.doc', url: 'http://onlyoffice.com', folder: 'Document Editor'},
{title: 'DocEditor_right.xsl', url: 'http://onlyoffice.com', folder: 'Spreadsheet Editor'},
{title: 'api.rtf', url: 'http://onlyoffice.com', folder: 'Unnamed folder'}
],
// templates : [
// {name: 'Contracts', icon: '../../api/documents/resources/templates/contracts.png', url: 'http://...'},
// {name: 'Letter', icon: '../../api/documents/resources/templates/letter.png', url: 'http://...'},
// {name: 'List', icon: '../../api/documents/resources/templates/list.png', url: 'http://...'},
// {name: 'Plan', icon: '../../api/documents/resources/templates/plan.png', url: 'http://...'}
// ],
embedded : {
embedUrl : 'http://onlyoffice.com/embed',
fullscreenUrl : 'http://onlyoffice.com/fullscreen',
saveUrl : 'http://onlyoffice.com/download',
shareUrl : 'http://tl.com/72b4la97',
toolbarDocked : 'top'
}
,customization: {
// logo: {
// image: 'https://dylnrgbh910l3.cloudfront.net/studio/tag/i8.8.237/skins/default/images/onlyoffice_logo/editor_logo_general.png', // default size 86 x 20
// imageEmbedded: 'https://d2hw9csky753gb.cloudfront.net/studio/tag/i8.8.237/skins/default/images/onlyoffice_logo/editor_embedded_logo.png', // default size 124 x 20
// url: 'http://...'
// },
// backgroundColor: '#ffffff',
// textColor: '#ff0000',
// customer: {
// name: 'SuperPuper',
// address: 'New-York, 125f-25',
// mail: 'support@gmail.com',
// www: 'www.superpuper.com',
// info: 'Some info',
// logo: 'https://img.imgsmail.ru/r/default/portal/0.1.29/logo.png' // default size 216 x 35
// },
// goback: {text: 'Go To London', url: 'http://...'},
about: true,
feedback: true
}
};
}
// Mobile version
function isMobile(){
var prefixes = {
ios: 'i(?:Pad|Phone|Pod)(?:.*)CPU(?: iPhone)? OS ',
android: '(Android |HTC_|Silk/)',
blackberry: 'BlackBerry(?:.*)Version\/',
rimTablet: 'RIM Tablet OS ',
webos: '(?:webOS|hpwOS)\/',
bada: 'Bada\/'
},
i, prefix, match;
for (i in prefixes){
if (prefixes.hasOwnProperty(i)) {
prefix = prefixes[i];
if (navigator.userAgent.match(new RegExp('(?:'+prefix+')([^\\s;]+)')))
return true;
}
}
return false;
}
var fixSize = function() {
var wrapEl = document.getElementById('wrap');
if (wrapEl){
wrapEl.style.height = screen.availHeight + 'px';
window.scrollTo(0, -1);
wrapEl.style.height = window.innerHeight + 'px';
}
};
var fixIpadLandscapeIos7 = function() {
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
var wrapEl = document.getElementById('wrap');
if (wrapEl){
wrapEl.style.position = "fixed";
wrapEl.style.bottom = 0;
wrapEl.style.width = "100%";
}
}
};
if (isMobile()){
window.addEventListener('load', fixSize);
window.addEventListener('resize', fixSize);
fixIpadLandscapeIos7();
}
})();
</script>
</body>
</html>

View file

@ -58,6 +58,7 @@
editorConfig: cfg,
events: {
onInternalMessage: onInternalMessage,
onRequestClose: e => {return 0;}
}
});
@ -100,7 +101,7 @@
mode : urlParams["mode"] || 'edit',
lang : urlParams["lang"] || 'en',
user: {
id: urlParams["userid"] || 'uid-901', name: urlParams["username"] || 'Chuk.Gek'
id: urlParams["userid"] || urlParams["username"] || 'uid-901', name: urlParams["username"] || 'Chuk.Gek'
}
};
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -76,6 +76,10 @@ if (Common === undefined) {
$me.trigger('setemailaddresses', data);
},
'setActionLink': function (data) {
$me.trigger('setactionlink', data.url);
},
'processMailMerge': function(data) {
$me.trigger('processmailmerge', data);
},
@ -94,6 +98,26 @@ if (Common === undefined) {
'resetFocus': function(data) {
$me.trigger('resetfocus', data);
},
'setUsers': function(data) {
$me.trigger('setusers', data);
},
'showSharingSettings': function(data) {
$me.trigger('showsharingsettings', data);
},
'setSharingSettings': function(data) {
$me.trigger('setsharingsettings', data);
},
'insertImage': function(data) {
$me.trigger('insertimage', data);
},
'setMailMergeRecipients': function(data) {
$me.trigger('setmailmergerecipients', data);
}
};
@ -234,6 +258,16 @@ if (Common === undefined) {
});
},
requestSaveAs: function(url, title) {
_postMessage({
event: 'onRequestSaveAs',
data: {
url: url,
title: title
}
});
},
collaborativeChanges: function() {
_postMessage({event: 'onCollaborativeChanges'});
},
@ -254,6 +288,26 @@ if (Common === undefined) {
_postMessage({event: 'onRequestClose'});
},
requestMakeActionLink: function (config) {
_postMessage({event:'onMakeActionLink', data: config})
},
requestUsers: function () {
_postMessage({event:'onRequestUsers'})
},
requestSendNotify: function (emails) {
_postMessage({event:'onRequestSendNotify', data: emails})
},
requestInsertImage: function () {
_postMessage({event:'onRequestInsertImage'})
},
requestMailMergeRecipients: function () {
_postMessage({event:'onRequestMailMergeRecipients'})
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -44,7 +44,7 @@
newDocumentPage.focus();
}
}
, dialogPrint: function(url) {
, dialogPrint: function(url, api) {
$('#id-print-frame').remove();
if ( !!url ) {
@ -59,10 +59,14 @@
document.body.appendChild(iframePrint);
iframePrint.onload = function () {
iframePrint.contentWindow.focus();
iframePrint.contentWindow.print();
iframePrint.contentWindow.blur();
window.focus();
try {
iframePrint.contentWindow.focus();
iframePrint.contentWindow.print();
iframePrint.contentWindow.blur();
window.focus();
} catch (e) {
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
}
};
iframePrint.src = url;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -61,10 +61,10 @@ common.view.modals = new(function() {
'</div>';
var _tplbody_embed = '<div class="size-manual">' +
'<span class="caption">Width:</span>' +
'<span class="caption">{width}:</span>' +
'<input id="txt-embed-width" class="form-control input-xs" type="text" value="400px">' +
'<input id="txt-embed-height" class="form-control input-xs right" type="text" value="600px">' +
'<span class="right caption">Height:</span>' +
'<span class="right caption">{height}:</span>' +
'</div>' +
'<textarea id="txt-embed-url" rows="4" class="form-control" readonly></textarea>';
@ -75,22 +75,29 @@ common.view.modals = new(function() {
var _$dlg;
if (name == 'share') {
_$dlg = $(tplDialog
.replace(/\{title}/, 'Share Link')
.replace(/\{title}/, this.txtShare)
.replace(/\{body}/, _tplbody_share)
.replace(/\{footer}/, '<button id="btn-copyshort" type="button" class="btn">Copy to clipboard</button>'))
.replace(/\{footer}/, '<button id="btn-copyshort" type="button" class="btn">' + this.txtCopy + '</button>'))
.appendTo(parent)
.attr('id', 'dlg-share');
} else
if (name == 'embed') {
_$dlg = $(tplDialog
.replace(/\{title}/, 'Embed')
.replace(/\{title}/, this.txtEmbed)
.replace(/\{body}/, _tplbody_embed)
.replace(/\{footer}/, '<button id="btn-copyembed" type="button" class="btn">Copy to clipboard</button>'))
.replace(/\{width}/, this.txtWidth)
.replace(/\{height}/, this.txtHeight)
.replace(/\{footer}/, '<button id="btn-copyembed" type="button" class="btn">' + this.txtCopy + '</button>'))
.appendTo(parent)
.attr('id', 'dlg-embed');
}
return _$dlg;
}
},
txtWidth: 'Width',
txtHeight: 'Height',
txtShare: 'Share Link',
txtCopy: 'Copy to clipboard',
txtEmbed: 'Embed'
};
})();

View file

@ -187,6 +187,7 @@
.close {
font-size: 28px;
font-family: Arial, sans-serif;
color: #666666;
opacity: 0.8;
display: block;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -35,46 +35,35 @@ if (Common === undefined) {
}
Common.Locale = new(function() {
var l10n = {};
"use strict";
var l10n = null;
var loadcallback,
apply = false;
var _createXMLHTTPObject = function() {
var xmlhttp;
var _applyLocalization = function(callback) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
};
callback && (loadcallback = callback);
if (l10n) {
for (var prop in l10n) {
var p = prop.split('.');
if (p && p.length > 2) {
var _applyLocalization = function() {
try {
for (var prop in l10n) {
var p = prop.split('.');
if (p && p.length > 2) {
var obj = window;
for (var i = 0; i < p.length - 1; ++i) {
if (obj[p[i]] === undefined) {
obj[p[i]] = new Object();
var obj = window;
for (var i = 0; i < p.length - 1; ++i) {
if (obj[p[i]] === undefined) {
obj[p[i]] = new Object();
}
obj = obj[p[i]];
}
obj = obj[p[i]];
}
if (obj) {
obj[p[p.length - 1]] = l10n[prop];
if (obj) {
obj[p[p.length - 1]] = l10n[prop];
}
}
}
}
loadcallback && loadcallback();
} else
apply = true;
}
catch (e) {
}
@ -82,7 +71,7 @@ Common.Locale = new(function() {
var _get = function(prop, scope) {
var res = '';
if (scope && scope.name) {
if (l10n && scope && scope.name) {
res = l10n[scope.name + '.' + prop];
}
@ -96,25 +85,48 @@ Common.Locale = new(function() {
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
};
try {
var langParam = _getUrlParameterByName('lang');
var xhrObj = _createXMLHTTPObject();
if (xhrObj && langParam) {
var lang = langParam.split(/[\-\_]/)[0];
xhrObj.open('GET', 'locale/' + lang + '.json', false);
xhrObj.send('');
l10n = eval("(" + xhrObj.responseText + ")");
}
}
catch (e) {
try {
xhrObj.open('GET', 'locale/en.json', false);
xhrObj.send('');
l10n = eval("(" + xhrObj.responseText + ")");
}
catch (e) {
}
}
var _requireLang = function () {
var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0];
fetch('locale/' + lang + '.json')
.then(function(response) {
if (!response.ok) {
if (lang != 'en')
/* load default lang if fetch failed */
return fetch('locale/en.json');
throw new Error('server error');
}
return response.json();
}).then(function(response) {
if ( response.then )
return response.json();
else {
l10n = response;
/* to break promises chain */
throw new Error('loaded');
}
}).then(function(json) {
l10n = json || {};
apply && _applyLocalization();
}).catch(function(e) {
l10n = l10n || {};
apply && _applyLocalization();
if ( e.message == 'loaded' ) {
} else
console.log('fetch error: ' + e);
});
};
if ( !window.fetch ) {
/* use fetch polifill if native method isn't supported */
var polyfills = ['../vendor/fetch/fetch.umd'];
if ( !window.Promise ) {
require(['../vendor/es6-promise/es6-promise.auto.min'],
function () {
require(polyfills, _requireLang);
});
} else require(polyfills, _requireLang);
} else _requireLang();
return {
apply: _applyLocalization,

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -52,6 +52,7 @@ define([
Common.Collections.Comments = Backbone.Collection.extend({
model: Common.Models.Comment,
groups: null,
clearEditing: function () {
this.each(function(comment) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -49,6 +49,10 @@ define([
'use strict';
Common.Collections.Plugins = Backbone.Collection.extend({
model: Common.Models.Plugin
model: Common.Models.Plugin,
hasVisible: function() {
return !!this.findWhere({visible: true});
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -132,7 +132,8 @@ define([
};
ButtonsArray.prototype.setDisabled = function(disable) {
if ( _disabled != disable ) {
// if ( _disabled != disable ) //bug when disable buttons outside the group
{
_disabled = disable;
this.forEach( function(button) {
@ -319,7 +320,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
if (parentEl) {
me.setElement(parentEl, false);
@ -386,6 +387,18 @@ define([
if (modalParents.length > 0) {
me.btnEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
me.btnMenuEl && me.btnMenuEl.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = me.btnEl.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
}
@ -491,6 +504,7 @@ define([
if (isSplit) {
$('[data-toggle^=dropdown]', el).on('mousedown', _.bind(menuHandler, this));
$('button', el).on('mousedown', _.bind(onMouseDown, this));
(me.options.width>0) && $('button:first', el).css('width', me.options.width - $('[data-toggle^=dropdown]', el).outerWidth());
}
el.on('hide.bs.dropdown', _.bind(doSplitSelect, me, false, 'arrow'));
@ -512,8 +526,8 @@ define([
});
el.on('mouseout', function(e) {
me.cmpEl.removeClass('over');
if (!me.disabled) {
me.cmpEl.removeClass('over');
me.trigger('mouseout', me, e);
}
});
@ -601,6 +615,9 @@ define([
}
}
if (disabled && this.menu && _.isObject(this.menu) && this.menu.rendered && this.menu.isVisible())
setTimeout(function(){ me.menu.hide()}, 1);
if ( !!me.options.signals ) {
var opts = me.options.signals;
if ( !(opts.indexOf('disabled') < 0) ) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -104,27 +104,25 @@ define([
},
render: function (parentEl) {
var me = this,
el = $(this.el);
var me = this;
if (!me.rendered) {
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.template({
labelText: this.options.labelText
}));
el = $(this.el);
} else {
el.html(this.template({
me.$el.html(this.template({
labelText: this.options.labelText
}));
}
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.$chk.on('click', _.bind(this.onItemCheck, this));
}
this.$chk = me.$el.find('input[type=button]');
this.$label = me.$el.find('label');
this.$chk.on('click', this.onItemCheck.bind(this));
this.rendered = true;
this.rendered = true;
}
if (this.options.disabled)
this.setDisabled(this.options.disabled);
@ -137,6 +135,9 @@ define([
},
setDisabled: function(disabled) {
if (!this.rendered)
return;
disabled = (disabled===true);
if (disabled !== this.disabled) {
this.$label.toggleClass('disabled', disabled);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -91,16 +91,14 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
var el = this.cmpEl;
el.on('click', 'span.color-item', _.bind(this.itemClick, this));
me.cmpEl.on('click', 'span.color-item', me.itemClick.bind(me));
}
me.rendered = true;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -108,12 +108,12 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
this.cmpEl.on('click', _.bind(this.handleClick, this));
this.cmpEl.on('click', me.handleClick.bind(me));
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
me.rendered = true;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -77,7 +77,7 @@ define([
Common.UI.ComboBorderSize = Common.UI.ComboBox.extend(_.extend({
template: _.template([
'<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="<%= style %>"></div>',
'<div class="form-control" style="padding-top:2px; <%= style %>"></div>',
'<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
@ -111,7 +111,7 @@ define([
editable: false,
store: new Common.UI.BordersStore(),
data: data,
menuStyle: 'min-width: 150px;'
menuStyle: 'min-width: 160px;'
}, options));
},
@ -209,7 +209,7 @@ define([
editable: true,
store: new Common.UI.BordersStore(),
data: data,
menuStyle: 'min-width: 150px;'
menuStyle: 'min-width: 160px;'
}, options));
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -85,12 +85,13 @@ define([
menuStyle : '',
displayField: 'displayValue',
valueField : 'value',
search : false,
scrollAlwaysVisible: false
},
template: _.template([
'<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control">',
'<input type="text" class="form-control" spellcheck="false">',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>',
@ -103,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -119,6 +119,7 @@ define([
this.store = me.options.store || new Common.UI.ComboBoxStore();
this.displayField = me.options.displayField;
this.valueField = me.options.valueField;
this.search = me.options.search;
this.scrollAlwaysVisible = me.options.scrollAlwaysVisible;
me.rendered = me.options.rendered || false;
@ -156,10 +157,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
}
if (!me.rendered) {
@ -192,6 +193,18 @@ define([
var modalParents = el.closest('.asc-window');
if (modalParents.length > 0) {
el.data('bs.tooltip').tip().css('z-index', parseInt(modalParents.css('z-index')) + 10);
var onModalClose = function(dlg) {
if (modalParents[0] !== dlg.$window[0]) return;
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
el.find('.dropdown-menu').on('mouseenter', function(){ // hide tooltip when mouse is over menu
@ -239,7 +252,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -264,7 +276,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
@ -295,12 +306,14 @@ define([
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
$list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
setTimeout(function(){$selected.find('a').focus();}, 1);
}
if (this.scroller)
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
this.trigger('show:after', this, e);
this._search = {};
},
onBeforeHideMenu: function(e) {
@ -332,6 +345,57 @@ define([
this.closeMenu();
this.onAfterHideMenu(e);
return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
(!this._search.text) && (this._search.text = '');
(!this._search.char) && (this._search.char = e.key);
(this._search.char !== e.key) && (this._search.full = true);
this._search.text += e.key;
if (this._search.index===undefined) {
var $items = this.cmpEl.find('ul > li').find('> a');
this._search.index = $items.index($items.filter(':focus'));
}
this.selectCandidate();
}
},
selectCandidate: function() {
var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
itemCandidate, idxCandidate;
for (var i=0; i<this.store.length; i++) {
var item = this.store.at(i);
if (re.test(item.get(this.displayField))) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
}
}
}
if (itemCandidate) {
this._search.index = idxCandidate;
var item = $('#' + itemCandidate.get('id') + ' a', $(this.el));
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var $list = $(this.el).find('ul');
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = $list.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
$list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
}
item.focus();
}
},
@ -576,7 +640,6 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
scrollYMarginOffset: 30,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -56,7 +56,7 @@ define([
thumbContext = thumbCanvas.getContext('2d'),
thumbPath = '../../../../sdkjs/common/Images/fonts_thumbnail.png',
thumbPath2x = '../../../../sdkjs/common/Images/fonts_thumbnail@2x.png',
listItemHeight = 36;
listItemHeight = 26;
if (typeof window['AscDesktopEditor'] === 'object') {
thumbPath = window['AscDesktopEditor'].getFontsSprite();
@ -69,14 +69,14 @@ define([
return {
template: _.template([
'<div class="input-group combobox fonts <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control">',
'<input type="text" class="form-control" spellcheck="false"> ',
'<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<li class="divider">',
'<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>">',
'<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',
'<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',
'</li>',
'<% }); %>',
'</ul>',
@ -93,9 +93,12 @@ define([
}
}));
this.recent = _.isNumber(options.recent) ? options.recent : 3;
this.recent = _.isNumber(options.recent) ? options.recent : 5;
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
// Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
Common.NotificationCenter.on('fonts:load', _.bind(this.fillFonts, this));
},
@ -115,8 +118,6 @@ define([
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');
return this;
},
@ -310,6 +311,11 @@ define([
me.store.set(store.toJSON());
me.rendered = false;
if (!_.isUndefined(me.scroller)) {
me.scroller.destroy();
delete me.scroller;
}
me._scrollerIsInited = false;
me.render($(me.el));
me._fontsArray = me.store.toJSON();
@ -317,6 +323,13 @@ define([
if (me.recent > 0) {
me.store.on('add', me.onInsertItem, me);
me.store.on('remove', me.onRemoveItem, me);
Common.Utils.InternalSettings.set(me.appPrefix + "-settings-recent-fonts", Common.localStorage.getItem(me.appPrefix + "-settings-recent-fonts"));
var arr = Common.Utils.InternalSettings.get(me.appPrefix + "-settings-recent-fonts");
arr = arr ? arr.split(';') : [];
arr.reverse().forEach(function(item) {
item && me.addItemToRecent(me.store.findWhere({name: item}), true);
});
}
});
},
@ -334,8 +347,6 @@ define([
var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getName());
if (this.getRawValue() !== name) {
if (this._modalParents.length > 0) return;
var record = this.store.findWhere({
name: name
});
@ -359,17 +370,17 @@ define([
},
itemClicked: function (e) {
Common.UI.ComboBox.prototype.itemClicked.apply(this, arguments);
var el = $(e.target).closest('li');
var record = this.store.findWhere({id: el.attr('id')});
this.addItemToRecent(record);
Common.UI.ComboBox.prototype.itemClicked.apply(this, arguments);
},
onInsertItem: function(item) {
$(this.el).find('ul').prepend(_.template([
'<li id="<%= item.id %>">',
'<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',
'<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',
'</li>'
].join(''))({
item: item.attributes,
@ -382,6 +393,10 @@ define([
},
onBeforeShowMenu: function(e) {
if (this.store.length<1) {
e.preventDefault();
return;
}
Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this, arguments);
if (!this.getSelectedRecord() && !!this.getRawValue()) {
@ -414,19 +429,29 @@ define([
Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this, arguments);
},
addItemToRecent: function(record) {
addItemToRecent: function(record, silent) {
if (this.recent<1) return;
if (record.get('type') != FONT_TYPE_RECENT &&
!this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT})) {
var fonts = this.store.where({type:FONT_TYPE_RECENT});
if (!(fonts.length < this.recent)) {
this.store.remove(fonts[this.recent - 1]);
}
var font = this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT});
font && this.store.remove(font);
var new_record = record.clone();
new_record.set({'type': FONT_TYPE_RECENT, 'id': Common.UI.getId(), cloneid: record.id});
this.store.add(new_record, {at:0});
var fonts = this.store.where({type:FONT_TYPE_RECENT});
if (!(fonts.length < this.recent)) {
this.store.remove(fonts[this.recent - 1]);
}
var new_record = record.clone();
new_record.set({'type': FONT_TYPE_RECENT, 'id': Common.UI.getId(), cloneid: record.id});
this.store.add(new_record, {at:0});
if (!silent) {
var arr = [];
this.store.where({type:FONT_TYPE_RECENT}).forEach(function(item){
arr.push(item.get('name'));
});
arr = arr.join(';');
Common.localStorage.setItem(this.appPrefix + "-settings-recent-fonts", arr);
Common.Utils.InternalSettings.set(this.appPrefix + "-settings-recent-fonts", arr);
}
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -148,7 +148,7 @@ define([
me.trigger('render:before', me);
me.cmpEl = $(me.el);
me.cmpEl = me.$el || $(me.el);
var templateEl = me.template({
id : me.id,
@ -245,11 +245,7 @@ define([
var picker = this.menuPicker;
if (picker) {
var record = picker.getSelectedRec();
if (record) {
record = record[0];
this.fillComboView(record || picker.store.at(0), !!record, true);
}
this.fillComboView(record || picker.store.at(0), !!record, true);
picker.onResize();
}
@ -311,7 +307,7 @@ define([
},
onAfterHideMenu: function(e, isFromInputControl) {
this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec()[0]; // for DataView - onKeyDown - Return key
this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec(); // for DataView - onKeyDown - Return key
(this.showLast) ? this.menuPicker.showLastSelected() : this.menuPicker.deselectAll();
this.trigger('hide:after', this, e, isFromInputControl);
},
@ -387,10 +383,7 @@ define([
var picker = this.menuPicker;
if (picker) {
var record = picker.getSelectedRec();
if (record) {
record = record[0];
this.fillComboView(record || picker.store.at(0), false);
}
this.fillComboView(record || picker.store.at(0), false);
}
}
},
@ -421,10 +414,11 @@ define([
}
}
me.fieldPicker.store.reset([]); // remove all
var indexRec = store.indexOf(record);
if (indexRec < 0)
return;
var indexRec = store.indexOf(record),
countRec = store.length,
var countRec = store.length,
maxViewCount = Math.floor(Math.max(fieldPickerEl.width(), me.minWidth) / (me.itemWidth + (me.itemMarginLeft || 0) + (me.itemMarginRight || 0) + (me.itemPaddingLeft || 0) + (me.itemPaddingRight || 0) +
(me.itemBorderLeft || 0) + (me.itemBorderRight || 0))),
newStyles = [];
@ -432,9 +426,6 @@ define([
if (fieldPickerEl.height() / me.itemHeight > 2)
maxViewCount *= Math.floor(fieldPickerEl.height() / me.itemHeight);
if (indexRec < 0)
return;
indexRec = Math.floor(indexRec / maxViewCount) * maxViewCount;
if (countRec - indexRec < maxViewCount)
indexRec = Math.max(countRec - maxViewCount, 0);
@ -442,7 +433,7 @@ define([
newStyles.push(store.at(index));
}
me.fieldPicker.store.add(newStyles);
me.fieldPicker.store.reset(newStyles);
}
if (forceSelect) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -135,7 +135,7 @@ define([
if (_.isUndefined(this.model.id))
return this;
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template(this.model.toJSON()));
el.addClass('item');
@ -151,7 +151,7 @@ define([
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
if (tip.dontShow===undefined && el.is(':hover'))
tip.dontShow = true;
}
@ -262,7 +262,6 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
@ -272,6 +271,7 @@ define([
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
groups: me.groups ? me.groups.toJSON() : null,
style: me.style
@ -389,17 +389,7 @@ define([
},
getSelectedRec: function() {
if (this.multiSelect) {
var items = [];
_.each(this.store.where({selected: true}), function(rec){
items.push(rec);
});
return items;
}
return this.store.where({selected: true});
return (this.multiSelect) ? this.store.where({selected: true}) : this.store.findWhere({selected: true});
},
onAddItem: function(record, store, opts) {
@ -424,7 +414,7 @@ define([
innerEl.prepend(view.render().el); else
innerEl.append(view.render().el);
innerEl.find('.empty-text').remove();
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();
var idx = _.indexOf(this.store.models, record);
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
@ -601,7 +591,7 @@ define([
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedRec()[0];
var rec = this.getSelectedRec();
if (this.lastSelectedRec===null)
this.lastSelectedRec = rec;
if (data.keyCode==Common.UI.Keys.RETURN) {
@ -699,8 +689,7 @@ define([
this.scrollToRecord(this.lastSelectedRec);
this.lastSelectedRec = null;
} else {
var rec = this.getSelectedRec()[0];
if (rec) this.scrollToRecord(rec);
this.scrollToRecord(this.getSelectedRec());
}
},
@ -777,6 +766,435 @@ define([
}
});
Common.UI.DataViewSimple = Common.UI.BaseView.extend({
options : {
handleSelect: true,
enableKeyEvents: true,
keyMoveDirection: 'both', // 'vertical', 'horizontal'
restoreHeight: 0,
scrollAlwaysVisible: false,
useBSKeydown: false
},
template: _.template([
'<div class="dataview inner" style="<%= style %>">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>',
'</div>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
me.template = me.options.template || me.template;
me.store = me.options.store || new Common.UI.DataViewStore();
me.itemTemplate = me.options.itemTemplate || null;
me.handleSelect = me.options.handleSelect;
me.parentMenu = me.options.parentMenu;
me.enableKeyEvents= me.options.enableKeyEvents;
me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu
me.style = me.options.style || '';
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false;
if (me.options.keyMoveDirection=='vertical')
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN];
else if (me.options.keyMoveDirection=='horizontal')
me.moveKeys = [Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
else
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
if (me.options.el)
me.render();
},
render: function (parentEl) {
var me = this;
this.trigger('render:before', this);
if (parentEl) {
this.setElement(parentEl, false);
this.cmpEl = $(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
parentEl.html(this.cmpEl);
} else {
this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({
items: me.store.toJSON(),
itemTemplate: me.itemTemplate,
style: me.style
}));
}
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.parentMenu) {
this.cmpEl.closest('li').css('height', '100%');
this.cmpEl.css('height', '100%');
this.parentMenu.on('show:after', _.bind(this.alignPosition, this));
this.parentMenu.on('show:after', _.bind(this.onAfterShowMenu, this));
} else if (this.store.length>0)
this.onAfterShowMenu();
if (this.enableKeyEvents && this.parentMenu && this.handleSelect) {
this.parentMenu.on('show:before', function(menu) { me.deselectAll(); });
this.parentMenu.on('show:after', function(menu) {
Common.NotificationCenter.trigger('dataview:focus');
_.delay(function() {
menu.cmpEl.find('.dataview').focus();
}, 10);
}).on('hide:after', function() {
Common.NotificationCenter.trigger('dataview:blur');
});
}
this.attachKeyEvents();
this.cmpEl.on( "click", "div.item", _.bind(me.onClickItem, me));
}
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
this.rendered = true;
this.cmpEl.on('click', function(e){
if (/dataview/.test(e.target.className)) return false;
});
this.trigger('render:after', this);
return this;
},
selectRecord: function(record, suspendEvents) {
if (!this.handleSelect)
return;
if (suspendEvents)
this.suspendEvents();
this.deselectAll(suspendEvents);
if (record) {
record.set({selected: true});
var idx = _.indexOf(this.store.models, record);
if (idx>=0 && this.dataViewItems && this.dataViewItems.length>idx) {
this.dataViewItems[idx].el.addClass('selected');
}
}
if (suspendEvents)
this.resumeEvents();
return record;
},
selectByIndex: function(index, suspendEvents) {
if (this.store.length > 0 && index > -1 && index < this.store.length) {
return this.selectRecord(this.store.at(index), suspendEvents);
}
},
deselectAll: function(suspendEvents) {
if (suspendEvents)
this.suspendEvents();
_.each(this.store.where({selected: true}), function(record){
record.set({selected: false});
});
this.cmpEl.find('.item.selected').removeClass('selected');
if (suspendEvents)
this.resumeEvents();
},
getSelectedRec: function() {
return this.store.findWhere({selected: true});
},
onResetItems: function() {
this.dataViewItems && _.each(this.dataViewItems, function(item) {
var tip = item.el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
}, this);
this.dataViewItems = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.find('.inner').html(template({
items: this.store.toJSON(),
itemTemplate: this.itemTemplate,
style : this.style
}));
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
});
if (!this.parentMenu && this.store.length>0)
this.onAfterShowMenu();
this._layoutParams = undefined;
},
setStore: function(store) {
if (store) {
this.store = store;
this.onResetItems();
}
},
onClickItem: function(e) {
if ( this.disabled ) return;
window._event = e; // for FireFox only
var index = $(e.currentTarget).closest('div.item').index(),
record = (index>=0) ? this.store.at(index) : null,
view = (index>=0) ? this.dataViewItems[index] : null;
if (!record || !view) return;
record.set({selected: true});
var tip = view.el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
if (!this.isSuspendEvents) {
this.trigger('item:click', this, view.el, record, e);
}
},
onAfterShowMenu: function(e) {
if (!this.dataViewItems) {
var me = this;
this.dataViewItems = [];
_.each(this.cmpEl.find('div.item'), function(item, index) {
var $item = $(item),
rec = me.store.at(index);
me.dataViewItems.push({el: $item});
if (rec.get('tip')) {
$item.tooltip({
title : rec.get('tip'),
placement : 'cursor',
zIndex : me.tipZIndex
});
}
});
}
},
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,
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.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
} else {
innerEl.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top);
}
}
},
onKeyDown: function (e, data) {
if ( this.disabled ) return;
if (data===undefined) data = e;
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedRec();
if (data.keyCode==Common.UI.Keys.RETURN) {
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec;
this.trigger('item:click', this, this, rec, e);
if (this.parentMenu)
this.parentMenu.hide();
} else {
var idx = _.indexOf(this.store.models, rec);
if (idx<0) {
if (data.keyCode==Common.UI.Keys.LEFT) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
} else
idx = 0;
} else
idx = 0;
} else if (this.options.keyMoveDirection == 'both') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
var topIdx = this.dataViewItems[idx].topIdx,
leftIdx = this.dataViewItems[idx].leftIdx;
idx = undefined;
if (data.keyCode==Common.UI.Keys.LEFT) {
while (idx===undefined) {
leftIdx--;
if (leftIdx<0) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
break;
} else
leftIdx = this._layoutParams.columns-1;
}
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.RIGHT) {
while (idx===undefined) {
leftIdx++;
if (leftIdx>this._layoutParams.columns-1) leftIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.UP) {
while (idx===undefined) {
topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else {
while (idx===undefined) {
topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
}
} else {
idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT)
? Math.max(0, idx-1)
: Math.min(this.store.length - 1, idx + 1) ;
}
if (idx !== undefined && idx>=0) rec = this.store.at(idx);
if (rec) {
this._fromKeyDown = true;
this.selectRecord(rec);
this._fromKeyDown = false;
this.scrollToRecord(rec);
}
}
} else {
this.trigger('item:keydown', this, rec, e);
}
},
attachKeyEvents: function() {
if (this.enableKeyEvents && this.handleSelect) {
var el = $(this.el).find('.inner').addBack().filter('.inner');
el.addClass('canfocused');
el.attr('tabindex', '0');
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
}
},
setDisabled: function(disabled) {
this.disabled = disabled;
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
},
isDisabled: function() {
return this.disabled;
},
alignPosition: function() {
var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu')
? this.parentMenu.cmpEl
: this.parentMenu.cmpEl.find('[role=menu]'),
docH = Common.Utils.innerHeight()-10,
innerEl = $(this.el).find('.inner').addBack().filter('.inner'),
parent = innerEl.parent(),
margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')),
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (top + menuH > docH ) {
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
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');
this.scroller.update(props);
}
},
fillIndexesArray: function() {
if (this.dataViewItems.length<=0) return;
this._layoutParams = {
itemsIndexes: [],
columns: 0,
rows: 0
};
var el = this.dataViewItems[0].el,
itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0;
for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft)/itemW);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length-1;
}
this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
item.topIdx = topIdx;
item.leftIdx = leftIdx;
if (this._layoutParams.columns<leftIdx) this._layoutParams.columns = leftIdx;
}
this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++;
},
onResize: function() {
this._layoutParams = undefined;
}
});
$(document).on('keydown.dataview', '[data-toggle=dropdown], [role=menu]', function(e) {
if (e.keyCode !== Common.UI.Keys.UP && e.keyCode !== Common.UI.Keys.DOWN && e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.RETURN) return;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -97,7 +97,7 @@ define([
me = this;
rootEl = $(this.el);
rootEl = me.$el || $(this.el);
me.itemSize = me.options.itemSize;
me.minRows = me.options.minRows;
@ -133,7 +133,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
return this;
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -82,7 +82,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el),
el = me.$el || $(this.el),
arrowSatBrightness, arrowHue,
areaSatBrightness, areaHue,
previewColor, previewTransparentColor, previewColorText,
@ -278,7 +278,7 @@ define([
},
render: function () {
$(this.el).html(this.template());
(this.$el || $(this.el)).html(this.template());
this.trigger('render:after', this);
return this;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -73,7 +73,8 @@ define([
maskExp : '',
validateOnChange: false,
validateOnBlur: true,
disabled: false
disabled: false,
editable: true
},
template: _.template([
@ -93,8 +94,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -106,7 +106,7 @@ define([
this.allowBlank = me.options.allowBlank;
this.placeHolder = me.options.placeHolder;
this.template = me.options.template || me.template;
this.editable = me.options.editable || true;
this.editable = me.options.editable;
this.disabled = me.options.disabled;
this.spellcheck = me.options.spellcheck;
this.blankError = me.options.blankError || 'This field is required';
@ -141,10 +141,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
if (!me.rendered) {
@ -155,6 +155,7 @@ define([
if (this.editable) {
this._input.on('blur', _.bind(this.onInputChanged, this));
this._input.on('keypress', _.bind(this.onKeyPress, this));
this._input.on('keydown', _.bind(this.onKeyDown, this));
this._input.on('keyup', _.bind(this.onKeyUp, this));
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
@ -225,13 +226,9 @@ define([
if (e.isDefaultPrevented())
return;
if (e.keyCode === Common.UI.Keys.RETURN) {
this._doChange(e);
} else if (this.options.maskExp && !_.isEmpty(this.options.maskExp.source)){
if (this.options.maskExp && !_.isEmpty(this.options.maskExp.source)){
var charCode = String.fromCharCode(e.which);
if(!this.options.maskExp.test(charCode) && !e.ctrlKey && e.keyCode !== Common.UI.Keys.DELETE && e.keyCode !== Common.UI.Keys.BACKSPACE &&
e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.HOME &&
e.keyCode !== Common.UI.Keys.END && e.keyCode !== Common.UI.Keys.ESC && e.keyCode !== Common.UI.Keys.INSERT ){
if(!this.options.maskExp.test(charCode) && !e.ctrlKey && e.keyCode !== Common.UI.Keys.RETURN){
e.preventDefault();
e.stopPropagation();
}
@ -240,6 +237,16 @@ define([
this.trigger('keypress:after', this, e);
},
onKeyDown: function(e) {
this.trigger('keydown:before', this, e);
if (e.isDefaultPrevented())
return;
if (e.keyCode === Common.UI.Keys.RETURN)
this._doChange(e);
},
onKeyUp: function(e) {
this.trigger('keyup:before', this, e);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -133,7 +133,21 @@ define([
};
var panel, resizer, stretch = false;
options.items.forEach(function(item) {
this.freeze = options.freeze;
this.changeLayout(options.items);
},
doLayout: function() {
},
changeLayout: function(items) {
var panel, resizer, stretch = false;
this.splitters && this.splitters.forEach(function(item) {
item.resizer && item.resizer.el.remove();
}, this);
this.splitters = [];
this.panels = [];
items.forEach(function(item) {
item.el instanceof HTMLElement && (item.el = $(item.el));
panel = _.extend(new LayoutPanel(), item);
if ( panel.stretch ) {
@ -158,11 +172,11 @@ define([
if (!stretch) {
panel.resize.el =
resizer.el = panel.el.after('<div class="layout-resizer after"></div>').next();
resizer.el = panel.el.after('<div class="layout-resizer after"></div>').next();
this.panels.push(resizer);
} else {
panel.resize.el =
resizer.el = panel.el.before('<div class="layout-resizer before"></div>').prev();
resizer.el = panel.el.before('<div class="layout-resizer before"></div>').prev();
this.panels.splice(this.panels.length - 1, 0, resizer);
}
@ -172,11 +186,7 @@ define([
Common.Gateway.on('processmouse', this.resize.eventStop);
}
}, this);
this.freeze = options.freeze; this.freeze && this.freezePanels(this.freeze);
},
doLayout: function() {
this.freezePanels(this.freeze);
},
getElementHeight: function(el) {
@ -378,8 +388,10 @@ define([
},
setResizeValue: function (index, value) {
if (index >= this.splitters.length)
if (index >= this.splitters.length) {
this.doLayout();
return false;
}
var panel = null, next = null, oldValue = 0,
resize = this.splitters[index].resizer,
@ -428,16 +440,6 @@ define([
Common.UI.VBoxLayout.prototype = _.extend(new BaseLayout(), {
initialize: function(options){
BaseLayout.prototype.initialize.call(this,options);
this.panels.forEach(function(panel){
!panel.stretch && !panel.height && (panel.height = this.getElementHeight(panel.el));
if (panel.isresizer) {
panel.el.on('mousedown', {type: 'vertical', panel: panel}, _.bind(this.resizeStart, this));
}
}, this);
this.doLayout.call(this);
},
doLayout: function() {
@ -474,6 +476,18 @@ define([
height += style.height || this.getElementHeight(panel.el);
}
}, this);
},
changeLayout: function(items) {
BaseLayout.prototype.changeLayout.call(this, items);
this.panels.forEach(function(panel){
!panel.stretch && !panel.height && (panel.height = this.getElementHeight(panel.el));
if (panel.isresizer) {
panel.el.on('mousedown', {type: 'vertical', panel: panel}, _.bind(this.resizeStart, this));
}
}, this);
this.doLayout.call(this);
}
});
@ -485,16 +499,6 @@ define([
Common.UI.HBoxLayout.prototype = _.extend(new BaseLayout(), {
initialize: function(options){
BaseLayout.prototype.initialize.call(this,options);
this.panels.forEach(function(panel){
!panel.stretch && !panel.width && (panel.width = this.getElementWidth(panel.el));
if (panel.isresizer) {
panel.el.on('mousedown', {type: 'horizontal', panel: panel}, _.bind(this.resizeStart, this));
}
}, this);
this.doLayout.call(this);
},
doLayout: function(event) {
@ -537,6 +541,18 @@ define([
width += this.getElementWidth(panel.el);
}
},this);
},
changeLayout: function(items) {
BaseLayout.prototype.changeLayout.call(this, items);
this.panels.forEach(function(panel){
!panel.stretch && !panel.width && (panel.width = this.getElementWidth(panel.el));
if (panel.isresizer) {
panel.el.on('mousedown', {type: 'horizontal', panel: panel}, _.bind(this.resizeStart, this));
}
}, this);
this.doLayout.call(this);
}
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -77,7 +77,7 @@ define([
this.innerEl = $(this.el).find('.inner');
if (view && this.innerEl) {
this.innerEl.find('.empty-text').remove();
(this.dataViewItems.length<1) && this.innerEl.find('.empty-text').remove();
if (this.options.simpleAddMode) {
this.innerEl.append(view.render().el);
this.dataViewItems.push(view);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -130,6 +130,8 @@ define([
left: Math.round(ownerEl.width() / 2 - (loaderEl.width() + parseInt(loaderEl.css('padding-left')) + parseInt(loaderEl.css('padding-right'))) / 2) + 'px'
});
if (ownerEl.height()<1 || ownerEl.width()<1)
loaderEl.css({visibility: 'hidden'});
Common.util.Shortcuts.suspendEvents();
@ -156,6 +158,16 @@ define([
isVisible: function() {
return !_.isEmpty(loaderEl);
},
updatePosition: function() {
if (ownerEl && ownerEl.hasClass('masked') && loaderEl){
loaderEl.css({
top : Math.round(ownerEl.height() / 2 - (loaderEl.height() + parseInt(loaderEl.css('padding-top')) + parseInt(loaderEl.css('padding-bottom'))) / 2) + 'px',
left: Math.round(ownerEl.width() / 2 - (loaderEl.width() + parseInt(loaderEl.css('padding-left')) + parseInt(loaderEl.css('padding-right'))) / 2) + 'px'
});
loaderEl.css({visibility: 'visible'});
}
}
}
})())

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -48,16 +48,13 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('masked-field user-select');
el.attr('maxlength', me.options.maxLength);
el.on('keypress', function(e) {
var charCode = String.fromCharCode(e.which);
if(!me.options.maskExp.test(charCode) && !e.ctrlKey && e.keyCode !== Common.UI.Keys.DELETE && e.keyCode !== Common.UI.Keys.BACKSPACE &&
e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.HOME &&
e.keyCode !== Common.UI.Keys.END && e.keyCode !== Common.UI.Keys.ESC && e.keyCode !== Common.UI.Keys.INSERT &&
e.keyCode !== Common.UI.Keys.TAB /* || el.val().length>=me.options.maxLength*/){
if(!me.options.maskExp.test(charCode) && !e.ctrlKey){
if (e.keyCode==Common.UI.Keys.RETURN) me.trigger('changed', me, el.val());
e.preventDefault();
e.stopPropagation();
@ -78,11 +75,11 @@ define([
setValue: function(value) {
if (this.options.maskExp.test(value) && value.length<=this.options.maxLength)
$(this.el).val(value);
this.$el.val(value);
},
getValue: function() {
$(this.el).val();
this.$el.val();
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -76,6 +76,11 @@
* Arrow of the {Common.UI.MenuItem} menu items
*
*
* @property {Boolean/Number} restoreHeight
*
* Adjust to the browser height and restore to restoreHeight when it's Number
*
*
*/
if (Common === undefined)
@ -143,7 +148,9 @@ define([
menuAlign : 'tl-bl',
menuAlignEl : null,
offset : [0, 0],
cyclic : true
cyclic : true,
search : false,
scrollAlwaysVisible: true
},
template: _.template([
@ -162,6 +169,13 @@ define([
this.offset = [0, 0];
this.menuAlign = this.options.menuAlign;
this.menuAlignEl = this.options.menuAlignEl;
this.scrollAlwaysVisible = this.options.scrollAlwaysVisible;
this.search = this.options.search;
if (this.options.restoreHeight) {
this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000);
!this.options.maxHeight && (this.options.maxHeight = this.options.restoreHeight);
}
if (!this.options.cyclic) this.options.cls += ' no-cyclic';
@ -194,7 +208,7 @@ define([
this.trigger('render:before', this);
this.cmpEl = $(this.el);
this.cmpEl = me.$el || $(this.el);
if (parentEl) {
this.setElement(parentEl, false);
@ -211,12 +225,13 @@ define([
this.cmpEl = this.template({
options : me.options
});
$(this.el).append(this.cmpEl);
this.$el.append(this.cmpEl);
}
}
var rootEl = this.cmpEl.parent(),
menuRoot = (rootEl.attr('role') === 'menu') ? rootEl : rootEl.find('[role=menu]');
this.menuRoot = menuRoot;
if (menuRoot) {
if (!me.rendered) {
@ -228,8 +243,17 @@ define([
});
}
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
menuRoot.css({
'max-height': me.options.maxHeight||'none',
position : 'fixed',
right : 'auto',
left : -1000,
@ -243,7 +267,6 @@ define([
this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me));
menuRoot.on('scroll', _.bind(me.onScroll, me));
menuRoot.hover(
function(e) { me.isOver = true;},
@ -294,17 +317,14 @@ define([
me.items.splice(index, 0, item);
if (this.rendered) {
var menuRoot = (el.attr('role') === 'menu')
? el
: el.find('[role=menu]');
var menuRoot = this.menuRoot;
if (menuRoot) {
if (index < 0) {
menuRoot.append(item.render().el);
} else if (index === 0) {
menuRoot.prepend(item.render().el);
} else {
$('li:nth-child(' + (index+1) + ')', menuRoot).before(item.render().el);
menuRoot.children('li:nth-child(' + (index+1) + ')').before(item.render().el);
}
item.on('click', _.bind(me.onItemClick, me));
@ -313,64 +333,6 @@ define([
}
},
doLayout: function() {
if (this.options.maxHeight > 0) {
if (!this.rendered) {
this.mustLayout = true;
return;
}
var me = this,
el = this.cmpEl;
var menuRoot = (el.attr('role') === 'menu') ? el : el.find('[role=menu]');
if (!menuRoot.is(':visible')) {
var pos = [menuRoot.css('left'), menuRoot.css('top')];
menuRoot.css({
left : '-1000px',
top : '-1000px',
display : 'block'
});
}
var $items = menuRoot.find('li');
if ($items.height() * $items.length > this.options.maxHeight) {
var scroll = '<div class="menu-scroll top"></div>';
menuRoot.prepend(scroll);
scroll = '<div class="menu-scroll bottom"></div>';
menuRoot.append(scroll);
menuRoot.css({
'box-shadow' : 'none',
'overflow-y' : 'hidden',
'padding-top' : '18px'
// 'padding-bottom' : '18px'
});
menuRoot.find('> li:last-of-type').css('margin-bottom',18);
var addEvent = function( elem, type, fn ) {
elem.addEventListener ? elem.addEventListener( type, fn, false ) : elem.attachEvent( "on" + type, fn );
};
var eventname=(/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
addEvent(menuRoot[0], eventname, _.bind(this.onMouseWheel,this));
menuRoot.find('.menu-scroll').on('click', _.bind(this.onScrollClick, this));
}
if (pos) {
menuRoot.css({
display : '',
left : pos[0],
top : pos[1]
});
}
}
},
addItem: function(item) {
this.insertItem(-1, item);
},
@ -405,35 +367,33 @@ define([
item.off('click').off('toggle');
item.remove();
});
this.rendered && this.cmpEl.find('.menu-scroll').off('click').remove();
me.items = [];
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
if (this.mustLayout) {
delete this.mustLayout;
this.doLayout.call(this);
}
this.trigger('show:before', this, e);
this.alignPosition();
},
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.options.restoreHeight && this.scroller)
this.scroller.update({minScrollbarLength : 40});
if (this.$el.find('> ul > .menu-scroll').length) {
var el = this.$el.find('li .checked')[0];
if (el) {
var offset = el.offsetTop - this.options.maxHeight / 2;
this.scrollMenu(offset < 0 ? 0 : offset);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
listHeight = menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
setTimeout(function(){$selected.focus();}, 1);
}
}
this._search = {};
},
onBeforeHideMenu: function(e) {
@ -449,6 +409,10 @@ define([
},
onAfterKeydownMenu: function(e) {
this.trigger('keydown:before', this, e);
if (e.isDefaultPrevented())
return;
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
@ -464,24 +428,57 @@ define([
} else if (e.keyCode == Common.UI.Keys.ESC) {
// Common.NotificationCenter.trigger('menu:afterkeydown', e);
// return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
(!this._search.text) && (this._search.text = '');
(!this._search.char) && (this._search.char = e.key);
(this._search.char !== e.key) && (this._search.full = true);
this._search.text += e.key;
if (this._search.index===undefined) {
var $items = this.menuRoot.find('> li').find('> a');
this._search.index = $items.index($items.filter(':focus'));
}
this.selectCandidate();
}
},
onScroll: function(item, e) {
if (this.scroller) return;
selectCandidate: function() {
var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
itemCandidate, idxCandidate;
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
scrollTop = menuRoot.scrollTop(),
top = menuRoot.find('.menu-scroll.top'),
bottom = menuRoot.find('.menu-scroll.bottom');
if (this.fromKeyDown) {
top.css('top', scrollTop + 'px');
bottom.css('bottom', (-scrollTop) + 'px');
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (re.test(item.caption)) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
}
}
}
if (itemCandidate) {
this._search.index = idxCandidate;
var item = itemCandidate.cmpEl.find('a');
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = this.menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
}
item.focus();
}
top.toggleClass('disabled', scrollTop<1);
bottom.toggleClass('disabled', scrollTop + this.options.maxHeight > menuRoot[0].scrollHeight-1);
},
onItemClick: function(item, e) {
@ -501,32 +498,6 @@ define([
this.trigger('item:toggle', this, item, state, e);
},
onScrollClick: function(e) {
if (/disabled/.test(e.currentTarget.className)) return false;
this.scrollMenu(/top/.test(e.currentTarget.className));
return false;
},
onMouseWheel: function(e) {
this.scrollMenu(((e.detail && -e.detail) || e.wheelDelta) > 0);
},
scrollMenu: function(up) {
this.fromKeyDown = false;
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
value = typeof(up)==='boolean'
? menuRoot.scrollTop() + (up ? -20 : 20)
: up;
menuRoot.scrollTop(value);
menuRoot.find('.menu-scroll.top').css('top', menuRoot.scrollTop() + 'px');
menuRoot.find('.menu-scroll.bottom').css('bottom', (-menuRoot.scrollTop()) + 'px');
},
setOffset: function(offsetX, offsetY) {
this.offset[0] = _.isUndefined(offsetX) ? this.offset[0] : offsetX;
this.offset[1] = _.isUndefined(offsetY) ? this.offset[1] : offsetY;
@ -537,10 +508,8 @@ define([
return this.offset;
},
alignPosition: function() {
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
alignPosition: function(fixedAlign, fixedOffset) {
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
@ -577,15 +546,24 @@ define([
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
menuH = menuRoot.outerHeight();
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight ) {
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
menuH = menuRoot.outerHeight();
}
}
} else {
if (top + menuH > docH)
top = docH - menuH;
if (top + menuH > docH) {
if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height
m = fixedAlign.match(/^([a-z]+)-([a-z]+)/);
top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0);
} else
top = docH - menuH;
}
if (top < 0)
top = 0;
@ -594,7 +572,7 @@ define([
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: left, top: top});
menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)});
},
clearAll: function() {
@ -610,4 +588,447 @@ define([
})()
})
})();
Common.UI.MenuSimple = Common.UI.BaseView.extend({
options : {
cls : '',
style : '',
itemTemplate: null,
items : [],
menuAlign : 'tl-bl',
menuAlignEl : null,
offset : [0, 0],
cyclic : true,
search : false,
scrollAlwaysVisible: true
},
template: _.template([
'<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>',
'</ul>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.id = this.options.id || Common.UI.getId();
this.itemTemplate = this.options.itemTemplate || _.template([
'<a id="<%= id %>" <% if(typeof style !== "undefined") { %> style="<%= style %>" <% } %>',
'<% if(typeof canFocused !== "undefined") { %> tabindex="-1" type="menuitem" <% } %>',
'<% if(typeof stopPropagation !== "undefined") { %> data-stopPropagation="true" <% } %>',
'class="<% if (checked) { %> checked <% } %>" >',
'<% if (typeof iconCls !== "undefined") { %>',
'<span class="menu-item-icon <%= iconCls %>"></span>',
'<% } %>',
'<%= caption %>',
'</a>'
].join(''));
this.rendered = false;
this.items = this.options.items || [];
this.offset = [0, 0];
this.menuAlign = this.options.menuAlign;
this.menuAlignEl = this.options.menuAlignEl;
this.scrollAlwaysVisible = this.options.scrollAlwaysVisible;
this.search = this.options.search;
if (this.options.restoreHeight) {
this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000);
!this.options.maxHeight && (this.options.maxHeight = this.options.restoreHeight);
}
if (!this.options.cyclic) this.options.cls += ' no-cyclic';
if (this.options.el)
this.render();
Common.UI.Menu.Manager.register(this);
},
remove: function() {
Common.UI.Menu.Manager.unregister(this);
Common.UI.BaseView.prototype.remove.call(this);
},
render: function(parentEl) {
var me = this;
this.trigger('render:before', this);
this.cmpEl = me.$el || $(this.el);
parentEl && this.setElement(parentEl, false);
if (!me.rendered) {
this.cmpEl = $(this.template({
items: me.items,
itemTemplate: me.itemTemplate,
options : me.options
}));
parentEl ? parentEl.append(this.cmpEl) : this.$el.append(this.cmpEl);
}
var rootEl = this.cmpEl.parent(),
menuRoot = (rootEl.attr('role') === 'menu') ? rootEl : rootEl.find('[role=menu]');
this.menuRoot = menuRoot;
if (menuRoot) {
if (!me.rendered) {
menuRoot.on( "click", "li", _.bind(me.onItemClick, me));
menuRoot.on( "mousedown", "li", _.bind(me.onItemMouseDown, me));
}
if (this.options.maxHeight) {
menuRoot.css({'max-height': me.options.maxHeight});
this.scroller = new Common.UI.Scroller({
el: me.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
});
}
menuRoot.css({
position : 'fixed',
right : 'auto',
left : -1000,
top : -1000
});
this.parentEl = menuRoot.parent();
this.parentEl.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
this.parentEl.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me));
this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me));
menuRoot.hover(
function(e) { me.isOver = true;},
function(e) { me.isOver = false; }
);
}
this.rendered = true;
this.trigger('render:after', this);
return this;
},
resetItems: function(items) {
this.items = items || [];
this.$items = null;
var template = _.template([
'<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<% item.checked = item.checked || false; %>',
'<li><%= itemTemplate(item) %></li>',
'<% }) %>'
].join(''));
this.cmpEl && this.cmpEl.html(template({
items: this.items,
itemTemplate: this.itemTemplate,
options : this.options
}));
},
isVisible: function() {
return this.rendered && (this.cmpEl.is(':visible'));
},
show: function() {
if (this.rendered && this.parentEl && !this.parentEl.hasClass('open')) {
this.cmpEl.dropdown('toggle');
}
},
hide: function() {
if (this.rendered && this.parentEl) {
if ( this.parentEl.hasClass('open') )
this.cmpEl.dropdown('toggle');
else if (this.parentEl.hasClass('over'))
this.parentEl.removeClass('over');
}
},
onItemClick: function(e) {
if (e.which != 1 && e.which !== undefined)
return false;
var index = $(e.currentTarget).closest('li').index(),
item = (index>=0) ? this.items[index] : null;
if (!item) return;
if (item.disabled)
return false;
if (item.checkable && !item.checked)
this.setChecked(index, !item.checked);
this.isOver = false;
if (item.stopPropagation) {
e.stopPropagation();
var me = this;
_.delay(function(){
me.$el.parent().parent().find('[data-toggle=dropdown]').focus();
}, 10);
return;
}
this.trigger('item:click', this, item, e);
},
onItemMouseDown: function(e) {
if (e.which != 1) {
e.preventDefault();
e.stopPropagation();
return false;
}
e.stopPropagation();
},
setChecked: function(index, check, suppressEvent) {
this.toggle(index, check, suppressEvent);
},
toggle: function(index, toggle, suppressEvent) {
var state = !!toggle;
var item = this.items[index];
this.clearAll();
if (item && item.checkable) {
item.checked = state;
if (this.rendered) {
var itemEl = item.el || this.cmpEl.find('#'+item.id);
if (itemEl) {
itemEl.toggleClass('checked', item.checked);
if (!_.isEmpty(item.iconCls)) {
itemEl.css('background-image', 'none');
}
}
}
if (!suppressEvent)
this.trigger('item:toggle', this, item, state);
}
},
setDisabled: function(disabled) {
this.disabled = !!disabled;
if (this.rendered)
this.cmpEl.toggleClass('disabled', this.disabled);
},
isDisabled: function() {
return this.disabled;
},
onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show');
this.trigger('show:before', this, e);
this.alignPosition();
},
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
if ($selected.length) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
listHeight = menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
setTimeout(function(){$selected.focus();}, 1);
}
}
this._search = {};
if (this.search && !this.$items) {
var me = this;
this.$items = this.menuRoot.find('> li').find('> a');
_.each(this.$items, function(item, index) {
me.items[index].el = $(item);
});
}
},
onBeforeHideMenu: function(e) {
this.trigger('hide:before', this, e);
if (Common.UI.Scroller.isMouseCapture())
e.preventDefault();
},
onAfterHideMenu: function(e, isFromInputControl) {
this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
},
onAfterKeydownMenu: function(e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
if (li.length>0) li.click();
if (!li.hasClass('dropdown-submenu'))
Common.UI.Menu.Manager.hideAll();
if ( $(e.currentTarget).closest('li').hasClass('dropdown-submenu')) {
e.stopPropagation();
return false;
}
} else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
this.fromKeyDown = true;
} else if (e.keyCode == Common.UI.Keys.ESC) {
// Common.NotificationCenter.trigger('menu:afterkeydown', e);
// return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
var me = this;
clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
(!this._search.text) && (this._search.text = '');
(!this._search.char) && (this._search.char = e.key);
(this._search.char !== e.key) && (this._search.full = true);
this._search.text += e.key;
if (this._search.index===undefined) {
this._search.index = this.$items.index(this.$items.filter(':focus'));
}
this.selectCandidate();
}
},
selectCandidate: function() {
var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
itemCandidate, idxCandidate;
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (re.test(item.caption)) {
if (!itemCandidate) {
itemCandidate = item;
idxCandidate = i;
}
if (this._search.full && i==index || i>index) {
itemCandidate = item;
idxCandidate = i;
break;
}
}
}
if (itemCandidate) {
this._search.index = idxCandidate;
var item = itemCandidate.el;
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = this.menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
}
}
item.focus();
}
},
setOffset: function(offsetX, offsetY) {
this.offset[0] = _.isUndefined(offsetX) ? this.offset[0] : offsetX;
this.offset[1] = _.isUndefined(offsetY) ? this.offset[1] : offsetY;
this.alignPosition();
},
getOffset: function() {
return this.offset;
},
alignPosition: function(fixedAlign, fixedOffset) {
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
docW = Common.Utils.innerWidth(),
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
menuH = menuRoot.outerHeight(),
parentW = menuParent.outerWidth(),
parentH = menuParent.outerHeight();
var posMenu = {
'tl': [0, 0],
'bl': [0, menuH],
'tr': [menuW, 0],
'br': [menuW, menuH]
};
var posParent = {
'tl': [0, 0],
'tr': [parentW, 0],
'bl': [0, parentH],
'br': [parentW, parentH]
};
var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0];
var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1];
if (left + menuW > docW)
if (menuParent.is('li.dropdown-submenu')) {
left = offset.left - menuW + 2;
} else {
left = docW - menuW;
}
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
}
}
} else {
if (top + menuH > docH) {
if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height
m = fixedAlign.match(/^([a-z]+)-([a-z]+)/);
top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0);
} else
top = docH - menuH;
}
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)});
},
clearAll: function() {
this.cmpEl && this.cmpEl.find('li > a.checked').removeClass('checked');
_.each(this.items, function(item){
item.checked = false;
});
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -119,8 +119,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
@ -135,9 +134,10 @@ define([
this.toggleGroup = me.options.toggleGroup;
this.template = me.options.template || this.template;
this.iconCls = me.options.iconCls;
this.hint = me.options.hint;
this.rendered = false;
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) {
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu) && !(this.menu instanceof Common.UI.MenuSimple)) {
this.menu = new Common.UI.Menu(_.extend({}, me.options.menu));
}
@ -147,7 +147,7 @@ define([
render: function() {
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
me.trigger('render:before', me);
@ -158,7 +158,7 @@ define([
el.off('click');
Common.UI.ToggleManager.unregister(me);
$(this.el).html(this.template({
el.html(this.template({
id : me.id,
caption : me.caption,
iconCls : me.iconCls,
@ -169,7 +169,7 @@ define([
if (me.menu) {
el.addClass('dropdown-submenu');
me.menu.render($(this.el));
me.menu.render(el);
el.mouseenter(_.bind(me.menu.alignPosition, me.menu));
// el.focusin(_.bind(me.onFocusItem, me));
el.focusout(_.bind(me.onBlurItem, me));
@ -189,8 +189,31 @@ define([
}
}
if (me.options.hint) {
el.attr('data-toggle', 'tooltip');
el.tooltip({
title : me.options.hint,
placement : me.options.hintAnchor||function(tip, element) {
var pos = this.getPosition(),
actualWidth = tip.offsetWidth,
actualHeight = tip.offsetHeight,
innerWidth = Common.Utils.innerWidth(),
innerHeight = Common.Utils.innerHeight();
var top = pos.top,
left = pos.left + pos.width + 2;
if (top + actualHeight > innerHeight) {
top = innerHeight - actualHeight - 2;
}
if (left + actualWidth > innerWidth) {
left = pos.left - actualWidth - 2;
}
$(tip).offset({top: top,left: left}).addClass('in');
}
});
}
if (this.disabled)
$(this.el).toggleClass('disabled', this.disabled);
el.toggleClass('disabled', this.disabled);
el.on('click', _.bind(this.onItemClick, this));
el.on('mousedown', _.bind(this.onItemMouseDown, this));
@ -199,7 +222,7 @@ define([
}
}
me.cmpEl = $(this.el);
me.cmpEl = el;
me.rendered = true;
me.trigger('render:after', me);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -118,7 +118,7 @@ define([
rendered : false,
template :
'<input type="text" class="form-control">' +
'<input type="text" class="form-control" spellcheck="false">' +
'<div class="spinner-buttons">' +
'<button type="button" class="spinner-up"><i class="img-commonctrl"></i></button>' +
'<button type="button" class="spinner-down"><i class="img-commonctrl"></i></button>' +
@ -128,7 +128,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
el.addClass('spinner');
@ -165,7 +165,7 @@ define([
this.setRawValue(this.value);
if (this.options.width) {
$(this.el).width(this.options.width);
el.width(this.options.width);
}
if (this.options.defaultValue===undefined)
@ -176,7 +176,7 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template);
this.$input = el.find('.form-control');
@ -189,7 +189,7 @@ define([
},
setDisabled: function(disabled) {
var el = $(this.el);
var el = this.$el || $(this.el);
if (disabled !== this.disabled) {
el.find('button').toggleClass('disabled', disabled);
el.toggleClass('disabled', disabled);
@ -374,12 +374,7 @@ define([
if (charCode=='.' || charCode==',') {
e.preventDefault();
e.stopPropagation();
} else if(this.options.maskExp && !this.options.maskExp.test(charCode) && !e.ctrlKey &&
e.keyCode !== Common.UI.Keys.DELETE && e.keyCode !== Common.UI.Keys.BACKSPACE &&
e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT &&
e.keyCode !== Common.UI.Keys.HOME && e.keyCode !== Common.UI.Keys.END &&
e.keyCode !== Common.UI.Keys.ESC && e.keyCode !== Common.UI.Keys.RETURN &&
e.keyCode !== Common.UI.Keys.INSERT && e.keyCode !== Common.UI.Keys.TAB){
} else if(this.options.maskExp && !this.options.maskExp.test(charCode) && !e.ctrlKey && e.keyCode !== Common.UI.Keys.RETURN ){
e.preventDefault();
e.stopPropagation();
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -42,7 +42,8 @@
*/
define([
'backbone'
'backbone',
'common/main/lib/component/BaseView'
], function (Backbone) {
'use strict';
@ -88,7 +89,7 @@ define([
var _template_tabs =
'<section class="tabs">' +
'<a class="scroll left"><i class="icon">&lt;</i></a>' +
'<a class="scroll left"></a>' +
'<ul>' +
'<% for(var i in items) { %>' +
'<li class="ribtab' +
@ -98,7 +99,7 @@ define([
'</li>' +
'<% } %>' +
'</ul>' +
'<a class="scroll right"><i class="icon">&gt;</i></a>' +
'<a class="scroll right"></a>' +
'</section>';
this.$layout = $(options.template({
@ -194,7 +195,7 @@ define([
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');
tab = me.$tabs.siblings(':not(.x-lone):visible').first().find('> a[data-tab]').data('tab');
me.setTab(tab);
}
}
@ -226,6 +227,8 @@ define([
if ( $boxTabs.parent().hasClass('short') ) {
$boxTabs.parent().removeClass('short');
}
this.processPanelVisible();
},
onTabClick: function (e) {
@ -243,10 +246,12 @@ define([
me.collapse();
} else {
me.setTab(tab);
me.processPanelVisible(null, true);
}
} else {
if ( !$target.hasClass('active') && !islone ) {
me.setTab(tab);
me.processPanelVisible(null, true);
}
}
},
@ -281,6 +286,7 @@ define([
if ( $tp.length ) {
$tp.addClass('active');
}
this.fireEvent('tab:active', [tab]);
}
},
@ -292,7 +298,7 @@ define([
return config.tabs[index].action;
}
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><a data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
config.tabs[after + 1] = tab;
var _after_action = _get_tab_action(after);
@ -345,6 +351,47 @@ define([
return true;
},
/**
* in case panel partly visible.
* hide button's caption to decrease panel width
* ##adopt-panel-width
**/
processPanelVisible: function(panel, now) {
var me = this;
if ( me._timer_id ) clearTimeout(me._timer_id);
function _fc() {
var $active = panel || me.$panels.filter('.active');
if ( $active && $active.length ) {
var _maxright = $active.parents('.box-controls').width();
var data = $active.data(),
_rightedge = data.rightedge;
if ( !_rightedge ) {
_rightedge = $active.get(0).getBoundingClientRect().right;
}
if ( _rightedge > _maxright ) {
if ( !$active.hasClass('compactwidth') ) {
$active.addClass('compactwidth');
data.rightedge = _rightedge;
}
} else {
if ($active.hasClass('compactwidth')) {
$active.removeClass('compactwidth');
}
}
}
};
if ( now === true ) _fc(); else
me._timer_id = setTimeout(function() {
delete me._timer_id;
_fc();
}, 100);
},
/**/
setExtra: function (place, el) {
if ( !!el ) {
if (this.$tabs) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -54,7 +54,11 @@ define([
maxValue: 100,
values: [0, 100],
colorValues: ['#000000', '#ffffff'],
currentThumb: 0
currentThumb: 0,
thumbTemplate: '<div class="thumb img-commonctrl" style="">' +
'<div class="thumb-top"></div>' +
'<div class="thumb-bottom"></div>' +
'</div>'
},
disabled: false,
@ -63,38 +67,20 @@ define([
'<div class="slider multi-slider-gradient">',
'<div class="track"></div>',
'<% _.each(items, function(item) { %>',
'<div class="thumb img-commonctrl" style="">',
'<div class="thumb-top"></div>',
'<div class="thumb-bottom"></div>',
'</div>',
'<%= thumbTemplate %>',
'<% }); %>',
'</div>'
].join('')),
initialize : function(options) {
this.styleStr = '';
if (Common.Utils.isChrome && Common.Utils.chromeVersion<10 || Common.Utils.isSafari && Common.Utils.safariVersion<5.1)
this.styleStr = '-webkit-gradient(linear, left top, right top, color-stop({1}%,{0}), color-stop({3}%,{2})); /* Chrome,Safari4+ */';
else if (Common.Utils.isChrome || Common.Utils.isSafari)
this.styleStr = '-webkit-linear-gradient(left, {0} {1}%, {2} {3}%)';
else if (Common.Utils.isGecko)
this.styleStr = '-moz-linear-gradient(left, {0} {1}%, {2} {3}%)';
else if (Common.Utils.isOpera && Common.Utils.operaVersion>11.0)
this.styleStr = '-o-linear-gradient(left, {0} {1}%, {2} {3}%)';
else if (Common.Utils.isIE)
this.styleStr = '-ms-linear-gradient(left, {0} {1}%, {2} {3}%)';
this.colorValues = this.options.colorValues;
this.styleStr = {};
Common.UI.MultiSlider.prototype.initialize.call(this, options);
},
render : function(parentEl) {
Common.UI.MultiSlider.prototype.render.call(this, parentEl);
var me = this,
style = '';
var me = this;
me.trackEl = me.cmpEl.find('.track');
for (var i=0; i<me.thumbs.length; i++) {
@ -102,33 +88,24 @@ define([
me.trigger('thumbdblclick', me);
});
me.thumbs[i].thumbcolor = me.thumbs[i].thumb.find('> div');
me.setColorValue(me.options.colorValues[i], i);
}
if (me.styleStr!=='') {
style = Common.Utils.String.format(me.styleStr, me.colorValues[0], 0, me.colorValues[1], 100);
me.trackEl.css('background', style);
}
if (Common.Utils.isIE) {
style = Common.Utils.String.format('progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )',
me.colorValues[0], me.colorValues[1]);
me.trackEl.css('filter', style);
}
style = Common.Utils.String.format('linear-gradient(to right, {0} {1}%, {2} {3}%)', me.colorValues[0], 0, me.colorValues[1], 100);
me.trackEl.css('background', style);
me.changeSliderStyle();
me.changeGradientStyle();
me.on('change', _.bind(me.changeGradientStyle, me));
},
setColorValue: function(color, index) {
var ind = (index!==undefined) ? index : this.currentThumb;
this.colorValues[ind] = color;
this.thumbs[ind].colorValue = color;
this.thumbs[ind].thumbcolor.css('background-color', color);
this.changeGradientStyle();
},
getColorValue: function(index) {
var ind = (index!==undefined) ? index : this.currentThumb;
return this.colorValues[ind];
return this.thumbs[ind].colorValue;
},
setValue: function(index, value) {
@ -136,32 +113,88 @@ define([
this.changeGradientStyle();
},
getColorValues: function() {
var values = [];
_.each (this.thumbs, function(thumb) {
values.push(thumb.colorValue);
});
return values;
},
changeGradientStyle: function() {
if (!this.rendered) return;
var style;
if (this.styleStr!=='') {
style = Common.Utils.String.format(this.styleStr, this.colorValues[0], this.getValue(0), this.colorValues[1], this.getValue(1));
if (this.styleStr.specific) {
style = Common.Utils.String.format(this.styleStr.specific, this.getColorValues().concat(this.getValues()));
this.trackEl.css('background', style);
}
if (Common.Utils.isIE) {
style = Common.Utils.String.format('progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )',
this.colorValues[0], this.colorValues[1]);
this.getColorValue(0), this.getColorValue(this.thumbs.length-1));
this.trackEl.css('filter', style);
}
style = Common.Utils.String.format('linear-gradient(to right, {0} {1}%, {2} {3}%)', this.colorValues[0], this.getValue(0), this.colorValues[1], this.getValue(1));
this.trackEl.css('background', style);
if (this.styleStr.common) {
style = Common.Utils.String.format(this.styleStr.common, this.getColorValues().concat(this.getValues()));
this.trackEl.css('background', style);
}
},
sortThumbs: function() {
var recalc_indexes = Common.UI.MultiSlider.prototype.sortThumbs.call(this),
new_colors = [],
me = this;
_.each (recalc_indexes, function(recalc_index) {
new_colors.push(me.colorValues[recalc_index]);
});
this.colorValues = new_colors;
this.trigger('sortthumbs', me, recalc_indexes);
var recalc_indexes = Common.UI.MultiSlider.prototype.sortThumbs.call(this);
this.trigger('sortthumbs', this, recalc_indexes);
return recalc_indexes;
},
addThumb: function() {
Common.UI.MultiSlider.prototype.addThumb.call(this);
var me = this,
index = me.thumbs.length-1;
me.thumbs[index].thumb.on('dblclick', null, function() {
me.trigger('thumbdblclick', me);
});
me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div');
(index>0) && this.setColorValue(this.getColorValue(index-1), index);
me.changeSliderStyle();
},
removeThumb: function(index) {
if (index===undefined) index = this.thumbs.length-1;
if (index>0) {
this.thumbs[index].thumb.remove();
this.thumbs.splice(index, 1);
this.changeSliderStyle();
}
},
changeSliderStyle: function() {
this.styleStr = {
specific: '',
common: 'linear-gradient(to right'
};
if (Common.Utils.isChrome && Common.Utils.chromeVersion<10 || Common.Utils.isSafari && Common.Utils.safariVersion<5.1)
this.styleStr.specific = '-webkit-gradient(linear, left top, right top'; /* Chrome,Safari4+ */
else if (Common.Utils.isChrome || Common.Utils.isSafari)
this.styleStr.specific = '-webkit-linear-gradient(left';
else if (Common.Utils.isGecko)
this.styleStr.specific = '-moz-linear-gradient(left';
else if (Common.Utils.isOpera && Common.Utils.operaVersion>11.0)
this.styleStr.specific = '-o-linear-gradient(left';
else if (Common.Utils.isIE)
this.styleStr.specific = '-ms-linear-gradient(left';
for (var i=0; i<this.thumbs.length; i++) {
this.styleStr.common += ', {' + i + '} {' + (this.thumbs.length + i) + '}%';
if (Common.Utils.isChrome && Common.Utils.chromeVersion<10 || Common.Utils.isSafari && Common.Utils.safariVersion<5.1)
this.styleStr.specific += ', color-stop({' + (this.thumbs.length + i) + '}%,{' + i + '})';
else
this.styleStr.specific += ', {' + i + '} {' + (this.thumbs.length + i) + '}%';
}
this.styleStr.specific += ')';
this.styleStr.common += ')';
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -71,13 +71,12 @@ define([
disabled : false,
rendered : false,
template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),
template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><span><%= labelText %></span></label>'),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
this.name = this.options.name || Common.UI.getId();
@ -94,19 +93,23 @@ define([
},
render: function () {
var el = $(this.el);
var el = this.$el || $(this.el);
el.html(this.template({
labelText: this.options.labelText,
name: this.name
}));
this.$radio = el.find('input[type=button]');
this.$label = el.find('label');
this.rendered = true;
return this;
},
setDisabled: function(disabled) {
if (!this.rendered)
return;
if (disabled !== this.disabled) {
this.$radio.toggleClass('disabled', disabled);
(disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled');
@ -142,6 +145,10 @@ define([
getValue: function() {
return this.$radio.hasClass('checked');
},
setCaption: function(text) {
this.$label.find('span').text(text);
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -78,7 +78,7 @@ define([
render: function() {
var me = this;
me.cmpEl = $(this.el);
me.cmpEl = me.$el || $(this.el);
if (!me.rendered) {
me.cmpEl.perfectScrollbar(_.extend({}, me.options));
@ -165,7 +165,12 @@ define([
$(this.el).find('.ps-scrollbar-y-rail').removeClass('always-visible-y');
$(this.el).find('.ps-scrollbar-y').addClass('always-visible-y');
}
},
isVisible: function() {
return $(this.el).find('.ps-scrollbar-y-rail').is(':visible');
}
}), {
isMouseCapture: function() {
return mouseCapture

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -104,8 +104,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -131,10 +130,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
me.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = me.$el;
}
this.cmpEl.find('.track-center').width(me.options.width - 14);
@ -277,7 +276,8 @@ define([
width: 100,
minValue: 0,
maxValue: 100,
values: [0, 100]
values: [0, 100],
thumbTemplate: '<div class="thumb" style=""></div>'
},
disabled: false,
@ -290,7 +290,7 @@ define([
'<div class="track-right" style=""></div>',
'</div>',
'<% _.each(items, function(item) { %>',
'<div class="thumb" style=""></div>',
'<%= thumbTemplate %>',
'<% }); %>',
'</div>'
].join('')),
@ -298,8 +298,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.minValue = me.options.minValue;
@ -317,17 +316,18 @@ define([
if (!me.rendered) {
this.cmpEl = $(this.template({
items: this.options.values
items: this.options.values,
thumbTemplate: this.options.thumbTemplate
}));
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
var el = this.cmpEl;
@ -353,8 +353,8 @@ define([
if (need_sort)
me.sortThumbs();
$(document).off('mouseup', onMouseUp);
$(document).off('mousemove', onMouseMove);
$(document).off('mouseup', me.binding.onMouseUp);
$(document).off('mousemove', me.binding.onMouseMove);
me._dragstart = undefined;
me.trigger('changecomplete', me, value, lastValue);
@ -399,8 +399,8 @@ define([
(index == idx) ? item.thumb.css('z-index', 500) : item.thumb.css('z-index', '');
});
$(document).on('mouseup', null, e.data, onMouseUp);
$(document).on('mousemove', null, e.data, onMouseMove);
$(document).on('mouseup', null, e.data, me.binding.onMouseUp);
$(document).on('mousemove', null, e.data, me.binding.onMouseMove);
};
var onTrackMouseDown = function (e) {
@ -443,6 +443,12 @@ define([
return index;
};
this.binding = {
onMouseUp: _.bind(onMouseUp, this),
onMouseMove: _.bind(onMouseMove, this),
onMouseDown: _.bind(onMouseDown, this)
};
this.$thumbs = el.find('.thumb');
_.each(this.$thumbs, function(item, index) {
var thumb = $(item);
@ -451,7 +457,7 @@ define([
index: index
});
me.setValue(index, me.options.values[index]);
thumb.on('mousedown', null, me.thumbs[index], onMouseDown);
thumb.on('mousedown', null, me.thumbs[index], me.binding.onMouseDown);
});
me.setActiveThumb(0, true);
@ -481,7 +487,6 @@ define([
this.setThumbPosition(index, Math.round((value-this.minValue)*this.delta));
},
getValue: function(index) {
return this.thumbs[index].value;
},
@ -511,6 +516,35 @@ define([
thumb.index = index;
});
return recalc_indexes;
},
setThumbs: function(count) {
var length = this.thumbs.length;
if (length==count) return;
for (var i=0; i<Math.abs(count-length); i++)
(length<count) ? this.addThumb() : this.removeThumb();
},
addThumb: function() {
var el = this.cmpEl,
thumb = $(this.options.thumbTemplate),
index = this.thumbs.length;
el.append(thumb);
this.thumbs.push({
thumb: thumb,
index: index
});
(index>0) && this.setValue(index, this.getValue(index-1));
thumb.on('mousedown', null, this.thumbs[index], this.binding.onMouseDown);
},
removeThumb: function(index) {
if (index===undefined) index = this.thumbs.length-1;
if (index>0) {
this.thumbs[index].thumb.remove();
this.thumbs.splice(index, 1);
}
}
});
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -65,8 +65,7 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
var me = this;
me.width = me.options.width;
me.thumbWidth = me.options.thumbWidth;
@ -89,10 +88,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
this.thumb = this.cmpEl.find('.thumb');

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -206,6 +206,7 @@ define([
function dragComplete() {
if (!_.isUndefined(me.drag)) {
me.drag.tab.removeClass('dragged');
me.drag.tab.$el.css('z-index', '');
me.bar.dragging = false;
var tab = null;
@ -250,6 +251,8 @@ define([
}
if (!_.isUndefined(bar) && !_.isUndefined(tab) && bar.tabs.length > 1) {
tab.addClass('dragged');
var index = bar.tabs.indexOf(tab),
_clientX = e.clientX*Common.Utils.zoom();
me.bar = bar;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -335,10 +335,10 @@ define([
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
$(this.el).html(this.cmpEl);
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = $(this.el);
this.cmpEl = this.$el;
}
me.rendered = true;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -98,7 +98,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent);
@ -116,7 +116,7 @@ define([
},
render: function () {
$(this.el).html(this.template({colors: this.colors}));
this.$el.html(this.template({colors: this.colors}));
return this;
},
@ -144,7 +144,7 @@ define([
},
updateCustomColors: function() {
var el = $(this.el);
var el = this.$el || $(this.el);
if (el) {
var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
@ -221,7 +221,7 @@ define([
},
setCustomColor: function(color) {
var el = $(this.el);
var el = this.$el || $(this.el);
color = /#?([a-fA-F0-9]{6})/.exec(color);
if (color) {
this.saveCustomColor(color[1]);
@ -272,7 +272,7 @@ define([
},
select: function(color, suppressEvent) {
var el = $(this.el);
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
if (typeof(color) == 'object' ) {
@ -320,11 +320,38 @@ define([
}
},
selectByRGB: function(rgb, suppressEvent) {
var el = this.$el || $(this.el);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
var color = (typeof(rgb) == 'object') ? rgb.color : rgb;
if (/#?[a-fA-F0-9]{6}/.test(color)) {
color = /#?([a-fA-F0-9]{6})/.exec(color)[1].toUpperCase();
}
if (/^[a-fA-F0-9]{6}|transparent$/.test(color)) {
if (color != this.value || this.options.allowReselect) {
var co = (color == 'transparent') ? el.find('a.color-transparent') : el.find('a.color-' + color).first();
if (co.length==0)
co = el.find('#'+color).first();
if (co.length==0)
co = el.find('a[color="'+color+'"]').first();
if (co.length>0) {
co.addClass(this.selectedCls);
this.value = color;
}
if (suppressEvent !== true) {
this.fireEvent('select', this, color);
}
}
}
},
updateColors: function(effectcolors, standartcolors, value) {
if (effectcolors===undefined || standartcolors===undefined) return;
var me = this,
el = $(this.el);
el = me.$el || $(this.el);
if (me.aColorElements === undefined) {
me.aColorElements = el.find('a.palette-color');
@ -380,7 +407,7 @@ define([
if (value)
this.select(value, true);
else {
var selected = $(this.el).find('a.' + this.selectedCls);
var selected = el.find('a.' + this.selectedCls);
if (selected.length && selected.hasClass('palette-color-effect')) {
this.value = selected[0].className.match(this.colorRe)[1].toUpperCase();
}
@ -389,7 +416,7 @@ define([
},
clearSelection: function(suppressEvent) {
$(this.el).find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
this.value = undefined;
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -193,9 +193,9 @@ define([
});
if (view) {
var innerEl = $(this.el).find('.inner').addBack().filter('.inner');
var innerEl = (this.$el || $(this.el)).find('.inner').addBack().filter('.inner');
if (innerEl) {
innerEl.find('.empty-text').remove();
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();
if (opts && opts.at!==undefined) {
var idx = opts.at;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -63,6 +63,12 @@
* @cfg {Boolean} animate
* Makes the window to animate while showing or hiding
*
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* Methods
*
* @method show
@ -106,12 +112,6 @@
* @window Common.UI.warning
* Shows warning message.
* @cfg {String} msg
* @cfg {Object} buttons
* Use an array for predefined buttons (ok, cancel, yes, no): @example ['yes', 'no']
* Use a named array for the custom buttons: {value: caption, ...}
* @param {String} value will be returned in callback function
* @param {String} caption
*
* @cfg {Function} callback
* @param {String} button
* If the window is closed via shortcut or header's close tool, the 'button' will be 'close'
@ -164,10 +164,18 @@ define([
'<% if (closable!==false) %>' +
'<div class="tool close img-commonctrl"></div>' +
'<% %>' +
'<span class="title"><%= title %></span> ' +
'<div class="title"><%= title %></div> ' +
'</div>' +
'<% } %>' +
'<div class="body"><%= tpl %></div>' +
'<div class="body"><%= tpl %>' +
'<% if (typeof (buttons) !== "undefined" && _.size(buttons) > 0) { %>' +
'<div class="footer">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>' +
'</div>' +
'</div>';
function _getMask() {
@ -235,6 +243,21 @@ define([
this.$window.css('top',top);
}
function _setVisible() {
if (window.innerHeight == undefined) {
var main_width = document.documentElement.offsetWidth;
var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
if (this.getLeft() + this.getWidth() > main_width)
this.$window.css('left', main_width - this.getWidth());
if (this.getTop() + this.getHeight() > main_height)
this.$window.css('top', main_height - this.getHeight());
}
function _getTransformation(end) {
return {
'-webkit-transition': '0.3s opacity',
@ -384,31 +407,9 @@ define([
Common.UI.alert = function(options) {
var me = this.Window.prototype;
var arrBtns = {ok: me.okButtonText, cancel: me.cancelButtonText,
yes: me.yesButtonText, no: me.noButtonText,
close: me.closeButtonText};
if (!options.buttons) {
options.buttons = {};
options.buttons['ok'] = {text: arrBtns['ok'], cls: 'primary'};
} else {
if (_.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
}
options.buttons = ['ok'];
}
options.dontshow = options.dontshow || false;
@ -420,14 +421,7 @@ define([
'<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' +
'</div>' +
'</div>' +
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>' +
'<% if (_.size(buttons) > 0) { %>' +
'<div class="footer <% if (dontshow) { %> dontshow <% } %>">' +
'<% for(var bt in buttons) { %>' +
'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button>'+
'<% } %>' +
'</div>' +
'<% } %>';
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>';
_.extend(options, {
cls: 'alert',
@ -485,7 +479,9 @@ define([
win.on({
'render:after': function(obj){
obj.getChild('.footer .dlg-btn').on('click', onBtnClick);
var footer = obj.getChild('.footer');
options.dontshow && footer.addClass('dontshow');
footer.find('.dlg-btn').on('click', onBtnClick);
chDontShow = new Common.UI.CheckBox({
el: win.$window.find('.dont-show-checkbox'),
labelText: win.textDontShow
@ -557,6 +553,29 @@ define([
this.initConfig = {};
this.binding = {};
var arrBtns = {ok: this.okButtonText, cancel: this.cancelButtonText,
yes: this.yesButtonText, no: this.noButtonText,
close: this.closeButtonText};
if (options.buttons && _.isArray(options.buttons)) {
if (options.primary==undefined)
options.primary = 'ok';
var newBtns = {};
_.each(options.buttons, function(b){
if (typeof(b) == 'object') {
if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom')
newBtns[b].cls += ' custom';
}
});
options.buttons = newBtns;
options.footerCls = options.footerCls || 'center';
}
_.extend(this.initConfig, config, options || {});
!this.initConfig.id && (this.initConfig.id = 'window-' + this.cid);
@ -612,9 +631,12 @@ define([
this.setResizable(this.initConfig.resizable);
var me = this;
Common.NotificationCenter.on('window:close', function() {
if (me.$window && me.isVisible()) me.close();
});
this.binding.winclose = function(obj) {
if (me.$window && me.isVisible() && me.$window == obj.$window) me.close();
};
Common.NotificationCenter.on('window:close', this.binding.winclose);
this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls);
this.fireEvent('render:after',this);
return this;
@ -623,7 +645,10 @@ define([
show: function(x,y) {
if (this.initConfig.modal) {
var mask = _getMask();
if (this.options.animate !== false) {
if (this.options.animate === false || this.options.animate && this.options.animate.mask === false) { // animate.mask = false -> don't animate mask
mask.attr('counter', parseInt(mask.attr('counter'))+1);
mask.show();
} else {
var opacity = mask.css('opacity');
mask.css('opacity', 0);
mask.attr('counter', parseInt(mask.attr('counter'))+1);
@ -632,9 +657,6 @@ define([
setTimeout(function () {
mask.css(_getTransformation(opacity));
}, 1);
} else {
mask.attr('counter', parseInt(mask.attr('counter'))+1);
mask.show();
}
Common.NotificationCenter.trigger('modal:show', this);
@ -652,6 +674,7 @@ define([
} else
if (!this.$window.is(':visible')) {
this.$window.css({opacity: 0});
_setVisible.call(this);
this.$window.show()
}
@ -704,6 +727,7 @@ define([
if ( this.initConfig.header ) {
this.$window.find('.header').off('mousedown', this.binding.dragStart);
}
Common.NotificationCenter.off({'window:close': this.binding.winclose});
if (this.initConfig.modal) {
var mask = _getMask(),

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -68,7 +68,7 @@ define([
var me = this;
Common.NotificationCenter.on('layout:changed', function(area){
Common.Utils.asyncCall(function(e) {
if ( e == 'toolbar' && me.panelChat.$el.is(':visible') ) {
if ( (e == 'toolbar' || e == 'status') && me.panelChat.$el.is(':visible') ) {
me.panelChat.updateLayout(true);
me.panelChat.setupAutoSizingTextBox();
}
@ -122,17 +122,7 @@ define([
this._isCoAuthoringStopped = true;
this.api.asc_coAuthoringDisconnect();
Common.NotificationCenter.trigger('api:disconnect');
/*
setTimeout(_.bind(function(){
Common.UI.alert({
closable: false,
title: this.notcriticalErrorTitle,
msg: this.textUserLimit,
iconCls: 'warn',
buttons: ['ok']
});
}, this), 100);
*/
return;
}
}
@ -225,7 +215,6 @@ define([
}
},
notcriticalErrorTitle: 'Warning',
textUserLimit: 'You are using ONLYOFFICE Editors free version.<br>Only two users can co-edit the document simultaneously.<br>Want more? Consider buying ONLYOFFICE Editors Pro version.<br><a href=\"http:\/\/www.onlyoffice.com\" target=\"_blank\">Read more</a>'
notcriticalErrorTitle: 'Warning'
}, Common.Controllers.Chat || {}));
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -74,7 +74,7 @@ define([
subEditStrings : {},
filter : undefined,
hintmode : false,
previewmode: false,
viewmode: false,
isSelectedComment : false,
uids : [],
oldUids : [],
@ -133,7 +133,7 @@ define([
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
Common.NotificationCenter.on('layout:changed', function(area){
Common.Utils.asyncCall(function(e) {
if ( e == 'toolbar' && this.view.$el.is(':visible') ) {
if ( (e == 'toolbar' || e == 'status') && this.view.$el.is(':visible') ) {
this.onAfterShow();
}
}, this, area);
@ -147,9 +147,11 @@ define([
this.popoverComments = new Common.Collections.Comments();
if (this.popoverComments) {
this.popoverComments.comparator = function (collection) { return -collection.get('time'); };
this.popoverComments.comparator = function (collection) { return collection.get('time'); };
}
this.groupCollection = [];
this.view = this.createView('Common.Views.Comments', { store: this.collection });
this.view.render();
@ -167,7 +169,7 @@ define([
this.currentUserName = data.config.user.fullname;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
this.hintmode = data['hintmode'] || false;
this.previewmode = data['previewmode'] || false;
this.viewmode = data['viewmode'] || false;
}
},
setApi: function (api) {
@ -192,6 +194,8 @@ define([
setMode: function(mode) {
this.mode = mode;
this.isModeChanged = true; // change show-comment mode from/to hint mode using canComments flag
this.view.viewmode = !this.mode.canComments;
this.view.changeLayout(mode);
return this;
},
//
@ -229,12 +233,12 @@ define([
this.api.asc_removeComment(id);
}
},
onResolveComment: function (uid, id) {
onResolveComment: function (uid) {
var t = this,
reply = null,
addReply = null,
ascComment = buildCommentData(), // new asc_CCommentData(null),
comment = t.findComment(uid, id);
comment = t.findComment(uid);
if (_.isUndefined(uid)) {
uid = comment.get('uid');
@ -248,6 +252,7 @@ define([
ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(!comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -277,9 +282,7 @@ define([
return false;
},
onShowComment: function (id, selected) {
if (this.previewmode) return;
var comment = this.findComment(id, undefined);
var comment = this.findComment(id);
if (comment) {
if (null !== comment.get('quote')) {
if (this.api) {
@ -295,7 +298,9 @@ define([
}
} else {
var model = this.popoverComments.findWhere({uid: id});
if (model) {
if (model && !this.getPopover().isVisible()) {
this.getPopover().showComments(true);
this.api.asc_selectComment(id);
return;
}
}
@ -340,6 +345,7 @@ define([
ascComment.asc_putUserId(t.currentUserId);
ascComment.asc_putUserName(t.currentUserName);
ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -396,6 +402,7 @@ define([
ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -458,6 +465,7 @@ define([
ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -491,6 +499,7 @@ define([
ascComment.asc_addReply(addReply);
me.api.asc_changeComment(id, ascComment);
me.mode && me.mode.canRequestUsers && me.view.pickEMail(ascComment.asc_getGuid(), replyVal);
return true;
}
@ -515,6 +524,7 @@ define([
ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -596,47 +606,40 @@ define([
if (filter) {
if (!this.view.isVisible()) {
this.view.needUpdateFilter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
return;
applyOnly = true;
}
this.view.needUpdateFilter = false;
this.filter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
var me = this,
comments = [];
this.filter.forEach(function(item){
if (!me.groupCollection[item])
me.groupCollection[item] = new Backbone.Collection([], { model: Common.Models.Comment});
comments = comments.concat(me.groupCollection[item].models);
});
this.collection.reset(comments);
this.collection.groups = this.filter;
if (!applyOnly) {
if (this.getPopover()) {
this.getPopover().hide();
}
}
this.view.needUpdateFilter = false;
var t = this, endComment = null;
this.collection.each(function (model) {
var prop = model.get(t.filter.property);
if (prop) {
model.set('hide', (null === prop.match(t.filter.value)), {silent: !!applyOnly});
var end = true;
for (var i = this.collection.length - 1; i >= 0; --i) {
if (end) {
this.collection.at(i).set('last', true, {silent: true});
} else {
if (this.collection.at(i).get('last')) {
this.collection.at(i).set('last', false, {silent: true});
}
}
end = false;
}
if (model.get('last')) {
model.set('last', false, {silent:!!applyOnly});
}
if (!model.get('hide')) {
endComment = model;
}
});
if (endComment) {
endComment.set('last', true, {silent: !!applyOnly});
}
if (!applyOnly)
this.view.render();
this.view.update();
}
}
},
onAppAddComment: function (sender, to_doc) {
@ -644,12 +647,23 @@ define([
this.addDummyComment();
},
addCommentToGroupCollection: function(comment) {
var groupname = comment.get('groupName');
if (!this.groupCollection[groupname])
this.groupCollection[groupname] = new Backbone.Collection([], { model: Common.Models.Comment});
this.groupCollection[groupname].push(comment);
},
// SDK
onApiAddComment: function (id, data) {
var comment = this.readSDKComment(id, data);
if (comment) {
this.collection.push(comment);
if (comment.get('groupName')) {
this.addCommentToGroupCollection(comment);
(_.indexOf(this.collection.groups, comment.get('groupName'))>-1) && this.collection.push(comment);
} else
this.collection.push(comment);
this.updateComments(true);
@ -668,12 +682,20 @@ define([
onApiAddComments: function (data) {
for (var i = 0; i < data.length; ++i) {
var comment = this.readSDKComment(data[i].asc_getId(), data[i]);
this.collection.push(comment);
comment.get('groupName') ? this.addCommentToGroupCollection(comment) : this.collection.push(comment);
}
this.updateComments(true);
},
onApiRemoveComment: function (id, silentUpdate) {
for (var name in this.groupCollection) {
var store = this.groupCollection[name],
model = store.findWhere({uid: id});
if (model) {
store.remove(model);
break;
}
}
if (this.collection.length) {
var model = this.collection.findWhere({uid: id});
if (model) {
@ -717,7 +739,7 @@ define([
replies = null,
repliesCount = 0,
dateReply = null,
comment = this.findComment(id);
comment = this.findComment(id) || this.findCommentInGroup(id);
if (comment) {
t = this;
@ -762,7 +784,6 @@ define([
}));
}
replies.sort(function (a,b) { return a.get('time') - b.get('time');});
comment.set('replys', replies);
if (!silentUpdate) {
@ -776,7 +797,7 @@ define([
}
},
onApiLockComment: function (id,userId) {
var cur = this.findComment(id),
var cur = this.findComment(id) || this.findCommentInGroup(id),
user = null;
if (cur) {
@ -792,7 +813,7 @@ define([
}
},
onApiUnLockComment: function (id) {
var cur = this.findComment(id);
var cur = this.findComment(id) || this.findCommentInGroup(id);
if (cur) {
cur.set('lock', false);
this.getPopover() && this.getPopover().loadText();
@ -800,11 +821,9 @@ define([
}
},
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 && same_uids) {
if (hint && this.isSelectedComment && same_uids && !this.isModeChanged) {
// хотим показать тот же коментарий что был и выбран
return;
}
@ -815,7 +834,7 @@ define([
if (popover) {
this.clearDummyComment();
if (this.isSelectedComment && same_uids) {
if (this.isSelectedComment && same_uids && !this.isModeChanged) {
//NOTE: click to sdk view ?
if (this.api) {
//this.view.txtComment.blur();
@ -831,9 +850,8 @@ define([
saveTxtReplyId = '',
comment = null,
text = '',
animate = true;
this.popoverComments.reset();
animate = true,
comments = [];
for (i = 0; i < uids.length; ++i) {
saveTxtId = uids[i];
@ -871,11 +889,15 @@ define([
this.isSelectedComment = !hint || !this.hintmode;
this.uids = _.clone(uids);
this.popoverComments.push(comment);
comments.push(comment);
if (!this._dontScrollToComment)
this.view.commentsView.scrollToRecord(comment);
this._dontScrollToComment = false;
}
comments.sort(function (a, b) {
return a.get('time') - b.get('time');
});
this.popoverComments.reset(comments);
if (popover.isVisible()) {
popover.hide();
@ -884,6 +906,7 @@ define([
popover.setLeftTop(posX, posY, leftX);
popover.showComments(animate, false, true, text);
}
this.isModeChanged = false;
},
onApiHideComment: function (hint) {
var t = this;
@ -919,8 +942,6 @@ define([
}
},
onApiUpdateCommentPosition: function (uids, posX, posY, leftX) {
if (this.previewmode) return;
var i, useAnimation = false,
comment = null,
text = undefined,
@ -937,9 +958,7 @@ define([
if (this.isModeChanged)
this.onApiShowComment(uids, posX, posY, leftX);
if (0 === this.popoverComments.length) {
this.popoverComments.reset();
var comments = [];
for (i = 0; i < uids.length; ++i) {
saveTxtId = uids[i];
saveTxtReplyId = uids[i] + '-R';
@ -956,8 +975,12 @@ define([
text = this.subEditStrings[saveTxtReplyId];
}
this.popoverComments.push(comment);
comments.push(comment);
}
comments.sort(function (a, b) {
return a.get('time') - b.get('time');
});
this.popoverComments.reset(comments);
useAnimation = true;
this.getPopover().showComments(useAnimation, undefined, undefined, text);
@ -993,12 +1016,7 @@ define([
// internal
updateComments: function (needRender, disableSort) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
return;
}
updateComments: function (needRender, disableSort, loadText) {
var me = this;
me.updateCommentsTime = new Date();
if (me.timerUpdateComments===undefined)
@ -1006,12 +1024,18 @@ define([
if ((new Date()) - me.updateCommentsTime>100) {
clearInterval(me.timerUpdateComments);
me.timerUpdateComments = undefined;
me.updateCommentsView(needRender, disableSort);
me.updateCommentsView(needRender, disableSort, loadText);
}
}, 25);
},
updateCommentsView: function (needRender, disableSort) {
updateCommentsView: function (needRender, disableSort, loadText) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
this.onUpdateFilter(this.filter, true);
return;
}
var i, end = true;
if (_.isUndefined(disableSort)) {
@ -1019,6 +1043,8 @@ define([
}
if (needRender) {
this.onUpdateFilter(this.filter, true);
for (i = this.collection.length - 1; i >= 0; --i) {
if (end) {
this.collection.at(i).set('last', true, {silent: true});
@ -1030,24 +1056,27 @@ define([
end = false;
}
this.onUpdateFilter(this.filter, true);
this.view.render();
this.view.needRender = false;
}
this.view.update();
},
findComment: function (uid, id) {
if (_.isUndefined(uid)) {
return this.collection.findWhere({id: id});
}
loadText && this.view.loadText();
},
findComment: function (uid) {
return this.collection.findWhere({uid: uid});
},
findPopupComment: function (id) {
return this.popoverComments.findWhere({id: id});
},
findCommentInGroup: function (id) {
for (var name in this.groupCollection) {
var store = this.groupCollection[name],
model = store.findWhere({uid: id});
if (model) return model;
}
},
closeEditing: function (id) {
var t = this;
@ -1102,7 +1131,9 @@ define([
if (_.isUndefined(this.popover)) {
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
commentsStore : this.popoverComments,
renderTo : this.sdkViewName
renderTo : this.sdkViewName,
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined
});
this.popover.setCommentsStore(this.popoverComments);
}
@ -1112,27 +1143,62 @@ define([
// 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});
var users = this.userCollection,
hasGroup = false;
for (var name in this.groupCollection) {
hasGroup = true;
this.groupCollection[name].each(function (model) {
var user = users.findOriginalUser(model.get('userid')),
color = (user) ? user.get('color') : null,
needrender = false;
if (color !== model.get('usercolor')) {
needrender = true;
model.set('usercolor', color, {silent: true});
}
model.get('replys').forEach(function (reply) {
user = users.findOriginalUser(reply.get('userid'));
color = (user) ? user.get('color') : null;
if (color !== reply.get('usercolor')) {
needrender = true;
reply.set('usercolor', color, {silent: true});
}
});
if (needrender)
model.trigger('change');
});
}
!hasGroup && this.collection.each(function (model) {
var user = users.findOriginalUser(model.get('userid')),
color = (user) ? user.get('color') : null,
needrender = false;
if (color !== model.get('usercolor')) {
needrender = true;
model.set('usercolor', color, {silent: true});
}
model.get('replys').forEach(function (reply) {
user = users.findOriginalUser(reply.get('userid'));
reply.set('usercolor', (user) ? user.get('color') : null, {silent: true});
color = (user) ? user.get('color') : null;
if (color !== reply.get('usercolor')) {
needrender = true;
reply.set('usercolor', color, {silent: true});
}
});
if (needrender)
model.trigger('change');
});
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 user = this.userCollection.findOriginalUser(data.asc_getUserId()),
groupname = id.substr(0, id.lastIndexOf('_')+1).match(/^(doc|sheet[0-9_]+)_/);
var comment = new Common.Models.Comment({
uid : id,
guid : data.asc_getGuid(),
userid : data.asc_getUserId(),
username : data.asc_getUserName(),
usercolor : (user) ? user.get('color') : null,
@ -1150,7 +1216,9 @@ define([
showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false),
scope : this.view,
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId),
hint : !this.mode.canComments,
groupName : (groupname && groupname.length>1) ? groupname[1] : null
});
if (comment) {
var replies = this.readSDKReplies(data);
@ -1187,10 +1255,6 @@ define([
editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)
}));
}
replies.sort(function (a, b) {
return a.get('time') - b.get('time');
});
}
return replies;
@ -1202,11 +1266,14 @@ define([
if (this.api) {
var me = this, anchor = null, date = new Date(), dialog = this.getPopover();
if (dialog) {
if (this.popoverComments.length) {
_.delay(function() {
dialog.commentsView.setFocusToTextBox();
}, 200);
return;
if (this.popoverComments.length) {// can add new comment to text with other comments
if (this.isDummyComment) {//don't hide previous dummy comment
_.delay(function() {
dialog.commentsView.setFocusToTextBox();
}, 200);
return;
} else
this.closeEditing(); // add dummy comment and close editing for existing comment
}
var user = this.userCollection.findOriginalUser(this.currentUserId);
@ -1242,8 +1309,8 @@ define([
dialog.hide();
}
dialog.handlerHide = (function () {
me.clearDummyComment();
dialog.handlerHide = (function (clear) {
me.clearDummyComment(clear);
});
anchor = this.api.asc_getAnchorPosition();
@ -1252,7 +1319,8 @@ define([
anchor.asc_getY(),
this.hintmode ? anchor.asc_getX() : undefined);
dialog.showComments(true, false, true);
Common.NotificationCenter.trigger('comments:showdummy');
dialog.showComments(true, false, true, dialog.getDummyText());
}
}
}
@ -1266,12 +1334,14 @@ define([
this.hidereply = false;
this.isSelectedComment = false;
this.uids = [];
this.isDummyComment = false;
this.popoverComments.reset();
if (this.getPopover().isVisible()) {
this.getPopover().hideComments();
}
this.isDummyComment = false;
comment.asc_putText(commentVal);
comment.asc_putTime(this.utcDateToString(new Date()));
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
@ -1284,14 +1354,14 @@ define([
this.api.asc_addComment(comment);
this.view.showEditContainer(false);
this.mode && this.mode.canRequestUsers && this.view.pickEMail(comment.asc_getGuid(), commentVal);
if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) {
this.api.asc_SetDocumentPlaceChangedEnabled(false);
}
}
}
},
clearDummyComment: function () {
clearDummyComment: function (clear) {
if (this.isDummyComment) {
this.isDummyComment = false;
@ -1303,6 +1373,9 @@ define([
var dialog = this.getPopover();
if (dialog) {
clear && dialog.clearDummyText();
dialog.saveDummyText();
dialog.handlerHide = (function () {
});
@ -1316,6 +1389,8 @@ define([
if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) {
this.api.asc_SetDocumentPlaceChangedEnabled(false);
}
Common.NotificationCenter.trigger('comments:cleardummy');
}
},
@ -1365,12 +1440,12 @@ define([
if ('none' !== panel.css('display')) {
this.view.txtComment.focus();
}
if (this.view.needRender)
this.updateComments(true);
else if (this.view.needUpdateFilter)
this.onUpdateFilter(this.view.needUpdateFilter);
this.view.update();
}
if (this.view.needRender)
this.updateComments(true);
else if (this.view.needUpdateFilter)
this.onUpdateFilter(this.view.needUpdateFilter);
this.view.update();
}
},
@ -1437,9 +1512,21 @@ define([
},
setPreviewMode: function(mode) {
this.previewmode = mode;
if (this.viewmode === mode) return;
this.viewmode = mode;
if (mode)
this.prevcanComments = this.mode.canComments;
this.mode.canComments = (mode) ? false : this.prevcanComments;
this.closeEditing();
this.setMode(this.mode);
this.updateComments(true);
if (this.getPopover())
this.getPopover().hide();
mode ? this.getPopover().hide() : this.getPopover().update(true);
},
clearCollections: function() {
this.collection.reset();
this.groupCollection = [];
}
}, Common.Controllers.Comments || {}));

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -45,6 +45,53 @@ define([
var config = {};
var app = window.AscDesktopEditor;
if ( !!app ) {
window.on_native_message = function (cmd, param) {
if (/^style:change/.test(cmd)) {
var obj = JSON.parse(param);
if ( obj.element == 'toolbar' ) {
if ( obj.action == 'off' && obj.style == 'native-color' ) {
$('.toolbar').removeClass('editor-native-color');
}
} else
if ( obj.element == 'body' ) {
if ( obj.action == 'merge' ) {
var style = document.createElement('style');
style.innerHTML = obj.style;
document.body.appendChild(style);
}
}
} else
if (/window:features/.test(cmd)) {
var obj = JSON.parse(param);
if ( obj.canUndock == 'true' ) {
if ( !config.canUndock ) {
config.canUndock = true;
if ( !_.isEmpty(config) )
Common.NotificationCenter.trigger('app:config', {canUndock:true});
}
}
} else
if (/window:status/.test(cmd)) {
var obj = JSON.parse(param);
if ( obj.action == 'undocking' ) {
Common.NotificationCenter.trigger('undock:status', {status:obj.status=='undocked'?'undocked':'docked'});
}
} else
if (/editor:config/.test(cmd)) {
if ( param == 'request' )
app.execCommand('editor:config', JSON.stringify({user: config.user, 'extraleft': $('#box-document-title #slot-btn-dt-save').parent().width()}));
}
};
app.execCommand('webapps:events', 'loading');
app.execCommand('window:features', 'request');
}
return {
init: function (opts) {
_.extend(config, opts);
@ -53,6 +100,18 @@ define([
Common.NotificationCenter.on('app:ready', function (opts) {
_.extend(config, opts);
!!app && app.execCommand('doc:onready', '');
$('.toolbar').addClass('editor-native-color');
});
Common.NotificationCenter.on('action:undocking', function (opts) {
app.execCommand('editor:event', JSON.stringify({action:'undocking', state: opts == 'dock' ? 'dock' : 'undock'}));
});
Common.NotificationCenter.on('app:face', function (mode) {
if ( config.canUndock ) {
Common.NotificationCenter.trigger('app:config', {canUndock: true});
}
});
}
},
@ -66,10 +125,21 @@ define([
if ( opts == 'preloader:hide' ) {
app.execCommand('editor:onready', '');
return true;
} else
if ( opts == 'create:new' ) {
if (config.createUrl == 'desktop://create.new') {
app.LocalFileCreate(!!window.SSE ? 2 : !!window.PE ? 1 : 0);
return true;
}
}
}
return false;
},
requestClose: function () {
if ( config.isDesktopApp && !!app ) {
app.execCommand('editor:event', JSON.stringify({action:'close', url: config.customization.goback.url}));
}
}
};
};

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -51,7 +51,8 @@ define([
var appLang = 'en',
customization = undefined,
targetApp = '',
externalEditor = null;
externalEditor = null,
isAppFirstOpened = true;
var createExternalEditor = function() {
@ -106,6 +107,11 @@ define([
if (externalEditor) {
externalEditor.serviceCommand('setAppDisabled',false);
if (isAppFirstOpened && this.diagramEditorView._isExternalDocReady) {
isAppFirstOpened = false;
this.diagramEditorView._chartData && this.setChartData();
}
if (this.needDisableEditing && this.diagramEditorView._isExternalDocReady) {
this.onDiagrammEditingDisabled();
}
@ -150,8 +156,10 @@ define([
},
setChartData: function() {
externalEditor && externalEditor.serviceCommand('setChartData', this.diagramEditorView._chartData);
this.diagramEditorView._chartData = null;
if (!isAppFirstOpened) {
externalEditor && externalEditor.serviceCommand('setChartData', this.diagramEditorView._chartData);
this.diagramEditorView._chartData = null;
}
},
loadConfig: function(data) {
@ -190,10 +198,8 @@ define([
if (this.diagramEditorView) {
if (eventData.type == 'documentReady') {
this.diagramEditorView._isExternalDocReady = true;
if (this.diagramEditorView._chartData) {
externalEditor && externalEditor.serviceCommand('setChartData', this.diagramEditorView._chartData);
this.diagramEditorView._chartData = null;
}
this.isExternalEditorVisible && (isAppFirstOpened = false);
this.diagramEditorView._chartData && this.setChartData();
if (this.needDisableEditing) {
this.onDiagrammEditingDisabled();
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -48,10 +48,10 @@ define([
'common/main/lib/collection/Fonts'
], function () { 'use strict';
Common.Controllers.Fonts = Backbone.Controller.extend((function() {
var FONT_TYPE_USERUSED = 4;
var FONT_TYPE_RECENT = 4;
function isFontSaved(store, rec) {
var out = rec.get('type') == FONT_TYPE_USERUSED,
var out = rec.get('type') == FONT_TYPE_RECENT,
i = -1,
c = store.length,
su,
@ -59,7 +59,7 @@ define([
while (!out && ++i < c) {
su = store.at(i);
if (su.get('type') != FONT_TYPE_USERUSED)
if (su.get('type') != FONT_TYPE_RECENT)
break;
out = su.get('name') == n;
@ -78,7 +78,7 @@ define([
// name: data.name,
// imgidx: data.imgidx,
// cloneid: node.querySelector('img').id,
// type: FONT_TYPE_USERUSED
// type: FONT_TYPE_RECENT
// };
// combo.getStore().insert(0,[font]);
//
@ -93,7 +93,7 @@ define([
// }
//
// font = combo.getStore().getAt(5);
// if (font.data.type==FONT_TYPE_USERUSED) {
// if (font.data.type==FONT_TYPE_RECENT) {
// combo.getStore().remove(font);
// } else {
// var plugin = combo.getPlugin('scrollpane');

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -113,7 +113,7 @@ define([
Common.Gateway.requestRestore(record.get('revision'));
else {
this.isFromSelectRevision = record.get('revision');
this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
}
return;
}
@ -152,7 +152,13 @@ define([
this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) commentsController.onApiHideComment();
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges');
if (reviewController)
reviewController.onApiShowChange();
}
},
@ -202,7 +208,13 @@ define([
this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) commentsController.onApiHideComment();
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges');
if (reviewController)
reviewController.onApiShowChange();
}
}
},

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -45,6 +45,9 @@ define([
Common.Controllers.Plugins = Backbone.Controller.extend(_.extend({
models: [],
appOptions: {},
configPlugins: {autostart:[]},// {config: 'from editor config', plugins: 'loaded plugins', UIplugins: 'loaded customization plugins', autostart: 'autostart guids'}
serverPlugins: {autostart:[]},// {config: 'from editor config', plugins: 'loaded plugins', autostart: 'autostart guids'}
collections: [
'Common.Collections.Plugins'
],
@ -63,7 +66,7 @@ define([
var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption};
me.$toolbarPanelPlugins = me.panelPlugins.getPanel();
toolbar.addTab(tab, me.$toolbarPanelPlugins, 4); // TODO: clear plugins list in left panel
toolbar.addTab(tab, me.$toolbarPanelPlugins, 10); // TODO: clear plugins list in left panel
}
}
},
@ -95,7 +98,54 @@ define([
this._moveOffset = {x:0, y:0};
this.autostart = null;
this.autostart = [];
Common.Gateway.on('init', this.loadConfig.bind(this));
Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this));
},
loadConfig: function(data) {
var me = this;
me.configPlugins.config = data.config.plugins;
me.editor = !!window.DE ? 'word' : !!window.PE ? 'slide' : 'cell';
},
loadPlugins: function() {
if (this.configPlugins.config) {
this.getPlugins(this.configPlugins.config.pluginsData)
.then(function(loaded)
{
me.configPlugins.plugins = loaded;
me.mergePlugins();
})
.catch(function(err)
{
me.configPlugins.plugins = false;
});
} else
this.configPlugins.plugins = false;
var server_plugins_url = '../../../../plugins.json',
me = this;
Common.Utils.loadConfig(server_plugins_url, function (obj) {
if ( obj != 'error' ) {
me.serverPlugins.config = obj;
me.getPlugins(me.serverPlugins.config.pluginsData)
.then(function(loaded)
{
me.serverPlugins.plugins = loaded;
me.mergePlugins();
})
.catch(function(err)
{
me.serverPlugins.plugins = false;
});
} else
me.serverPlugins.plugins = false;
});
},
onAppShowed: function (config) {
},
setApi: function(api) {
@ -106,19 +156,23 @@ define([
this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this));
this.api.asc_registerCallback("asc_onPluginMouseUp", _.bind(this.onPluginMouseUp, this));
this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this));
this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this));
this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this));
this.loadPlugins();
return this;
},
setMode: function(mode) {
if (mode.canPlugins) {
this.updatePluginsList();
}
this.appOptions = mode;
this.customPluginsComplete = !this.appOptions.canBrandingExt;
if (this.appOptions.canBrandingExt)
this.getAppCustomPlugins(this.configPlugins);
return this;
},
onAfterRender: function(panelPlugins) {
panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
panelPlugins.viewPluginsList && panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this));
this.bindViewEvents(this.panelPlugins, this.events);
var me = this;
Common.NotificationCenter.on({
@ -138,7 +192,7 @@ define([
});
},
updatePluginsList: function() {
refreshPluginsList: function() {
var me = this;
var storePlugins = this.getApplication().getCollection('Common.Collections.Plugins'),
arr = [];
@ -147,6 +201,7 @@ define([
plugin.set_Name(item.get('name'));
plugin.set_Guid(item.get('guid'));
plugin.set_BaseUrl(item.get('baseUrl'));
var variations = item.get('variations'),
variationsArr = [];
variations.forEach(function(itemVar){
@ -156,6 +211,7 @@ define([
variation.set_Icons(itemVar.get('icons'));
variation.set_Visual(itemVar.get('isVisual'));
variation.set_CustomWindow(itemVar.get('isCustomWindow'));
variation.set_System(itemVar.get('isSystem'));
variation.set_Viewer(itemVar.get('isViewer'));
variation.set_EditorsSupport(itemVar.get('EditorsSupport'));
variation.set_Modal(itemVar.get('isModal'));
@ -166,14 +222,17 @@ define([
variation.set_Buttons(itemVar.get('buttons'));
variation.set_Size(itemVar.get('size'));
variation.set_InitOnSelectionChanged(itemVar.get('initOnSelectionChanged'));
variation.set_Events(itemVar.get('events'));
variationsArr.push(variation);
});
plugin.set_Variations(variationsArr);
item.set('pluginObj', plugin);
arr.push(plugin);
});
this.api.asc_pluginsRegister('', arr);
if (storePlugins.length>0)
if (storePlugins.hasVisible())
Common.NotificationCenter.trigger('tab:visible', 'plugins', true);
},
@ -191,6 +250,7 @@ define([
onResetPlugins: function (collection) {
var me = this;
me.appOptions.canPlugins = !collection.isEmpty();
if ( me.$toolbarPanelPlugins ) {
me.$toolbarPanelPlugins.empty();
@ -215,6 +275,8 @@ define([
rank = new_rank;
});
_group.appendTo(me.$toolbarPanelPlugins);
} else {
console.error('toolbar panel isnot created');
}
},
@ -291,12 +353,13 @@ define([
this.api.asc_pluginRun(record.get('guid'), 0, '');
},
onPluginShow: function(plugin, variationIndex, frameId) {
onPluginShow: function(plugin, variationIndex, frameId, urlAddition) {
var variation = plugin.get_Variations()[variationIndex];
if (variation.get_Visual()) {
var url = variation.get_Url();
url = ((plugin.get_BaseUrl().length == 0) ? url : plugin.get_BaseUrl()) + url;
if (urlAddition)
url += urlAddition;
if (variation.get_InsideMode()) {
if (!this.panelPlugins.openInsideMode(plugin.get_Name(), url, frameId))
this.api.asc_pluginButtonClick(-1);
@ -310,7 +373,8 @@ define([
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
if (b.visible)
newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
});
}
@ -353,7 +417,7 @@ define([
else if (this.panelPlugins.iframePlugin)
this.panelPlugins.closeInsideMode();
this.panelPlugins.closedPluginMode(plugin.get_Guid());
this.runAutoStartPlugins(this.autostart);
this.runAutoStartPlugins();
},
onPluginResize: function(size, minSize, maxSize, callback ) {
@ -392,13 +456,229 @@ define([
Common.NotificationCenter.trigger('frame:mousemove', { pageX: x*Common.Utils.zoom()+this._moveOffset.x, pageY: y*Common.Utils.zoom()+this._moveOffset.y });
},
runAutoStartPlugins: function(autostart) {
if (autostart && autostart.length>0) {
var guid = autostart.shift();
this.autostart = autostart;
this.api.asc_pluginRun(guid, 0, '');
}
}
onPluginsInit: function(pluginsdata) {
!(pluginsdata instanceof Array) && (pluginsdata = pluginsdata["pluginsData"]);
this.parsePlugins(pluginsdata)
},
runAutoStartPlugins: function() {
if (this.autostart && this.autostart.length > 0) {
this.api.asc_pluginRun(this.autostart.shift(), 0, '');
}
},
resetPluginsList: function() {
this.getApplication().getCollection('Common.Collections.Plugins').reset();
},
applyUICustomization: function () {
var me = this;
return new Promise(function(resolve, reject) {
var timer_sl = setInterval(function() {
if ( me.customPluginsComplete ) {
clearInterval(timer_sl);
try {
me.configPlugins.UIplugins && me.configPlugins.UIplugins.forEach(function (c) {
if ( c.code ) eval(c.code);
});
} catch (e) {}
resolve();
}
}, 10);
});
},
parsePlugins: function(pluginsdata, uiCustomize) {
var me = this;
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = me.appOptions.isEdit,
editor = me.editor;
if ( pluginsdata instanceof Array ) {
var arr = [], arrUI = [],
lang = me.appOptions.lang.split(/[\-_]/)[0];
pluginsdata.forEach(function(item){
if ( arr.some(function(i) {
return (i.get('baseUrl') == item.baseUrl || i.get('guid') == item.guid);
}
) || pluginStore.findWhere({baseUrl: item.baseUrl}) || pluginStore.findWhere({guid: item.guid}))
{
return;
}
var variationsArr = [],
pluginVisible = false;
item.variations.forEach(function(itemVar){
var visible = (isEdit || itemVar.isViewer && (itemVar.isDisplayedInViewer!==false)) && _.contains(itemVar.EditorsSupport, editor) && !itemVar.isSystem;
if ( visible ) pluginVisible = true;
if (item.isUICustomizer ) {
visible && arrUI.push({
url: item.baseUrl + itemVar.url
});
} else {
var model = new Common.Models.PluginVariation(itemVar);
var description = itemVar.description;
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
_.each(itemVar.buttons, function(b, index){
if (typeof b.textLocale == 'object')
b.text = b.textLocale[lang] || b.textLocale['en'] || b.text || '';
b.visible = (isEdit || b.isViewer !== false);
});
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
buttons: itemVar.buttons,
visible: visible
});
variationsArr.push(model);
}
});
if (variationsArr.length > 0 && !item.isUICustomizer) {
var name = item.name;
if (typeof item.nameLocale == 'object')
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
arr.push(new Common.Models.Plugin({
name : name,
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
currentVariation: 0,
visible: pluginVisible,
groupName: (item.group) ? item.group.name : '',
groupRank: (item.group) ? item.group.rank : 0
}));
}
});
if ( uiCustomize!==false ) // from ui customizer in editor config or desktop event
me.configPlugins.UIplugins = arrUI;
if ( !uiCustomize && pluginStore)
{
arr = pluginStore.models.concat(arr);
arr.sort(function(a, b){
var rank_a = a.get('groupRank'),
rank_b = b.get('groupRank');
if (rank_a < rank_b)
return (rank_a==0) ? 1 : -1;
if (rank_a > rank_b)
return (rank_b==0) ? -1 : 1;
return 0;
});
pluginStore.reset(arr);
this.appOptions.canPlugins = !pluginStore.isEmpty();
}
}
else if (!uiCustomize){
this.appOptions.canPlugins = false;
}
if (!uiCustomize)
this.getApplication().getController('LeftMenu').enablePlugins();
if (this.appOptions.canPlugins) {
this.refreshPluginsList();
this.runAutoStartPlugins();
}
},
getPlugins: function(pluginsData, fetchFunction) {
if (!pluginsData || pluginsData.length<1)
return Promise.resolve([]);
fetchFunction = fetchFunction || function (url) {
return fetch(url)
.then(function(response) {
if ( response.ok ) return response.json();
else return Promise.reject(url);
}).then(function(json) {
json.baseUrl = url.substring(0, url.lastIndexOf("config.json"));
return json;
});
};
var loaded = [];
return pluginsData.map(fetchFunction).reduce(function (previousPromise, currentPromise) {
return previousPromise
.then(function()
{
return currentPromise;
})
.then(function(item)
{
loaded.push(item);
return Promise.resolve(item);
})
.catch(function(item)
{
return Promise.resolve(item);
});
}, Promise.resolve())
.then(function ()
{
return Promise.resolve(loaded);
});
},
mergePlugins: function() {
if (this.serverPlugins.plugins !== undefined && this.configPlugins.plugins !== undefined) { // undefined - plugins are loading
var autostart = [],
arr = [],
plugins = this.configPlugins,
warn = false;
if (plugins.plugins && plugins.plugins.length>0) {
arr = plugins.plugins;
var val = plugins.config.autostart || plugins.config.autoStartGuid;
if (typeof (val) == 'string')
val = [val];
warn = !!plugins.config.autoStartGuid;
autostart = val || [];
}
plugins = this.serverPlugins;
if (plugins.plugins && plugins.plugins.length>0) {
arr = arr.concat(plugins.plugins);
var val = plugins.config.autostart || plugins.config.autoStartGuid;
if (typeof (val) == 'string')
val = [val];
(warn || plugins.config.autoStartGuid) && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
autostart = autostart.concat(val || []);
}
this.autostart = autostart;
this.parsePlugins(arr, false);
}
},
getAppCustomPlugins: function (plugins) {
var me = this,
funcComplete = function() {me.customPluginsComplete = true;};
if ( plugins.config ) {
this.getPlugins(plugins.config.UIpluginsData)
.then(function(loaded)
{
me.parsePlugins(loaded, true);
me.getPlugins(plugins.UIplugins, function(item) {
return fetch(item.url)
.then(function(response) {
if ( response.ok ) return response.text();
else return Promise.reject();
})
.then(function(text) {
item.code = text;
return text;
});
}).then(funcComplete, funcComplete);
}, funcComplete);
} else
funcComplete();
}
}, Common.Controllers.Plugins || {}));
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -87,14 +87,13 @@ define([
if (api) {
this.api = api;
if (this.appConfig.isDesktopApp && this.appConfig.isOffline) {
if (this.appConfig.isPasswordSupport)
this.api.asc_registerCallback('asc_onDocumentPassword', _.bind(this.onDocumentPassword, this));
if (this.appConfig.canProtect) {
Common.NotificationCenter.on('protect:sign', _.bind(this.onSignatureRequest, this));
Common.NotificationCenter.on('protect:signature', _.bind(this.onSignatureClick, this));
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onSignatureSign, this));
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
}
if (this.appConfig.isSignatureSupport) {
Common.NotificationCenter.on('protect:sign', _.bind(this.onSignatureRequest, this));
Common.NotificationCenter.on('protect:signature', _.bind(this.onSignatureClick, this));
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onSignatureSign, this));
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -86,7 +86,8 @@ define([
'Common.Views.ReviewPopover': {
'reviewchange:accept': _.bind(this.onAcceptClick, this),
'reviewchange:reject': _.bind(this.onRejectClick, this),
'reviewchange:delete': _.bind(this.onDeleteClick, this)
'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:goto': _.bind(this.onGotoClick, this)
}
});
},
@ -108,6 +109,7 @@ define([
this.setApi(api);
if (data) {
this.currentUserId = data.config.user.id;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
}
},
@ -115,7 +117,7 @@ define([
if (api) {
this.api = api;
if (this.appConfig.canReview) {
if (this.appConfig.canReview || this.appConfig.canViewReview) {
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
@ -135,6 +137,19 @@ define([
if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(state, this.langs);
this.setPreviewMode(state);
},
setPreviewMode: function(mode) { //disable accept/reject in popover
if (this.viewmode === mode) return;
this.viewmode = mode;
if (mode)
this.prevcanReview = this.appConfig.canReview;
this.appConfig.canReview = (mode) ? false : this.prevcanReview;
var me = this;
this.popoverChanges && this.popoverChanges.each(function (model) {
model.set('hint', !me.appConfig.canReview);
});
},
onApiShowChange: function (sdkchange) {
@ -148,6 +163,7 @@ define([
lock = (sdkchange[0].get_LockUserId()!==null),
lockUser = this.getUserName(sdkchange[0].get_LockUserId());
this.getPopover().hideTips();
this.popoverChanges.reset(changes);
if (animate) {
@ -157,7 +173,7 @@ define([
this.getPopover().showReview(animate, lock, lockUser);
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
this.view.btnAccept.setDisabled(lock==true);
this.view.btnReject.setDisabled(lock==true);
if (this.dlgChanges) {
@ -174,6 +190,7 @@ define([
this._state.posx = this._state.posy = -1000;
this._state.changes_length = 0;
this._state.popoverVisible = false;
this.getPopover().hideTips();
this.popoverChanges.reset();
this.getPopover().hideReview();
}
@ -207,7 +224,7 @@ define([
},
getPopover: function () {
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
reviewStore : this.popoverChanges,
renderTo : this.sdkViewName
@ -224,10 +241,11 @@ define([
_.each(data, function(item) {
var changetext = '', proptext = '',
value = item.get_Value(),
movetype = item.get_MoveType(),
settings = false;
switch (item.get_Type()) {
case Asc.c_oAscRevisionsChangeType.TextAdd:
changetext = me.textInserted;
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textInserted : me.textParaMoveTo;
if (typeof value == 'object') {
_.each(value, function(obj) {
if (typeof obj === 'string')
@ -254,7 +272,7 @@ define([
}
break;
case Asc.c_oAscRevisionsChangeType.TextRem:
changetext = me.textDeleted;
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textDeleted : (item.is_MovedDown() ? me.textParaMoveFromDown : me.textParaMoveFromUp);
if (typeof value == 'object') {
_.each(value, function(obj) {
if (typeof obj === 'string')
@ -392,7 +410,15 @@ define([
changetext += '</b>';
changetext += proptext;
break;
case Asc.c_oAscRevisionsChangeType.TablePr:
changetext = me.textTableChanged;
break;
case Asc.c_oAscRevisionsChangeType.RowsAdd:
changetext = me.textTableRowsAdd;
break;
case Asc.c_oAscRevisionsChangeType.RowsRem:
changetext = me.textTableRowsDel;
break;
}
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
user = me.userCollection.findOriginalUser(item.get_UserId()),
@ -405,10 +431,13 @@ define([
changetext : changetext,
id : Common.UI.getId(),
lock : (item.get_LockUserId()!==null),
lockuser : item.get_LockUserId(),
lockuser : me.getUserName(item.get_LockUserId()),
type : item.get_Type(),
changedata : item,
scope : me.view
scope : me.view,
hint : !me.appConfig.canReview,
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
editable : (item.get_UserId() == me.currentUserId)
});
arr.push(change);
@ -489,6 +518,13 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onGotoClick: function(change) {
if (this.api) {
this.api.asc_FollowRevisionMove(change);
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onTurnPreview: function(state) {
if ( this.appConfig.isReviewOnly ) {
this.view.turnChanges(true);
@ -497,7 +533,7 @@ define([
state = (state == 'on');
this.api.asc_SetTrackRevisions(state);
Common.localStorage.setItem(this.view.appPrefix + "track-changes", state ? 1 : 0);
Common.localStorage.setItem(this.view.appPrefix + "track-changes-" + (this.appConfig.fileKey || ''), state ? 1 : 0);
this.view.turnChanges(state);
}
@ -509,21 +545,26 @@ define([
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
this.api.asc_setSpellCheck(state);
Common.Utils.InternalSettings.set("de-settings-spellcheck", state);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-spellcheck", state);
},
onReviewViewClick: function(menu, item, e) {
this.turnDisplayMode(item.value);
!this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
Common.NotificationCenter.trigger('edit:complete', this.view);
},
turnDisplayMode: function(mode) {
if (this.api) {
if (item.value === 'final')
if (mode === 'final')
this.api.asc_BeginViewModeInReview(true);
else if (item.value === 'original')
else if (mode === 'original')
this.api.asc_BeginViewModeInReview(false);
else
this.api.asc_EndViewModeInReview();
}
this.disableEditing(item.value !== 'markup');
this._state.previewMode = (item.value !== 'markup');
Common.NotificationCenter.trigger('edit:complete', this.view);
this.disableEditing(mode == 'final' || mode == 'original');
this._state.previewMode = (mode == 'final' || mode == 'original');
},
isPreviewChangesMode: function() {
@ -561,29 +602,31 @@ define([
disableEditing: function(disable) {
var app = this.getApplication();
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('Toolbar').DisableToolbar(disable, false, true);
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;
leftMenu.btnComments.setDisabled(disable);
if (disable) leftMenu.close();
if (this.appConfig.canReview) {
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
}
var comments = app.getController('Common.Controllers.Comments');
if (comments)
comments.setPreviewMode(disable);
leftMenu.getMenu('file').miProtect.setDisabled(disable);
var leftMenu = app.getController('LeftMenu');
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
leftMenu.setPreviewMode(disable);
if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(disable || this.langs.length<1);
button.setDisabled(disable || !this.langs || this.langs.length<1);
}
}, this);
}
@ -600,7 +643,7 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) )
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
me.view.turnSpelling(true);
if ( config.canReview ) {
@ -612,17 +655,9 @@ define([
me.api.asc_SetTrackRevisions(state);
};
if ( config.isReviewOnly ) {
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(true);
} else
if ( !me.api.asc_IsTrackRevisions() ) {
_setReviewStatus(false);
} else {
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(Common.localStorage.getBool(me.view.appPrefix + "track-changes"));
}
var state = config.isReviewOnly || Common.localStorage.getBool(me.view.appPrefix + "track-changes-" + (config.fileKey || ''));
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(state);
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
@ -634,6 +669,15 @@ define([
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
}
});
} else if (config.canViewReview) {
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
if (config.canViewReview) {
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
if (val===null)
val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
}
}
if (me.view && me.view.btnChat) {
@ -666,21 +710,13 @@ define([
},
onDocLanguage: function() {
var langs = _.map(this.langs, function(item){
return {
displayValue: item.title,
value: item.tip,
code: item.code
}
});
var me = this;
(new Common.Views.LanguageDialog({
languages: langs,
languages: me.langs,
current: me.api.asc_getDefaultLanguage(),
handler: function(result, tip) {
handler: function(result, value) {
if (result=='ok') {
var record = _.findWhere(langs, {'value':tip});
var record = _.findWhere(me.langs, {'value':value});
record && me.api.asc_setDefaultLanguage(record.code);
}
}
@ -755,7 +791,12 @@ define([
textEquation: 'Equation',
textImage: 'Image',
textChart: 'Chart',
textShape: 'Shape'
textShape: 'Shape',
textTableChanged: '<b>Table Settings Changed</b>',
textTableRowsAdd: '<b>Table Rows Added<b/>',
textTableRowsDel: '<b>Table Rows Deleted<b/>',
textParaMoveTo: '<b>Moved:</b>',
textParaMoveFromUp: '<b>Moved Up:</b>',
textParaMoveFromDown: '<b>Moved Down:</b>'
}, Common.Controllers.ReviewChanges || {}));
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -41,8 +41,8 @@
function onDropDownKeyDown(e) {
var $this = $(this),
$parent = $this.parent(),
beforeEvent = jQuery.Event('keydown.before.bs.dropdown'),
afterEvent = jQuery.Event('keydown.after.bs.dropdown');
beforeEvent = jQuery.Event('keydown.before.bs.dropdown', {keyCode: e.keyCode}),
afterEvent = jQuery.Event('keydown.after.bs.dropdown', {keyCode: e.keyCode});
$parent.trigger(beforeEvent);
@ -111,17 +111,9 @@ function patchDropDownKeyDown(e) {
var mnu = $('> [role=menu]', li),
$subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'),
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'),
focusIdx = 0;
if (mnu.find('> .menu-scroll').length>0) {
var offset = mnu.scrollTop();
for (var i=0; i<$subitems.length; i++) {
if ($subitems[i].offsetTop > offset) {
focusIdx = i; break;
}
}
}
if ($subitems.length>0 && $dataviews.length<1)
$subitems.eq(focusIdx).focus();
$internal_menu = mnu.find('> li:not(.divider):not(.disabled):visible ul.internal-menu');
if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1)
($subitems.index($subitems.filter(':focus'))<0) && $subitems.eq(0).focus();
}, 250);
}
} else if (e.keyCode == 37) { // left
@ -165,13 +157,25 @@ function patchDropDownKeyDownAdditional(e) { // only for formula menu when typin
if (!$items.length) return;
var index = $items.index($items.filter('.focus'));
var index = $items.index($items.filter('.focus')),
previndex = index;
if (e.keyCode == 38) { index > 0 ? index-- : ($this.hasClass('no-cyclic') ? (index = 0) : (index = $items.length - 1));} else // up
if (e.keyCode == 40) { index < $items.length - 1 ? index++ : ($this.hasClass('no-cyclic') ? (index = $items.length - 1) : (index = 0));} // down
if (!~index) index=0;
$items.removeClass('focus');
$items.eq(index).addClass('focus');
if (previndex !== index) {
var tip = $items.eq(previndex).parent().data('bs.tooltip');
if (tip) {
tip.hide();
}
tip = $items.eq(index).parent().data('bs.tooltip');
if (tip) {
tip.show();
}
}
}
function getParent($this) {

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -53,6 +53,7 @@ define([
Common.Models.Comment = Backbone.Model.extend({
defaults: {
uid : 0, // asc
guid : '',
userid : 0,
username : 'Guest',
usercolor : null,

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -55,7 +55,9 @@ define([
url: "",
index: 0,
icons: undefined,
isSystem: false,
isViewer: false,
isDisplayedInViewer: true,
EditorsSupport: ["word", "cell", "slide"],
isVisual: false,
isCustomWindow: false,

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -62,7 +62,8 @@ define([
lockuser : '',
type : 0,
changedata : null,
hint : false,
editable : false,
id : Common.UI.getId(), // internal
scope : null
}

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -0,0 +1,89 @@
From d16a11fb136ef9ff06d20810e56e4a944173c977 Mon Sep 17 00:00:00 2001
From: Julia Radzhabova
Date: Fri, 19 Apr 2019 17:54:45 +0300
Subject: [PATCH] [Common] perfect-scrollbar: set width and position for
scrollbarXRail based on margins.
---
apps/common/main/lib/mods/perfect-scrollbar.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/apps/common/main/lib/mods/perfect-scrollbar.js b/apps/common/main/lib/mods/perfect-scrollbar.js
index 9b6f650..778009d 100644
--- a/apps/common/main/lib/mods/perfect-scrollbar.js
+++ b/apps/common/main/lib/mods/perfect-scrollbar.js
@@ -95,6 +95,7 @@
scrollbarXWidth,
scrollbarXLeft,
scrollbarXBottom = parseInt($scrollbarXRail.css('bottom'), 10),
+ scrollbarXRailWidth,
scrollbarYHeight,
scrollbarYTop,
scrollbarYRight = parseInt($scrollbarYRail.css('right'), 10),
@@ -122,7 +123,7 @@
var updateContentScrollLeft = function (currentLeft, deltaX) {
var newLeft = currentLeft + deltaX,
- maxLeft = containerWidth - scrollbarXWidth;
+ maxLeft = scrollbarXRailWidth - scrollbarXWidth;
if (newLeft < 0) {
scrollbarXLeft = 0;
@@ -134,7 +135,7 @@
scrollbarXLeft = newLeft;
}
- var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth), 10);
+ var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (scrollbarXRailWidth - scrollbarXWidth), 10);
$this.scrollLeft(scrollLeft);
$scrollbarYRail.css({right: scrollbarYRight - scrollLeft});
};
@@ -147,7 +148,7 @@
};
var updateScrollbarCss = function () {
- $scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: containerWidth, display: scrollbarXActive ? "inherit": "none"});
+ $scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: scrollbarXRailWidth, display: scrollbarXActive ? "inherit": "none"});
if ($scrollbarYRail.hasClass('in-scrolling'))
$scrollbarYRail.css({/*top: $this.scrollTop(),*/ right: scrollbarYRight - $this.scrollLeft(), height: scrollbarYRailHeight, display: scrollbarYActive ? "inherit": "none"});
@@ -162,13 +163,14 @@
containerWidth = settings.includePadding ? $this.innerWidth() : $this.width();
containerHeight = settings.includePadding ? $this.innerHeight() : $this.height();
scrollbarYRailHeight = containerHeight - (settings.includeMargin ? (parseInt($scrollbarYRail.css('margin-top')) + parseInt($scrollbarYRail.css('margin-bottom'))): 0);
+ scrollbarXRailWidth = containerWidth - (settings.includeMargin ? (parseInt($scrollbarXRail.css('margin-left')) + parseInt($scrollbarXRail.css('margin-right'))): 0);
contentWidth = $this.prop('scrollWidth');
contentHeight = $this.prop('scrollHeight');
if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) {
scrollbarXActive = true;
- scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(containerWidth * containerWidth / contentWidth, 10));
- scrollbarXLeft = parseInt($this.scrollLeft() * (containerWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10);
+ scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(scrollbarXRailWidth * containerWidth / contentWidth, 10));
+ scrollbarXLeft = parseInt($this.scrollLeft() * (scrollbarXRailWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10);
}
else {
scrollbarXActive = false;
@@ -192,8 +194,8 @@
if (scrollbarYTop >= scrollbarYRailHeight - scrollbarYHeight) {
scrollbarYTop = scrollbarYRailHeight - scrollbarYHeight;
}
- if (scrollbarXLeft >= containerWidth - scrollbarXWidth) {
- scrollbarXLeft = containerWidth - scrollbarXWidth;
+ if (scrollbarXLeft >= scrollbarXRailWidth - scrollbarXWidth) {
+ scrollbarXLeft = scrollbarXRailWidth - scrollbarXWidth;
}
updateScrollbarCss();
@@ -461,7 +463,7 @@
$scrollbarXRail.bind('click' + eventClassName, function (e) {
var halfOfScrollbarLength = parseInt(scrollbarXWidth / 2, 10),
positionLeft = e.pageX - $scrollbarXRail.offset().left - halfOfScrollbarLength,
- maxPositionLeft = containerWidth - scrollbarXWidth,
+ maxPositionLeft = scrollbarXRailWidth - scrollbarXWidth,
positionRatio = positionLeft / maxPositionLeft;
if (positionRatio < 0) {
--
2.6.1.windows.1

View file

@ -95,6 +95,7 @@
scrollbarXWidth,
scrollbarXLeft,
scrollbarXBottom = parseInt($scrollbarXRail.css('bottom'), 10),
scrollbarXRailWidth,
scrollbarYHeight,
scrollbarYTop,
scrollbarYRight = parseInt($scrollbarYRail.css('right'), 10),
@ -122,7 +123,7 @@
var updateContentScrollLeft = function (currentLeft, deltaX) {
var newLeft = currentLeft + deltaX,
maxLeft = containerWidth - scrollbarXWidth;
maxLeft = scrollbarXRailWidth - scrollbarXWidth;
if (newLeft < 0) {
scrollbarXLeft = 0;
@ -134,7 +135,7 @@
scrollbarXLeft = newLeft;
}
var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth), 10);
var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (scrollbarXRailWidth - scrollbarXWidth), 10);
$this.scrollLeft(scrollLeft);
$scrollbarYRail.css({right: scrollbarYRight - scrollLeft});
};
@ -147,7 +148,7 @@
};
var updateScrollbarCss = function () {
$scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: containerWidth, display: scrollbarXActive ? "inherit": "none"});
$scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: scrollbarXRailWidth, display: scrollbarXActive ? "inherit": "none"});
if ($scrollbarYRail.hasClass('in-scrolling'))
$scrollbarYRail.css({/*top: $this.scrollTop(),*/ right: scrollbarYRight - $this.scrollLeft(), height: scrollbarYRailHeight, display: scrollbarYActive ? "inherit": "none"});
@ -162,13 +163,14 @@
containerWidth = settings.includePadding ? $this.innerWidth() : $this.width();
containerHeight = settings.includePadding ? $this.innerHeight() : $this.height();
scrollbarYRailHeight = containerHeight - (settings.includeMargin ? (parseInt($scrollbarYRail.css('margin-top')) + parseInt($scrollbarYRail.css('margin-bottom'))): 0);
scrollbarXRailWidth = containerWidth - (settings.includeMargin ? (parseInt($scrollbarXRail.css('margin-left')) + parseInt($scrollbarXRail.css('margin-right'))): 0);
contentWidth = $this.prop('scrollWidth');
contentHeight = $this.prop('scrollHeight');
if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) {
scrollbarXActive = true;
scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(containerWidth * containerWidth / contentWidth, 10));
scrollbarXLeft = parseInt($this.scrollLeft() * (containerWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10);
scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(scrollbarXRailWidth * containerWidth / contentWidth, 10));
scrollbarXLeft = parseInt($this.scrollLeft() * (scrollbarXRailWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10);
}
else {
scrollbarXActive = false;
@ -192,8 +194,8 @@
if (scrollbarYTop >= scrollbarYRailHeight - scrollbarYHeight) {
scrollbarYTop = scrollbarYRailHeight - scrollbarYHeight;
}
if (scrollbarXLeft >= containerWidth - scrollbarXWidth) {
scrollbarXLeft = containerWidth - scrollbarXWidth;
if (scrollbarXLeft >= scrollbarXRailWidth - scrollbarXWidth) {
scrollbarXLeft = scrollbarXRailWidth - scrollbarXWidth;
}
updateScrollbarCss();
@ -461,7 +463,7 @@
$scrollbarXRail.bind('click' + eventClassName, function (e) {
var halfOfScrollbarLength = parseInt(scrollbarXWidth / 2, 10),
positionLeft = e.pageX - $scrollbarXRail.offset().left - halfOfScrollbarLength,
maxPositionLeft = containerWidth - scrollbarXWidth,
maxPositionLeft = scrollbarXRailWidth - scrollbarXWidth,
positionRatio = positionLeft / maxPositionLeft;
if (positionRatio < 0) {

View file

@ -10,7 +10,7 @@
<% if (quote!==null && quote!=='') { %>
<div class="user-quote"><%=scope.getFixedQuote(quote)%></div>
<% } %>
<% if (!editText) { %>
<% if (!editText || scope.viewmode) { %>
<div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>
<% } else { %>
<div class="inner-edit-ct">
@ -24,20 +24,22 @@
<% if (replys.length) { %>
<div class="reply-arrow img-commonctrl"></div>
<% _.each(replys, function (item) { %>
<div class="reply-item-ct">
<% _.each(replys, function (item, index) { %>
<div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>
<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>
<% if (!scope.viewmode) { %>
<div class="btns-reply-ct">
<% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
<% } %>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div>
</div>
<%}%>
<% } else { %>
<div class="inner-edit-ct">
<textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>
@ -51,7 +53,7 @@
<!-- add reply button -->
<% if (!showReply) { %>
<% if (!showReply && !scope.viewmode) { %>
<% if (replys.length) { %>
<label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>
<% } else { %>
@ -61,12 +63,12 @@
<!-- edit buttons -->
<% if (!editText && !lock) { %>
<% if (!editText && !lock && !scope.viewmode) { %>
<div class="edit-ct">
<% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<div class="btn-delete img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>
<% } else { %>

View file

@ -10,7 +10,7 @@
<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>
<textarea class="msg-reply user-select" maxlength="maxCommLength" spellcheck="false" <% if (!!dummy) { %> placeholder="textMention"<% } %>><%=comment%></textarea>
<% if (hideAddReply) { %>
<button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textAdd</button>
<% } else { %>
@ -36,13 +36,13 @@
<div class="btns-reply-ct">
<% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
<%}%>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div>
<%}%>
<% } else { %>
<div class="inner-edit-ct">
<textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>
<textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength" spellcheck="false"><%=item.get("reply")%></textarea>
<button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change-popover">textEdit</button>
<button class="btn normal dlg-btn btn-inner-close">textClose</button>
</div>
@ -68,8 +68,8 @@
<div class="edit-ct">
<% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<div class="btn-delete img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>
<% } else { %>
@ -82,7 +82,7 @@
<% if (showReplyInPopover) { %>
<div class="reply-ct">
<textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength"></textarea>
<textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength" spellcheck="false"></textarea>
<button class="btn normal dlg-btn primary btn-reply" id="id-comments-change-popover">textReply</button>
<button class="btn normal dlg-btn btn-close">textClose</button>
</div>

View file

@ -5,11 +5,22 @@
<div class="user-date"><%=date%></div>
<div class="user-message limit-height"><%=changetext%></div>
<div class="edit-ct">
<% if (scope.appConfig.isReviewOnly) { %>
<div class="btn-delete img-commonctrl"></div>
<% } else { %>
<div class="btn-accept img-commonctrl"></div>
<div class="btn-reject img-commonctrl"></div>
<% if (goto) { %>
<div class="btn-goto img-commonctrl"></div>
<% } %>
<% if (!hint) { %>
<% if (scope.appConfig.isReviewOnly) { %>
<% if (editable) { %>
<div class="btn-delete img-commonctrl"></div>
<% } %>
<% } else { %>
<div class="btn-accept img-commonctrl"></div>
<div class="btn-reject img-commonctrl"></div>
<% } %>
<% } %>
</div>
<% if (!hint && lock) { %>
<div class="lock-area" style="cursor: default;"></div>
<div class="lock-author" style="cursor: default;"><%=lockuser%></div>
<% } %>
</div>

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -45,399 +45,401 @@ if (Common === undefined) {
Common.util = Common.util||{};
Common.util.LanguageInfo = new(function() {
var localLanguageName = {
var localLanguageName = { // code: [short-name, native-name, english-name] - fill 3 field when need to add language to editor interface
0x0036 : ["af", "Afrikaans"],
0x0436 : ["af-ZA", "Afrikaans (Suid Afrika)"],
0x0436 : ["af-ZA", "Afrikaans (Suid Afrika)", "Afrikaans (South Africa)"],
0x001C : ["sq", "Shqipe"],
0x041C : ["sq-AL", "Shqipe (Shqipëria)"],
0x041C : ["sq-AL", "Shqipe (Shqipëria)", "Albanian (Albania)"],
0x0084 : ["gsw", "Elsässisch"],
0x0484 : ["gsw-FR", "Elsässisch (Frànkrisch)"],
0x0484 : ["gsw-FR", "Elsässisch (Frànkrisch)", "Alsatian (France)"],
0x005E : ["am", "አማርኛ"],
0x045E : ["am-ET", "አማርኛ (ኢትዮጵያ)"],
0x045E : ["am-ET", "አማርኛ (ኢትዮጵያ)", "Amharic (Ethiopia)"],
0x0001 : ["ar", "العربية‏"],
0x1401 : ["ar-DZ", "العربية (الجزائر)"],
0x3C01 : ["ar-BH", "العربية (البحرين)"],
0x0C01 : ["ar-EG", "العربية (مصر)"],
0x0801 : ["ar-IQ", "العربية (العراق)"],
0x2C01 : ["ar-JO", "العربية (الأردن)"],
0x3401 : ["ar-KW", "العربية (الكويت)"],
0x3001 : ["ar-LB", "العربية (لبنان)"],
0x1001 : ["ar-LY", "العربية (ليبيا)"],
0x1801 : ["ar-MA", "العربية (المملكة المغربية)"],
0x2001 : ["ar-OM", "العربية (عمان)"],
0x4001 : ["ar-QA", "العربية (قطر)"],
0x0401 : ["ar-SA", "العربية (المملكة العربية السعودية)"],
0x2801 : ["ar-SY", "العربية (سوريا)"],
0x1C01 : ["ar-TN", "العربية (تونس)"],
0x3801 : ["ar-AE", "العربية (الإمارات العربية المتحدة)"],
0x2401 : ["ar-YE", "العربية (اليمن)"],
0x1401 : ["ar-DZ", "العربية (الجزائر)", "Arabic (Algeria)"],
0x3C01 : ["ar-BH", "العربية (البحرين)", "Arabic (Bahrain)"],
0x0C01 : ["ar-EG", "العربية (مصر)", "Arabic (Egypt)"],
0x0801 : ["ar-IQ", "العربية (العراق)", "Arabic (Iraq)"],
0x2C01 : ["ar-JO", "العربية (الأردن)", "Arabic (Jordan)"],
0x3401 : ["ar-KW", "العربية (الكويت)", "Arabic (Kuwait)"],
0x3001 : ["ar-LB", "العربية (لبنان)", "Arabic (Lebanon)"],
0x1001 : ["ar-LY", "العربية (ليبيا)", "Arabic (Libya)"],
0x1801 : ["ar-MA", "العربية (المملكة المغربية)", "Arabic (Morocco)"],
0x2001 : ["ar-OM", "العربية (عمان)", "Arabic (Oman)"],
0x4001 : ["ar-QA", "العربية (قطر)", "Arabic (Qatar)"],
0x0401 : ["ar-SA", "العربية (المملكة العربية السعودية)", "Arabic (Saudi Arabia)"],
0x2801 : ["ar-SY", "العربية (سوريا)", "Arabic (Syria)"],
0x1C01 : ["ar-TN", "العربية (تونس)", "Arabic (Tunisia)"],
0x3801 : ["ar-AE", "العربية (الإمارات العربية المتحدة)", "Arabic (U.A.E.)"],
0x2401 : ["ar-YE", "العربية (اليمن)", "Arabic (Yemen)"],
0x002B : ["hy", "Հայերեն"],
0x042B : ["hy-AM", "Հայերեն (Հայաստան)"],
0x042B : ["hy-AM", "Հայերեն (Հայաստան)", "Armenian (Armenia)"],
0x004D : ["as", "অসমীয়া"],
0x044D : ["as-IN", "অসমীয়া (ভাৰত)"],
0x044D : ["as-IN", "অসমীয়া (ভাৰত)", "Assamese (India)"],
0x002C : ["az", "Azərbaycan­ılı"],
0x742C : ["az-Cyrl", "Азәрбајҹан дили"],
0x082C : ["az-Cyrl-AZ", "Азәрбајҹан (Азәрбајҹан)"],
0x082C : ["az-Cyrl-AZ", "Азәрбајҹан (Азәрбајҹан)", "Azeri (Cyrillic, Azerbaijan)"],
0x782C : ["az-Latn", "Azərbaycan­ılı"],
0x042C : ["az-Latn-AZ", "Azərbaycan­ılı (Azərbaycan)"],
0x042C : ["az-Latn-AZ", "Azərbaycan­ılı (Azərbaycan)", "Azeri (Latin, Azerbaijan)"],
0x006D : ["ba", "Башҡорт"],
0x046D : ["ba-RU", "Башҡорт (Россия)"],
0x046D : ["ba-RU", "Башҡорт (Россия)", "Bashkir (Russia)"],
0x002D : ["eu", "Euskara"],
0x042D : ["eu-ES", "Euskara (Euskara)"],
0x042D : ["eu-ES", "Euskara (Euskara)", "Basque (Basque)"],
0x0023 : ["be", "Беларускі"],
0x0423 : ["be-BY", "Беларускі (Беларусь)"],
0x0423 : ["be-BY", "Беларускі (Беларусь)", "Belarusian (Belarus)"],
0x0045 : ["bn", "বাংলা"],
0x0845 : ["bn-BD", "বাংলা (বাংলাদেশ)"],
0x0445 : ["bn-IN", "বাংলা (ভারত)"],
0x0845 : ["bn-BD", "বাংলা (বাংলাদেশ)", "Bengali (Bangladesh)"],
0x0445 : ["bn-IN", "বাংলা (ভারত)", "Bengali (India)"],
0x781A : ["bs", "bosanski"],
0x641A : ["bs-Cyrl", "Босански (Ћирилица)"],
0x201A : ["bs-Cyrl-BA", "Босански (Босна и Херцеговина)"],
0x201A : ["bs-Cyrl-BA", "Босански (Босна и Херцеговина)", "Bosnian (Cyrillic) (Bosnia and Herzegovina)"],
0x681A : ["bs-Latn", "Bosanski (Latinica)"],
0x141A : ["bs-Latn-BA", "Bosanski (Bosna i Hercegovina)"],
0x141A : ["bs-Latn-BA", "Bosanski (Bosna i Hercegovina)", "Bosnian (Latin) (Bosnia and Herzegovina)"],
0x007E : ["br", "Brezhoneg"],
0x047E : ["br-FR", "Brezhoneg (Frañs)"],
0x047E : ["br-FR", "Brezhoneg (Frañs)", "Breton (France)"],
0x0002 : ["bg", "Български"],
0x0402 : ["bg-BG", "Български (България)"],
0x0402 : ["bg-BG", "Български (България)", "Bulgarian (Bulgaria)"],
0x0003 : ["ca", "Català"],
0x0403 : ["ca-ES", "Català (Català)"],
0x0803 : ["ca-ES-valencia", "Català (Valencià)"],
0x0403 : ["ca-ES", "Català (Català)", "Catalan (Catalan)"],
0x0803 : ["ca-ES-valencia", "Català (Valencià)", "Catalan (Valencia)"],
0x7804 : ["zh", "中文"],
0x0004 : ["zh-Hans", "中文(简体)"],
0x0804 : ["zh-CN", "中文(中华人民共和国)"],
0x1004 : ["zh-SG", "中文(新加坡)"],
0x7C04 : ["zh-Hant", "中文(繁體)"],
0x0C04 : ["zh-HK", "中文(香港特別行政區)"],
0x1404 : ["zh-MO", "中文(澳門特別行政區)"],
0x0404 : ["zh-TW", "中文(台灣)"],
0x0004 : ["zh-Hans", "中文(简体)", "Chinese (Simplified)"],
0x0804 : ["zh-CN", "中文(中华人民共和国)", "Chinese (People's Republic of China)"],
0x1004 : ["zh-SG", "中文(新加坡)", "Chinese (Simplified, Singapore)"],
0x7C04 : ["zh-Hant", "中文(繁體)", "Chinese (Traditional)"],
0x0C04 : ["zh-HK", "中文(香港特別行政區)", "Chinese (Traditional, Hong Kong S.A.R.)"],
0x1404 : ["zh-MO", "中文(澳門特別行政區)", "Chinese (Traditional, Macao S.A.R.)"],
0x0404 : ["zh-TW", "中文(台灣)", "Chinese (Traditional, Taiwan)"],
0x0083 : ["co", "Corsu"],
0x0483 : ["co-FR", "Corsu (France)"],
0x0483 : ["co-FR", "Corsu (France)", "Corsican (France)"],
0x001A : ["hr", "Hrvatski"],
0x041A : ["hr-HR", "Hrvatski (Hrvatska)"],
0x101A : ["hr-BA", "Hrvatski (Bosna i Hercegovina)"],
0x041A : ["hr-HR", "Hrvatski (Hrvatska)", "Croatian (Croatia)"],
0x101A : ["hr-BA", "Hrvatski (Bosna i Hercegovina)", "Croatian (Bosnia and Herzegovina)"],
0x0005 : ["cs", "Čeština"],
0x0405 : ["cs-CZ", "Čeština (Česká republika)"],
0x0405 : ["cs-CZ", "Čeština (Česká republika)", "Czech (Czech Republic)"],
0x0006 : ["da", "Dansk"],
0x0406 : ["da-DK", "Dansk (Danmark)"],
0x0406 : ["da-DK", "Dansk (Danmark)", "Danish (Denmark)"],
0x008C : ["prs", "درى‏"],
0x048C : ["prs-AF", "درى (افغانستان)"],
0x048C : ["prs-AF", "درى (افغانستان)", "Dari (Afghanistan)"],
0x0065 : ["dv", "ދިވެހިބަސް‏"],
0x0465 : ["dv-MV", "ދިވެހިބަސް (ދިވެހި ރާއްޖެ)"],
0x0465 : ["dv-MV", "ދިވެހިބަސް (ދިވެހި ރާއްޖެ)", "Divehi (Maldives)"],
0x0013 : ["nl", "Nederlands"],
0x0813 : ["nl-BE", "Nederlands (België)"],
0x0413 : ["nl-NL", "Nederlands (Nederland)"],
0x0813 : ["nl-BE", "Nederlands (België)", "Dutch (Belgium)"],
0x0413 : ["nl-NL", "Nederlands (Nederland)", "Dutch (Netherlands)"],
0x0009 : ["en", "English"],
0x0C09 : ["en-AU", "English (Australia)"],
0x2809 : ["en-BZ", "English (Belize)"],
0x1009 : ["en-CA", "English (Canada)"],
0x2409 : ["en-029", "English (Caribbean)"],
0x4009 : ["en-IN", "English (India)"],
0x1809 : ["en-IE", "English (Ireland)"],
0x2009 : ["en-JM", "English (Jamaica)"],
0x4409 : ["en-MY", "English (Malaysia)"],
0x1409 : ["en-NZ", "English (New Zealand)"],
0x3409 : ["en-PH", "English (Philippines)"],
0x4809 : ["en-SG", "English (Singapore)"],
0x1C09 : ["en-ZA", "English (South Africa)"],
0x2C09 : ["en-TT", "English (Trinidad y Tobago)"],
0x0809 : ["en-GB", "English (United Kingdom)"],
0x0409 : ["en-US", "English (United States)"],
0x3009 : ["en-ZW", "English (Zimbabwe)"],
0x3c09 : ["en-HK", "English (Hong Kong)"],
0x3809 : ["en-ID", "English (Indonesia)"],
0x0C09 : ["en-AU", "English (Australia)", "English (Australia)"],
0x2809 : ["en-BZ", "English (Belize)", "English (Belize)"],
0x1009 : ["en-CA", "English (Canada)", "English (Canada)"],
0x2409 : ["en-029", "English (Caribbean)", "English (Caribbean)"],
0x4009 : ["en-IN", "English (India)", "English (India)"],
0x1809 : ["en-IE", "English (Ireland)", "English (Ireland)"],
0x2009 : ["en-JM", "English (Jamaica)", "English (Jamaica)"],
0x4409 : ["en-MY", "English (Malaysia)", "English (Malaysia)"],
0x1409 : ["en-NZ", "English (New Zealand)", "English (New Zealand)"],
0x3409 : ["en-PH", "English (Philippines)", "English (Philippines)"],
0x4809 : ["en-SG", "English (Singapore)", "English (Singapore)"],
0x1C09 : ["en-ZA", "English (South Africa)", "English (South Africa)"],
0x2C09 : ["en-TT", "English (Trinidad y Tobago)", "English (Trinidad y Tobago)"],
0x0809 : ["en-GB", "English (United Kingdom)", "English (United Kingdom)"],
0x0409 : ["en-US", "English (United States)", "English (United States)"],
0x3009 : ["en-ZW", "English (Zimbabwe)", "English (Zimbabwe)"],
0x3c09 : ["en-HK", "English (Hong Kong)", "English (Hong Kong)"],
0x3809 : ["en-ID", "English (Indonesia)", "English (Indonesia)"],
0x0025 : ["et", "Eesti"],
0x0425 : ["et-EE", "Eesti (Eesti)"],
0x0425 : ["et-EE", "Eesti (Eesti)", "Estonian (Estonia)"],
0x0038 : ["fo", "Føroyskt"],
0x0438 : ["fo-FO", "Føroyskt (Føroyar)"],
0x0438 : ["fo-FO", "Føroyskt (Føroyar)", "Faroese (Faroe Islands)"],
0x0064 : ["fil", "Filipino"],
0x0464 : ["fil-PH", "Filipino (Pilipinas)"],
0x0464 : ["fil-PH", "Filipino (Pilipinas)", "Filipino (Philippines)"],
0x000B : ["fi", "Suomi"],
0x040B : ["fi-FI", "Suomi (Suomi)"],
0x040B : ["fi-FI", "Suomi (Suomi)", "Finnish (Finland)"],
0x000C : ["fr", "Français"],
0x080C : ["fr-BE", "Français (Belgique)"],
0x0C0C : ["fr-CA", "Français (Canada)"],
0x040C : ["fr-FR", "Français (France)"],
0x140C : ["fr-LU", "Français (Luxembourg)"],
0x180C : ["fr-MC", "Français (Principauté de Monaco)"],
0x100C : ["fr-CH", "Français (Suisse)"],
0x3c0c : ["fr-HT", "French (Haiti)"],
0x240c : ["fr-CG", "French (Congo)"],
0x300c : ["fr-CI", "French (Cote d'Ivoire)"],
0x2c0c : ["fr-CM", "French (Cameroon)"],
0x380c : ["fr-MA", "French (Morocco)"],
0x340c : ["fr-ML", "French (Mali)"],
0x200c : ["fr-RE", "French (Reunion)"],
0x280c : ["fr-SN", "French (Senegal)"],
0x080C : ["fr-BE", "Français (Belgique)", "French (Belgium)"],
0x0C0C : ["fr-CA", "Français (Canada)", "French (Canada)"],
0x040C : ["fr-FR", "Français (France)", "French (France)"],
0x140C : ["fr-LU", "Français (Luxembourg)", "French (Luxembourg)"],
0x180C : ["fr-MC", "Français (Principauté de Monaco)", "French (Principality of Monaco)"],
0x100C : ["fr-CH", "Français (Suisse)", "French (Switzerland)"],
0x3c0c : ["fr-HT", "Français (Haïti)", "French (Haiti)"],
0x240c : ["fr-CG", "Français (Congo-Brazzaville)", "French (Congo)"],
0x300c : ["fr-CI", "Français (Côte dIvoire)", "French (Cote d'Ivoire)"],
0x2c0c : ["fr-CM", "Français (Cameroun)", "French (Cameroon)"],
0x380c : ["fr-MA", "Français (Maroc)", "French (Morocco)"],
0x340c : ["fr-ML", "Français (Mali)", "French (Mali)"],
0x200c : ["fr-RE", "Français (La Réunion)", "French (Reunion)"],
0x280c : ["fr-SN", "Français (Sénégal)", "French (Senegal)"],
0x1c0c : ["fr-West", "French"],
0x0062 : ["fy", "Frysk"],
0x0462 : ["fy-NL", "Frysk (Nederlân)"],
0x0462 : ["fy-NL", "Frysk (Nederlân)", "Frisian (Netherlands)"],
0x0056 : ["gl", "Galego"],
0x0456 : ["gl-ES", "Galego (Galego)"],
0x0456 : ["gl-ES", "Galego (Galego)", "Galician (Galician)"],
0x0037 : ["ka", "ქართული"],
0x0437 : ["ka-GE", "ქართული (საქართველო)"],
0x0437 : ["ka-GE", "ქართული (საქართველო)", "Georgian (Georgia)"],
0x0007 : ["de", "Deutsch"],
0x0C07 : ["de-AT", "Deutsch (Österreich)"],
0x0407 : ["de-DE", "Deutsch (Deutschland)"],
0x1407 : ["de-LI", "Deutsch (Liechtenstein)"],
0x1007 : ["de-LU", "Deutsch (Luxemburg)"],
0x0807 : ["de-CH", "Deutsch (Schweiz)"],
0x0C07 : ["de-AT", "Deutsch (Österreich)", "German (Austria)"],
0x0407 : ["de-DE", "Deutsch (Deutschland)", "German (Germany)"],
0x1407 : ["de-LI", "Deutsch (Liechtenstein)", "German (Liechtenstein)"],
0x1007 : ["de-LU", "Deutsch (Luxemburg)", "German (Luxembourg)"],
0x0807 : ["de-CH", "Deutsch (Schweiz)", "German (Switzerland)"],
0x0008 : ["el", "Ελληνικά"],
0x0408 : ["el-GR", "Ελληνικά (Ελλάδα)"],
0x0408 : ["el-GR", "Ελληνικά (Ελλάδα)", "Greek (Greece)"],
0x006F : ["kl", "Kalaallisut"],
0x046F : ["kl-GL", "Kalaallisut (Kalaallit Nunaat)"],
0x046F : ["kl-GL", "Kalaallisut (Kalaallit Nunaat)", "Greenlandic (Greenland)"],
0x0047 : ["gu", "ગુજરાતી"],
0x0447 : ["gu-IN", "ગુજરાતી (ભારત)"],
0x0447 : ["gu-IN", "ગુજરાતી (ભારત)", "Gujarati (India)"],
0x0068 : ["ha", "Hausa"],
0x7C68 : ["ha-Latn", "Hausa (Latin)"],
0x0468 : ["ha-Latn-NG", "Hausa (Nigeria)"],
0x0468 : ["ha-Latn-NG", "Hausa (Nigeria)", "Hausa (Latin) (Nigeria)"],
0x000D : ["he", "עברית‏"],
0x040D : ["he-IL", "עברית (ישראל)"],
0x040D : ["he-IL", "עברית (ישראל)", "Hebrew (Israel)"],
0x0039 : ["hi", "हिंदी"],
0x0439 : ["hi-IN", "हिंदी (भारत)"],
0x0439 : ["hi-IN", "हिंदी (भारत)", "Hindi (India)"],
0x000E : ["hu", "Magyar"],
0x040E : ["hu-HU", "Magyar (Magyarország)"],
0x040E : ["hu-HU", "Magyar (Magyarország)", "Hungarian (Hungary)"],
0x000F : ["is", "Íslenska"],
0x040F : ["is-IS", "Íslenska (Ísland)"],
0x040F : ["is-IS", "Íslenska (Ísland)", "Icelandic (Iceland)"],
0x0070 : ["ig", "Igbo"],
0x0470 : ["ig-NG", "Igbo (Nigeria)"],
0x0470 : ["ig-NG", "Igbo (Nigeria)", "Igbo (Nigeria)"],
0x0021 : ["id", "Bahasa Indonesia"],
0x0421 : ["id-ID", "Bahasa Indonesia (Indonesia)"],
0x0421 : ["id-ID", "Bahasa Indonesia (Indonesia)", "Indonesian (Indonesia)"],
0x005D : ["iu", "Inuktitut"],
0x7C5D : ["iu-Latn", "Inuktitut (Qaliujaaqpait)"],
0x085D : ["iu-Latn-CA", "Inuktitut"],
0x085D : ["iu-Latn-CA", "Inuktitut (Kanatami) (kanata)", "Inuktitut (Latin) (Canada)"],
0x785D : ["iu-Cans", "ᐃᓄᒃᑎᑐᑦ (ᖃᓂᐅᔮᖅᐸᐃᑦ)"],
0x045D : ["iu-Cans-CA", "ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)"],
0x045D : ["iu-Cans-CA", "ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)", "Inuktitut (Canada)"],
0x003C : ["ga", "Gaeilge"],
0x083C : ["ga-IE", "Gaeilge (Éire)"],
0x083C : ["ga-IE", "Gaeilge (Éire)", "Irish (Ireland)"],
0x0034 : ["xh", "isiXhosa"],
0x0434 : ["xh-ZA", "isiXhosa (uMzantsi Afrika)"],
0x0434 : ["xh-ZA", "isiXhosa (uMzantsi Afrika)", "isiXhosa (South Africa)"],
0x0035 : ["zu", "isiZulu"],
0x0435 : ["zu-ZA", "isiZulu (iNingizimu Afrika)"],
0x0435 : ["zu-ZA", "isiZulu (iNingizimu Afrika)", "isiZulu (South Africa)"],
0x0010 : ["it", "Italiano"],
0x0410 : ["it-IT", "Italiano (Italia)"],
0x0810 : ["it-CH", "Italiano (Svizzera)"],
0x0410 : ["it-IT", "Italiano (Italia)", "Italian (Italy)"],
0x0810 : ["it-CH", "Italiano (Svizzera)", "Italian (Switzerland)"],
0x0011 : ["ja", "日本語"],
0x0411 : ["ja-JP", "日本語 (日本)"],
0x0411 : ["ja-JP", "日本語 (日本)", "Japanese (Japan)"],
0x004B : ["kn", "ಕನ್ನಡ"],
0x044B : ["kn-IN", "ಕನ್ನಡ (ಭಾರತ)"],
0x044B : ["kn-IN", "ಕನ್ನಡ (ಭಾರತ)", "Kannada (India)"],
0x003F : ["kk", "Қазақ"],
0x043F : ["kk-KZ", "Қазақ (Қазақстан)"],
0x043F : ["kk-KZ", "Қазақ (Қазақстан)", "Kazakh (Kazakhstan)"],
0x0053 : ["km", "ខ្មែរ"],
0x0453 : ["km-KH", "ខ្មែរ (កម្ពុជា)"],
0x0453 : ["km-KH", "ខ្មែរ (កម្ពុជា)", "Khmer (Cambodia)"],
0x0086 : ["qut", "K'iche"],
0x0486 : ["qut-GT", "K'iche (Guatemala)"],
0x0486 : ["qut-GT", "K'iche (Guatemala)", "K'iche (Guatemala)"],
0x0087 : ["rw", "Kinyarwanda"],
0x0487 : ["rw-RW", "Kinyarwanda (Rwanda)"],
0x0487 : ["rw-RW", "Kinyarwanda (Rwanda)", "Kinyarwanda (Rwanda)"],
0x0041 : ["sw", "Kiswahili"],
0x0441 : ["sw-KE", "Kiswahili (Kenya)"],
0x0441 : ["sw-KE", "Kiswahili (Kenya)", "Kiswahili (Kenya)"],
0x0057 : ["kok", "कोंकणी"],
0x0457 : ["kok-IN", "कोंकणी (भारत)"],
0x0457 : ["kok-IN", "कोंकणी (भारत)", "Konkani (India)"],
0x0012 : ["ko", "한국어"],
0x0412 : ["ko-KR", "한국어 (대한민국)"],
0x0412 : ["ko-KR", "한국어 (대한민국)", "Korean (Korea)"],
0x0040 : ["ky", "Кыргыз"],
0x0440 : ["ky-KG", "Кыргыз (Кыргызстан)"],
0x0440 : ["ky-KG", "Кыргыз (Кыргызстан)", "Kyrgyz (Kyrgyzstan)"],
0x0054 : ["lo", "ລາວ"],
0x0454 : ["lo-LA", "ລາວ (ສ.ປ.ປ. ລາວ)"],
0x0454 : ["lo-LA", "ລາວ (ສ.ປ.ປ. ລາວ)", "Lao (Lao P.D.R.)"],
0x0026 : ["lv", "Latviešu"],
0x0426 : ["lv-LV", "Latviešu (Latvija)"],
0x0426 : ["lv-LV", "Latviešu (Latvija)", "Latvian (Latvia)"],
0x0027 : ["lt", "Lietuvių"],
0x0427 : ["lt-LT", "Lietuvių (Lietuva)"],
0x0427 : ["lt-LT", "Lietuvių (Lietuva)", "Lithuanian (Lithuania)"],
0x7C2E : ["dsb", "Dolnoserbšćina"],
0x082E : ["dsb-DE", "Dolnoserbšćina (Nimska)"],
0x082E : ["dsb-DE", "Dolnoserbšćina (Nimska)", "Lower Sorbian (Germany)"],
0x006E : ["lb", "Lëtzebuergesch"],
0x046E : ["lb-LU", "Lëtzebuergesch (Luxembourg)"],
0x042F : ["mk-MK", "Македонски јазик (Македонија)"],
0x046E : ["lb-LU", "Lëtzebuergesch (Luxembourg)", "Luxembourgish (Luxembourg)"],
0x042F : ["mk-MK", "Македонски јазик (Македонија)", "Macedonian (Former Yugoslav Republic of Macedonia)"],
0x002F : ["mk", "Македонски јазик"],
0x003E : ["ms", "Bahasa Melayu"],
0x083E : ["ms-BN", "Bahasa Melayu (Brunei Darussalam)"],
0x043E : ["ms-MY", "Bahasa Melayu (Malaysia)"],
0x083E : ["ms-BN", "Bahasa Melayu (Brunei Darussalam)", "Malay (Brunei Darussalam)"],
0x043E : ["ms-MY", "Bahasa Melayu (Malaysia)", "Malay (Malaysia)"],
0x004C : ["ml", "മലയാളം"],
0x044C : ["ml-IN", "മലയാളം (ഭാരതം)"],
0x044C : ["ml-IN", "മലയാളം (ഭാരതം)", "Malayalam (India)"],
0x003A : ["mt", "Malti"],
0x043A : ["mt-MT", "Malti (Malta)"],
0x043A : ["mt-MT", "Malti (Malta)", "Maltese (Malta)"],
0x0081 : ["mi", "Reo Māori"],
0x0481 : ["mi-NZ", "Reo Māori (Aotearoa)"],
0x0481 : ["mi-NZ", "Reo Māori (Aotearoa)", "Maori (New Zealand)"],
0x007A : ["arn", "Mapudungun"],
0x047A : ["arn-CL", "Mapudungun (Chile)"],
0x047A : ["arn-CL", "Mapudungun (Chile)", "Mapudungun (Chile)"],
0x004E : ["mr", "मराठी"],
0x044E : ["mr-IN", "मराठी (भारत)"],
0x044E : ["mr-IN", "मराठी (भारत)", "Marathi (India)"],
0x007C : ["moh", "Kanien'kéha"],
0x047C : ["moh-CA", "Kanien'kéha"],
0x047C : ["moh-CA", "Kanien'kéha (Canada)", "Mohawk (Canada)"],
0x0050 : ["mn", "Монгол хэл"],
0x7850 : ["mn-Cyrl", "Монгол хэл"],
0x0450 : ["mn-MN", "Монгол хэл (Монгол улс)"],
0x0450 : ["mn-MN", "Монгол хэл (Монгол улс)", "Mongolian (Cyrillic, Mongolia)"],
0x7C50 : ["mn-Mong", "ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ"],
0x0850 : ["mn-Mong-CN", "ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)"],
0x0850 : ["mn-Mong-CN", "ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)", "Mongolian (Traditional Mongolian) (People's Republic of China)"],
0x0061 : ["ne", "नेपाली"],
0x0461 : ["ne-NP", "नेपाली (नेपाल)"],
0x0461 : ["ne-NP", "नेपाली (नेपाल)", "Nepali (Nepal)"],
0x0861 : ["ne-IN", "नेपाली (भारत)", "Nepali (India)"],
0x0014 : ["no", "Norsk"],
0x7C14 : ["nb", "Norsk (bokmål)"],
0x0414 : ["nb-NO", "Norsk, bokmål (Norge)", "Norwegian, Bokmål (Norway)"],
0x7814 : ["nn", "Norsk (Nynorsk)"],
0x0414 : ["nb-NO", "Norsk, bokmål (Norge)"],
0x0814 : ["nn-NO", "Norsk, nynorsk (Noreg)"],
0x0814 : ["nn-NO", "Norsk, nynorsk (Noreg)", "Norwegian, Nynorsk (Norway)"],
0x0082 : ["oc", "Occitan"],
0x0482 : ["oc-FR", "Occitan (França)"],
0x0482 : ["oc-FR", "Occitan (França)", "Occitan (France)"],
0x0048 : ["or", "ଓଡ଼ିଆ"],
0x0448 : ["or-IN", "ଓଡ଼ିଆ (ଭାରତ)"],
0x0448 : ["or-IN", "ଓଡ଼ିଆ (ଭାରତ)", "Oriya (India)"],
0x0063 : ["ps", "پښتو‏"],
0x0463 : ["ps-AF", "پښتو (افغانستان)"],
0x0463 : ["ps-AF", "پښتو (افغانستان)", "Pashto (Afghanistan)"],
0x0029 : ["fa", "فارسى‏"],
0x0429 : ["fa-IR", "فارسى (ایران)"],
0x0429 : ["fa-IR", "فارسى (ایران)", "Persian (Iran)"],
0x0015 : ["pl", "Polski"],
0x0415 : ["pl-PL", "Polski (Polska)"],
0x0415 : ["pl-PL", "Polski (Polska)", "Polish (Poland)"],
0x0016 : ["pt", "Português"],
0x0416 : ["pt-BR", "Português (Brasil)"],
0x0816 : ["pt-PT", "Português (Portugal)"],
0x0416 : ["pt-BR", "Português (Brasil)", "Portuguese (Brazil)"],
0x0816 : ["pt-PT", "Português (Portugal)", "Portuguese (Portugal)"],
0x0046 : ["pa", "ਪੰਜਾਬੀ"],
0x0446 : ["pa-IN", "ਪੰਜਾਬੀ (ਭਾਰਤ)"],
0x0446 : ["pa-IN", "ਪੰਜਾਬੀ (ਭਾਰਤ)", "Punjabi (India)"],
0x006B : ["quz", "Runasimi"],
0x046B : ["quz-BO", "Runasimi (Qullasuyu)"],
0x086B : ["quz-EC", "Runasimi (Ecuador)"],
0x0C6B : ["quz-PE", "Runasimi (Piruw)"],
0x046B : ["quz-BO", "Runasimi (Qullasuyu)", "Quechua (Bolivia)"],
0x086B : ["quz-EC", "Runasimi (Ecuador)", "Quechua (Ecuador)"],
0x0C6B : ["quz-PE", "Runasimi (Piruw)", "Quechua (Peru)"],
0x0018 : ["ro", "Română"],
0x0418 : ["ro-RO", "Română (România)"],
0x0818 : ["ro-MD", "Română (Moldova)"],
0x0418 : ["ro-RO", "Română (România)", "Romanian (Romania)"],
0x0818 : ["ro-MD", "Română (Moldova)", "Romanian (Republic of Moldova)"],
0x0017 : ["rm", "Rumantsch"],
0x0417 : ["rm-CH", "Rumantsch (Svizra)"],
0x0417 : ["rm-CH", "Rumantsch (Svizra)", "Romansh (Switzerland)"],
0x0019 : ["ru", "Русский"],
0x0419 : ["ru-RU", "Русский (Россия)"],
0x0819 : ["ru-MD", "Русский (Молдавия)"],
0x0419 : ["ru-RU", "Русский (Россия)", "Russian (Russia)"],
0x0819 : ["ru-MD", "Русский (Молдавия)", "Russian (Republic of Moldova)"],
0x703B : ["smn", "Sämikielâ"],
0x243B : ["smn-FI", "Sämikielâ (Suomâ)", "Sami (Inari) (Finland)"],
0x7C3B : ["smj", "Julevusámegiella"],
0x103B : ["smj-NO", "Julevusámegiella (Vuodna)", "Sami (Lule) (Norway)"],
0x143B : ["smj-SE", "Julevusámegiella (Svierik)", "Sami (Lule) (Sweden)"],
0x003B : ["se", "Davvisámegiella"],
0x0C3B : ["se-FI", "Davvisámegiella (Suopma)", "Sami (Northern) (Finland)"],
0x043B : ["se-NO", "Davvisámegiella (Norga)", "Sami (Northern) (Norway)"],
0x083B : ["se-SE", "Davvisámegiella (Ruoŧŧa)", "Sami (Northern) (Sweden)"],
0x743B : ["sms", "Sääm´ǩiõll"],
0x203B : ["sms-FI", "Sääm´ǩiõll (Lää´ddjânnam)", "Sami (Skolt) (Finland)"],
0x783B : ["sma", "åarjelsaemiengiele"],
0x243B : ["smn-FI", "Sämikielâ (Suomâ)"],
0x103B : ["smj-NO", "Julevusámegiella (Vuodna)"],
0x143B : ["smj-SE", "Julevusámegiella (Svierik)"],
0x0C3B : ["se-FI", "Davvisámegiella (Suopma)"],
0x043B : ["se-NO", "Davvisámegiella (Norga)"],
0x083B : ["se-SE", "Davvisámegiella (Ruoŧŧa)"],
0x203B : ["sms-FI", "Sääm´ǩiõll (Lää´ddjânnam)"],
0x183B : ["sma-NO", "åarjelsaemiengiele (Nöörje)"],
0x1C3B : ["sma-SE", "åarjelsaemiengiele (Sveerje)"],
0x183B : ["sma-NO", "åarjelsaemiengiele (Nöörje)", "Sami (Southern) (Norway)"],
0x1C3B : ["sma-SE", "åarjelsaemiengiele (Sveerje)", "Sami (Southern) (Sweden)"],
0x004F : ["sa", "संस्कृत"],
0x044F : ["sa-IN", "संस्कृत (भारतम्)"],
0x044F : ["sa-IN", "संस्कृत (भारतम्)", "Sanskrit (India)"],
0x0091 : ["gd", "Gàidhlig"],
0x0491 : ["gd-GB", "Gàidhlig (An Rìoghachd Aonaichte)"],
0x0491 : ["gd-GB", "Gàidhlig (An Rìoghachd Aonaichte)", "Scottish Gaelic (United Kingdom)"],
0x7C1A : ["sr", "Srpski"],
0x6C1A : ["sr-Cyrl", "Српски (Ћирилица)"],
0x1C1A : ["sr-Cyrl-BA", "Српски (Босна и Херцеговина)"],
0x301A : ["sr-Cyrl-ME", "Српски (Црна Гора)"],
0x0C1A : ["sr-Cyrl-CS", "Српски (Србија и Црна Гора (Претходно))"],
0x281A : ["sr-Cyrl-RS", "Српски (Србија)"],
0x1C1A : ["sr-Cyrl-BA", "Српски (Босна и Херцеговина)", "Serbian (Cyrillic) (Bosnia and Herzegovina)"],
0x301A : ["sr-Cyrl-ME", "Српски (Црна Гора)", "Serbian (Cyrillic, Montenegro)"],
0x0C1A : ["sr-Cyrl-CS", "Српски (Србија и Црна Гора (Претходно))", "Serbian (Cyrillic, Serbia and Montenegro (Former))"],
0x281A : ["sr-Cyrl-RS", "Српски (Србија)", "Serbian (Cyrillic, Serbia)"],
0x701A : ["sr-Latn", "Srpski (Latinica)"],
0x181A : ["sr-Latn-BA", "Srpski (Bosna i Hercegovina)"],
0x2C1A : ["sr-Latn-ME", "Srpski (Crna Gora)"],
0x081A : ["sr-Latn-CS", "Srpski (Srbija i Crna Gora (Prethodno))"],
0x241A : ["sr-Latn-RS", "Srpski (Srbija, Latinica)"],
0x181A : ["sr-Latn-BA", "Srpski (Bosna i Hercegovina)", "Serbian (Latin, Bosnia and Herzegovina)"],
0x2C1A : ["sr-Latn-ME", "Srpski (Crna Gora)", "Serbian (Latin, Montenegro)"],
0x081A : ["sr-Latn-CS", "Srpski (Srbija i Crna Gora (Prethodno))", "Serbian (Latin, Serbia and Montenegro (Former))"],
0x241A : ["sr-Latn-RS", "Srpski (Srbija, Latinica)", "Serbian (Latin, Serbia)"],
0x006C : ["nso", "Sesotho sa Leboa"],
0x046C : ["nso-ZA", "Sesotho sa Leboa (Afrika Borwa)"],
0x046C : ["nso-ZA", "Sesotho sa Leboa (Afrika Borwa)", "Sesotho sa Leboa (South Africa)"],
0x0032 : ["tn", "Setswana"],
0x0432 : ["tn-ZA", "Setswana (Aforika Borwa)"],
0x0432 : ["tn-ZA", "Setswana (Aforika Borwa)", "Setswana (South Africa)"],
0x005B : ["si", "සිංහ"],
0x045B : ["si-LK", "සිංහ (ශ්‍රී ලංකා)"],
0x045B : ["si-LK", "සිංහ (ශ්‍රී ලංකා)", "Sinhala (Sri Lanka)"],
0x001B : ["sk", "Slovenčina"],
0x041B : ["sk-SK", "Slovenčina (Slovenská republika)"],
0x041B : ["sk-SK", "Slovenčina (Slovenská republika)", "Slovak (Slovakia)"],
0x0024 : ["sl", "Slovenski"],
0x0424 : ["sl-SI", "Slovenski (Slovenija)"],
0x0424 : ["sl-SI", "Slovenski (Slovenija)", "Slovenian (Slovenia)"],
0x000A : ["es", "Español"],
0x2C0A : ["es-AR", "Español (Argentina)"],
0x400A : ["es-BO", "Español (Bolivia)"],
0x340A : ["es-CL", "Español (Chile)"],
0x240A : ["es-CO", "Español (Colombia)"],
0x140A : ["es-CR", "Español (Costa Rica)"],
0x1C0A : ["es-DO", "Español (República Dominicana)"],
0x300A : ["es-EC", "Español (Ecuador)"],
0x440A : ["es-SV", "Español (El Salvador)"],
0x100A : ["es-GT", "Español (Guatemala)"],
0x480A : ["es-HN", "Español (Honduras)"],
0x080A : ["es-MX", "Español (México)"],
0x4C0A : ["es-NI", "Español (Nicaragua)"],
0x180A : ["es-PA", "Español (Panamá)"],
0x3C0A : ["es-PY", "Español (Paraguay)"],
0x280A : ["es-PE", "Español (Perú)"],
0x500A : ["es-PR", "Español (Puerto Rico)"],
0x0C0A : ["es-ES", "Español (España, alfabetización internacional)"],
0x540A : ["es-US", "Español (Estados Unidos)"],
0x380A : ["es-UY", "Español (Uruguay)"],
0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)"],
0x2C0A : ["es-AR", "Español (Argentina)", "Spanish (Argentina)"],
0x400A : ["es-BO", "Español (Bolivia)", "Spanish (Bolivia)"],
0x340A : ["es-CL", "Español (Chile)", "Spanish (Chile)"],
0x240A : ["es-CO", "Español (Colombia)", "Spanish (Colombia)"],
0x140A : ["es-CR", "Español (Costa Rica)", "Spanish (Costa Rica)"],
0x1C0A : ["es-DO", "Español (República Dominicana)", "Spanish (Dominican Republic)"],
0x300A : ["es-EC", "Español (Ecuador)", "Spanish (Ecuador)"],
0x440A : ["es-SV", "Español (El Salvador)", "Spanish (El Salvador)"],
0x100A : ["es-GT", "Español (Guatemala)", "Spanish (Guatemala)"],
0x480A : ["es-HN", "Español (Honduras)", "Spanish (Honduras)"],
0x080A : ["es-MX", "Español (México)", "Spanish (Mexico)"],
0x4C0A : ["es-NI", "Español (Nicaragua)", "Spanish (Nicaragua)"],
0x180A : ["es-PA", "Español (Panamá)", "Spanish (Panama)"],
0x3C0A : ["es-PY", "Español (Paraguay)", "Spanish (Paraguay)"],
0x280A : ["es-PE", "Español (Perú)", "Spanish (Peru)"],
0x500A : ["es-PR", "Español (Puerto Rico)", "Spanish (Puerto Rico)"],
0x0C0A : ["es-ES", "Español (España, alfabetización internacional)", "Spanish (Spain)"],
0x540A : ["es-US", "Español (Estados Unidos)", "Spanish (United States)"],
0x380A : ["es-UY", "Español (Uruguay)", "Spanish (Uruguay)"],
0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)", "Spanish (Venezuela)"],
0x040a : ["es-ES_tradnl", "Spanish"],
0x580a : ["es-419", "Español (América Latina y el Caribe)", "Spanish (Latin America and the Caribbean)"],
0x5C0a : ["es-CU", "Español (Cuba)", "Spanish (Cuba)"],
0x001D : ["sv", "Svenska"],
0x081D : ["sv-FI", "Svenska (Finland)"],
0x041D : ["sv-SE", "Svenska (Sverige)"],
0x081D : ["sv-FI", "Svenska (Finland)", "Swedish (Finland)"],
0x041D : ["sv-SE", "Svenska (Sverige)", "Swedish (Sweden)"],
0x005A : ["syr", "ܣܘܪܝܝܐ‏"],
0x045A : ["syr-SY", "ܣܘܪܝܝܐ (سوريا)"],
0x045A : ["syr-SY", "ܣܘܪܝܝܐ (سوريا)", "Syriac (Syria)"],
0x0028 : ["tg", "Тоҷикӣ"],
0x7C28 : ["tg-Cyrl", "Тоҷикӣ"],
0x0428 : ["tg-Cyrl-TJ", "Тоҷикӣ (Тоҷикистон)"],
0x0428 : ["tg-Cyrl-TJ", "Тоҷикӣ (Тоҷикистон)", "Tajik (Cyrillic) (Tajikistan)"],
0x005F : ["tzm", "Tamazight"],
0x7C5F : ["tzm-Latn", "Tamazight (Latin)"],
0x085F : ["tzm-Latn-DZ", "Tamazight (Djazaïr)"],
0x085F : ["tzm-Latn-DZ", "Tamazight (Djazaïr)", "Tamazight (Latin) (Algeria)"],
0x0049 : ["ta", "தமிழ்"],
0x0449 : ["ta-IN", "தமிழ் (இந்தியா)"],
0x0449 : ["ta-IN", "தமிழ் (இந்தியா)", "Tamil (India)"],
0x0044 : ["tt", "Татар"],
0x0444 : ["tt-RU", "Татар (Россия)"],
0x0444 : ["tt-RU", "Татар (Россия)", "Tatar (Russia)"],
0x004A : ["te", "తెలుగు"],
0x044A : ["te-IN", "తెలుగు (భారత దేశం)"],
0x044A : ["te-IN", "తెలుగు (భారత దేశం)", "Telugu (India)"],
0x001E : ["th", "ไทย"],
0x041E : ["th-TH", "ไทย (ไทย)"],
0x041E : ["th-TH", "ไทย (ไทย)", "Thai (Thailand)"],
0x0051 : ["bo", "བོད་ཡིག"],
0x0451 : ["bo-CN", "བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)"],
0x0451 : ["bo-CN", "བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)", "Tibetan (People's Republic of China)"],
0x0851 : ["bo-BT", "Tibetan (Bhutan)", "Tibetan (Bhutan)"],
0x001F : ["tr", "Türkçe"],
0x041F : ["tr-TR", "Türkçe (Türkiye)"],
0x041F : ["tr-TR", "Türkçe (Türkiye)", "Turkish (Turkey)"],
0x0042 : ["tk", "Türkmençe"],
0x0442 : ["tk-TM", "Türkmençe (Türkmenistan)"],
0x0442 : ["tk-TM", "Türkmençe (Türkmenistan)", "Turkmen (Turkmenistan)"],
0x0022 : ["uk", "Українська"],
0x0422 : ["uk-UA", "Українська (Україна)"],
0x0422 : ["uk-UA", "Українська (Україна)", "Ukrainian (Ukraine)"],
0x002E : ["hsb", "Hornjoserbšćina"],
0x042E : ["hsb-DE", "Hornjoserbšćina (Němska)"],
0x042E : ["hsb-DE", "Hornjoserbšćina (Němska)", "Upper Sorbian (Germany)"],
0x0020 : ["ur", "اُردو‏"],
0x0420 : ["ur-PK", "اُردو (پاکستان)"],
0x0420 : ["ur-PK", "اُردو (پاکستان)", "Urdu (Islamic Republic of Pakistan)"],
0x0820 : ["ur-IN", "اُردو (بھارت)", "Urdu (India)"],
0x0080 : ["ug", "ئۇيغۇر يېزىقى‏"],
0x0480 : ["ug-CN", "(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى‏"],
0x0480 : ["ug-CN", "(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى‏", "Uighur (People's Republic of China)"],
0x7843 : ["uz-Cyrl", "Ўзбек"],
0x0843 : ["uz-Cyrl-UZ", "Ўзбек (Ўзбекистон)"],
0x0843 : ["uz-Cyrl-UZ", "Ўзбек (Ўзбекистон)", "Uzbek (Cyrillic, Uzbekistan)"],
0x0043 : ["uz", "U'zbek"],
0x7C43 : ["uz-Latn", "U'zbek"],
0x0443 : ["uz-Latn-UZ", "U'zbek (U'zbekiston Respublikasi)"],
0x0443 : ["uz-Latn-UZ", "U'zbek (U'zbekiston Respublikasi)", "Uzbek (Latin, Uzbekistan)"],
0x002A : ["vi", "Tiếng Việt"],
0x042A : ["vi-VN", "Tiếng Việt (Việt Nam)"],
0x042A : ["vi-VN", "Tiếng Việt (Việt Nam)", "Vietnamese (Vietnam)"],
0x0052 : ["cy", "Cymraeg"],
0x0452 : ["cy-GB", "Cymraeg (y Deyrnas Unedig)"],
0x0452 : ["cy-GB", "Cymraeg (y Deyrnas Unedig)", "Welsh (United Kingdom)"],
0x0088 : ["wo", "Wolof"],
0x0488 : ["wo-SN", "Wolof (Sénégal)"],
0x0488 : ["wo-SN", "Wolof (Sénégal)", "Wolof (Senegal)"],
0x0085 : ["sah", "Саха"],
0x0485 : ["sah-RU", "Саха (Россия)"],
0x0485 : ["sah-RU", "Саха (Россия)", "Yakut (Russia)"],
0x0078 : ["ii", "ꆈꌠꁱꂷ"],
0x0478 : ["ii-CN", "ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)"],
0x0478 : ["ii-CN", "ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)", "Yi (People's Republic of China)"],
0x006A : ["yo", "Yoruba"],
0x046A : ["yo-NG", "Yoruba (Nigeria)"],
0x0851 : ["bo-BT", "Tibetan (Bhutan)"],
0x0466 : ["bin-NG", "Bini (Nigeria)"],
0x045c : ["chr-US", "Cherokee (United States)"],
0x0467 : ["fuv-NG", "Nigerian Fulfulde (Nigeria)"],
0x0472 : ["gaz-ET", "West Central Oromo (Ethiopia)"],
0x0474 : ["gn-PY", "Guarani (Paraguay)"],
0x0475 : ["haw-US", "Hawaiian (United States)"],
0x0469 : ["ibb-NG", "Ibibio (Nigeria)"],
0x0471 : ["kr-NG", "Kanuri (Nigeria)"],
0x0458 : ["mni", "Manipuri"],
0x0455 : ["my-MM", "Burmese (Myanmar)"],
0x0861 : ["ne-IN", "Nepali (India)"],
0x0479 : ["pap-AN", "Papiamento, Netherlands Antilles"],
0x0846 : ["pa-PK", "Panjabi (Pakistan)"],
0x048d : ["plt-MG", "Plateau Malagasy (Madagascar)"],
0x0459 : ["sd-IN", "Sindhi (India)"],
0x0859 : ["sd-PK", "Sindhi (Pakistan)"],
0x0477 : ["so-SO", "Somali (Somalia)"],
0x0430 : ["st-ZA", "Southern Sotho (South Africa)"],
0x0473 : ["ti-ER", "Tigrinya (Eritrea)"],
0x0873 : ["ti-ET", "Tigrinya (Ethiopia)"],
0x046A : ["yo-NG", "Yoruba (Nigeria)", "Yoruba (Nigeria)"],
0x0466 : ["bin-NG", "Bini (Nigeria)", "Bini (Nigeria)"],
0x045c : ["chr-US", "ᏣᎳᎩ (ᏌᏊ ᎢᏳᎾᎵᏍᏔᏅ ᏍᎦᏚᎩ)", "Cherokee (United States)"],
0x0467 : ["fuv-NG", "Nigerian Fulfulde (Nigeria)", "Nigerian Fulfulde (Nigeria)"],
0x0472 : ["gaz-ET", "West Central Oromo (Ethiopia)", "West Central Oromo (Ethiopia)"],
0x0474 : ["gn-PY", "Guarani (Paraguay)", "Guarani (Paraguay)"],
0x0475 : ["haw-US", "ʻŌlelo Hawaiʻi (ʻAmelika Hui Pū ʻIa)", "Hawaiian (United States)"],
0x0469 : ["ibb-NG", "Ibibio (Nigeria)", "Ibibio (Nigeria)"],
0x0471 : ["kr-NG", "Kanuri (Nigeria)", "Kanuri (Nigeria)"],
0x0458 : ["mni", "Manipuri", "Manipuri"],
0x0455 : ["my-MM", "Burmese (Myanmar)", "Burmese (Myanmar)"],
0x0479 : ["pap-AN", "Papiamento, Netherlands Antilles", "Papiamento, Netherlands Antilles"],
0x0846 : ["pa-PK", "Panjabi (Pakistan)", "Panjabi (Pakistan)"],
0x048d : ["plt-MG", "Plateau Malagasy (Madagascar)", "Plateau Malagasy (Madagascar)"],
0x0459 : ["sd-IN", "Sindhi (India)", "Sindhi (India)"],
0x0859 : ["sd-PK", "Sindhi (Pakistan)", "Sindhi (Pakistan)"],
0x0477 : ["so-SO", "Soomaali (Soomaaliya)", "Somali (Somalia)"],
0x0430 : ["st-ZA", "Southern Sotho (South Africa)", "Southern Sotho (South Africa)"],
0x0473 : ["ti-ER", "ትግርኛ (ኤርትራ)", "Tigrinya (Eritrea)"],
0x0873 : ["ti-ET", "ትግርኛ (ኢትዮጵያ)", "Tigrinya (Ethiopia)"],
0x045f : ["tmz", "Tamanaku"],
0x0c5f : ["tmz-MA", "Tamanaku (Morocco)"],
0x0431 : ["ts-ZA", "Tsonga (South Africa)"],
0x0820 : ["ur-IN", "Urdu (India)"],
0x0433 : ["ven-ZA", "South Africa"]
0x0c5f : ["tmz-MA", "Tamaziɣt n laṭlaṣ (Meṛṛuk)", "Tamanaku (Morocco)"],
0x0431 : ["ts-ZA", "Tsonga (South Africa)", "Tsonga (South Africa)"],
0x0433 : ["ven-ZA", "South Africa", "South Africa"]
};
return {
@ -446,11 +448,17 @@ Common.util.LanguageInfo = new(function() {
},
getLocalLanguageCode: function(name) {
for (var code in localLanguageName) {
if (localLanguageName[code][0].toLowerCase()===name.toLowerCase())
return code;
if (name) {
for (var code in localLanguageName) {
if (localLanguageName[code][0].toLowerCase()===name.toLowerCase())
return code;
}
}
return null;
},
getLanguages: function() {
return localLanguageName;
}
}
})();

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -127,15 +127,12 @@
if (this.hasContent() && this.enabled && !this.dontShow) {
if (!this.$element.is(":visible") && this.$element.closest('[role=menu]').length>0) return;
var $tip = this.tip();
var placement = typeof this.options.placement === 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement;
if (this.options.arrow === false) $tip.addClass('arrow-free');
if (this.options.cls) $tip.addClass(this.options.cls);
var placementEx = /^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(placement);
if (!at && !placementEx[2].length) {
var placementEx = (typeof this.options.placement !== 'function') ? /^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(this.options.placement) : null;
if (!at && placementEx && !placementEx[2].length) {
_superclass.prototype.show.apply(this, arguments);
} else {
var e = $.Event('show.bs.tooltip');
@ -152,7 +149,9 @@
this.options.container ?
$tip.appendTo(this.options.container) : $tip.insertAfter(this.$element);
if (typeof at == 'object') {
if (typeof this.options.placement === 'function') {
this.options.placement.call(this, $tip[0], this.$element[0]);
} else if (typeof at == 'object') {
var tp = {top: at[1] + 15, left: at[0] + 18},
innerWidth = Common.Utils.innerWidth(),
innerHeight = Common.Utils.innerHeight();

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -87,11 +87,12 @@ Common.Utils = _.extend(new(function() {
isSecure = /^https/i.test(window.location.protocol),
emailRe = /^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,
ipRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
hostnameRe = /^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
localRe = /^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,
emailStrongRe = /(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
emailAddStrongRe = /(mailto:|\s[@]|\s[+])?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%\+-=\?:&]*)/ig,
ipStrongRe = /(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,
hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/\+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
documentSettingsType = {
Paragraph : 0,
Table : 1,
@ -106,6 +107,13 @@ Common.Utils = _.extend(new(function() {
Pivot : 10,
Cell : 11
},
importTextType = {
DRM: 0,
CSV: 1,
TXT: 2,
Paste: 3,
Columns: 4
},
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,
checkSize = function() {
@ -201,9 +209,11 @@ Common.Utils = _.extend(new(function() {
hostnameRe: hostnameRe,
localRe: localRe,
emailStrongRe: emailStrongRe,
emailAddStrongRe: emailAddStrongRe,
ipStrongRe: ipStrongRe,
hostnameStrongRe: hostnameStrongRe,
documentSettingsType: documentSettingsType,
importTextType: importTextType,
zoom: function() {return me.zoom;},
innerWidth: function() {return me.innerWidth;},
innerHeight: function() {return me.innerHeight;}
@ -535,6 +545,8 @@ Common.Utils.String = new (function() {
return {
format: function(format) {
var args = _.toArray(arguments).slice(1);
if (args.length && typeof args[0] == 'object')
args = args[0];
return format.replace(/\{(\d+)\}/g, function(s, i) {
return args[i];
});
@ -587,6 +599,7 @@ Common.Utils.isBrowserSupported = function() {
};
Common.Utils.showBrowserRestriction = function() {
if (document.getElementsByClassName && document.getElementsByClassName('app-error-panel').length>0) return;
var editor = (window.DE ? 'Document' : window.SSE ? 'Spreadsheet' : window.PE ? 'Presentation' : 'that');
var newDiv = document.createElement("div");
newDiv.innerHTML = '<div class="app-error-panel">' +
@ -634,20 +647,22 @@ Common.Utils.applyCustomizationPlugins = function(plugins) {
var _createXMLHTTPObject = function() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
if (typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
} else {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
}
return xmlhttp;
};
@ -674,33 +689,26 @@ Common.Utils.applyCustomizationPlugins = function(plugins) {
Common.Utils.fillUserInfo = function(info, lang, defname) {
var _user = info || {};
!_user.id && (_user.id = ('uid-' + Date.now()));
if (_.isEmpty(_user.name)) {
_.isEmpty(_user.firstname) && _.isEmpty(_user.lastname) && (_user.firstname = defname);
if (_.isEmpty(_user.firstname))
_user.fullname = _user.lastname;
else if (_.isEmpty(_user.lastname))
_user.fullname = _user.firstname;
else
_user.fullname = /^ru/.test(lang) ? _user.lastname + ' ' + _user.firstname : _user.firstname + ' ' + _user.lastname;
} else
_user.fullname = _user.name;
_user.fullname = _.isEmpty(_user.name) ? defname : _user.name;
return _user;
};
Common.Utils.createXhr = function () {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
if (typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
} else {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
}
return xmlhttp;
@ -722,21 +730,18 @@ Common.Utils.getConfigJson = function (url) {
return null;
};
Common.Utils.getConfigJson = function (url) {
if ( url ) {
try {
var xhrObj = Common.Utils.createXhr();
if ( xhrObj ) {
xhrObj.open('GET', url, false);
xhrObj.send('');
Common.Utils.loadConfig = function(url, callback) {
"use strict";
return JSON.parse(xhrObj.responseText);
}
} catch (e) {}
}
return null;
}
fetch(url)
.then(function(response){
if ( response.ok )
return response.json();
else return 'error';
}).then(function(json){
callback(json);
});
};
Common.Utils.asyncCall = function (callback, scope, args) {
(new Promise(function (resolve, reject) {
@ -772,6 +777,117 @@ Common.Utils.InternalSettings = new(function() {
}
});
Common.Utils.lockControls = function(causes, lock, opts, defControls) {
!opts && (opts = {});
var controls = opts.array || defControls;
opts.merge && (controls = _.union(defControls,controls));
function doLock(cmp, cause) {
if ( cmp && _.contains(cmp.options.lock, cause) ) {
var index = cmp.keepState.indexOf(cause);
if (lock) {
if (index < 0) {
cmp.keepState.push(cause);
}
} else {
if (!(index < 0)) {
cmp.keepState.splice(index, 1);
}
}
}
}
_.each(controls, function(item) {
if (item && _.isFunction(item.setDisabled)) {
!item.keepState && (item.keepState = []);
if (opts.clear && opts.clear.length > 0 && item.keepState.length > 0) {
item.keepState = _.difference(item.keepState, opts.clear);
}
_.isArray(causes) ? _.each(causes, function(c) {doLock(item, c)}) : doLock(item, causes);
if (!(item.keepState.length > 0)) {
item.isDisabled() && item.setDisabled(false);
} else {
!item.isDisabled() && item.setDisabled(true);
}
}
});
};
Common.Utils.injectButtons = function($slots, id, iconCls, caption, lock, split, menu, toggle) {
var btnsArr = createButtonSet();
btnsArr.setDisabled(true);
id = id || ("id-toolbar-" + iconCls);
$slots.each(function(index, el) {
var _cls = 'btn-toolbar';
/x-huge/.test(el.className) && (_cls += ' x-huge icon-top');
var button = new Common.UI.Button({
id: id + index,
cls: _cls,
iconCls: iconCls,
caption: caption,
split: split || false,
menu: menu || false,
enableToggle: toggle || false,
lock: lock,
disabled: true
}).render( $slots.eq(index) );
btnsArr.add(button);
});
return btnsArr;
};
Common.Utils.injectComponent = function ($slot, cmp) {
if (cmp && $slot.length) {
cmp.rendered ? $slot.append(cmp.$el) : cmp.render($slot);
}
};
jQuery.fn.extend({
elementById: function (id, parent) {
/**
* usage: $obj.findById('#id')
* $().findById('#id', $obj | node)
* $.fn.findById('#id', $obj | node)
*
* return: dom element
* */
var _el = document.getElementById(id.substring(1));
if ( !_el ) {
parent = parent || this;
if ( parent instanceof jQuery ) {
parent.each(function (i, node) {
_el = node.querySelectorAll(id);
if ( _el.length == 0 ) {
if ( ('#' + node.id) == id ) {
_el = node;
return false;
}
} else
if ( _el.length ) {
_el = _el[0];
return false;
}
})
} else {
_el = parent.querySelectorAll(id);
if ( _el && _el.length ) return _el[0];
}
}
return _el;
},
findById: function (id, parent) {
var _el = $.fn.elementById.apply(this, arguments);
return !!_el ? $(_el) : $();
}
});
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);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -45,6 +45,7 @@ define([
Common.Views.About = Common.UI.BaseView.extend(_.extend({
menu: undefined,
rendered: false,
options: {
alias: 'Common.Views.About'
},
@ -53,15 +54,11 @@ define([
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.txtVersionNum = '{{PRODUCT_VERSION}}';
this.txtAscMail = 'support@onlyoffice.com';
this.txtAscTelNum = '+371 660-16425';
this.txtAscUrl = 'www.onlyoffice.com';
this.txtAscName = 'Ascensio System SIA';
this.template = _.template([
'<table id="id-about-licensor-logo" cols="1" style="width: 100%; margin-top: 20px;">',
'<tr>',
'<td align="center"><div class="asc-about-office"/></td>',
'<td align="center"><div class="asc-about-office"></div></td>',
'</tr>',
'<tr>',
'<td align="center"><label class="asc-about-version">' + options.appName.toUpperCase() + '</label></td>',
@ -72,29 +69,29 @@ define([
'</table>',
'<table id="id-about-licensor-info" cols="3" style="width: 100%;" class="margin-bottom">',
'<tr>',
'<td colspan="3" align="center" style="padding: 20px 0 10px 0;"><label class="asc-about-companyname">' + this.txtAscName + '</label></td>',
'<td colspan="3" align="center" style="padding: 20px 0 10px 0;"><label class="asc-about-companyname"><%= publishername %></label></td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center" class="padding-small">',
'<label class="asc-about-desc-name">' + this.txtAddress + '</label>',
'<label class="asc-about-desc">' + this.txtAscAddress + '</label>',
'<label class="asc-about-desc"><%= publisheraddr %></label>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center" class="padding-small">',
'<label class="asc-about-desc-name">' + this.txtMail + '</label>',
'<a href="mailto:'+ this.txtAscMail +'">' + this.txtAscMail + '</a>',
'<a href="mailto:<%= supportemail %>"><%= supportemail %></a>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center" class="padding-small">',
'<label class="asc-about-desc-name">' + this.txtTel + '</label>',
'<label class="asc-about-desc">' + this.txtAscTelNum + '</label>',
'<label class="asc-about-desc"><%= phonenum %></label>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center">',
'<a href="http:\/\/'+ this.txtAscUrl +'" target="_blank">' + this.txtAscUrl + '</a>',
'<a href="<%= publisherurl %>" target="_blank"><% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %></a>',
'</td>',
'</tr>',
'</table>',
@ -143,11 +140,11 @@ define([
'<td style="width:50%;"><div class="separator horizontal short"/></td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center" style="padding: 9px 0 10px;"><label class="asc-about-companyname">' + this.txtAscName + '</label></td>',
'<td colspan="3" align="center" style="padding: 9px 0 10px;"><label class="asc-about-companyname"><%= publishername %></label></td>',
'</tr>',
'<tr>',
'<td colspan="3" align="center">',
'<label class="asc-about-desc">' + this.txtAscUrl + '</label>',
'<label class="asc-about-desc"><% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %></label>',
'</td>',
'</tr>',
'</table>'
@ -156,76 +153,95 @@ define([
},
render: function() {
var el = $(this.el);
el.html(this.template({
scope: this
}));
if ( !this.rendered ) {
this.rendered = true;
el.addClass('about-dlg');
this.cntLicenseeInfo = $('#id-about-licensee-info');
this.cntLicensorInfo = $('#id-about-licensor-info');
this.divCompanyLogo = $('#id-about-company-logo');
this.lblCompanyName = $('#id-about-company-name');
this.lblCompanyAddress = $('#id-about-company-address');
this.lblCompanyMail = $('#id-about-company-mail');
this.lblCompanyUrl = $('#id-about-company-url');
this.lblCompanyLic = $('#id-about-company-lic');
var _$l = $(this.template({
publishername: '{{PUBLISHER_NAME}}',
publisheraddr: '{{PUBLISHER_ADDRESS}}',
publisherurl: '{{PUBLISHER_URL}}',
supportemail: '{{SUPPORT_EMAIL}}',
phonenum: '{{PUBLISHER_PHONE}}',
scope: this
}));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
this.cntLicenseeInfo = _$l.findById('#id-about-licensee-info');
this.cntLicensorInfo = _$l.findById('#id-about-licensor-info');
this.divCompanyLogo = _$l.findById('#id-about-company-logo');
this.lblCompanyName = _$l.findById('#id-about-company-name');
this.lblCompanyAddress = _$l.findById('#id-about-company-address');
this.lblCompanyMail = _$l.findById('#id-about-company-mail');
this.lblCompanyUrl = _$l.findById('#id-about-company-url');
this.lblCompanyLic = _$l.findById('#id-about-company-lic');
if ( this.licData )
this.setLicInfo(this.licData);
this.$el.html(_$l);
this.$el.addClass('about-dlg');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: this.$el,
suppressScrollX: true
});
}
}
return this;
},
setLicInfo: function(data){
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
var customer = data.customer;
if ( !this.rendered ) {
this.licData = data || true;
} else {
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
var customer = data.customer;
$('#id-about-licensor-logo').addClass('hidden');
$('#id-about-licensor-short').removeClass('hidden');
this.cntLicensorInfo.addClass('hidden');
$('#id-about-licensor-logo').addClass('hidden');
$('#id-about-licensor-short').removeClass('hidden');
this.cntLicensorInfo.addClass('hidden');
this.cntLicenseeInfo.removeClass('hidden');
this.cntLicensorInfo.removeClass('margin-bottom');
this.cntLicenseeInfo.removeClass('hidden');
this.cntLicensorInfo.removeClass('margin-bottom');
var value = customer.name;
value && value.length ?
var value = customer.name;
value && value.length ?
this.lblCompanyName.text(value) :
this.lblCompanyName.parents('tr').addClass('hidden');
value = customer.address;
value && value.length ?
value = customer.address;
value && value.length ?
this.lblCompanyAddress.text(value) :
this.lblCompanyAddress.parents('tr').addClass('hidden');
(value = customer.mail) && value.length ?
(value = customer.mail) && value.length ?
this.lblCompanyMail.attr('href', "mailto:"+value).text(value) :
this.lblCompanyMail.parents('tr').addClass('hidden');
if ((value = customer.www) && value.length) {
var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : '';
this.lblCompanyUrl.attr('href', http+value).text(value);
} else
this.lblCompanyUrl.parents('tr').addClass('hidden');
if ((value = customer.www) && value.length) {
var http = !/^https?:\/{2}/i.test(value) ? "http:\/\/" : '';
this.lblCompanyUrl.attr('href', http+value).text(value);
} else
this.lblCompanyUrl.parents('tr').addClass('hidden');
(value = customer.info) && value.length ?
(value = customer.info) && value.length ?
this.lblCompanyLic.text(value) :
this.lblCompanyLic.parents('tr').addClass('hidden');
(value = customer.logo) && value.length ?
(value = customer.logo) && value.length ?
this.divCompanyLogo.html('<img src="'+value+'" style="max-width:216px; max-height: 35px;" />') :
this.divCompanyLogo.parents('tr').addClass('hidden');
} else {
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
} else {
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
}
}
},
show: function () {
if ( !this.rendered ) this.render();
Common.UI.BaseView.prototype.show.call(this,arguments);
this.fireEvent('show', this );
},
@ -247,7 +263,6 @@ define([
txtLicensor: 'LICENSOR',
txtLicensee: 'LICENSEE',
txtAddress: 'address: ',
txtAscAddress: 'Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021',
txtMail: 'email: ',
txtTel: 'tel.: ',
txtEdition: 'Integration Edition '

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -51,7 +51,8 @@ define([
cls: 'advanced-settings-dlg',
toggleGroup: 'advanced-settings-group',
contentTemplate: '',
items: []
items: [],
buttons: ['ok', 'cancel']
}, options);
this.template = options.template || [
@ -64,11 +65,7 @@ define([
'<div class="separator"/>',
'<div class="content-panel" >' + _options.contentTemplate + '</div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
_options.tpl = _.template(this.template)(_options);
@ -110,6 +107,22 @@ define([
this.content_panels = $window.find('.settings-panel');
if (this.btnsCategory.length>0)
this.btnsCategory[0].toggle(true, true);
me.menuAddAlign = function(menuRoot, left, top) {
var self = this;
if (!$window.hasClass('notransform')) {
$window.addClass('notransform');
menuRoot.addClass('hidden');
setTimeout(function() {
menuRoot.removeClass('hidden');
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}, 300);
} else {
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}
}
},
setHeight: function(height) {
@ -174,9 +187,6 @@ define([
if (this.storageName)
Common.localStorage.setItem(this.storageName, this.getActiveCategory());
Common.UI.Window.prototype.close.call(this, suppressevent);
},
cancelButtonText: 'Cancel',
okButtonText : 'Ok'
}
}, Common.Views.AdvancedSettingsWindow || {}));
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -60,8 +60,7 @@ define([
storeMessages: undefined,
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 class="name"><div class="color" style="background-color: <%= user.get("color") %>;" ></div><%= scope.getUserName(user.get("username")) %>',
'</div>',
'</li>'].join(''),
@ -217,6 +216,9 @@ define([
var arr = [], offset, len;
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -224,6 +226,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -72,6 +72,99 @@ define([
return tpl;
}
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
return {
options : {
handleSelect: false,
scrollable: true,
listenStoreEvents: false,
template: _.template('<div class="dataview-ct inner"></div>')
},
getTextBox: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
if (text && text.length) {
var val = text.val();
text.focus();
text.val('');
text.val(val);
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = $(this.el).find('textarea'),
domTextBox = null,
minHeight = 50,
lineHeight = 0,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
function updateTextBoxHeight() {
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
}
}
}
view.autoScrollToEditButtons();
}
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
this.textBox.unbind('input propertychange');
this.textBox = undefined;
}
},
autoScrollToEditButtons: function () {
var button = $('#id-comments-change'), // 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);
}
}
}
}
}
})());
Common.Views.Comments = Common.UI.BaseView.extend(_.extend({
el: '#left-panel-comments',
template: _.template(panelTemplate),
@ -79,12 +172,128 @@ define([
addCommentHeight: 45,
newCommentHeight: 110,
textBoxAutoSizeLocked: undefined, // disable autosize textbox
viewmode: false,
_commentsViewOnItemClick: function (picker, item, record, e) {
var me = this;
var btn, showEditBox, showReplyBox, commentId, replyId, hideAddReply;
function readdresolves() {
me.update();
}
btn = $(e.target);
if (btn) {
showEditBox = record.get('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
this.autoHeightTextBox();
readdresolves();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
this.autoHeightTextBox();
readdresolves();
this.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
this.autoHeightTextBox();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
},
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.store = this.options.store;
},
render: function () {
var me = this;
@ -133,255 +342,51 @@ define([
}
});
}
var CommentsPanelDataView = Common.UI.DataView.extend((function() {
return {
if (this.commentsView) {
this.commentsView.onResetItems();
} else {
this.commentsView = new CommentsPanelDataView({
el: $('.messages-ct',me.el),
store: me.store,
itemTemplate: _.template(replaceWords(commentsTemplate, {
textAddReply: me.textAddReply,
textAdd: me.textAdd,
textCancel: me.textCancel,
textEdit: me.textEdit,
textReply: me.textReply,
textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}))
});
options : {
handleSelect: false,
scrollable: true,
listenStoreEvents: false,
template: _.template('<div class="dataview-ct inner"></div>')
},
getTextBox: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
if (text && text.length) {
var val = text.val();
text.focus();
text.val('');
text.val(val);
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = $(this.el).find('textarea'),
domTextBox = null,
minHeight = 50,
lineHeight = 0,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
function updateTextBoxHeight() {
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
}
}
}
view.autoScrollToEditButtons();
}
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
this.textBox.unbind('input propertychange');
this.textBox = undefined;
}
},
autoScrollToEditButtons: function () {
var button = $('#id-comments-change'), // 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);
}
}
}
var addtooltip = function (dataview, view, record) {
if (view.tipsArray) {
view.tipsArray.forEach(function(item){
item.remove();
});
}
}
})());
if (CommentsPanelDataView) {
if (this.commentsView) {
this.commentsView.onResetItems();
} else {
this.commentsView = new CommentsPanelDataView({
el: $('.messages-ct',me.el),
store: me.store,
itemTemplate: _.template(replaceWords(commentsTemplate, {
textAddReply: me.textAddReply,
textAdd: me.textAdd,
textCancel: me.textCancel,
textEdit: me.textEdit,
textReply: me.textReply,
textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength
}))
var arr = [],
btns = $(view.el).find('.btn-resolve');
btns.tooltip({title: me.textResolve, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
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: me.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: me.textOpenAgain, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
view.tipsArray = arr;
};
this.commentsView.on('item:add', addtooltip);
this.commentsView.on('item:remove', addtooltip);
this.commentsView.on('item:change', addtooltip);
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('editText');
showReplyBox = record.get('showReply');
commentId = record.get('uid');
replyId = btn.attr('data-value');
if (btn.hasClass('btn-edit')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:closeEditing', [commentId]);
me.fireEvent('comment:editReply', [commentId, replyId]);
me.commentsView.reply = replyId;
this.autoHeightTextBox();
readdresolves();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else {
if (!showEditBox) {
me.fireEvent('comment:closeEditing');
record.set('editText', true);
this.autoHeightTextBox();
readdresolves();
this.setFocusToTextBox();
me.hookTextBox();
}
}
} else if (btn.hasClass('btn-delete')) {
if (!_.isUndefined(replyId)) {
me.fireEvent('comment:removeReply', [commentId, replyId]);
} else {
me.fireEvent('comment:remove', [commentId]);
Common.NotificationCenter.trigger('edit:complete', me);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('user-reply')) {
me.fireEvent('comment:closeEditing');
record.set('showReply', true);
readdresolves();
this.autoHeightTextBox();
me.hookTextBox();
this.autoScrollToEditButtons();
this.setFocusToTextBox();
} else if (btn.hasClass('btn-reply', false)) {
if (showReplyBox) {
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
me.fireEvent('comment:closeEditing');
readdresolves();
}
} else if (btn.hasClass('btn-close', false)) {
me.fireEvent('comment:closeEditing', [commentId]);
} else if (btn.hasClass('btn-inner-edit', false)) {
if (!_.isUndefined(me.commentsView.reply)) {
me.fireEvent('comment:changeReply', [commentId, me.commentsView.reply, this.getActiveTextBoxVal()]);
me.commentsView.reply = undefined;
} else if (showEditBox) {
me.fireEvent('comment:change', [commentId, this.getActiveTextBoxVal()]);
}
me.fireEvent('comment:closeEditing');
readdresolves();
} else if (btn.hasClass('btn-inner-close', false)) {
me.fireEvent('comment:closeEditing');
me.commentsView.reply = undefined;
readdresolves();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
me.fireEvent('comment:resolve', [commentId]);
readdresolves();
} else if (!btn.hasClass('msg-reply') &&
!btn.hasClass('btn-resolve-check') &&
!btn.hasClass('btn-resolve')) {
me.fireEvent('comment:show', [commentId, false]);
}
}
btns = $(view.el).find('.btn-resolve-check');
btns.tooltip({title: me.textOpenAgain, placement: 'cursor'});
btns.each(function(idx, item){
arr.push($(item).data('bs.tooltip').tip());
});
}
view.tipsArray = arr;
};
this.commentsView.on({
'item:add': addtooltip,
'item:remove': addtooltip,
'item:change': addtooltip,
'item:click': this._commentsViewOnItemClick.bind(this)
});
}
if (!this.rendered) this.setupLayout();
@ -481,7 +486,7 @@ define([
},
setupLayout: function () {
var me = this, parent = $(me.el);
var me = this, parent = me.$el;
var add = $('.new-comment-ct', me.el),
to = $('.add-link-ct', me.el),
@ -549,6 +554,42 @@ define([
this.autoHeightTextBox();
},
changeLayout: function(mode) {
var me = this,
add = $('.new-comment-ct', this.el),
to = $('.add-link-ct', this.el),
msgs = $('.messages-ct', this.el);
msgs.toggleClass('stretch', !mode.canComments);
if (!mode.canComments) {
add.hide(); to.hide();
this.layout.changeLayout([{el: msgs[0], rely: false, stretch: true}]);
} else {
var container = $('#comments-box', this.el),
items = container.find(' > .layout-item');
to.show();
this.layout.changeLayout([{el: items[0], rely: true,
resize: {
hidden: false,
autohide: false,
fmin: (function () {
var height = container.height();
if (add.css('display') !== 'none') {
if (height * 0.5 < me.newCommentHeight)
return height - me.newCommentHeight;
}
return height * 0.5;
}),
fmax: (function () {
if (add.css('display') !== 'none')
return container.height() - me.newCommentHeight;
return container.height() - me.addCommentHeight;
})
}},
{el: items[1], stretch: true},
{el: items[2], stretch: true}]);
}
},
updateLayout: function () {
var container = $('#comments-box', this.el), add = $('.new-comment-ct', this.el);
if (add.css('display') !== 'none') {
@ -561,6 +602,7 @@ define([
autoHeightTextBox: function () {
var me = this, domTextBox = null, lineHeight = 0, minHeight = 44;
var textBox = $('#comment-msg-new', this.el);
if (textBox.length<1) return;
function updateTextBoxHeight() {
@ -617,6 +659,9 @@ define([
message = Common.Utils.String.htmlEncode(message);
message.replace(Common.Utils.ipStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
offset = arguments[arguments.length-2];
arr.push({start: offset, end: subStr.length+offset, str: '<a href="' + subStr + '" target="_blank" data-can-copy="true">' + subStr + '</a>'});
return '';
@ -624,6 +669,9 @@ define([
if (message.length<1000 || message.search(/\S{255,}/)<0)
message.replace(Common.Utils.hostnameStrongRe, function(subStr) {
var result = /[\.,\?\+;:=!\(\)]+$/.exec(subStr);
if (result)
subStr = subStr.substring(0, result.index);
var ref = (! /(((^https?)|(^ftp)):\/\/)/i.test(subStr) ) ? ('http://' + subStr) : subStr;
offset = arguments[arguments.length-2];
len = subStr.length;
@ -662,6 +710,24 @@ define([
return str_res;
},
pickEMail: function (commentId, message) {
var arr = Common.Utils.String.htmlEncode(message).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi);
arr = _.map(arr, function(str){
return str.slice(1, str.length);
});
(arr.length>0) && Common.Gateway.requestSendNotify({
emails: arr,
actionId: commentId, // comment id
actionLink: {
action: {
type: "comment",
data: commentId
}
},
message: message //comment text
});
},
textComments : 'Comments',
textAnonym : 'Guest',
textAddCommentToDoc : 'Add Comment to Document',

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -50,12 +50,14 @@ define([
options: {
width : 500,
height : 325,
cls : 'modal-dlg copy-warning'
cls : 'modal-dlg copy-warning',
buttons: ['ok']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
title: this.textTitle,
buttons: ['ok']
}, options || {});
this.template = [
@ -77,10 +79,7 @@ define([
'</div>',
'<div id="copy-warning-checkbox" style="margin-top: 20px; text-align: left;"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary">' + this.okButtonText + '</button>',
'</div>'
'<div class="separator horizontal"/>'
].join('');
this.options.tpl = _.template(this.template)(this.options);

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -280,7 +280,12 @@ define([
},50);
},
cancelButtonText: 'Cancel',
onPrimary: function() {
this.trigger('onmodalresult', 1);
this.close(true);
return false;
},
addButtonText: 'Add',
textNew: 'New',
textCurrent: 'Current',

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -61,7 +61,7 @@ define([
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer" style="text-align: center;">',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok" style="margin-right: 10px;">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
'<button id="id-btn-merge-editor-cancel" class="btn normal dlg-btn disabled" result="cancel">' + this.textClose + '</button>',
'</div>'
].join('');

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -54,6 +54,7 @@ define([
var storeUsers, appConfig;
var $userList, $panelUsers, $btnUsers;
var $saveStatus;
var _readonlyRights = false;
var templateUserItem =
'<li id="<%= user.get("iid") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
@ -73,7 +74,7 @@ define([
var templateRightBox = '<section>' +
'<section id="box-doc-name">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'</section>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
@ -99,6 +100,7 @@ define([
'</section>'+
'</div>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-btn-undock"></div>' +
'<div class="btn-slot" id="slot-btn-back"></div>' +
'<div class="btn-slot" id="slot-btn-options"></div>' +
'</div>' +
@ -109,6 +111,7 @@ define([
'</section>';
var templateTitleBox = '<section id="box-document-title">' +
'<div class="extra"></div>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-btn-dt-save"></div>' +
'<div class="btn-slot" id="slot-btn-dt-print"></div>' +
@ -116,27 +119,26 @@ define([
'<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;">' +
'<input type="text" id="title-doc-name" spellcheck="false" data-can-copy="false" style="pointer-events: none;" disabled="disabled">' +
'<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 && !appConfig.canComments) {
if ( usercount > 1 || usercount > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit) {
$userList.html(templateUserList({
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
}));
if (!$userList.scroller)
$userList.scroller = new Common.UI.Scroller({
el: $userList.find('ul'),
useKeyboard: true,
minScrollbarLength: 40,
alwaysVisibleY: true
});
$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();
@ -151,7 +153,9 @@ define([
};
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 (!$btnUsers) return;
var has_edit_users = count > 1 || count > 0 && appConfig && !appConfig.isEdit && !appConfig.isRestrictedEdit; // has other user(s) who edit document
if ( has_edit_users ) {
$btnUsers
.attr('data-toggle', 'dropdown')
@ -165,7 +169,7 @@ define([
.removeClass('dropdown-toggle')
.menu = false;
$panelUsers[(appConfig && !appConfig.isReviewOnly && appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length) ? 'show' : 'hide']();
$panelUsers[(!_readonlyRights && appConfig && !appConfig.isReviewOnly && appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length) ? 'show' : 'hide']();
}
$btnUsers.find('.caption')
@ -180,20 +184,24 @@ define([
}
}
function onLostEditRights() {
_readonlyRights = true;
$panelUsers.find('#tlb-change-rights').hide();
$btnUsers && !$btnUsers.menu && $panelUsers.hide();
}
function onUsersClick(e) {
if ( !$btnUsers.menu ) {
$panelUsers.removeClass('open');
this.fireEvent('click:users', this);
} else {
var usertip = $btnUsers.data('bs.tooltip');
if ( usertip ) {
if ( usertip.dontShow===undefined)
usertip.dontShow = true;
return false;
}
var usertip = $btnUsers.data('bs.tooltip');
if ( usertip ) {
if ( usertip.dontShow===undefined)
usertip.dontShow = true;
usertip.hide();
usertip.hide();
}
}
}
@ -209,11 +217,12 @@ define([
if ( me.logo )
me.logo.children(0).on('click', function (e) {
var _url = !!me.branding && !!me.branding.logo && !!me.branding.logo.url ?
me.branding.logo.url : 'http://www.onlyoffice.com';
var newDocumentPage = window.open(_url);
newDocumentPage && newDocumentPage.focus();
var _url = !!me.branding && !!me.branding.logo && (me.branding.logo.url!==undefined) ?
me.branding.logo.url : '{{PUBLISHER_URL}}';
if (_url) {
var newDocumentPage = window.open(_url);
newDocumentPage && newDocumentPage.focus();
}
});
onResetUsers(storeUsers);
@ -227,7 +236,7 @@ define([
var editingUsers = storeUsers.getEditingCount();
$btnUsers.tooltip({
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.canComments) ? me.tipViewUsers : me.tipAccessRights,
title: (editingUsers > 1 || editingUsers>0 && !appConfig.isEdit && !appConfig.isRestrictedEdit) ? me.tipViewUsers : me.tipAccessRights,
titleNorm: me.tipAccessRights,
titleExt: me.tipViewUsers,
placement: 'bottom',
@ -243,7 +252,7 @@ define([
});
$labelChangeRights[(!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']();
$panelUsers[(editingUsers > 1 || editingUsers > 0 && !appConfig.isEdit && !appConfig.isRestrictedEdit || !mode.isOffline && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
if ( $saveStatus ) {
$saveStatus.attr('data-width', me.textSaveExpander);
@ -304,6 +313,24 @@ define([
me.btnOptions.updateHint(me.tipViewSettings);
}
function onAppConfig(config) {
var me = this;
if ( config.canUndock ) {
me.btnUndock = new Common.UI.Button({
cls: 'btn-header no-caret',
iconCls: 'svgicon svg-btn-undock',
hint: me.tipUndock,
split: true
});
me.btnUndock.on('click', function (e) {
Common.NotificationCenter.trigger('action:undocking', 'undock');
});
me.btnUndock.render($('#toolbar .box-tabs #slot-btn-undock'));
}
}
function onDocNameKeyDown(e) {
var me = this;
@ -338,6 +365,13 @@ define([
}
}
function onAppUndocked(c) {
var me = this;
if ( me.btnUndock ) {
c.status == 'undocked' ? me.btnUndock.hide() : me.btnUndock.show();
}
}
return {
options: {
branding: {},
@ -385,12 +419,13 @@ define([
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);
Common.NotificationCenter.on({
'app:ready': function(mode) {Common.Utils.asyncCall(onAppReady, me, mode);},
'app:face': function(mode) {Common.Utils.asyncCall(onAppShowed, me, mode);},
'app:config' : function (c) {Common.Utils.asyncCall(onAppConfig, me, c);},
'undock:status': onAppUndocked.bind(this)
});
Common.NotificationCenter.on('collaboration:sharingdeny', onLostEditRights);
},
render: function (el, role) {
@ -417,6 +452,7 @@ define([
if (this.branding && this.branding.logo && this.branding.logo.image && this.logo) {
this.logo.html('<img src="' + this.branding.logo.image + '" style="max-width:100px; max-height:20px; margin: 0;"/>');
this.logo.css({'background-image': 'none', width: 'auto'});
(this.branding.logo.url || this.branding.logo.url===undefined) && this.logo.addClass('link');
}
return $html;
@ -456,13 +492,13 @@ define([
if ( !config.isEdit ) {
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline )
this.btnDownload = createTitleButton('svg-btn-download', $html.find('#slot-hbtn-download'));
this.btnDownload = createTitleButton('svg-btn-download', $html.findById('#slot-hbtn-download'));
if ( config.canPrint )
this.btnPrint = createTitleButton('svg-btn-print', $html.find('#slot-hbtn-print'));
this.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-hbtn-print'));
if ( config.canEdit && config.canRequestEditRights )
this.btnEdit = createTitleButton('svg-btn-edit', $html.find('#slot-hbtn-edit'));
this.btnEdit = createTitleButton('svg-btn-edit', $html.findById('#slot-hbtn-edit'));
}
me.btnOptions.render($html.find('#slot-btn-options'));
@ -486,12 +522,12 @@ define([
me.setUserName(me.options.userName);
if ( config.canPrint && config.isEdit ) {
me.btnPrint = createTitleButton('svg-btn-print', $('#slot-btn-dt-print', $html));
me.btnPrint = createTitleButton('svg-btn-print', $html.findById('#slot-btn-dt-print'), true);
}
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);
me.btnSave = createTitleButton('svg-btn-save', $html.findById('#slot-btn-dt-save'), true);
me.btnUndo = createTitleButton('svg-btn-undo', $html.findById('#slot-btn-dt-undo'), true);
me.btnRedo = createTitleButton('svg-btn-redo', $html.findById('#slot-btn-dt-redo'), true);
if ( me.btnSave.$icon.is('svg') ) {
me.btnSave.$icon.addClass('icon-save');
@ -527,6 +563,7 @@ define([
if (element) {
element.html('<img src="' + value.logo.image + '" style="max-width:100px; max-height:20px; margin: 0;"/>');
element.css({'background-image': 'none', width: 'auto'});
(value.logo.url || value.logo.url===undefined) && element.addClass('link');
}
}
}
@ -645,7 +682,7 @@ define([
$btnUsers.addClass('disabled').attr('disabled', 'disabled'); else
$btnUsers.removeClass('disabled').attr('disabled', '');
} else {
function _lockButton(btn) {
var _lockButton = function (btn) {
if ( btn ) {
if ( lock ) {
btn.keepState = {
@ -657,7 +694,7 @@ define([
delete btn.keepState;
}
}
}
};
switch ( alias ) {
case 'undo': _lockButton(me.btnUndo); break;
@ -692,6 +729,7 @@ define([
tipSave: 'Save',
tipUndo: 'Undo',
tipRedo: 'Redo',
tipUndock: 'Undock',
textCompactView: 'Hide Toolbar',
textHideStatusBar: 'Hide Status Bar',
textHideLines: 'Hide Rulers',

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -83,7 +83,7 @@ define([
'style="display: block; ' + '<% if (!isRevision) { %>' + 'padding-left: 40px;' + '<% } %>' + '<% if (canRestore && selected) { %>' + 'padding-bottom: 6px;' + '<% } %>' +'">',
'<div class="user-date"><%= created %></div>',
'<% if (markedAsVersion) { %>',
'<div class="user-version">ver.<%=version%></div>',
'<div class="user-version">' + this.textVer + '<%=version%></div>',
'<% } %>',
'<% if (isRevision && hasChanges) { %>',
'<div class="revision-expand img-commonctrl ' + '<% if (isExpanded) { %>' + 'up' + '<% } %>' + '"></div>',
@ -150,7 +150,8 @@ define([
textHide: 'Collapse',
textCloseHistory: 'Close History',
textHideAll: 'Hide detailed changes',
textShowAll: 'Show detailed changes'
textShowAll: 'Show detailed changes',
textVer: 'ver.'
}, Common.Views.History || {}))
});

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -46,7 +46,9 @@ define([
options: {
width: 330,
header: false,
cls: 'modal-dlg'
cls: 'modal-dlg',
buttons: ['ok', 'cancel'],
footerCls: 'right'
},
initialize : function(options) {
@ -58,10 +60,6 @@ define([
'<label>' + this.textUrl + '</label>',
'</div>',
'<div id="id-dlg-url" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -87,7 +85,6 @@ define([
var $window = this.getChild();
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
},
show: function() {
@ -99,10 +96,9 @@ define([
},500);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
}
onPrimary: function(event) {
this._handleInput('ok');
return false;
},
onBtnClick: function(event) {
@ -125,8 +121,6 @@ define([
},
textUrl : 'Paste an image URL:',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtEmpty : 'This field is required',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"'
}, Common.Views.ImageFromUrlDialog || {}));

View file

@ -1,6 +1,6 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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)
@ -13,8 +13,8 @@
* 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.
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
@ -51,7 +51,8 @@ define([
height: 156,
style: 'min-width: 230px;',
cls: 'modal-dlg',
split: false
split: false,
buttons: ['ok', 'cancel']
},
initialize : function(options) {
@ -67,10 +68,6 @@ define([
'<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>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
@ -138,8 +135,6 @@ define([
txtColumns: 'Number of Columns',
txtRows: 'Number of Rows',
textInvalidRowsCols: 'You need to specify valid rows and columns count.',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtMinText: 'The minimum value for this field is {0}',
txtMaxText: 'The maximum value for this field is {0}'
}, Common.Views.InsertTableDialog || {}))

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