Merge branch 'release/v4.3.0'

This commit is contained in:
Alexey Golubev 2017-04-03 13:00:31 +03:00
commit 4faf90cbf7
4006 changed files with 206261 additions and 382381 deletions

5
.gitignore vendored
View file

@ -18,3 +18,8 @@ apps/presentationeditor/mobile/document
apps/spreadsheeteditor/embed/offlinedocs apps/spreadsheeteditor/embed/offlinedocs
apps/spreadsheeteditor/main/offlinedocs apps/spreadsheeteditor/main/offlinedocs
apps/spreadsheeteditor/mobile/offlinedocs apps/spreadsheeteditor/mobile/offlinedocs
# tests
selenium-debug.log
**/test/bin
**/test/reports

View file

@ -50,7 +50,6 @@
lang: <language code>, lang: <language code>,
location: <location>, location: <location>,
canCoAuthoring: <can coauthoring documents>, canCoAuthoring: <can coauthoring documents>,
canAutosave: <can autosave documents>,
canBackToFolder: <can return to folder> - deprecated. use "customization.goback" parameter, canBackToFolder: <can return to folder> - deprecated. use "customization.goback" parameter,
createUrl: 'create document url', createUrl: 'create document url',
sharingSettingsUrl: 'document sharing settings url', sharingSettingsUrl: 'document sharing settings url',
@ -105,15 +104,18 @@
url: 'http://...', url: 'http://...',
text: 'Go to London' text: 'Go to London'
}, },
chat: false, chat: true,
comments: false, comments: true,
zoom: 100, zoom: 100,
compactToolbar: false, compactToolbar: false,
leftMenu: true, leftMenu: true,
rightMenu: true, rightMenu: true,
toolbar: true, toolbar: true,
header: true, header: true,
autosave: true statusBar: true,
autosave: true,
forcesave: false,
commentAuthorOnly: false
}, },
plugins: { plugins: {
autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}', autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}',
@ -129,8 +131,7 @@
events: { events: {
'onReady': <document ready callback>, 'onReady': <document ready callback>,
'onBack': <back to folder callback>, 'onBack': <back to folder callback>,
'onDocumentStateChange': <document state changed callback>, 'onDocumentStateChange': <document state changed callback>
'onSave': <save request callback>
} }
} }
@ -258,25 +259,26 @@
}; };
var _onMessage = function(msg) { var _onMessage = function(msg) {
if (msg && msg.frameEditorId == placeholderId) { if ( msg ) {
var events = _config.events || {}, if ( msg.type === "onExternalPluginMessage" ) {
handler = events[msg.event], _sendCommand(msg);
res;
if (msg.event === 'onRequestEditRights' && !handler) {
_applyEditRights(false, 'handler is\'n defined');
} else } else
if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') { if ( msg.frameEditorId == placeholderId ) {
_callLocalStorage(msg.data.data); var events = _config.events || {},
} else { handler = events[msg.event],
if (msg.event === 'onReady') { res;
_onReady();
}
if (handler) { if (msg.event === 'onRequestEditRights' && !handler) {
res = handler.call(_self, { target: _self, data: msg.data }); _applyEditRights(false, 'handler isn\'t defined');
if (msg.event === 'onSave' && res !== false) { } else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
_processSaveResult(true); _callLocalStorage(msg.data.data);
} else {
if (msg.event === 'onReady') {
_onReady();
}
if (handler) {
res = handler.call(_self, {target: _self, data: msg.data});
} }
} }
} }
@ -363,7 +365,7 @@
if (target && _checkConfigParams()) { if (target && _checkConfigParams()) {
iframe = createIframe(_config); iframe = createIframe(_config);
target.parentNode && target.parentNode.replaceChild(iframe, target); target.parentNode && target.parentNode.replaceChild(iframe, target);
this._msgDispatcher = new MessageDispatcher(_onMessage, this); var _msgDispatcher = new MessageDispatcher(_onMessage, this);
} }
/* /*
@ -372,6 +374,18 @@
data: <command specific data> data: <command specific data>
} }
*/ */
var _destroyEditor = function(cmd) {
var target = document.createElement("div");
target.setAttribute('id', placeholderId);
if (iframe) {
_msgDispatcher && _msgDispatcher.unbindEvents();
_detachMouseEvents();
iframe.parentNode && iframe.parentNode.replaceChild(target, iframe);
}
};
var _sendCommand = function(cmd) { var _sendCommand = function(cmd) {
if (iframe && iframe.contentWindow) if (iframe && iframe.contentWindow)
postMessage(iframe.contentWindow, cmd); postMessage(iframe.contentWindow, cmd);
@ -505,7 +519,8 @@
var data = { var data = {
type: evt.type, type: evt.type,
x: evt.x - r.left, x: evt.x - r.left,
y: evt.y - r.top y: evt.y - r.top,
event: evt
}; };
_sendCommand({ _sendCommand({
@ -527,7 +542,6 @@
return { return {
showError : _showError, showError : _showError,
showMessage : _showMessage, showMessage : _showMessage,
applyEditRights : _applyEditRights,
processSaveResult : _processSaveResult, processSaveResult : _processSaveResult,
processRightsChange : _processRightsChange, processRightsChange : _processRightsChange,
denyEditingRights : _denyEditingRights, denyEditingRights : _denyEditingRights,
@ -538,7 +552,8 @@
downloadAs : _downloadAs, downloadAs : _downloadAs,
serviceCommand : _serviceCommand, serviceCommand : _serviceCommand,
attachMouseEvents : _attachMouseEvents, attachMouseEvents : _attachMouseEvents,
detachMouseEvents : _detachMouseEvents detachMouseEvents : _detachMouseEvents,
destroyEditor : _destroyEditor
} }
}; };
@ -558,23 +573,31 @@
}; };
DocsAPI.DocEditor.version = function() { DocsAPI.DocEditor.version = function() {
return '4.2.7'; return '{{PRODUCT_VERSION}}';
}; };
MessageDispatcher = function(fn, scope) { MessageDispatcher = function(fn, scope) {
var _fn = fn, var _fn = fn,
_scope = scope || window; _scope = scope || window,
eventFn = function(msg) {
_onMessage(msg);
};
var _bindEvents = function() { var _bindEvents = function() {
if (window.addEventListener) { if (window.addEventListener) {
window.addEventListener("message", function(msg) { window.addEventListener("message", eventFn, false)
_onMessage(msg);
}, false)
} }
else if (window.attachEvent) { else if (window.attachEvent) {
window.attachEvent("onmessage", function(msg) { window.attachEvent("onmessage", eventFn);
_onMessage(msg); }
}); };
var _unbindEvents = function() {
if (window.removeEventListener) {
window.removeEventListener("message", eventFn, false)
}
else if (window.detachEvent) {
window.detachEvent("onmessage", eventFn);
} }
}; };
@ -592,6 +615,10 @@
}; };
_bindEvents.call(this); _bindEvents.call(this);
return {
unbindEvents: _unbindEvents
}
}; };
function getBasePath() { function getBasePath() {

View file

@ -65,7 +65,6 @@
'onRequestEmailAddresses': onRequestEmailAddresses, 'onRequestEmailAddresses': onRequestEmailAddresses,
'onRequestStartMailMerge': onRequestStartMailMerge, 'onRequestStartMailMerge': onRequestStartMailMerge,
'onRequestHistoryClose': onRequestHistoryClose, 'onRequestHistoryClose': onRequestHistoryClose,
'onSave': onDocumentSave,
'onError': onError 'onError': onError
} }
}); });
@ -195,12 +194,6 @@
docEditor.applyEditRights(true, "Someone is editing this document right now. Please try again later."); docEditor.applyEditRights(true, "Someone is editing this document right now. Please try again later.");
} }
function onDocumentSave(event) {
var url = event.data;
// if you want to async save process return false
// and call api.processSaveResult when ready
}
function onError(event) { function onError(event) {
// critical error happened // critical error happened
// examine event.data.errorCode and event.data.errorDescription for details // examine event.data.errorCode and event.data.errorDescription for details

View file

@ -94,7 +94,7 @@
mode : urlParams["mode"] || 'edit', mode : urlParams["mode"] || 'edit',
lang : urlParams["lang"] || 'en', lang : urlParams["lang"] || 'en',
user: { user: {
id: urlParams["userid"], firstname: urlParams["userfname"], lastname: urlParams["userlname"] id: urlParams["userid"] || 'uid-901', name: urlParams["username"] || 'Chuk.Gek'
} }
}; };
} }

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -35,22 +35,22 @@ if (Common === undefined)
Common.component = Common.component || {}; Common.component = Common.component || {};
Common.Analytics = Common.component.Analytics = new(function() { Common.Analytics = Common.component.Analytics = new(function() {
var _category; var _category;
return { return {
initialize: function(id, category) { initialize: function(id, category) {
if (typeof id === 'undefined') if (typeof id === 'undefined')
throw 'Analytics: invalid id.'; throw 'Analytics: invalid id.';
if (typeof category === 'undefined' || Object.prototype.toString.apply(category) !== '[object String]') if (typeof category === 'undefined' || Object.prototype.toString.apply(category) !== '[object String]')
throw 'Analytics: invalid category type.'; throw 'Analytics: invalid category type.';
_category = category; _category = category;
$('head').append( $('head').append(
'<script type="text/javascript">' + '<script type="text/javascript">' +
'var _gaq = _gaq || [];' + 'var _gaq = _gaq || [];' +
'_gaq.push(["_setAccount", "' + id + '"]);' + '_gaq.push(["_setAccount", "' + id + '"]);' +
'_gaq.push(["_trackPageview"]);' + '_gaq.push(["_trackPageview"]);' +
@ -60,27 +60,27 @@ Common.Analytics = Common.component.Analytics = new(function() {
'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);' + 'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);' +
'})();' + '})();' +
'</script>' '</script>'
); );
}, },
trackEvent: function(action, label, value) { trackEvent: function(action, label, value) {
if (typeof action !== 'undefined' && Object.prototype.toString.apply(action) !== '[object String]') if (typeof action !== 'undefined' && Object.prototype.toString.apply(action) !== '[object String]')
throw 'Analytics: invalid action type.'; throw 'Analytics: invalid action type.';
if (typeof label !== 'undefined' && Object.prototype.toString.apply(label) !== '[object String]') if (typeof label !== 'undefined' && Object.prototype.toString.apply(label) !== '[object String]')
throw 'Analytics: invalid label type.'; throw 'Analytics: invalid label type.';
if (typeof value !== 'undefined' && !(Object.prototype.toString.apply(value) === '[object Number]' && isFinite(value))) if (typeof value !== 'undefined' && !(Object.prototype.toString.apply(value) === '[object Number]' && isFinite(value)))
throw 'Analytics: invalid value type.'; throw 'Analytics: invalid value type.';
if (typeof _gaq === 'undefined') if (typeof _gaq === 'undefined')
return; return;
if (_category === 'undefined') if (_category === 'undefined')
throw 'Analytics is not initialized.'; throw 'Analytics is not initialized.';
_gaq.push(['_trackEvent', _category, action, label, value]); _gaq.push(['_trackEvent', _category, action, label, value]);
}
} }
} })();
})();

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -30,225 +30,219 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
if (Common === undefined) { if (Common === undefined) {
var Common = {}; var Common = {};
} }
Common.Gateway = new(function() { Common.Gateway = new(function() {
var me = this, var me = this,
$me = $(me); $me = $(me);
var commandMap = { var commandMap = {
'init': function(data) { 'init': function(data) {
$me.trigger('init', data); $me.trigger('init', data);
}, },
'openDocument': function(data) { 'openDocument': function(data) {
$me.trigger('opendocument', data); $me.trigger('opendocument', data);
}, },
'showMessage': function(data) { 'showMessage': function(data) {
$me.trigger('showmessage', data); $me.trigger('showmessage', data);
}, },
'applyEditRights': function(data) { 'applyEditRights': function(data) {
$me.trigger('applyeditrights', data); $me.trigger('applyeditrights', data);
}, },
'processSaveResult': function(data) { 'processSaveResult': function(data) {
$me.trigger('processsaveresult', data); $me.trigger('processsaveresult', data);
}, },
'processRightsChange': function(data) { 'processRightsChange': function(data) {
$me.trigger('processrightschange', data); $me.trigger('processrightschange', data);
}, },
'refreshHistory': function(data) { 'refreshHistory': function(data) {
$me.trigger('refreshhistory', data); $me.trigger('refreshhistory', data);
}, },
'setHistoryData': function(data) { 'setHistoryData': function(data) {
$me.trigger('sethistorydata', data); $me.trigger('sethistorydata', data);
}, },
'setEmailAddresses': function(data) { 'setEmailAddresses': function(data) {
$me.trigger('setemailaddresses', data); $me.trigger('setemailaddresses', data);
}, },
'processMailMerge': function(data) { 'processMailMerge': function(data) {
$me.trigger('processmailmerge', data); $me.trigger('processmailmerge', data);
}, },
'downloadAs': function() { 'downloadAs': function() {
$me.trigger('downloadas'); $me.trigger('downloadas');
}, },
'processMouse': function(data) { 'processMouse': function(data) {
$me.trigger('processmouse', data); $me.trigger('processmouse', data);
}, },
'internalCommand': function(data) { 'internalCommand': function(data) {
$me.trigger('internalcommand', data); $me.trigger('internalcommand', data);
}, },
'resetFocus': function(data) { 'resetFocus': function(data) {
$me.trigger('resetfocus', data); $me.trigger('resetfocus', data);
} }
}; };
var _postMessage = function(msg) { var _postMessage = function(msg) {
// TODO: specify explicit origin // TODO: specify explicit origin
if (window.parent && window.JSON) { if (window.parent && window.JSON) {
msg.frameEditorId = window.frameEditorId; msg.frameEditorId = window.frameEditorId;
window.parent.postMessage(window.JSON.stringify(msg), "*"); window.parent.postMessage(window.JSON.stringify(msg), "*");
} }
}; };
var _onMessage = function(msg) { var _onMessage = function(msg) {
// TODO: check message origin // TODO: check message origin
var data = msg.data; var data = msg.data;
if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) { if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) {
return; return;
}
var cmd, handler;
try {
cmd = window.JSON.parse(data)
} catch(e) {
cmd = '';
}
if (cmd) {
handler = commandMap[cmd.command];
if (handler) {
handler.call(this, cmd.data);
}
}
};
var fn = function(e) { _onMessage(e); };
if (window.attachEvent) {
window.attachEvent('onmessage', fn);
} else {
window.addEventListener('message', fn, false);
} }
var cmd, handler; return {
try { ready: function() {
cmd = window.JSON.parse(data) _postMessage({ event: 'onReady' });
} catch(e) { },
cmd = '';
}
if (cmd) { requestEditRights: function() {
handler = commandMap[cmd.command]; _postMessage({ event: 'onRequestEditRights' });
if (handler) { },
handler.call(this, cmd.data);
requestHistory: function() {
_postMessage({ event: 'onRequestHistory' });
},
requestHistoryData: function(revision) {
_postMessage({
event: 'onRequestHistoryData',
data: revision
});
},
requestRestore: function(version, url) {
_postMessage({
event: 'onRequestRestore',
data: {
version: version,
url: url
}
});
},
requestEmailAddresses: function() {
_postMessage({ event: 'onRequestEmailAddresses' });
},
requestStartMailMerge: function() {
_postMessage({event: 'onRequestStartMailMerge'});
},
requestHistoryClose: function(revision) {
_postMessage({event: 'onRequestHistoryClose'});
},
reportError: function(code, description) {
_postMessage({
event: 'onError',
data: {
errorCode: code,
errorDescription: description
}
});
},
sendInfo: function(info) {
_postMessage({
event: 'onInfo',
data: info
});
},
setDocumentModified: function(modified) {
_postMessage({
event: 'onDocumentStateChange',
data: modified
});
},
internalMessage: function(type, data) {
_postMessage({
event: 'onInternalMessage',
data: {
type: type,
data: data
}
});
},
updateVersion: function() {
_postMessage({ event: 'onOutdatedVersion' });
},
downloadAs: function(url) {
_postMessage({
event: 'onDownloadAs',
data: url
});
},
collaborativeChanges: function() {
_postMessage({event: 'onCollaborativeChanges'});
},
requestRename: function(title) {
_postMessage({event: 'onRequestRename', data: title});
},
metaChange: function(meta) {
_postMessage({event: 'onMetaChange', data: meta});
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)
};
$me.on(event, localHandler);
} }
} }
};
var fn = function(e) { _onMessage(e); }; })();
if (window.attachEvent) {
window.attachEvent('onmessage', fn);
} else {
window.addEventListener('message', fn, false);
}
return {
ready: function() {
_postMessage({ event: 'onReady' });
},
save: function(url) {
_postMessage({
event: 'onSave',
data: url
});
},
requestEditRights: function() {
_postMessage({ event: 'onRequestEditRights' });
},
requestHistory: function() {
_postMessage({ event: 'onRequestHistory' });
},
requestHistoryData: function(revision) {
_postMessage({
event: 'onRequestHistoryData',
data: revision
});
},
requestRestore: function(version, url) {
_postMessage({
event: 'onRequestRestore',
data: {
version: version,
url: url
}
});
},
requestEmailAddresses: function() {
_postMessage({ event: 'onRequestEmailAddresses' });
},
requestStartMailMerge: function() {
_postMessage({event: 'onRequestStartMailMerge'});
},
requestHistoryClose: function(revision) {
_postMessage({event: 'onRequestHistoryClose'});
},
reportError: function(code, description) {
_postMessage({
event: 'onError',
data: {
errorCode: code,
errorDescription: description
}
});
},
sendInfo: function(info) {
_postMessage({
event: 'onInfo',
data: info
});
},
setDocumentModified: function(modified) {
_postMessage({
event: 'onDocumentStateChange',
data: modified
});
},
internalMessage: function(type, data) {
_postMessage({
event: 'onInternalMessage',
data: {
type: type,
data: data
}
});
},
updateVersion: function() {
_postMessage({ event: 'onOutdatedVersion' });
},
downloadAs: function(url) {
_postMessage({
event: 'onDownloadAs',
data: url
});
},
collaborativeChanges: function() {
_postMessage({event: 'onCollaborativeChanges'});
},
requestRename: function(title) {
_postMessage({event: 'onRequestRename', data: title});
},
metaChange: function(meta) {
_postMessage({event: 'onMetaChange', data: meta});
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)
};
$me.on(event, localHandler);
}
}
})();

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -53,7 +53,7 @@
$dlgShare = common.view.modals.create('share'); $dlgShare = common.view.modals.create('share');
var _encoded = encodeURIComponent(appConfig.shareUrl); var _encoded = encodeURIComponent(appConfig.shareUrl);
var _mailto = 'mailto:?subject=I have shared a document with you: ' + appConfig.docTitle + '&body=I have shared a document with you: ' + _encoded + '"'; var _mailto = 'mailto:?subject=I have shared a document with you: ' + appConfig.docTitle + '&body=I have shared a document with you: ' + _encoded;
$dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url'))); $dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url')));
$dlgShare.find('.share-buttons > span').on('click', function(e){ $dlgShare.find('.share-buttons > span').on('click', function(e){

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -331,7 +331,7 @@ define([
$(document).off('mouseup', onMouseUp); $(document).off('mouseup', onMouseUp);
}; };
var onAfterHideMenu = function(e) { var onAfterHideMenu = function(e, isFromInputControl) {
me.cmpEl.find('.dropdown-toggle').blur(); me.cmpEl.find('.dropdown-toggle').blur();
if (me.cmpEl.hasClass('active') !== me.pressed) if (me.cmpEl.hasClass('active') !== me.pressed)
me.cmpEl.trigger('button.internal.active', [me.pressed]); me.cmpEl.trigger('button.internal.active', [me.pressed]);
@ -416,24 +416,27 @@ define([
setDisabled: function(disabled) { setDisabled: function(disabled) {
if (this.rendered && this.disabled != disabled) { if (this.rendered && this.disabled != disabled) {
var el = this.cmpEl, var el = this.cmpEl,
isGroup = el.hasClass('btn-group'); isGroup = el.hasClass('btn-group'),
me = this;
disabled = (disabled===true); disabled = (disabled===true);
if (disabled !== el.hasClass('disabled')) { if (disabled !== el.hasClass('disabled')) {
var decorateBtn = function(button) { var decorateBtn = function(button) {
button.toggleClass('disabled', disabled); button.toggleClass('disabled', disabled);
(disabled) ? button.attr({disabled: disabled}) : button.removeAttr('disabled'); if (!me.options.allowMouseEventsOnDisabled)
(disabled) ? button.attr({disabled: disabled}) : button.removeAttr('disabled');
}; };
decorateBtn(el); decorateBtn(el);
isGroup && decorateBtn(el.children('button')); isGroup && decorateBtn(el.children('button'));
} }
if (disabled) { if (disabled || !Common.Utils.isGecko) {
var tip = this.cmpEl.data('bs.tooltip'); var tip = this.cmpEl.data('bs.tooltip');
if (tip) { if (tip) {
tip.hide(); disabled && tip.hide();
!Common.Utils.isGecko && (tip.enabled = !disabled);
} }
} }
} }
@ -466,8 +469,10 @@ define([
var cmpEl = this.cmpEl, var cmpEl = this.cmpEl,
modalParents = cmpEl.closest('.asc-window'); modalParents = cmpEl.closest('.asc-window');
if (cmpEl.data('bs.tooltip'))
cmpEl.removeData('bs.tooltip');
cmpEl.attr('data-toggle', 'tooltip'); cmpEl.attr('data-toggle', 'tooltip');
cmpEl.tooltip('destroy').tooltip({ cmpEl.tooltip({
title : hint, title : hint,
placement : this.options.hintAnchor || 'cursor' placement : this.options.hintAnchor || 'cursor'
}); });

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -112,6 +112,7 @@ define([
this.menuCls = me.options.menuCls; this.menuCls = me.options.menuCls;
this.menuStyle = me.options.menuStyle; this.menuStyle = me.options.menuStyle;
this.template = me.options.template || me.template; this.template = me.options.template || me.template;
this.itemsTemplate = me.options.itemsTemplate;
this.hint = me.options.hint; this.hint = me.options.hint;
this.editable = me.options.editable; this.editable = me.options.editable;
this.disabled = me.options.disabled; this.disabled = me.options.disabled;
@ -134,15 +135,22 @@ define([
var me = this; var me = this;
if (!me.rendered) { if (!me.rendered) {
var items = this.store.toJSON();
this.cmpEl = $(this.template({ this.cmpEl = $(this.template({
id : this.id, id : this.id,
cls : this.cls, cls : this.cls,
style : this.style, style : this.style,
menuCls : this.menuCls, menuCls : this.menuCls,
menuStyle : this.menuStyle, menuStyle : this.menuStyle,
items : this.store.toJSON(), items : items,
scope : me scope : me
})); }));
if (this.itemsTemplate)
this.cmpEl.find('ul').append(
$(this.itemsTemplate({
items : items,
scope : me
})));
if (parentEl) { if (parentEl) {
this.setElement(parentEl, false); this.setElement(parentEl, false);
@ -274,7 +282,7 @@ define([
} }
if (this.scroller) if (this.scroller)
this.scroller.update(); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
this.trigger('show:after', this, e); this.trigger('show:after', this, e);
}, },
@ -286,10 +294,10 @@ define([
e.preventDefault(); e.preventDefault();
}, },
onAfterHideMenu: function(e) { onAfterHideMenu: function(e, isFromInputControl) {
this.cmpEl.find('.dropdown-toggle').blur(); this.cmpEl.find('.dropdown-toggle').blur();
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide'); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {
@ -441,7 +449,7 @@ define([
return this.rendered ? this._input.val() : null; return this.rendered ? this._input.val() : null;
}, },
setValue: function(value) { setValue: function(value, defValue) {
if (!this.rendered) if (!this.rendered)
return; return;
@ -454,7 +462,7 @@ define([
this.setRawValue(this._selectedItem.get(this.displayField)); this.setRawValue(this._selectedItem.get(this.displayField));
$('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected'); $('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} else { } else {
this.setRawValue(value); this.setRawValue((defValue!==undefined) ? defValue : value);
} }
}, },
@ -529,14 +537,21 @@ define([
}, },
onResetItems: function() { onResetItems: function() {
$(this.el).find('ul').html(_.template([ if (this.itemsTemplate) {
'<% _.each(items, function(item) { %>', $(this.el).find('ul').html( $(this.itemsTemplate({
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>', items: this.store.toJSON(),
'<% }); %>' scope: this
].join(''), { })));
items: this.store.toJSON(), } else {
scope: this $(this.el).find('ul').html(_.template([
})); '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% }); %>'
].join(''), {
items: this.store.toJSON(),
scope: this
}));
}
if (!_.isUndefined(this.scroller)) { if (!_.isUndefined(this.scroller)) {
this.scroller.destroy(); this.scroller.destroy();

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -193,7 +193,7 @@ define([
me.onAfterHideMenu(e); me.onAfterHideMenu(e);
}, 10); }, 10);
} else if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode != Common.UI.Keys.CTRL && e.keyCode != Common.UI.Keys.SHIFT && e.keyCode != Common.UI.Keys.ALT){ } else if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode != Common.UI.Keys.CTRL && e.keyCode != Common.UI.Keys.SHIFT && e.keyCode != Common.UI.Keys.ALT){
if (!this.isMenuOpen()) if (!this.isMenuOpen() && !e.ctrlKey)
this.openMenu(); this.openMenu();
if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) { if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -85,6 +85,7 @@ define([
this.rootWidth = 0; this.rootWidth = 0;
this.rootHeight = 0; this.rootHeight = 0;
this.rendered = false; this.rendered = false;
this.needFillComboView = false;
this.fieldPicker = new Common.UI.DataView({ this.fieldPicker = new Common.UI.DataView({
cls: 'field-picker', cls: 'field-picker',
@ -209,7 +210,7 @@ define([
}, },
checkSize: function() { checkSize: function() {
if (this.cmpEl) { if (this.cmpEl && this.cmpEl.is(':visible')) {
var me = this, var me = this,
width = this.cmpEl.width(), width = this.cmpEl.width(),
height = this.cmpEl.height(); height = this.cmpEl.height();
@ -304,10 +305,10 @@ define([
} }
}, },
onAfterHideMenu: function(e) { onAfterHideMenu: function(e, isFromInputControl) {
this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec()[0]; // for DataView - onKeyDown - Return key this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec()[0]; // for DataView - onKeyDown - Return key
(this.showLast) ? this.menuPicker.showLastSelected() : this.menuPicker.deselectAll(); (this.showLast) ? this.menuPicker.showLastSelected() : this.menuPicker.deselectAll();
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e, isFromInputControl);
}, },
onFieldPickerSelect: function(picker, item, record) { onFieldPickerSelect: function(picker, item, record) {
@ -315,6 +316,7 @@ define([
}, },
onMenuPickerSelect: function(picker, item, record, fromKeyDown) { onMenuPickerSelect: function(picker, item, record, fromKeyDown) {
this.needFillComboView = this.disabled;
if (this.disabled || fromKeyDown===true) return; if (this.disabled || fromKeyDown===true) return;
this.fillComboView(record, false); this.fillComboView(record, false);
@ -375,6 +377,17 @@ define([
this.cmpEl.toggleClass('disabled', disabled); this.cmpEl.toggleClass('disabled', disabled);
$('button', this.openButton.cmpEl).toggleClass('disabled', disabled); $('button', this.openButton.cmpEl).toggleClass('disabled', disabled);
this.fieldPicker.setDisabled(disabled); this.fieldPicker.setDisabled(disabled);
if (this.needFillComboView && !disabled) {
var picker = this.menuPicker;
if (picker) {
var record = picker.getSelectedRec();
if (record) {
record = record[0];
this.fillComboView(record || picker.store.at(0), false);
}
}
}
}, },
isDisabled: function() { isDisabled: function() {
@ -383,6 +396,8 @@ define([
fillComboView: function(record, forceSelect, forceFill) { fillComboView: function(record, forceSelect, forceFill) {
if (!_.isUndefined(record) && record instanceof Backbone.Model){ if (!_.isUndefined(record) && record instanceof Backbone.Model){
this.needFillComboView = false;
var me = this, var me = this,
store = me.menuPicker.store, store = me.menuPicker.store,
fieldPickerEl = $(me.fieldPicker.el); fieldPickerEl = $(me.fieldPicker.el);

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -84,7 +84,9 @@ define([
defaults: function() { defaults: function() {
return { return {
id: Common.UI.getId(), id: Common.UI.getId(),
caption: '' caption: '',
inline: false,
headername: undefined
} }
} }
}); });
@ -99,7 +101,8 @@ define([
id: Common.UI.getId(), id: Common.UI.getId(),
selected: false, selected: false,
allowSelected: true, allowSelected: true,
value: null value: null,
disabled: false
} }
} }
}); });
@ -140,6 +143,7 @@ define([
el.off('click').on('click', _.bind(this.onClick, this)); el.off('click').on('click', _.bind(this.onClick, this));
el.off('dblclick').on('dblclick', _.bind(this.onDblClick, this)); el.off('dblclick').on('dblclick', _.bind(this.onDblClick, this));
el.off('contextmenu').on('contextmenu', _.bind(this.onContextMenu, this)); el.off('contextmenu').on('contextmenu', _.bind(this.onContextMenu, this));
el.toggleClass('disabled', this.model.get('disabled'));
if (!_.isUndefined(this.model.get('cls'))) if (!_.isUndefined(this.model.get('cls')))
el.addClass(this.model.get('cls')); el.addClass(this.model.get('cls'));
@ -157,10 +161,14 @@ define([
}, },
onClick: function(e) { onClick: function(e) {
if (this.model.get('disabled')) return false;
this.trigger('click', this, this.model, e); this.trigger('click', this, this.model, e);
}, },
onDblClick: function(e) { onDblClick: function(e) {
if (this.model.get('disabled')) return false;
this.trigger('dblclick', this, this.model, e); this.trigger('dblclick', this, this.model, e);
}, },
@ -190,10 +198,15 @@ define([
template: _.template([ template: _.template([
'<div class="dataview inner" style="<%= style %>">', '<div class="dataview inner" style="<%= style %>">',
'<% _.each(groups, function(group) { %>', '<% _.each(groups, function(group) { %>',
'<div class="grouped-data" id="<%= group.id %>">', '<% if (group.headername !== undefined) { %>',
'<div class="group-description">', '<div class="header-name"><%= group.headername %></div>',
'<span><b><%= group.caption %></b></span>', '<% } %>',
'</div>', '<div class="grouped-data <% if (group.inline) { %> inline <% } %> <% if (!_.isEmpty(group.caption)) { %> margin <% } %>" id="<%= group.id %>">',
'<% if (!_.isEmpty(group.caption)) { %>',
'<div class="group-description">',
'<span><%= group.caption %></span>',
'</div>',
'<% } %>',
'<div class="group-items-container">', '<div class="group-items-container">',
'</div>', '</div>',
'</div>', '</div>',
@ -696,39 +709,29 @@ define([
fillIndexesArray: function() { fillIndexesArray: function() {
if (this.dataViewItems.length<=0) return; if (this.dataViewItems.length<=0) return;
var top, left,
el = $(this.dataViewItems[0].el),
itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
itemH = el.outerHeight() + parseInt(el.css('margin-top')) + parseInt(el.css('margin-bottom')),
offsetLeft = this.$el.offset().left,
offsetTop = this.$el.offset().top,
idxOffset = 0;
this._layoutParams = { this._layoutParams = {
itemsIndexes: [], itemsIndexes: [],
columns: 0, columns: 0,
rows: 0 rows: 0
}; };
if (this.groups && this.groups.length > 0) { var el = $(this.dataViewItems[0].el),
var group_desc = this.cmpEl.find('.group-description:first'); itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
if (group_desc.length>0) offsetLeft = this.$el.offset().left,
offsetLeft += group_desc.width(); prevtop = -1, topIdx = 0, leftIdx = 0;
}
for (var i=0; i<this.dataViewItems.length; i++) { for (var i=0; i<this.dataViewItems.length; i++) {
top = Math.floor(($(this.dataViewItems[i].el).offset().top - offsetTop)/itemH) + idxOffset; var top = $(this.dataViewItems[i].el).offset().top;
left = Math.floor(($(this.dataViewItems[i].el).offset().left - offsetLeft)/itemW); leftIdx = Math.floor(($(this.dataViewItems[i].el).offset().left - offsetLeft)/itemW);
if (top<0) { if (top>prevtop) {
idxOffset = -top; prevtop = top;
top += idxOffset;
}
if (top > this._layoutParams.itemsIndexes.length-1) {
this._layoutParams.itemsIndexes.push([]); this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length-1;
} }
this._layoutParams.itemsIndexes[top][left] = i; this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
this.dataViewItems[i].topIdx = top; this.dataViewItems[i].topIdx = topIdx;
this.dataViewItems[i].leftIdx = left; this.dataViewItems[i].leftIdx = leftIdx;
if (this._layoutParams.columns<left) this._layoutParams.columns = left; if (this._layoutParams.columns<leftIdx) this._layoutParams.columns = leftIdx;
} }
this._layoutParams.rows = this._layoutParams.itemsIndexes.length; this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++; this._layoutParams.columns++;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -439,9 +439,9 @@ define([
e.preventDefault(); e.preventDefault();
}, },
onAfterHideMenu: function(e) { onAfterHideMenu: function(e, isFromInputControl) {
this.trigger('hide:after', this, e); this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -244,6 +244,10 @@ define([
if (this.$input) this.$input.val(value); if (this.$input) this.$input.val(value);
}, },
getRawValue: function () {
return this.$input.val();
},
setValue: function(value, suspendchange) { setValue: function(value, suspendchange) {
var showError = false; var showError = false;
this._fromKeyDown = false; this._fromKeyDown = false;
@ -290,6 +294,10 @@ define([
} }
}, },
setMask: function(value) {
this.options.maskExp = value;
},
onMouseDown: function (type, e) { onMouseDown: function (type, e) {
if ( this.disabled ) return; if ( this.disabled ) return;
@ -336,10 +344,10 @@ define([
} }
} else if (e.keyCode==Common.UI.Keys.RETURN) { } else if (e.keyCode==Common.UI.Keys.RETURN) {
if (this.options.defaultUnit && this.options.defaultUnit.length) { if (this.options.defaultUnit && this.options.defaultUnit.length) {
var value = this.$input.val(); var value = this.getRawValue();
if (this.value != value) { if (this.value != value) {
this.onEnterValue(); this.onEnterValue();
return false; return (this.value == value);
} }
} else { } else {
this.onEnterValue(); this.onEnterValue();
@ -384,7 +392,7 @@ define([
onEnterValue: function() { onEnterValue: function() {
if (this.$input) { if (this.$input) {
var val = this.$input.val(); var val = this.getRawValue();
this.setValue((val==='') ? this.value : val ); this.setValue((val==='') ? this.value : val );
this.trigger('entervalue', this); this.trigger('entervalue', this);
} }
@ -392,7 +400,7 @@ define([
onBlur: function(e){ onBlur: function(e){
if (this.$input) { if (this.$input) {
var val = this.$input.val(); var val = this.getRawValue();
this.setValue((val==='') ? this.value : val ); this.setValue((val==='') ? this.value : val );
if (this.options.hold && this.switches.fromKeyDown) if (this.options.hold && this.switches.fromKeyDown)
this._stopSpin(); this._stopSpin();
@ -430,7 +438,7 @@ define([
if (!me.readOnly) { if (!me.readOnly) {
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.$input.val(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : parseFloat(val); val = _.isEmpty(val) ? me.oldValue : parseFloat(val);
} else if(me.getValue() !== '') { } else if(me.getValue() !== '') {
if (me.options.allowAuto && me.getValue()==me.options.autoText) { if (me.options.allowAuto && me.getValue()==me.options.autoText) {
@ -451,7 +459,7 @@ define([
if (!me.readOnly) { if (!me.readOnly) {
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.$input.val(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : parseFloat(val); val = _.isEmpty(val) ? me.oldValue : parseFloat(val);
} else if(me.getValue() !== '') { } else if(me.getValue() !== '') {
if (me.options.allowAuto && me.getValue()==me.options.autoText) { if (me.options.allowAuto && me.getValue()==me.options.autoText) {
@ -520,4 +528,22 @@ define([
return v_out; return v_out;
} }
}); });
Common.UI.CustomSpinner = Common.UI.MetricSpinner.extend(_.extend({
initialize : function(options) {
this.options.toCustomFormat = (options.toCustomFormat) ? options.toCustomFormat : function(value) { return value; };
this.options.fromCustomFormat = (options.fromCustomFormat) ? options.fromCustomFormat : function(value) { return value; };
Common.UI.MetricSpinner.prototype.initialize.call(this, options);
},
setRawValue: function (value) {
if (this.$input) this.$input.val(this.options.toCustomFormat(value));
},
getRawValue: function () {
return this.options.fromCustomFormat(this.$input.val());
}
}, Common.UI.CustomSpinner || {}));
}); });

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -63,7 +63,10 @@ define([
'<div class="slider multi-slider-gradient">', '<div class="slider multi-slider-gradient">',
'<div class="track"></div>', '<div class="track"></div>',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<div class="thumb img-commonctrl" style=""></div>', '<div class="thumb img-commonctrl" style="">',
'<div class="thumb-top"></div>',
'<div class="thumb-bottom"></div>',
'</div>',
'<% }); %>', '<% }); %>',
'</div>' '</div>'
].join('')), ].join('')),
@ -98,6 +101,7 @@ define([
me.thumbs[i].thumb.on('dblclick', null, function() { me.thumbs[i].thumb.on('dblclick', null, function() {
me.trigger('thumbdblclick', me); me.trigger('thumbdblclick', me);
}); });
me.thumbs[i].thumbcolor = me.thumbs[i].thumb.find('> div');
} }
if (me.styleStr!=='') { if (me.styleStr!=='') {
@ -118,6 +122,7 @@ define([
setColorValue: function(color, index) { setColorValue: function(color, index) {
var ind = (index!==undefined) ? index : this.currentThumb; var ind = (index!==undefined) ? index : this.currentThumb;
this.colorValues[ind] = color; this.colorValues[ind] = color;
this.thumbs[ind].thumbcolor.css('background-color', color);
this.changeGradientStyle(); this.changeGradientStyle();
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -120,8 +120,8 @@
this.getBSTip().show(at); this.getBSTip().show(at);
}, },
hide: function() { hide: function(callback) {
this.getBSTip().hide(); this.getBSTip().hide(callback);
}, },
setTitle: function(title) { setTitle: function(title) {

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -404,8 +404,8 @@ define([
if (!options.width) options.width = 'auto'; if (!options.width) options.width = 'auto';
var template = '<div class="info-box">' + var template = '<div class="info-box">' +
'<div class="icon img-commonctrl <%= iconCls %>" />' + '<% if (typeof iconCls !== "undefined") { %><div class="icon img-commonctrl <%= iconCls %>" /><% } %>' +
'<div class="text"><span><%= msg %></span>' + '<div class="text" <% if (typeof iconCls == "undefined") { %> style="padding-left:10px;" <% } %>><span><%= msg %></span>' +
'<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' + '<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
@ -454,6 +454,8 @@ define([
body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height'))); body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height')));
window.setHeight(parseInt(body.css('height')) + parseInt(header.css('height'))); window.setHeight(parseInt(body.css('height')) + parseInt(header.css('height')));
} }
if (text.height() < icon.height()-10)
text.css({'vertical-align': 'baseline', 'line-height': icon.height()+'px'});
} }
function onBtnClick(event) { function onBtnClick(event) {

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -692,7 +692,8 @@ define([
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : false, showReplyInPopover : false,
scope : t.view scope : t.view,
editable : t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)
})); }));
} }
@ -1041,7 +1042,8 @@ define([
editTextInPopover : (this.editPopover ? true : false), editTextInPopover : (this.editPopover ? true : false),
showReplyInPopover : false, showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false), hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false),
scope : this.view scope : this.view,
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)
}); });
if (comment) { if (comment) {
var replies = this.readSDKReplies(data); var replies = this.readSDKReplies(data);
@ -1072,7 +1074,8 @@ define([
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : false, showReplyInPopover : false,
scope : this.view scope : this.view,
editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)
})); }));
} }
@ -1223,7 +1226,7 @@ define([
for (i = 0; i < comments.length; ++i) { for (i = 0; i < comments.length; ++i) {
comment = this.findComment(comments[i].asc_getId()); comment = this.findComment(comments[i].asc_getId());
if (comment) { if (comment) {
comment.set('editTextInPopover', true); comment.set('editTextInPopover', t.mode.canEditComments);// dont't edit comment when customization->commentAuthorOnly is true
comment.set('hint', false); comment.set('hint', false);
this.popoverComments.push(comment); this.popoverComments.push(comment);
} }

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -114,6 +114,7 @@ define([
createExternalEditor.apply(this); createExternalEditor.apply(this);
} }
this.isExternalEditorVisible = true; this.isExternalEditorVisible = true;
this.isHandlerCalled = false;
}, this), }, this),
'hide': _.bind(function(cmp){ 'hide': _.bind(function(cmp){
if (externalEditor) { if (externalEditor) {
@ -138,6 +139,8 @@ define([
}, },
handler: function(result, value) { handler: function(result, value) {
if (this.isHandlerCalled) return;
this.isHandlerCalled = true;
externalEditor && externalEditor.serviceCommand('queryClose',{mr:result}); externalEditor && externalEditor.serviceCommand('queryClose',{mr:result});
return true; return true;
}, },

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -57,6 +57,7 @@ define([
this.currentArrColors = []; this.currentArrColors = [];
this.currentDocId = ''; this.currentDocId = '';
this.currentDocIdPrev = ''; this.currentDocIdPrev = '';
this.currentRev = 0;
}, },
events: { events: {
@ -74,6 +75,7 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onExpiredToken', _.bind(this.onExpiredToken, this));
return this; return this;
}, },
@ -127,6 +129,7 @@ define([
this.currentArrColors = record.get('arrColors'); this.currentArrColors = record.get('arrColors');
this.currentDocId = record.get('docId'); this.currentDocId = record.get('docId');
this.currentDocIdPrev = record.get('docIdPrev'); this.currentDocIdPrev = record.get('docIdPrev');
this.currentRev = rev;
if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) { if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) {
_.delay(function() { _.delay(function() {
@ -134,12 +137,15 @@ define([
}, 10); }, 10);
} else { } else {
var urlDiff = record.get('urlDiff'), var urlDiff = record.get('urlDiff'),
token = record.get('token'),
hist = new Asc.asc_CVersionHistory(); hist = new Asc.asc_CVersionHistory();
hist.asc_setDocId(_.isEmpty(urlDiff) ? this.currentDocId : this.currentDocIdPrev); hist.asc_setDocId(_.isEmpty(urlDiff) ? this.currentDocId : this.currentDocIdPrev);
hist.asc_setUrl(url); hist.asc_setUrl(url);
hist.asc_setUrlChanges(urlDiff); hist.asc_setUrlChanges(urlDiff);
hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setCurrentChangeId(this.currentChangeId);
hist.asc_setArrColors(this.currentArrColors); hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token);
hist.asc_setIsRequested(false);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments'); var commentsController = this.getApplication().getController('Common.Controllers.Comments');
@ -166,7 +172,8 @@ define([
var diff = (this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes var diff = (this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes
url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url, url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url,
docId = opts.data.key ? opts.data.key : this.currentDocId, docId = opts.data.key ? opts.data.key : this.currentDocId,
docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev; docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev,
token = opts.data.token;
if (revisions && revisions.length>0) { if (revisions && revisions.length>0) {
for(var i=0; i<revisions.length; i++) { for(var i=0; i<revisions.length; i++) {
@ -178,6 +185,7 @@ define([
rev.set('docId', docId, {silent: true}); rev.set('docId', docId, {silent: true});
rev.set('docIdPrev', docIdPrev, {silent: true}); rev.set('docIdPrev', docIdPrev, {silent: true});
} }
rev.set('token', token, {silent: true});
} }
} }
var hist = new Asc.asc_CVersionHistory(); var hist = new Asc.asc_CVersionHistory();
@ -186,6 +194,8 @@ define([
hist.asc_setDocId(_.isEmpty(diff) ? docId : docIdPrev); hist.asc_setDocId(_.isEmpty(diff) ? docId : docIdPrev);
hist.asc_setCurrentChangeId(this.currentChangeId); hist.asc_setCurrentChangeId(this.currentChangeId);
hist.asc_setArrColors(this.currentArrColors); hist.asc_setArrColors(this.currentArrColors);
hist.asc_setToken(token);
hist.asc_setIsRequested(true);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments'); var commentsController = this.getApplication().getController('Common.Controllers.Comments');
@ -194,6 +204,13 @@ define([
} }
}, },
onExpiredToken: function() {
var me = this;
_.delay(function() {
Common.Gateway.requestHistoryData(me.currentRev); // получаем url-ы для ревизий
}, 10);
},
onClickBackToDocument: function () { onClickBackToDocument: function () {
// reload editor // reload editor
Common.Gateway.requestHistoryClose(); Common.Gateway.requestHistoryClose();

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -84,7 +84,6 @@ define([
setMode: function(mode) { setMode: function(mode) {
if (mode.canPlugins) { if (mode.canPlugins) {
this.panelPlugins.pluginsPath = mode.pluginsPath;
this.updatePluginsList(); this.updatePluginsList();
} }
}, },
@ -143,7 +142,7 @@ define([
item.set('pluginObj', plugin); item.set('pluginObj', plugin);
arr.push(plugin); arr.push(plugin);
}); });
this.api.asc_pluginsRegister(this.panelPlugins.pluginsPath, arr); this.api.asc_pluginsRegister('', arr);
}, },
onSelectPlugin: function(picker, item, record, e){ onSelectPlugin: function(picker, item, record, e){
@ -205,7 +204,7 @@ define([
menuContainer.css({left: showPoint[0], top: showPoint[1]}); menuContainer.css({left: showPoint[0], top: showPoint[1]});
menu.menuAlignEl = currentTarget; menu.menuAlignEl = currentTarget;
menu.setOffset(-11, -currentTarget.height()/2 + 2); menu.setOffset(-20, -currentTarget.height()/2 - 3);
menu.show(); menu.show();
_.delay(function() { _.delay(function() {
menu.cmpEl.focus(); menu.cmpEl.focus();
@ -220,8 +219,7 @@ define([
var variation = plugin.get_Variations()[variationIndex]; var variation = plugin.get_Variations()[variationIndex];
if (variation.get_Visual()) { if (variation.get_Visual()) {
var url = variation.get_Url(); var url = variation.get_Url();
if (!/(^https?:\/\/)/i.test(url) && !/(^www.)/i.test(url)) url = ((plugin.get_BaseUrl().length == 0) ? url : plugin.get_BaseUrl()) + url;
url = ((plugin.get_BaseUrl().length == 0) ? this.panelPlugins.pluginsPath : plugin.get_BaseUrl()) + url;
if (variation.get_InsideMode()) { if (variation.get_InsideMode()) {
if (!this.panelPlugins.openInsideMode(plugin.get_Name(), url)) if (!this.panelPlugins.openInsideMode(plugin.get_Name(), url))

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -186,13 +186,13 @@ function getParent($this) {
return $parent && $parent.length ? $parent : $this.parent(); return $parent && $parent.length ? $parent : $this.parent();
} }
function clearMenus() { function clearMenus(isFromInputControl) {
$('.dropdown-toggle').each(function (e) { $('.dropdown-toggle').each(function (e) {
var $parent = ($(this)).parent(); var $parent = ($(this)).parent();
if (!$parent.hasClass('open')) return; if (!$parent.hasClass('open')) return;
$parent.trigger(e = $.Event('hide.bs.dropdown')); $parent.trigger(e = $.Event('hide.bs.dropdown'));
if (e.isDefaultPrevented()) return; if (e.isDefaultPrevented()) return;
$parent.removeClass('open').trigger('hidden.bs.dropdown'); $parent.removeClass('open').trigger('hidden.bs.dropdown', isFromInputControl);
}) })
} }
@ -217,7 +217,7 @@ $(document)
function onDropDownClick(e) { function onDropDownClick(e) {
if (e.which == 1 || e.which == undefined) if (e.which == 1 || e.which == undefined)
clearMenus(); clearMenus(/form-control/.test(e.target.className));
} }
if (!!clickDefHandler) { if (!!clickDefHandler) {

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -75,7 +75,8 @@ define([
scope : null, scope : null,
hide : false, hide : false,
hint : false, hint : false,
dummy : undefined dummy : undefined,
editable : true
} }
}); });
Common.Models.Reply = Backbone.Model.extend({ Common.Models.Reply = Backbone.Model.extend({
@ -89,7 +90,8 @@ define([
id : Common.UI.getId(), // internal id : Common.UI.getId(), // internal
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
scope : null scope : null,
editable : true
} }
}); });
}); });

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -64,6 +64,7 @@ define([
urlGetTime : '', urlGetTime : '',
docId: '', docId: '',
docIdPrev: '', docIdPrev: '',
token: '',
arrColors: [], // array of user colors for all changes of current version arrColors: [], // array of user colors for all changes of current version
markedAsVersion: false, markedAsVersion: false,
canRestore: false, canRestore: false,

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -65,8 +65,7 @@ define([
isUpdateOleOnResize: false, isUpdateOleOnResize: false,
buttons: [], buttons: [],
size: [800, 600], size: [800, 600],
initOnSelectionChanged: false, initOnSelectionChanged: false
isRelativeUrl: true
} }
} }
}); });

View file

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

View file

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

View file

@ -29,7 +29,9 @@
<% if (!item.get("editText")) { %> <% if (!item.get("editText")) { %>
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div> <div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <% 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 { %> <% } else { %>
@ -57,7 +59,9 @@
<% if (!editText && !lock) { %> <% if (!editText && !lock) { %>
<div class="edit-ct"> <div class="edit-ct">
<div class="btn-edit img-commonctrl"></div> <% 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) { %> <% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -30,7 +30,9 @@
<div class="user-message"><%=scope.pickLink(item.get("reply"))%></div> <div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>
<% if (!hint) { %> <% if (!hint) { %>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <% 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>
<%}%> <%}%>
@ -60,7 +62,9 @@
<% if (!editTextInPopover && !lock && !hint) { %> <% if (!editTextInPopover && !lock && !hint) { %>
<div class="edit-ct"> <div class="edit-ct">
<div class="btn-edit img-commonctrl"></div> <% 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) { %> <% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -1,7 +1,6 @@
<div id="header-container"> <div id="header-container">
<div id="header-logo"></div> <div id="header-logo"></div>
<div id="header-caption"><div><%= headerCaption %></div></div> <div id="header-caption"><div><%= headerCaption %></div></div>
<div id="header-developer" class="hidden"><div><%= headerDeveloper %></div></div>
<div id="header-documentcaption"><div><%= documentCaption %></div></div> <div id="header-documentcaption"><div><%= documentCaption %></div></div>
<div id="header-back" style="display: <%= canBack ? 'table-cell' : 'none' %>;"><div><%= textBack %></div></div> <div id="header-back" style="display: <%= canBack ? 'table-cell' : 'none' %>;"><div><%= textBack %></div></div>
</div> </div>

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -100,6 +100,7 @@ Common.util.LanguageInfo = new(function() {
0x0402 : ["bg-BG", "Български (България)"], 0x0402 : ["bg-BG", "Български (България)"],
0x0003 : ["ca", "Català"], 0x0003 : ["ca", "Català"],
0x0403 : ["ca-ES", "Català (Català)"], 0x0403 : ["ca-ES", "Català (Català)"],
0x0803 : ["ca-ES-valencia", "Català (Valencià)"],
0x7804 : ["zh", "中文"], 0x7804 : ["zh", "中文"],
0x0004 : ["zh-Hans", "中文(简体)"], 0x0004 : ["zh-Hans", "中文(简体)"],
0x0804 : ["zh-CN", "中文(中华人民共和国)"], 0x0804 : ["zh-CN", "中文(中华人民共和国)"],
@ -315,7 +316,7 @@ Common.util.LanguageInfo = new(function() {
0x181A : ["sr-Latn-BA", "Srpski (Bosna i Hercegovina)"], 0x181A : ["sr-Latn-BA", "Srpski (Bosna i Hercegovina)"],
0x2C1A : ["sr-Latn-ME", "Srpski (Crna Gora)"], 0x2C1A : ["sr-Latn-ME", "Srpski (Crna Gora)"],
0x081A : ["sr-Latn-CS", "Srpski (Srbija i Crna Gora (Prethodno))"], 0x081A : ["sr-Latn-CS", "Srpski (Srbija i Crna Gora (Prethodno))"],
0x241A : ["sr-Latn-RS", "Srpski (Srbija)"], 0x241A : ["sr-Latn-RS", "Srpski (Srbija, Latinica)"],
0x006C : ["nso", "Sesotho sa Leboa"], 0x006C : ["nso", "Sesotho sa Leboa"],
0x046C : ["nso-ZA", "Sesotho sa Leboa (Afrika Borwa)"], 0x046C : ["nso-ZA", "Sesotho sa Leboa (Afrika Borwa)"],
0x0032 : ["tn", "Setswana"], 0x0032 : ["tn", "Setswana"],

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -38,71 +38,73 @@
* *
*/ */
Common.localStorage = new (function() { define(['gateway'], function () {
var _storeName, _filter; Common.localStorage = new (function() {
var _store = {}; var _storeName, _filter;
var _store = {};
var ongetstore = function(data) { var ongetstore = function(data) {
if (data.type == 'localstorage') { if (data.type == 'localstorage') {
_store = data.keys; _store = data.keys;
}
};
Common.Gateway.on('internalcommand', ongetstore);
var _refresh = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter});
};
var _save = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store});
};
var _setItem = function(name, value, just) {
if (_lsAllowed) {
localStorage.setItem(name, value);
} else {
_store[name] = value;
if (just===true) {
Common.Gateway.internalMessage('localstorage', {
cmd:'set',
keys: {
name: value
}
});
} }
};
Common.Gateway.on('internalcommand', ongetstore);
var _refresh = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter});
};
var _save = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store});
};
var _setItem = function(name, value, just) {
if (_lsAllowed) {
localStorage.setItem(name, value);
} else {
_store[name] = value;
if (just===true) {
Common.Gateway.internalMessage('localstorage', {
cmd:'set',
keys: {
name: value
}
});
}
}
};
var _getItem = function(name) {
if (_lsAllowed)
return localStorage.getItem(name);
else
return _store[name]===undefined ? null : _store[name];
};
try {
var _lsAllowed = !!window.localStorage;
} catch (e) {
_lsAllowed = false;
} }
};
var _getItem = function(name) { return {
if (_lsAllowed) getId: function() {
return localStorage.getItem(name); return _storeName;
else },
return _store[name]===undefined ? null : _store[name]; setId: function(name) {
}; _storeName = name;
},
try { getItem: _getItem,
var _lsAllowed = !!window.localStorage; setItem: _setItem,
} catch (e) { setKeysFilter: function(value) {
_lsAllowed = false; _filter = value;
} },
sync: _refresh,
return { save: _save
getId: function() { };
return _storeName; })();
}, });
setId: function(name) {
_storeName = name;
},
getItem: _getItem,
setItem: _setItem,
setKeysFilter: function(value) {
_filter = value;
},
sync: _refresh,
save: _save
};
})();

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -86,8 +86,8 @@ Common.Utils = _.extend(new(function() {
isSecure = /^https/i.test(window.location.protocol), isSecure = /^https/i.test(window.location.protocol),
emailRe = /^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i, 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, 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, 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, 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, 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, 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, hostnameStrongRe = /((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,
@ -102,57 +102,33 @@ Common.Utils = _.extend(new(function() {
Chart : 7, Chart : 7,
MailMerge : 8 MailMerge : 8
}, },
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, me = this,
checkSize = function() { checkSize = function() {
me.zoom = 1; me.zoom = 1;
if (isChrome && !isOpera && document && document.firstElementChild && document.body) if (isChrome && !isOpera && !isMobile && document && document.firstElementChild && document.body)
{ {
if (false) // делаем простую проверку
{ // считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio;
// этот код - рабочий, но только если этот ифрейм открыт на весь размер браузера // считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio;
// (window.outerWidth и window.innerWidth зависимы) if (window.devicePixelRatio > 0.1)
if (window.innerWidth > 300) {
me.zoom = window.outerWidth / window.innerWidth; if (window.devicePixelRatio < 1.99)
{
if (Math.abs(me.zoom - 1) < 0.1) var _devicePixelRatio = 1;
me.zoom = 1; me.zoom = window.devicePixelRatio / _devicePixelRatio;
}
me.zoom = window.outerWidth / window.innerWidth; else
{
var _devicePixelRatio = window.devicePixelRatio / me.zoom; var _devicePixelRatio = 2;
me.zoom = window.devicePixelRatio / _devicePixelRatio;
// device pixel ratio: кратно 0.5 }
_devicePixelRatio = (5 * (((2.5 + 10 * _devicePixelRatio) / 5) >> 0)) / 10; // chrome 54.x: zoom = "reset" - clear retina zoom (windows)
me.zoom = window.devicePixelRatio / _devicePixelRatio; //document.firstElementChild.style.zoom = "reset";
document.firstElementChild.style.zoom = 1.0 / me.zoom;
// chrome 54.x: zoom = "reset" - clear retina zoom (windows) }
//document.firstElementChild.style.zoom = "reset"; else
document.firstElementChild.style.zoom = 1.0 / me.zoom; document.firstElementChild.style.zoom = "normal";
}
else
{
// делаем простую проверку
// считаем: 0 < window.devicePixelRatio < 2 => _devicePixelRatio = 1; zoom = window.devicePixelRatio / _devicePixelRatio;
// считаем: window.devicePixelRatio >= 2 => _devicePixelRatio = 2; zoom = window.devicePixelRatio / _devicePixelRatio;
if (window.devicePixelRatio > 0.1)
{
if (window.devicePixelRatio < 1.99)
{
var _devicePixelRatio = 1;
me.zoom = window.devicePixelRatio / _devicePixelRatio;
}
else
{
var _devicePixelRatio = 2;
me.zoom = window.devicePixelRatio / _devicePixelRatio;
}
// chrome 54.x: zoom = "reset" - clear retina zoom (windows)
//document.firstElementChild.style.zoom = "reset";
document.firstElementChild.style.zoom = 1.0 / me.zoom;
}
else
document.firstElementChild.style.zoom = "normal";
}
} }
me.innerWidth = window.innerWidth * me.zoom; me.innerWidth = window.innerWidth * me.zoom;
me.innerHeight = window.innerHeight * me.zoom; me.innerHeight = window.innerHeight * me.zoom;

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -52,7 +52,7 @@ define([
initialize: function(options) { initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments); Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.txtVersionNum = '4.2'; this.txtVersionNum = '{{PRODUCT_VERSION}}';
this.txtAscMail = 'support@onlyoffice.com'; this.txtAscMail = 'support@onlyoffice.com';
this.txtAscTelNum = '+371 660-16425'; this.txtAscTelNum = '+371 660-16425';
this.txtAscUrl = 'www.onlyoffice.com'; this.txtAscUrl = 'www.onlyoffice.com';
@ -147,7 +147,7 @@ define([
'</tr>', '</tr>',
'<tr>', '<tr>',
'<td colspan="3" align="center">', '<td colspan="3" align="center">',
'<a href="http:\/\/'+ this.txtAscUrl +'" target="_blank">' + this.txtAscUrl + '</a>', '<label class="asc-about-desc">' + this.txtAscUrl + '</label>',
'</td>', '</td>',
'</tr>', '</tr>',
'</table>' '</table>'

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -54,7 +54,6 @@ define([
options : { options : {
branding: {}, branding: {},
headerCaption: 'Default Caption', headerCaption: 'Default Caption',
headerDeveloper: 'DEVELOPER MODE',
documentCaption: '', documentCaption: '',
canBack: false canBack: false
}, },
@ -79,16 +78,15 @@ define([
this.options = this.options ? _({}).extend(this.options, options) : options; this.options = this.options ? _({}).extend(this.options, options) : options;
this.headerCaption = this.options.headerCaption; this.headerCaption = this.options.headerCaption;
this.headerDeveloper = this.txtHeaderDeveloper;
this.documentCaption = this.options.documentCaption; this.documentCaption = this.options.documentCaption;
this.canBack = this.options.canBack; this.canBack = this.options.canBack;
this.branding = this.options.customization; this.branding = this.options.customization;
this.isModified = false;
}, },
render: function () { render: function () {
$(this.el).html(this.template({ $(this.el).html(this.template({
headerCaption : this.headerCaption, headerCaption : this.headerCaption,
headerDeveloper : this.headerDeveloper,
documentCaption : Common.Utils.String.htmlEncode(this.documentCaption), documentCaption : Common.Utils.String.htmlEncode(this.documentCaption),
canBack : this.canBack, canBack : this.canBack,
textBack : this.textBack textBack : this.textBack
@ -158,14 +156,18 @@ define([
return this.headerCaption; return this.headerCaption;
}, },
setDocumentCaption: function(value, applyOnly) { setDocumentCaption: function(value, isModified) {
if (_.isUndefined(applyOnly)) { if (isModified !== undefined)
this.documentCaption = value; this.isModified = isModified;
}
this.documentCaption = value;
if (!value) if (!value)
value = ''; value = '';
if (this.isModified)
value = value + '*';
var dc = $('#header-documentcaption div'); var dc = $('#header-documentcaption div');
if (dc) if (dc)
dc.html(Common.Utils.String.htmlEncode(value)); dc.html(Common.Utils.String.htmlEncode(value));
@ -223,10 +225,6 @@ define([
} }
}, },
setDeveloperMode: function(mode) {
$('#header-developer').toggleClass('hidden', !mode);
},
setCanRename: function(rename) { setCanRename: function(rename) {
var dc = $('#header-documentcaption div'); var dc = $('#header-documentcaption div');
if (rename) { if (rename) {
@ -257,7 +255,6 @@ define([
textBack: 'Go to Documents', textBack: 'Go to Documents',
openNewTabText: 'Open in New Tab', openNewTabText: 'Open in New Tab',
txtHeaderDeveloper: 'DEVELOPER MODE',
txtRename: 'Rename' txtRename: 'Rename'
}, Common.Views.Header || {})) }, Common.Views.Header || {}))
}); });

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2017
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
@ -72,7 +72,6 @@ define([
initialize: function(options) { initialize: function(options) {
_.extend(this, options); _.extend(this, options);
this.pluginsPath = '../../../../sdkjs-plugins/';
this._locked = false; this._locked = false;
this._state = { this._state = {
DisabledControls: true DisabledControls: true
@ -92,7 +91,7 @@ define([
enableKeyEvents: false, enableKeyEvents: false,
itemTemplate: _.template([ itemTemplate: _.template([
'<div id="<%= id %>" class="item-plugins" style="display: block;">', '<div id="<%= id %>" class="item-plugins" style="display: block;">',
'<div class="plugin-icon" style="background-image: url(' + '<% if (variations[currentVariation].get("isRelativeUrl")) { if (baseUrl !=="") { %>' + '<%= baseUrl %>' + '<% } else { %>' + this.pluginsPath + '<% } } %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);"></div>', '<div class="plugin-icon" style="background-image: url(' + '<%= baseUrl %>' + '<%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);"></div>',
'<% if (variations.length>1) { %>', '<% if (variations.length>1) { %>',
'<div class="plugin-caret img-commonctrl"></div>', '<div class="plugin-caret img-commonctrl"></div>',
'<% } %>', '<% } %>',

View file

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

View file

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

View file

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

View file

@ -295,7 +295,7 @@
height: 20px; height: 20px;
line-height: @line-height-base; line-height: @line-height-base;
background-color: #EE3525; background-color: #EE3525;
margin: 18px 25px; margin: 10px 18px;
padding: 2px 10px; padding: 2px 10px;
color: #fff; color: #fff;
overflow: hidden; overflow: hidden;

View file

@ -31,26 +31,43 @@
clear: left; clear: left;
overflow: hidden; overflow: hidden;
& > div { &.inline {
display: inline-block; display: inline-block;
&.margin .group-items-container {
margin-right: 20px;
}
} }
.group-items-container { .group-items-container {
overflow: hidden; overflow: hidden;
margin-bottom: 5px;
& > div { & > div {
display: inline-block; display: inline-block;
float: left; float: left;
margin: 4px; margin: 2px 4px 4px;
cursor: pointer;
&:not(.disabled) {
cursor: pointer;
}
&.disabled {
opacity: 0.5;
}
.box-shadow(0 0 0 1px @gray); .box-shadow(0 0 0 1px @gray);
&:hover, &:hover:not(.disabled),
&.selected { &.selected:not(.disabled) {
.box-shadow(0 0 0 2px @primary); .box-shadow(0 0 0 2px @primary);
} }
} }
} }
} }
.header-name {
padding: 10px 2px 12px 4px;
font-weight: bold;
cursor: default;
}
} }

View file

@ -46,34 +46,6 @@
} }
} }
#header-developer {
background-color: #ffb400;
padding-left: 15px + @app-header-height / 3;
& > div {
position: relative;
background-color: #ffb400;
color: #6e4e00 !important;
padding-right: 15px;
cursor: default;
z-index: 1;
white-space: nowrap;
height: @app-header-height;
line-height: @app-header-height;
&:after {
content: '';
position: absolute;
top: 0;
right: -@app-header-height / 2;
width: @app-header-height / 2;
height: @app-header-height;
border-top: @app-header-height / 2 solid transparent;
border-left: @app-header-height / 3 solid #ffb400;
border-bottom: @app-header-height / 2 solid transparent;
}
}
}
#header-documentcaption { #header-documentcaption {
width: 100%; width: 100%;
max-width: 100px; max-width: 100px;

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