Merge branch 'develop' into hotfix/v5.0.6

This commit is contained in:
Julia Radzhabova 2017-12-11 13:24:21 +03:00 committed by GitHub
commit d1e3692e48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
162 changed files with 8700 additions and 929 deletions

View file

@ -43,7 +43,8 @@
print: <can print>, // default = true
rename: <can rename>, // default = false
changeHistory: <can change history>, // default = false
comment: <can comment in view mode> // default = edit
comment: <can comment in view mode> // default = edit,
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
}
},
editorConfig: {
@ -170,7 +171,8 @@
'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onError': <error callback>,
'onDocumentReady': <document ready callback>
'onDocumentReady': <document ready callback>,
'onWarning': <warning callback>
}
}
*/
@ -506,9 +508,10 @@
});
};
var _downloadAs = function() {
var _downloadAs = function(data) {
_sendCommand({
command: 'downloadAs'
command: 'downloadAs',
data: data
});
};

View file

@ -80,8 +80,8 @@ if (Common === undefined) {
$me.trigger('processmailmerge', data);
},
'downloadAs': function() {
$me.trigger('downloadas');
'downloadAs': function(data) {
$me.trigger('downloadas', data);
},
'processMouse': function(data) {
@ -189,6 +189,16 @@ if (Common === undefined) {
});
},
reportWarning: function(code, description) {
_postMessage({
event: 'onWarning',
data: {
warningCode: code,
warningDescription: description
}
});
},
sendInfo: function(info) {
_postMessage({
event: 'onInfo',

View file

@ -106,7 +106,14 @@ Common.Locale = new(function() {
l10n = eval("(" + xhrObj.responseText + ")");
}
}
catch (e) {
catch (e) {
try {
xhrObj.open('GET', 'locale/en.json', false);
xhrObj.send('');
l10n = eval("(" + xhrObj.responseText + ")");
}
catch (e) {
}
}
return {

View file

@ -160,8 +160,8 @@ define([
'</span>' +
'</button>' +
'<button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown">' +
'<span class="caption"><%= caption %></span>' +
'<span class="btn-fixflex-vcenter">' +
'<span class="caption"><%= caption %></span>' +
'<i class="caret img-commonctrl"></i>' +
'</span>' +
'</button>' +
@ -180,7 +180,8 @@ define([
menu : null,
disabled : false,
pressed : false,
split : false
split : false,
visible : true
},
template: _.template([
@ -238,6 +239,7 @@ define([
me.split = me.options.split;
me.toggleGroup = me.options.toggleGroup;
me.disabled = me.options.disabled;
me.visible = me.options.visible;
me.pressed = me.options.pressed;
me.caption = me.options.caption;
me.template = me.options.template || me.template;
@ -466,6 +468,10 @@ define([
me.setDisabled(!(me.disabled=false));
}
if (!me.visible) {
me.setVisible(me.visible);
}
me.trigger('render:after', me);
return this;
@ -550,6 +556,11 @@ define([
setVisible: function(visible) {
if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible);
this.visible = visible;
},
isVisible: function() {
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
},
updateHint: function(hint) {

View file

@ -99,10 +99,32 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
if (this.options.el)
this.render();
},
render: function (parentEl) {
var me = this,
el = $(this.el);
if (!me.rendered) {
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.template({
labelText: this.options.labelText
}));
el = $(this.el);
} else {
el.html(this.template({
labelText: this.options.labelText
}));
}
this.render();
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.$chk.on('click', _.bind(this.onItemCheck, this));
}
this.rendered = true;
if (this.options.disabled)
this.setDisabled(this.options.disabled);
@ -111,20 +133,6 @@ define([
this.setValue(this.options.value, true);
// handle events
this.$chk.on('click', _.bind(this.onItemCheck, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
labelText: this.options.labelText
}));
this.$chk = el.find('input[type=button]');
this.$label = el.find('label');
this.rendered = true;
return this;
},

View file

@ -41,7 +41,8 @@ define([
Common.UI.ColorButton = Common.UI.Button.extend({
options : {
hint: false,
enableToggle: false
enableToggle: false,
visible: true
},
template: _.template([

View file

@ -113,6 +113,8 @@ define([
this._input.on('keyup', _.bind(this.onInputKeyUp, this));
this._input.on('keydown', _.bind(this.onInputKeyDown, this));
this._modalParents = this.cmpEl.closest('.asc-window');
return this;
},
@ -139,7 +141,7 @@ define([
me.onAfterHideMenu(e);
}, 10);
return false;
} else if ((e.keyCode == Common.UI.Keys.HOME || e.keyCode == Common.UI.Keys.END || e.keyCode == Common.UI.Keys.BACKSPACE) && this.isMenuOpen()) {
} else if ((e.keyCode == Common.UI.Keys.HOME && !e.shiftKey || e.keyCode == Common.UI.Keys.END && !e.shiftKey || e.keyCode == Common.UI.Keys.BACKSPACE && !me._input.is(':focus')) && this.isMenuOpen()) {
me._input.focus();
setTimeout(function() {
me._input[0].selectionStart = me._input[0].selectionEnd = (e.keyCode == Common.UI.Keys.HOME) ? 0 : me._input[0].value.length;
@ -319,6 +321,8 @@ define([
var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getName());
if (this.getRawValue() !== name) {
if (this._modalParents.length > 0) return;
var record = this.store.findWhere({
name: name
});

View file

@ -233,6 +233,8 @@ define([
me.emptyText = me.options.emptyText || '';
me.listenStoreEvents= (me.options.listenStoreEvents!==undefined) ? me.options.listenStoreEvents : true;
me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true;
if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false;
me.dataViewItems = [];
if (me.options.keyMoveDirection=='vertical')
@ -471,6 +473,9 @@ define([
});
}
if (this.disabled)
this.setDisabled(this.disabled);
this.attachKeyEvents();
this.lastSelectedRec = null;
this._layoutParams = undefined;
@ -688,20 +693,19 @@ define([
var menuRoot = (this.parentMenu.cmpEl.attr('role') === 'menu')
? this.parentMenu.cmpEl
: this.parentMenu.cmpEl.find('[role=menu]'),
docH = Common.Utils.innerHeight()-10,
innerEl = $(this.el).find('.inner').addBack().filter('.inner'),
docH = Common.Utils.innerHeight(),
parent = innerEl.parent(),
margins = parseInt(parent.css('margin-top')) + parseInt(parent.css('margin-bottom')) + parseInt(menuRoot.css('margin-top')),
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top'));
if (menuH > docH) {
innerEl.css('max-height', (docH - parseInt(menuRoot.css('padding-top')) - parseInt(menuRoot.css('padding-bottom'))-5) + 'px');
if (top + menuH > docH ) {
innerEl.css('max-height', (docH - top - paddings - margins) + 'px');
if (this.allowScrollbar) this.scroller.update({minScrollbarLength : 40});
} else if ( innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - parseInt(menuRoot.css('padding-top')) - parseInt(menuRoot.css('padding-bottom'))-5, this.options.restoreHeight)) + 'px');
menuH = menuRoot.outerHeight();
if (top+menuH > docH) {
menuRoot.css('top', 0);
}
} else if ( top + menuH < docH && innerEl.height() < this.options.restoreHeight ) {
innerEl.css('max-height', (Math.min(docH - top - paddings - margins, this.options.restoreHeight)) + 'px');
if (this.allowScrollbar) this.scroller.update({minScrollbarLength : 40});
}
},

View file

@ -168,6 +168,7 @@ define([
this.splitters.push({resizer:resizer});
panel.resize.hidden && resizer.el.hide();
Common.Gateway.on('processmouse', this.resize.eventStop);
}
}, this);
@ -298,6 +299,11 @@ define([
if (!this.resize.$el) return;
var zoom = (e instanceof jQuery.Event) ? Common.Utils.zoom() : 1;
if (!(e instanceof jQuery.Event) && (e.pageY === undefined || e.pageX === undefined)) {
e.pageY = e.y;
e.pageX = e.x;
}
if (this.resize.type == 'vertical') {
var prop = 'height';
var value = e.pageY*zoom - this.resize.inity;

View file

@ -64,6 +64,7 @@ define([
onResetItems : function() {
this.innerEl = null;
Common.UI.DataView.prototype.onResetItems.call(this);
this.trigger('items:reset', this);
},
onAddItem: function(record, index) {
@ -97,6 +98,16 @@ define([
this.listenTo(view, 'dblclick',this.onDblClickItem);
this.listenTo(view, 'select', this.onSelectItem);
if (record.get('tip')) {
var view_el = $(view.el);
view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : this.tipZIndex
});
}
if (!this.isSuspendEvents)
this.trigger('item:add', this, view, record);
}

View file

@ -424,6 +424,9 @@ define([
onAfterShowMenu: function(e) {
this.trigger('show:after', this, e);
if (this.options.restoreHeight && this.scroller)
this.scroller.update({minScrollbarLength : 40});
if (this.$el.find('> ul > .menu-scroll').length) {
var el = this.$el.find('li .checked')[0];
if (el) {
@ -465,14 +468,20 @@ define([
},
onScroll: function(item, e) {
if (this.fromKeyDown) {
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]');
if (this.scroller) return;
menuRoot.find('.menu-scroll.top').css('top', menuRoot.scrollTop() + 'px');
menuRoot.find('.menu-scroll.bottom').css('bottom', (-menuRoot.scrollTop()) + 'px');
var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl
: this.cmpEl.find('[role=menu]'),
scrollTop = menuRoot.scrollTop(),
top = menuRoot.find('.menu-scroll.top'),
bottom = menuRoot.find('.menu-scroll.bottom');
if (this.fromKeyDown) {
top.css('top', scrollTop + 'px');
bottom.css('bottom', (-scrollTop) + 'px');
}
top.toggleClass('disabled', scrollTop<1);
bottom.toggleClass('disabled', scrollTop + this.options.maxHeight > menuRoot[0].scrollHeight-1);
},
onItemClick: function(item, e) {
@ -493,6 +502,8 @@ define([
},
onScrollClick: function(e) {
if (/disabled/.test(e.currentTarget.className)) return false;
this.scrollMenu(/top/.test(e.currentTarget.className));
return false;
},
@ -562,17 +573,37 @@ define([
left = docW - menuW;
}
if (top + menuH > docH)
top = docH - menuH;
if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');
menuH = menuRoot.outerHeight();
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight ) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
menuH = menuRoot.outerHeight();
}
}
} else {
if (top + menuH > docH)
top = docH - menuH;
if (top < 0)
top = 0;
if (top < 0)
top = 0;
}
if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top);
else
menuRoot.css({left: left, top: top});
},
clearAll: function() {
_.each(this.items, function(item){
if (item.setChecked)
item.setChecked(false, true);
});
}
}), {
Manager: (function() {
return manager;

View file

@ -57,7 +57,7 @@ define([
if ( sv || opts == 'right' ) {
$boxTabs.animate({scrollLeft: opts == 'left' ? sv - 100 : sv + 100}, 200);
}
}
};
function onTabDblclick(e) {
this.fireEvent('change:compact', [$(e.target).data('tab')]);
@ -92,6 +92,10 @@ define([
config.tabs = options.tabs;
$(document.body).on('click', onClickDocument.bind(this));
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
this.setVisible(action, visible)
}, this));
},
afterRender: function() {
@ -108,6 +112,7 @@ define([
$scrollR.on('click', onScrollTabs.bind(this, 'right'));
$boxTabs.on('dblclick', '> .ribtab', onTabDblclick.bind(this));
$boxTabs.on('click', '> .ribtab', me.onTabClick.bind(this));
},
isTabActive: function(tag) {
@ -164,6 +169,12 @@ define([
// clearTimeout(optsFold.timer);
optsFold.$bar.removeClass('folded');
optsFold.$box.off();
var active_panel = optsFold.$box.find('.panel.active');
if ( active_panel.length ) {
var tab = active_panel.data('tab');
me.$tabs.find('> a[data-tab=' + tab + ']').parent().toggleClass('active', true);
}
}
},
@ -194,6 +205,18 @@ define([
}
},
onTabClick: function (e) {
var _is_active = $(e.currentTarget).hasClass('active');
if ( _is_active ) {
if ( this.isFolded ) {
// this.collapse();
}
} else {
var tab = $(e.target).data('tab');
this.setTab(tab);
}
},
setTab: function (tab) {
if ( !tab ) {
onShowFullviewPanel.call(this, false);
@ -234,7 +257,7 @@ define([
return config.tabs[index].action;
}
var _tabTemplate = _.template('<li class="ribtab"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
config.tabs[after + 1] = tab;
var _after_action = _get_tab_action(after);
@ -269,13 +292,13 @@ define([
var _left_bound_ = Math.round($boxTabs.offset().left),
_right_bound_ = Math.round(_left_bound_ + $boxTabs.width());
var tab = this.$tabs.filter(':first:visible').get(0);
var tab = this.$tabs.filter(':visible:first').get(0);
if ( !tab ) return false;
var rect = tab.getBoundingClientRect();
if ( !(Math.round(rect.left) < _left_bound_) ) {
tab = this.$tabs.filter(':last:visible').get(0);
tab = this.$tabs.filter(':visible:last').get(0);
rect = tab.getBoundingClientRect();
if (!(Math.round(rect.right) > _right_bound_))
@ -296,6 +319,11 @@ define([
}
}
}
},
setVisible: function (tab, visible) {
if ( tab && this.$tabs )
this.$tabs.find('> a[data-tab=' + tab + ']').parent().css('display', visible ? '' : 'none');
}
};
}()));

View file

@ -43,7 +43,8 @@ define([
options : {
target : $(document.body),
text : '',
placement: 'right'
placement: 'right',
showLink: true
},
template: _.template([
@ -54,7 +55,9 @@ define([
'<div class="tip-text" style="width: 260px;"><%= scope.text %></div>',
'<div class="close img-commonctrl"></div>',
'</div>',
'<div class="show-link"><label><%= scope.textDontShow %></label></div>',
'<% if ( scope.showLink ) { %>',
'<div class="show-link"><label><%= scope.textLink %></label></div>',
'<% } %>',
'</div>',
'</div>'
].join('')),
@ -65,7 +68,9 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
this.target = this.options.target;
this.text = !_.isEmpty(this.options.text) ? this.options.text : this.textSynchronize;
this.textLink = !_.isEmpty(this.options.textLink) ? this.options.textLink : this.textDontShow;
this.placement = this.options.placement;
this.showLink = this.options.showLink;
},
render: function() {
@ -93,10 +98,18 @@ define([
if (this.cmpEl) this.cmpEl.hide();
},
close: function() {
if (this.cmpEl) this.cmpEl.remove();
},
applyPlacement: function () {
var showxy = this.target.offset();
(this.placement == 'top') ? this.cmpEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'})
: this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'});
if (this.placement == 'top')
this.cmpEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
else if (this.placement == 'left')
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
else // right
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'});
},
isVisible: function() {

View file

@ -207,7 +207,7 @@ define([
function dragComplete() {
if (!_.isUndefined(me.drag)) {
me.drag.tab.$el.css('z-index', '');
me.bar.dragging = false;
var tab = null;
for (var i = me.bar.tabs.length - 1; i >= 0; --i) {
tab = me.bar.tabs[i].$el;
@ -254,6 +254,7 @@ define([
_clientX = e.clientX*Common.Utils.zoom();
me.bar = bar;
me.drag = {tab: tab, index: index};
bar.dragging = true;
this.calculateBounds();
this.setAbsTabs();
@ -343,6 +344,8 @@ define([
this.insert(-1, this.saved);
delete this.saved;
Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this));
this.rendered = true;
return this;
},
@ -362,6 +365,14 @@ define([
}
},
onProcessMouse: function(data) {
if (data.type == 'mouseup' && this.dragging) {
var tab = this.getActive(true);
if (tab)
tab.mouseup();
}
},
add: function(tabs) {
return this.insert(-1, tabs) > 0;
},

View file

@ -146,6 +146,13 @@ define([
updateCustomColors: function() {
var el = $(this.el);
if (el) {
var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
if (color) { // custom color was selected
color = color.toUpperCase();
selected.removeClass(this.selectedCls);
}
var colors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom');
colors = colors ? colors.split(',') : [];
@ -156,6 +163,10 @@ define([
colorEl.find('span').css({
'background-color': '#'+colors[i]
});
if (colors[i] == color) {
colorEl.addClass(this.selectedCls);
color = undefined; //select only first found color
}
}
}
},

View file

@ -294,6 +294,13 @@ define([
}
}
function _onProcessMouse(data) {
if (data.type == 'mouseup' && this.dragging.enabled) {
_mouseup.call(this);
}
}
/* window resize functions */
function _resizestart(event) {
Common.UI.Menu.Manager.hideAll();
@ -580,6 +587,9 @@ define([
};
this.$window.find('.header').on('mousedown', this.binding.dragStart);
this.$window.find('.tool.close').on('click', _.bind(doclose, this));
if (!this.initConfig.modal)
Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this));
} else {
this.$window.find('.body').css({
top:0,

View file

@ -112,7 +112,7 @@ define([
return this;
},
onUsersChanged: function(users){
onUsersChanged: function(users, currentUserId){
if (!this.mode.canLicense || !this.mode.canCoAuthoring) {
var len = 0;
for (name in users) {
@ -146,13 +146,14 @@ define([
if (undefined !== name) {
user = users[name];
if (user) {
arrUsers.push(new Common.Models.User({
var usermodel = new Common.Models.User({
id : user.asc_getId(),
username : user.asc_getUserName(),
online : true,
color : user.asc_getColor(),
view : user.asc_getView()
}));
});
arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel);
}
}
}

View file

@ -173,6 +173,8 @@ define([
arr.push(plugin);
});
this.api.asc_pluginsRegister('', arr);
if (storePlugins.length>0)
Common.NotificationCenter.trigger('tab:visible', 'plugins', true);
},
onAddPlugin: function (model) {

View file

@ -0,0 +1,252 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* Protection.js
*
* Created by Julia Radzhabova on 14.11.2017
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
Common.Controllers = Common.Controllers || {};
define([
'core',
'common/main/lib/view/Protection',
'common/main/lib/view/PasswordDialog',
'common/main/lib/view/SignDialog',
'common/main/lib/view/SignSettingsDialog'
], function () {
'use strict';
Common.Controllers.Protection = Backbone.Controller.extend(_.extend({
models : [],
collections : [
],
views : [
'Common.Views.Protection'
],
sdkViewName : '#id_main',
initialize: function () {
this.addListeners({
'Common.Views.Protection': {
'protect:password': _.bind(this.onPasswordClick, this),
'protect:signature': _.bind(this.onSignatureClick, this)
}
});
},
onLaunch: function () {
this._state = {};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setConfig: function (data, api) {
this.setApi(api);
if (data) {
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
}
},
setApi: function (api) {
if (api) {
this.api = api;
if (this.appConfig.isDesktopApp && this.appConfig.isOffline) {
this.api.asc_registerCallback('asc_onDocumentPassword', _.bind(this.onDocumentPassword, this));
if (this.appConfig.canProtect) {
Common.NotificationCenter.on('protect:sign', _.bind(this.onSignatureRequest, this));
Common.NotificationCenter.on('protect:signature', _.bind(this.onSignatureClick, this));
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onSignatureSign, this));
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
}
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
}
},
setMode: function(mode) {
this.appConfig = mode;
this.view = this.createView('Common.Views.Protection', {
mode: mode
});
return this;
},
onDocumentPassword: function(hasPassword) {
this.view && this.view.onDocumentPassword(hasPassword);
},
SetDisabled: function(state, canProtect) {
this.view && this.view.SetDisabled(state, canProtect);
},
onPasswordClick: function(btn, opts){
switch (opts) {
case 'add': this.addPassword(); break;
case 'delete': this.deletePassword(); break;
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onSignatureRequest: function(guid){
this.api.asc_RequestSign(guid);
},
onSignatureClick: function(type, signed, guid){
switch (type) {
case 'invisible': this.onSignatureRequest('unvisibleAdd'); break;
case 'visible': this.addVisibleSignature(signed, guid); break;
}
},
createToolbarPanel: function() {
return this.view.getPanel();
},
getView: function(name) {
return !name && this.view ?
this.view : Backbone.Controller.prototype.getView.call(this, name);
},
onAppReady: function (config) {
},
addPassword: function() {
var me = this,
win = new Common.Views.PasswordDialog({
api: me.api,
signType: 'invisible',
handler: function(result, props) {
if (result == 'ok') {
me.api.asc_setCurrentPassword(props);
}
Common.NotificationCenter.trigger('edit:complete');
}
});
win.show();
},
deletePassword: function() {
this.api.asc_resetPassword();
},
addInvisibleSignature: function() {
var me = this,
win = new Common.Views.SignDialog({
api: me.api,
signType: 'invisible',
handler: function(dlg, result) {
if (result == 'ok') {
var props = dlg.getSettings();
me.api.asc_Sign(props.certificateId);
}
Common.NotificationCenter.trigger('edit:complete');
}
});
win.show();
},
addVisibleSignature: function(signed, guid) {
var me = this,
win = new Common.Views.SignSettingsDialog({
type: (!signed) ? 'edit' : 'view',
handler: function(dlg, result) {
if (!signed && result == 'ok') {
me.api.asc_AddSignatureLine2(dlg.getSettings());
}
Common.NotificationCenter.trigger('edit:complete');
}
});
win.show();
if (guid)
win.setSettings(this.api.asc_getSignatureSetup(guid));
},
signVisibleSignature: function(guid, width, height) {
var me = this;
if (_.isUndefined(me.fontStore)) {
me.fontStore = new Common.Collections.Fonts();
var fonts = me.getApplication().getController('Toolbar').getView('Toolbar').cmbFontName.store.toJSON();
var arr = [];
_.each(fonts, function(font, index){
if (!font.cloneid) {
arr.push(_.clone(font));
}
});
me.fontStore.add(arr);
}
var win = new Common.Views.SignDialog({
api: me.api,
signType: 'visible',
fontStore: me.fontStore,
signSize: {width: width || 0, height: height || 0},
handler: function(dlg, result) {
if (result == 'ok') {
var props = dlg.getSettings();
me.api.asc_Sign(props.certificateId, guid, props.images[0], props.images[1]);
}
Common.NotificationCenter.trigger('edit:complete');
}
});
win.show();
},
onSignatureSign: function(guid, width, height, isVisible) {
(isVisible) ? this.signVisibleSignature(guid, width, height) : this.addInvisibleSignature();
},
onApiUpdateSignatures: function(valid, requested){
this.SetDisabled(valid && valid.length>0, true);// can add invisible signature
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
}
}, Common.Controllers.Protection || {}));
});

View file

@ -76,7 +76,8 @@ define([
'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchanges:view': _.bind(this.onReviewViewClick, this),
'lang:document': _.bind(this.onDocLanguage, this)
'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
},
'Common.Views.ReviewChangesDialog': {
'reviewchange:accept': _.bind(this.onAcceptClick, this),
@ -94,7 +95,7 @@ define([
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
setConfig: function (data, api) {
this.setApi(api);
@ -111,7 +112,7 @@ define([
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiServerDisconnect, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
}
},
@ -131,7 +132,7 @@ define([
SetDisabled: function(state) {
if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(state);
this.view && this.view.SetDisabled(state, this.langs);
},
onApiShowChange: function (sdkchange) {
@ -487,7 +488,7 @@ define([
state = (state == 'on');
this.api.asc_SetTrackRevisions(state);
Common.localStorage.setItem("de-track-changes", state ? 1 : 0);
Common.localStorage.setItem(this.view.appPrefix + "track-changes", state ? 1 : 0);
this.view.turnChanges(state);
}
@ -497,8 +498,9 @@ define([
state = (state == 'on');
this.view.turnSpelling(state);
Common.localStorage.setItem("de-settings-spellcheck", state ? 1 : 0);
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
this.api.asc_setSpellCheck(state);
Common.Utils.InternalSettings.set("de-settings-spellcheck", state);
},
onReviewViewClick: function(menu, item, e) {
@ -519,6 +521,35 @@ define([
return this._state.previewMode;
},
onCoAuthMode: function(menu, item, e) {
Common.localStorage.setItem(this.view.appPrefix + "settings-coauthmode", item.value);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-coauthmode", item.value);
if (this.api) {
this.api.asc_SetFastCollaborative(item.value==1);
if (this.api.SetCollaborativeMarksShowType) {
var value = Common.localStorage.getItem(item.value ? this.view.appPrefix + "settings-showchanges-fast" : this.view.appPrefix + "settings-showchanges-strict");
if (value !== null)
this.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
else
this.api.SetCollaborativeMarksShowType(item.value ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
}
value = Common.localStorage.getItem(this.view.appPrefix + "settings-autosave");
if (value===null && this.appConfig.customization && this.appConfig.customization.autosave===false)
value = 0;
value = (!item.value && value!==null) ? parseInt(value) : 1;
Common.localStorage.setItem(this.view.appPrefix + "settings-autosave", value);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-autosave", value);
this.api.asc_setAutoSaveGap(value);
}
Common.NotificationCenter.trigger('edit:complete', this.view);
this.view.fireEvent('settings:apply', [this]);
},
disableEditing: function(disable) {
var app = this.getApplication();
app.getController('RightMenu').getView('RightMenu').clearSelection();
@ -535,8 +566,16 @@ define([
if (comments)
comments.setPreviewMode(disable);
leftMenu.getMenu('file').miProtect.setDisabled(disable);
if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(disable || this.langs.length<1);
}
}, this);
}
},
@ -551,7 +590,7 @@ define([
onAppReady: function (config) {
var me = this;
if ( me.view && Common.localStorage.getBool("de-settings-spellcheck", true) )
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", true) )
me.view.turnSpelling(true);
if ( config.canReview ) {
@ -572,7 +611,7 @@ define([
_setReviewStatus(false);
} else {
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
_setReviewStatus(Common.localStorage.getBool(me.view.appPrefix + "track-changes"));
}
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
@ -586,10 +625,19 @@ define([
}
});
}
if (me.view && me.view.btnChat) {
me.getApplication().getController('LeftMenu').leftMenu.btnChat.on('toggle', function(btn, state){
if (state !== me.view.btnChat.pressed)
me.view.turnChat(state);
});
}
},
applySettings: function(menu) {
this.view && this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck", true) );
this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) );
this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) );
},
synchronizeChanges: function() {
@ -600,7 +648,11 @@ define([
setLanguages: function (array) {
this.langs = array;
this.view.btnDocLang.setDisabled(this.langs.length<1);
this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(this.langs.length<1);
}
}, this);
},
onDocLanguage: function() {
@ -625,7 +677,11 @@ define([
})).show();
},
onApiServerDisconnect: function() {
onLostEditRights: function() {
this.view && this.view.onLostEditRights();
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
},

View file

@ -317,7 +317,7 @@
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;
if (e && e.target && (e.target.type === 'textarea' || e.target.type === 'input')) {
if (e && e.target && (e.target.type === 'textarea' && !e.target.hasAttribute('readonly') || e.target.type === 'input')) {
e.stopImmediatePropagation();
e.preventDefault();

View file

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

View file

@ -125,6 +125,9 @@ define(['gateway'], function () {
setKeysFilter: function(value) {
_filter = value;
},
getKeysFilter: function() {
return _filter;
},
itemExists: _getItemExists,
sync: _refresh,
save: _save

View file

@ -101,7 +101,9 @@ Common.Utils = _.extend(new(function() {
Shape : 5,
Slide : 6,
Chart : 7,
MailMerge : 8
MailMerge : 8,
Signature : 9,
Pivot : 10
},
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
me = this,
@ -700,7 +702,23 @@ Common.Utils.createXhr = function () {
}
return xmlhttp;
}
};
Common.Utils.getConfigJson = function (url) {
if ( url ) {
try {
var xhrObj = Common.Utils.createXhr();
if ( xhrObj ) {
xhrObj.open('GET', url, false);
xhrObj.send('');
return JSON.parse(xhrObj.responseText);
}
} catch (e) {}
}
return null;
};
Common.Utils.getConfigJson = function (url) {
if ( url ) {
@ -724,7 +742,7 @@ Common.Utils.asyncCall = function (callback, scope, args) {
})).then(function () {
callback.call(scope, args);
});
}
};
// Extend javascript String type
String.prototype.strongMatch = function(regExp){
@ -734,4 +752,20 @@ String.prototype.strongMatch = function(regExp){
}
return false;
};
};
Common.Utils.InternalSettings = new(function() {
var settings = {};
var _get = function(name) {
return settings[name];
},
_set = function(name, value) {
settings[name] = value;
};
return {
get: _get,
set: _set
}
});

View file

@ -152,11 +152,11 @@ define([
},
getTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function (blur) {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
if (blur) {
text.blur();
} else {
@ -169,15 +169,16 @@ define([
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {
var view = this,
textBox = this.$el.find('textarea'),
domTextBox = null,
minHeight = 50,
$domTextBox = null,
lineHeight = 0,
minHeight = 50,
scrollPos = 0,
oldHeight = 0,
newHeight = 0;
@ -186,17 +187,17 @@ define([
scrollPos = $(view.scroller.el).scrollTop();
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
$domTextBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
parentView.calculateSizeOfContent();
} else {
oldHeight = domTextBox.clientHeight;
if (oldHeight >= minHeight) {
textBox.css({height: minHeight + 'px'});
$domTextBox.css({height: minHeight + 'px'});
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
textBox.css({height: newHeight + 'px'});
$domTextBox.css({height: newHeight + 'px'});
}
parentView.calculateSizeOfContent();
@ -209,17 +210,23 @@ define([
view.autoScrollToEditButtons();
}
this.textBox = undefined;
if (textBox && textBox.length) {
domTextBox = textBox.get(0);
if (domTextBox) {
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
updateTextBoxHeight();
textBox.bind('input propertychange', updateTextBoxHeight)
}
textBox.each(function(idx, item){
if (item) {
domTextBox = item;
$domTextBox = $(item);
var isEdited = !$domTextBox.hasClass('user-message');
lineHeight = isEdited ? parseInt($domTextBox.css('lineHeight'), 10) * 0.25 : 0;
minHeight = isEdited ? 50 : 24;
updateTextBoxHeight();
if (isEdited) {
$domTextBox.bind('input propertychange', updateTextBoxHeight);
view.textBox = $domTextBox;
}
}
});
}
this.textBox = textBox;
},
clearTextBoxBind: function () {
if (this.textBox) {
@ -375,6 +382,7 @@ define([
t.fireEvent('comment:closeEditing');
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('user-reply')) {
t.fireEvent('comment:closeEditing');
@ -399,6 +407,7 @@ define([
t.fireEvent('comment:closeEditing');
readdresolves();
this.autoHeightTextBox();
}
} else if (btn.hasClass('btn-close', false)) {
t.fireEvent('comment:closeEditing', [commentId]);
@ -406,6 +415,7 @@ define([
t.fireEvent('comment:show', [commentId]);
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-inner-edit', false)) {
@ -427,6 +437,7 @@ define([
}
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-inner-close', false)) {
if (record.get('dummy')) {
@ -438,11 +449,8 @@ define([
me.saveText();
record.set('hideAddReply', false);
this.getTextBox().val(me.textVal);
this.autoHeightTextBox();
} else {
this.clearTextBoxBind();
t.fireEvent('comment:closeEditing', [commentId]);
}
@ -453,6 +461,7 @@ define([
me.calculateSizeOfContent();
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-resolve', false)) {
var tip = btn.data('bs.tooltip');
@ -461,6 +470,7 @@ define([
t.fireEvent('comment:resolve', [commentId]);
readdresolves();
this.autoHeightTextBox();
} else if (btn.hasClass('btn-resolve-check', false)) {
var tip = btn.data('bs.tooltip');
if (tip) tip.dontShow = true;
@ -468,20 +478,21 @@ define([
t.fireEvent('comment:resolve', [commentId]);
readdresolves();
this.autoHeightTextBox();
}
}
});
me.on({
'show': function () {
me.commentsView.autoHeightTextBox();
me.$window.find('textarea').keydown(function (event) {
me.$window.find('textarea:not(.user-message)').keydown(function (event) {
if (event.keyCode == Common.UI.Keys.ESC) {
me.hide();
}
});
},
'animate:before': function () {
var text = me.$window.find('textarea');
me.commentsView.autoHeightTextBox();
var text = me.$window.find('textarea:not(.user-message)');
if (text && text.length)
text.focus();
}
@ -889,11 +900,11 @@ define([
},
getTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text : undefined;
},
setFocusToTextBox: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
if (text && text.length) {
var val = text.val();
text.focus();
@ -902,7 +913,7 @@ define([
}
},
getActiveTextBoxVal: function () {
var text = $(this.el).find('textarea');
var text = $(this.el).find('textarea:not(.user-message)');
return (text && text.length) ? text.val().trim() : '';
},
autoHeightTextBox: function () {

View file

@ -70,7 +70,9 @@ define([
'</ul>');
var templateRightBox = '<section>' +
'<section id="box-doc-name"><input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false"></input></section>' +
'<section id="box-doc-name">' +
'<input type="text" id="rib-doc-name" spellcheck="false" data-can-copy="false"></input>' +
'</section>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
@ -394,12 +396,13 @@ define([
if ( this.labelDocName ) this.labelDocName.off();
this.labelDocName = $html.find('#rib-doc-name');
this.labelDocName.on({
'keydown': onDocNameKeyDown.bind(this)
});
// this.labelDocName.attr('maxlength', 50);
this.labelDocName.text = function (text) {
this.val(text).attr('size', text.length);
}
if ( this.documentCaption ) {
this.labelDocName.val( this.documentCaption );
this.labelDocName.text( this.documentCaption );
}
if ( !_.isUndefined(this.options.canRename) ) {
@ -497,8 +500,8 @@ define([
this.documentCaption = value;
this.isModified && (value += '*');
if ( this.labelDocName ) {
this.labelDocName.val( value );
this.labelDocName.attr('size', value.length);
this.labelDocName.text( value );
// this.labelDocName.attr('size', value.length);
this.setCanRename(true);
}
@ -516,7 +519,7 @@ define([
var _name = this.documentCaption;
changed && (_name += '*');
this.labelDocName.val(_name);
this.labelDocName.text(_name);
},
setCanBack: function (value) {
@ -541,7 +544,16 @@ define([
title: me.txtRename,
placement: 'cursor'}
);
label.on({
'keydown': onDocNameKeyDown.bind(this),
'blur': function (e) {
}
});
} else {
label.off();
label.attr('disabled', true);
var tip = label.data('bs.tooltip');
if ( tip ) {

View file

@ -0,0 +1,170 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* OpenDialog.js
*
* Select Codepage for open CSV/TXT format file.
*
* Created by Alexey.Musinov on 29/04/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window'
], function () {
'use strict';
Common.Views.PasswordDialog = Common.UI.Window.extend(_.extend({
applyFunction: undefined,
initialize : function (options) {
var t = this,
_options = {};
_.extend(_options, {
closable: false,
width : 350,
height : 220,
header : true,
cls : 'modal-dlg',
contentTemplate : '',
title : t.txtTitle
}, options);
this.template = options.template || [
'<div class="box" style="height:' + (_options.height - 85) + 'px;">',
'<div class="input-row" style="margin-bottom: 10px;">',
'<label>' + t.txtDescription + '</label>',
'</div>',
'<div class="input-row">',
'<label>' + t.txtPassword + '</label>',
'</div>',
'<div id="id-password-txt" class="input-row" style="margin-bottom: 5px;"></div>',
'<div class="input-row">',
'<label>' + t.txtRepeat + '</label>',
'</div>',
'<div id="id-repeat-txt" class="input-row"></div>',
'</div>',
'<div class="separator horizontal"/>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + t.cancelButtonText + '</button>',
'</div>'
].join('');
this.handler = options.handler;
this.settings = options.settings;
_options.tpl = _.template(this.template)(_options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
if (this.$window) {
var me = this;
this.$window.find('.tool').hide();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'),
type: 'password',
allowBlank : false,
style : 'width: 100%;',
validateOnBlur: false
});
this.repeatPwd = new Common.UI.InputField({
el: $('#id-repeat-txt'),
type: 'password',
allowBlank : false,
style : 'width: 100%;',
validateOnBlur: false,
validation : function(value) {
return me.txtIncorrectPwd;
}
});
this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
}
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
setTimeout(function(){
me.inputPwd.cmpEl.find('input').focus();
}, 500);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
}
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
_handleInput: function(state) {
if (this.handler) {
if (state == 'ok') {
if (this.inputPwd.checkValidate() !== true) {
this.inputPwd.cmpEl.find('input').focus();
return;
}
if (this.inputPwd.getValue() !== this.repeatPwd.getValue()) {
this.repeatPwd.checkValidate();
this.repeatPwd.cmpEl.find('input').focus();
return;
}
}
this.handler.call(this, state, this.inputPwd.getValue());
}
this.close();
},
okButtonText : "OK",
cancelButtonText : "Cancel",
txtTitle : "Set Password",
txtPassword : "Password",
txtDescription : "A Password is required to open this document",
txtRepeat: 'Repeat password',
txtIncorrectPwd: 'Confirmation password is not identical'
}, Common.Views.PasswordDialog || {}));
});

View file

@ -0,0 +1,314 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* Protection.js
*
* Created by Julia Radzhabova on 14.11.2017
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
Common.Views = Common.Views || {};
define([
'common/main/lib/util/utils',
'common/main/lib/component/BaseView',
'common/main/lib/component/Layout',
'common/main/lib/component/Window'
], function (template) {
'use strict';
Common.Views.Protection = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section id="protection-panel" class="panel" data-tab="protect">' +
'<div class="group">' +
'<span id="slot-btn-add-password" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-change-password" class="btn-slot text x-huge"></span>' +
'<span id="slot-btn-signature" class="btn-slot text x-huge"></span>' +
'</div>' +
'</section>';
function setEvents() {
var me = this;
if ( me.appConfig.isDesktopApp && me.appConfig.isOffline ) {
this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(button) {
button.on('click', function (b, e) {
me.fireEvent('protect:password', [b, 'add']);
});
});
this.btnsDelPwd.forEach(function(button) {
button.on('click', function (b, e) {
me.fireEvent('protect:password', [b, 'delete']);
});
});
this.btnPwd.menu.on('item:click', function (menu, item, e) {
me.fireEvent('protect:password', [menu, item.value]);
});
if (me.appConfig.canProtect) {
if (this.btnSignature.menu)
this.btnSignature.menu.on('item:click', function (menu, item, e) {
me.fireEvent('protect:signature', [item.value, false]);
});
this.btnsInvisibleSignature.forEach(function(button) {
button.on('click', function (b, e) {
me.fireEvent('protect:signature', ['invisible']);
});
});
}
}
}
return {
options: {},
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.appConfig = options.mode;
this.btnsInvisibleSignature = [];
this.btnsAddPwd = [];
this.btnsDelPwd = [];
this.btnsChangePwd = [];
this._state = {disabled: false, hasPassword: false};
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
if ( this.appConfig.isDesktopApp && this.appConfig.isOffline ) {
this.btnAddPwd = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-protect',
caption: this.txtEncrypt
});
this.btnsAddPwd.push(this.btnAddPwd);
this.btnPwd = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-protect',
caption: this.txtEncrypt,
menu: true,
visible: false
});
if (this.appConfig.canProtect) {
this.btnSignature = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-signature',
caption: this.txtSignature,
menu: (this.appPrefix !== 'pe-')
});
if (!this.btnSignature.menu)
this.btnsInvisibleSignature.push(this.btnSignature);
}
}
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},
render: function (el) {
this.boxSdk = $('#editor_sdk');
if ( el ) el.html( this.getPanel() );
return this;
},
onAppReady: function (config) {
var me = this;
(new Promise(function (accept, reject) {
accept();
})).then(function(){
if ( config.isDesktopApp && config.isOffline) {
me.btnAddPwd.updateHint(me.hintAddPwd);
me.btnPwd.updateHint(me.hintPwd);
me.btnPwd.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtChangePwd,
value: 'add'
},
{
caption: me.txtDeletePwd,
value: 'delete'
}
]
})
);
if (me.btnSignature) {
me.btnSignature.updateHint((me.btnSignature.menu) ? me.hintSignature : me.txtInvisibleSignature);
me.btnSignature.menu && me.btnSignature.setMenu(
new Common.UI.Menu({
items: [
{
caption: me.txtInvisibleSignature,
value: 'invisible'
},
{
caption: me.txtSignatureLine,
value: 'visible',
disabled: me._state.disabled
}
]
})
);
}
Common.NotificationCenter.trigger('tab:visible', 'protect', true);
}
setEvents.call(me);
});
},
getPanel: function () {
this.$el = $(_.template(template)( {} ));
if ( this.appConfig.isDesktopApp && this.appConfig.isOffline ) {
this.btnAddPwd.render(this.$el.find('#slot-btn-add-password'));
this.btnPwd.render(this.$el.find('#slot-btn-change-password'));
this.btnSignature && this.btnSignature.render(this.$el.find('#slot-btn-signature'));
}
return this.$el;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
this.fireEvent('show', this);
},
getButton: function(type, parent) {
if ( type == 'signature' ) {
var button = new Common.UI.Button({
cls: 'btn-text-default',
style: 'width: 100%;',
caption: this.txtInvisibleSignature,
disabled: this._state.disabled
});
this.btnsInvisibleSignature.push(button);
return button;
} else if ( type == 'add-password' ) {
var button = new Common.UI.Button({
cls: 'btn-text-default',
style: 'width: 100%;',
caption: this.txtAddPwd,
disabled: this._state.disabled,
visible: !this._state.hasPassword
});
this.btnsAddPwd.push(button);
return button;
} else if ( type == 'del-password' ) {
var button = new Common.UI.Button({
cls: 'btn-text-default',
style: 'width: 100%;',
caption: this.txtDeletePwd,
disabled: this._state.disabled,
visible: this._state.hasPassword
});
this.btnsDelPwd.push(button);
return button;
} else if ( type == 'change-password' ) {
var button = new Common.UI.Button({
cls: 'btn-text-default',
style: 'width: 100%;',
caption: this.txtChangePwd,
disabled: this._state.disabled,
visible: this._state.hasPassword
});
this.btnsChangePwd.push(button);
return button;
}
},
SetDisabled: function (state, canProtect) {
this._state.disabled = state;
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
if ( button ) {
button.setDisabled(state && !canProtect);
}
}, this);
if (this.btnSignature && this.btnSignature.menu) {
this.btnSignature.menu.items && this.btnSignature.menu.items[1].setDisabled(state); // disable adding signature line
this.btnSignature.setDisabled(state && !canProtect); // disable adding any signature
}
this.btnsAddPwd.concat(this.btnsDelPwd, this.btnsChangePwd).forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
},
onDocumentPassword: function (hasPassword) {
this._state.hasPassword = hasPassword;
this.btnsAddPwd && this.btnsAddPwd.forEach(function(button) {
if ( button ) {
button.setVisible(!hasPassword);
}
}, this);
this.btnsDelPwd.concat(this.btnsChangePwd).forEach(function(button) {
if ( button ) {
button.setVisible(hasPassword);
}
}, this);
this.btnPwd.setVisible(hasPassword);
},
txtEncrypt: 'Encrypt',
txtSignature: 'Signature',
hintAddPwd: 'Encrypt with password',
hintPwd: 'Change or delete password',
hintSignature: 'Add digital signature or signature line',
txtChangePwd: 'Change password',
txtDeletePwd: 'Delete password',
txtAddPwd: 'Add password',
txtInvisibleSignature: 'Add digital signature',
txtSignatureLine: 'Signature line'
}
}()), Common.Views.Protection || {}));
});

View file

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

View file

@ -0,0 +1,358 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* SignDialog.js
*
* Created by Julia Radzhabova on 5/19/17
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/util/utils',
'common/main/lib/component/InputField',
'common/main/lib/component/Window',
'common/main/lib/component/ComboBoxFonts'
], function () { 'use strict';
Common.Views.SignDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
style: 'min-width: 350px;',
cls: 'modal-dlg'
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.api = this.options.api;
this.signType = this.options.signType || 'invisible';
this.signSize = this.options.signSize || {width: 0, height: 0};
this.certificateId = null;
this.signObject = null;
this.fontStore = this.options.fontStore;
this.font = {
size: 11,
name: 'Arial',
bold: false,
italic: false
};
this.template = [
'<div class="box" style="height: ' + ((this.signType == 'invisible') ? '132px;' : '300px;') + '">',
'<div id="id-dlg-sign-invisible">',
'<div class="input-row">',
'<label>' + this.textPurpose + '</label>',
'</div>',
'<div id="id-dlg-sign-purpose" class="input-row"></div>',
'</div>',
'<div id="id-dlg-sign-visible">',
'<div class="input-row">',
'<label>' + this.textInputName + '</label>',
'</div>',
'<div id="id-dlg-sign-name" class="input-row" style="margin-bottom: 5px;"></div>',
'<div id="id-dlg-sign-fonts" class="input-row" style="display: inline-block;"></div>',
'<div id="id-dlg-sign-font-size" class="input-row" style="display: inline-block;margin-left: 3px;"></div>',
'<div id="id-dlg-sign-bold" style="display: inline-block;margin-left: 3px;"></div>','<div id="id-dlg-sign-italic" style="display: inline-block;margin-left: 3px;"></div>',
'<div class="input-row" style="margin-top: 10px;">',
'<label>' + this.textUseImage + '</label>',
'</div>',
'<button id="id-dlg-sign-image" class="btn btn-text-default" style="">' + this.textSelectImage + '</button>',
'<div class="input-row" style="margin-top: 10px;">',
'<label style="font-weight: bold;">' + this.textSignature + '</label>',
'</div>',
'<div style="border: 1px solid #cbcbcb;"><div id="signature-preview-img" style="width: 100%; height: 50px;position: relative;"></div></div>',
'</div>',
'<table style="margin-top: 30px;">',
'<tr>',
'<td><label style="font-weight: bold;margin-bottom: 3px;">' + this.textCertificate + '</label></td>' +
'<td rowspan="2" style="vertical-align: top; padding-left: 30px;"><button id="id-dlg-sign-change" class="btn btn-text-default" style="">' + this.textChange + '</button></td>',
'</tr>',
'<tr><td><div id="id-dlg-sign-certificate" class="hidden" style="max-width: 212px;overflow: hidden;"></td></tr>',
'</table>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
this.templateCertificate = _.template([
'<label style="display: block;margin-bottom: 3px;"><%= Common.Utils.String.htmlEncode(name) %></label>',
'<label style="display: block;"><%= Common.Utils.String.htmlEncode(valid) %></label>'
].join(''));
this.options.tpl = _.template(this.template)(this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var me = this,
$window = this.getChild();
me.inputPurpose = new Common.UI.InputField({
el : $('#id-dlg-sign-purpose'),
style : 'width: 100%;'
});
me.inputName = new Common.UI.InputField({
el : $('#id-dlg-sign-name'),
style : 'width: 100%;',
validateOnChange: true
}).on ('changing', _.bind(me.onChangeName, me));
me.cmbFonts = new Common.UI.ComboBoxFonts({
el : $('#id-dlg-sign-fonts'),
cls : 'input-group-nr',
style : 'width: 214px;',
menuCls : 'scrollable-menu',
menuStyle : 'min-width: 55px;max-height: 270px;',
store : new Common.Collections.Fonts(),
recent : 0,
hint : me.tipFontName
}).on('selected', function(combo, record) {
if (me.signObject) {
me.signObject.setText(me.inputName.getValue(), record.name, me.font.size, me.font.italic, me.font.bold);
}
me.font.name = record.name;
});
this.cmbFontSize = new Common.UI.ComboBox({
el: $('#id-dlg-sign-font-size'),
cls: 'input-group-nr',
style: 'width: 55px;',
menuCls : 'scrollable-menu',
menuStyle: 'min-width: 55px;max-height: 270px;',
hint: this.tipFontSize,
data: [
{ value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" },
{ value: 10, displayValue: "10" },
{ value: 11, displayValue: "11" },
{ value: 12, displayValue: "12" },
{ value: 14, displayValue: "14" },
{ value: 16, displayValue: "16" },
{ value: 18, displayValue: "18" },
{ value: 20, displayValue: "20" },
{ value: 22, displayValue: "22" },
{ value: 24, displayValue: "24" },
{ value: 26, displayValue: "26" },
{ value: 28, displayValue: "28" },
{ value: 36, displayValue: "36" },
{ value: 48, displayValue: "48" },
{ value: 72, displayValue: "72" }
]
}).on('selected', function(combo, record) {
if (me.signObject) {
me.signObject.setText(me.inputName.getValue(), me.font.name, record.value, me.font.italic, me.font.bold);
}
me.font.size = record.value;
});
this.cmbFontSize.setValue(this.font.size);
me.btnBold = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'btn-bold',
enableToggle: true,
hint: me.textBold
});
me.btnBold.render($('#id-dlg-sign-bold')) ;
me.btnBold.on('click', function(btn, e) {
if (me.signObject) {
me.signObject.setText(me.inputName.getValue(), me.font.name, me.font.size, me.font.italic, btn.pressed);
}
me.font.bold = btn.pressed;
});
me.btnItalic = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'btn-italic',
enableToggle: true,
hint: me.textItalic
});
me.btnItalic.render($('#id-dlg-sign-italic')) ;
me.btnItalic.on('click', function(btn, e) {
if (me.signObject) {
me.signObject.setText(me.inputName.getValue(), me.font.name, me.font.size, btn.pressed, me.font.bold);
}
me.font.italic = btn.pressed;
});
me.btnSelectImage = new Common.UI.Button({
el: '#id-dlg-sign-image'
});
me.btnSelectImage.on('click', _.bind(me.onSelectImage, me));
me.btnChangeCertificate = new Common.UI.Button({
el: '#id-dlg-sign-change'
});
me.btnChangeCertificate.on('click', _.bind(me.onChangeCertificate, me));
me.btnOk = new Common.UI.Button({
el: $window.find('.primary'),
disabled: true
});
me.cntCertificate = $('#id-dlg-sign-certificate');
me.cntVisibleSign = $('#id-dlg-sign-visible');
me.cntInvisibleSign = $('#id-dlg-sign-invisible');
(me.signType == 'visible') ? me.cntInvisibleSign.addClass('hidden') : me.cntVisibleSign.addClass('hidden');
$window.find('.dlg-btn').on('click', _.bind(me.onBtnClick, me));
$window.find('input').on('keypress', _.bind(me.onKeyPress, me));
me.afterRender();
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
((me.signType == 'visible') ? me.inputName : me.inputPurpose).cmpEl.find('input').focus();
},500);
},
close: function() {
this.api.asc_unregisterCallback('on_signature_defaultcertificate_ret', this.binding.certificateChanged);
this.api.asc_unregisterCallback('on_signature_selectsertificate_ret', this.binding.certificateChanged);
Common.UI.Window.prototype.close.apply(this, arguments);
if (this.signObject)
this.signObject.destroy();
},
afterRender: function () {
if (this.api) {
this.binding = {
certificateChanged: _.bind(this.onCertificateChanged, this)
};
this.api.asc_registerCallback('on_signature_defaultcertificate_ret', this.binding.certificateChanged);
this.api.asc_registerCallback('on_signature_selectsertificate_ret', this.binding.certificateChanged);
this.api.asc_GetDefaultCertificate();
}
if (this.signType == 'visible') {
this.cmbFonts.fillFonts(this.fontStore);
this.cmbFonts.selectRecord(this.fontStore.findWhere({name: this.font.name}) || this.fontStore.at(0));
this.signObject = new AscCommon.CSignatureDrawer('signature-preview-img', this.api, this.signSize.width, this.signSize.height);
}
},
getSettings: function () {
var props = {};
props.certificateId = this.certificateId;
if (this.signType == 'invisible') {
props.purpose = this.inputPurpose.getValue();
} else {
props.images = this.signObject ? this.signObject.getImages() : [null, null];
}
return props;
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
return false;
}
},
_handleInput: function(state) {
if (this.options.handler) {
if (state == 'ok' && (this.btnOk.isDisabled() || this.signObject && !this.signObject.isValid()))
return;
this.options.handler.call(this, this, state);
}
this.close();
},
onChangeCertificate: function() {
this.api.asc_SelectCertificate();
},
onCertificateChanged: function(certificate) {
this.certificateId = certificate.id;
var date = certificate.date,
arr_date = (typeof date == 'string') ? date.split(' - ') : ['', ''];
this.cntCertificate.html(this.templateCertificate({name: certificate.name, valid: this.textValid.replace('%1', arr_date[0]).replace('%2', arr_date[1])}));
this.cntCertificate.toggleClass('hidden', _.isEmpty(this.certificateId) || this.certificateId<0);
this.btnOk.setDisabled(_.isEmpty(this.certificateId) || this.certificateId<0);
},
onSelectImage: function() {
if (!this.signObject) return;
this.signObject.selectImage();
this.inputName.setValue('');
},
onChangeName: function (input, value) {
if (!this.signObject) return;
this.signObject.setText(value, this.font.name, this.font.size, this.font.italic, this.font.bold);
},
textTitle: 'Sign Document',
textPurpose: 'Purpose for signing this document',
textCertificate: 'Certificate',
textValid: 'Valid from %1 to %2',
textChange: 'Change',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
textInputName: 'Input signer name',
textUseImage: 'or click \'Select Image\' to use a picture as signature',
textSelectImage: 'Select Image',
textSignature: 'Signature looks as',
tipFontName: 'Font Name',
tipFontSize: 'Font Size',
textBold: 'Bold',
textItalic: 'Italic'
}, Common.Views.SignDialog || {}))
});

View file

@ -0,0 +1,213 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* SignSettingsDialog.js
*
* Created by Julia Radzhabova on 5/19/17
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/util/utils',
'common/main/lib/component/InputField',
'common/main/lib/component/CheckBox',
'common/main/lib/component/Window'
], function () { 'use strict';
Common.Views.SignSettingsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
style: 'min-width: 350px;',
cls: 'modal-dlg',
type: 'edit'
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box" style="height: 260px;">',
'<div class="input-row">',
'<label>' + this.textInfo + '</label>',
'</div>',
'<div class="input-row">',
'<label>' + this.textInfoName + '</label>',
'</div>',
'<div id="id-dlg-sign-settings-name" class="input-row" style="margin-bottom: 5px;"></div>',
'<div class="input-row">',
'<label>' + this.textInfoTitle + '</label>',
'</div>',
'<div id="id-dlg-sign-settings-title" class="input-row" style="margin-bottom: 5px;"></div>',
'<div class="input-row">',
'<label>' + this.textInfoEmail + '</label>',
'</div>',
'<div id="id-dlg-sign-settings-email" class="input-row" style="margin-bottom: 10px;"></div>',
'<div class="input-row">',
'<label>' + this.textInstructions + '</label>',
'</div>',
'<textarea id="id-dlg-sign-settings-instructions" class="form-control" style="width: 100%;height: 35px;margin-bottom: 10px;resize: none;"></textarea>',
'<div id="id-dlg-sign-settings-date"></div>',
'</div>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<% if (type == "edit") { %>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'<% } %>',
'</div>'
].join('');
this.api = this.options.api;
this.type = this.options.type || 'edit';
this.options.tpl = _.template(this.template)(this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var me = this,
$window = this.getChild();
me.inputName = new Common.UI.InputField({
el : $('#id-dlg-sign-settings-name'),
style : 'width: 100%;',
disabled : this.type=='view'
});
me.inputTitle = new Common.UI.InputField({
el : $('#id-dlg-sign-settings-title'),
style : 'width: 100%;',
disabled : this.type=='view'
});
me.inputEmail = new Common.UI.InputField({
el : $('#id-dlg-sign-settings-email'),
style : 'width: 100%;',
disabled : this.type=='view'
});
me.textareaInstructions = this.$window.find('textarea');
me.textareaInstructions.keydown(function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
event.stopPropagation();
}
});
(this.type=='view') ? this.textareaInstructions.attr('disabled', 'disabled') : this.textareaInstructions.removeAttr('disabled');
this.textareaInstructions.toggleClass('disabled', this.type=='view');
this.chDate = new Common.UI.CheckBox({
el: $('#id-dlg-sign-settings-date'),
labelText: this.textShowDate,
disabled: this.type=='view'
});
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
me.inputName.cmpEl.find('input').focus();
},500);
},
setSettings: function (props) {
if (props) {
var me = this;
var value = props.asc_getSigner1();
me.inputName.setValue(value ? value : '');
value = props.asc_getSigner2();
me.inputTitle.setValue(value ? value : '');
value = props.asc_getEmail();
me.inputEmail.setValue(value ? value : '');
value = props.asc_getInstructions();
me.textareaInstructions.val(value ? value : '');
me.chDate.setValue(props.asc_getShowDate());
}
},
getSettings: function () {
var me = this,
props = new AscCommon.asc_CSignatureLine();
props.asc_setSigner1(me.inputName.getValue());
props.asc_setSigner2(me.inputTitle.getValue());
props.asc_setEmail(me.inputEmail.getValue());
props.asc_setInstructions(me.textareaInstructions.val());
props.asc_setShowDate(me.chDate.getValue()=='checked');
return props;
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
return false;
}
},
_handleInput: function(state) {
if (this.options.handler)
this.options.handler.call(this, this, state);
this.close();
},
textInfo: 'Signer Info',
textInfoName: 'Name',
textInfoTitle: 'Signer Title',
textInfoEmail: 'E-mail',
textInstructions: 'Instructions for Signer',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',
txtEmpty: 'This field is required',
textAllowComment: 'Allow signer to add comment in the signature dialog',
textShowDate: 'Show sign date in signature line',
textTitle: 'Signature Settings'
}, Common.Views.SignSettingsDialog || {}))
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -11,10 +11,10 @@
<polygon points="13,31 10,28 10,30 6,30 6,32 10,32 10,34 "/>
</symbol>
<symbol id="svg-btn-users" viewBox="0 0 20 20">
<path d="M16.469,14.184l-0.161-1.113c0.658-0.479,1.118-1.524,1.118-2.319c0-1.092-0.863-2.013-1.926-2.013c-1.063,0-1.925,0.868-1.925,1.961c0,0.795,0.46,1.766,1.118,2.242l-0.162,1.247c-0.461,0.039-0.863,0.108-1.214,0.215
c-0.886-1.419-2.496-2.061-3.997-2.226l-0.129-0.844c0.903-0.804,1.559-2.239,1.559-3.48c0-1.85-1.458-3.354-3.25-3.354S4.25,5.985,4.25,7.811c0,1.23,0.644,2.616,1.562,3.419l-0.135,0.952C3.459,12.427,1,13.705,1,17h18
C19,16,18.387,14.345,16.469,14.184z M2.517,16c0.136-1.908,1.116-2.647,3.642-2.86l0.397-0.033l0.328-2.317L6.64,10.612C5.86,10.048,5.25,8.816,5.25,7.811C5.25,6.536,6.26,5.5,7.5,5.5s2.25,1.056,2.25,2.354c0,1.024-0.624,2.312-1.391,2.868L8.113,10.9
l0.337,2.202l0.393,0.033c2.525,0.213,3.505,0.952,3.641,2.864H2.517z"/>
<path fill="#FFFFFF" d="M7,3.999c1.103,0,2,0.897,2,2C9,7.103,8.103,8,7,8C5.897,8,5,7.103,5,5.999C5,4.896,5.897,3.999,7,3.999 M7,2.999c-1.657,0-3,1.344-3,3S5.343,9,7,9c1.657,0,3-1.345,3-3.001S8.657,2.999,7,2.999L7,2.999z"/>
<path fill="#FFFFFF" d="M7,11.666c4.185,0,4.909,2.268,5,2.642V16H2v-1.688C2.1,13.905,2.841,11.666,7,11.666 M7,10.666 c-5.477,0-6,3.545-6,3.545V17h12v-2.789C13,14.211,12.477,10.666,7,10.666L7,10.666z"/>
<circle fill="#FFFFFF" cx="14.5" cy="8.001" r="2.5"/>
<path fill="#FFFFFF" d="M14.5,11.863c-0.566,0-1.056,0.059-1.49,0.152c0.599,0.726,0.895,1.481,0.979,2.049L14,14.138V17h5v-2.263 C19,14.737,18.607,11.863,14.5,11.863z"/>
</symbol>
<symbol id="svg-btn-download" viewBox="0 0 20 20">
<rect x="4" y="16" width="12" height="1"/>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -155,6 +155,9 @@
}
.btn-fixflex-vcenter {
display: flex;
align-items: center;
.caret {
vertical-align: inherit;
}

View file

@ -275,4 +275,15 @@
}
}
}
}
.combo-pivot-template {
.combo-template(60px);
margin-top: -6px;
margin-bottom: -6px;
.view .dataview {
padding: 1px;
}
}

View file

@ -78,7 +78,7 @@
overflow: hidden;
color: @gray-darker;
textarea {
textarea:not(.user-message) {
width: 100%;
height: 50px;
resize: none;
@ -172,6 +172,14 @@
}
}
textarea.user-message {
border: none;
resize: none;
width: 100%;
line-height: 15px;
cursor: text;
}
.user-reply {
color: @black;
margin-top: 10px;

View file

@ -66,6 +66,7 @@
background-color: @dropdown-bg;
height: 16px;
width: 100%;
cursor: pointer;
&.top {
top: 0;
@ -96,5 +97,10 @@
border-left: 3px solid transparent;
}
}
&.disabled {
opacity: 0.3;
cursor: default;
}
}
}

View file

@ -100,8 +100,16 @@
border: 0 none;
cursor: default;
&:focus {
&:hover:not(:disabled) {
border: 1px solid @gray-dark;
background-color: rgba(255,255,255,0.2);
}
&:focus:not(:active) {
border: 1px solid @gray-dark;
cursor: text;
background-color: white;
color: @gray-deep;
}
width: 100%;
}
@ -217,7 +225,7 @@
.name {
display: block;
padding-left: 16px;
margin-top: -3px;
margin-top: -5px;
white-space: nowrap;
text-overflow: ellipsis;
vertical-align: middle;

View file

@ -28,24 +28,33 @@
border-style: solid;
border-width: 1px 0;
border-top-color: #fafafa;
}
&:not(.disabled) > .item {
&:hover {
background-color: @secondary;
border-color: @secondary;
border-style: solid;
border-width: 1px 0;
background-color: @secondary;
border-color: @secondary;
border-style: solid;
border-width: 1px 0;
}
&.selected {
background-color: @primary;
color: #fff;
border-color: @primary;
border-style: solid;
border-width: 1px 0;
background-color: @primary;
color: #fff;
border-color: @primary;
border-style: solid;
border-width: 1px 0;
}
}
&.ps-container {
overflow: hidden;
}
&.disabled {
> .item {
cursor: default;
opacity: 0.5;
}
}
}

View file

@ -23,6 +23,21 @@
}
}
&.left {
margin: -32px 15px 0 0;
.tip-arrow {
right: -15px;
top: 20px;
width: 15px;
height: 30px;
&:after {
top: 5px;
left: -8px;
}
}
}
&.top {
margin: 0 -32px 15px 0;

View file

@ -224,6 +224,10 @@
width: 22px;
height: 22px;
}
.checkbox-indeterminate {
margin-top: 3px;
}
}
}
@ -275,6 +279,12 @@
.button-normal-icon(~'x-huge .btn-ic-docspell', 12, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-review', 13, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-reviewview', 30, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-sharing', 31, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-coedit', 32, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-chat', 33, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-history', 34, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-protect', 35, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-ic-signature', 36, @toolbar-big-icon-size);
.button-normal-icon(review-save, 14, @toolbar-big-icon-size);
.button-normal-icon(review-deny, 15, @toolbar-big-icon-size);
.button-normal-icon(review-next, 16, @toolbar-big-icon-size);

View file

@ -398,6 +398,8 @@ var ApplicationController = new(function(){
});
}
else {
Common.Gateway.reportWarning(id, message);
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
$('#id-critical-error-message').text(message);
$('#id-critical-error-close').off();

View file

@ -163,6 +163,7 @@ require([
,'Common.Controllers.ExternalDiagramEditor'
,'Common.Controllers.ExternalMergeEditor'
,'Common.Controllers.ReviewChanges'
,'Common.Controllers.Protection'
]
});
@ -183,6 +184,7 @@ require([
'documenteditor/main/app/view/TableSettings',
'documenteditor/main/app/view/ShapeSettings',
'documenteditor/main/app/view/TextArtSettings',
'documenteditor/main/app/view/SignatureSettings',
'common/main/lib/util/utils',
'common/main/lib/util/LocalStorage',
'common/main/lib/controller/Fonts',
@ -196,6 +198,7 @@ require([
,'common/main/lib/controller/ExternalDiagramEditor'
,'common/main/lib/controller/ExternalMergeEditor'
,'common/main/lib/controller/ReviewChanges'
,'common/main/lib/controller/Protection'
], function() {
app.start();
});

View file

@ -99,11 +99,18 @@ define([
'search:replace': _.bind(this.onQueryReplace, this),
'search:replaceall': _.bind(this.onQueryReplaceAll, this),
'search:highlight': _.bind(this.onSearchHighlight, this)
},
'Common.Views.ReviewChanges': {
'collaboration:chat': _.bind(this.onShowHideChat, this)
}
});
Common.NotificationCenter.on('leftmenu:change', _.bind(this.onMenuChange, this));
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
Common.NotificationCenter.on('collaboration:history', _.bind(function () {
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem(null, 'history');
}, this));
},
onLaunch: function() {
@ -267,7 +274,7 @@ define([
default: close_menu = false;
}
if (close_menu) {
if (close_menu && menu) {
menu.hide();
}
},
@ -297,16 +304,21 @@ define([
applySettings: function(menu) {
var value;
this.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode"));
value = Common.localStorage.getBool("de-settings-inputmode");
Common.Utils.InternalSettings.set("de-settings-inputmode", value);
this.api.SetTextBoxInputMode(value);
if (Common.Utils.isChrome) {
value = Common.localStorage.getBool("de-settings-inputsogou");
Common.Utils.InternalSettings.set("de-settings-inputsogou", value);
this.api.setInputParams({"SogouPinyin" : value});
}
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
var fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true);
Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
@ -316,13 +328,21 @@ define([
case 'last': value = Asc.c_oAscCollaborativeMarksShowType.LastChanges; break;
default: value = (fast_coauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges;
}
Common.Utils.InternalSettings.set((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value);
this.api.SetCollaborativeMarksShowType(value);
}
(Common.localStorage.getBool("de-settings-livecomment", true)) ? this.api.asc_showComments(Common.localStorage.getBool("de-settings-resolvedcomment", true)) : this.api.asc_hideComments();
value = Common.localStorage.getBool("de-settings-livecomment", true);
Common.Utils.InternalSettings.set("de-settings-livecomment", value);
var resolved = Common.localStorage.getBool("de-settings-resolvedcomment", true);
Common.Utils.InternalSettings.set("de-settings-resolvedcomment", resolved);
if (this.mode.canComments && this.leftMenu.panelComments.isVisible())
value = resolved = true;
(value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments();
/** coauthoring end **/
value = Common.localStorage.getItem("de-settings-fontrender");
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
switch (value) {
case '1': this.api.SetFontRenderingMode(1); break;
case '2': this.api.SetFontRenderingMode(2); break;
@ -330,13 +350,16 @@ define([
}
if (this.mode.isEdit) {
value = Common.localStorage.getItem("de-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = parseInt(Common.localStorage.getItem("de-settings-autosave"));
Common.Utils.InternalSettings.set("de-settings-autosave", value);
this.api.asc_setAutoSaveGap(value);
this.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
value = Common.localStorage.getBool("de-settings-spellcheck", true);
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
this.api.asc_setSpellCheck(value);
}
this.api.put_ShowSnapLines(Common.localStorage.getBool("de-settings-showsnaplines", true));
this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
menu.hide();
},
@ -527,8 +550,9 @@ define([
},
commentsShowHide: function(mode) {
var value = Common.localStorage.getBool("de-settings-livecomment", true),
resolved = Common.localStorage.getBool("de-settings-resolvedcomment", true);
var value = Common.Utils.InternalSettings.get("de-settings-livecomment"),
resolved = Common.Utils.InternalSettings.get("de-settings-resolvedcomment");
if (!value || !resolved) {
(mode === 'show') ? this.api.asc_showComments(true) : ((value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments());
}
@ -676,6 +700,18 @@ define([
Common.Gateway.requestHistory();
},
onShowHideChat: function(state) {
if (this.mode.canCoAuthoring && this.mode.canChat && !this.mode.isLightVersion) {
if (state) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu('chat');
} else {
this.leftMenu.btnChat.toggle(false, true);
this.leftMenu.onBtnMenuClick(this.leftMenu.btnChat);
}
}
},
textNoTextFound : 'Text not found',
newDocumentTitle : 'Unnamed document',
requestEditRightsText : 'Requesting editing rights...',

View file

@ -93,6 +93,9 @@ define([
this.addListeners({
'FileMenu': {
'settings:apply': _.bind(this.applySettings, this)
},
'Common.Views.ReviewChanges': {
'settings:apply': _.bind(this.applySettings, this)
}
});
},
@ -119,6 +122,7 @@ define([
var value = Common.localStorage.getItem("de-settings-fontrender");
if (value === null)
window.devicePixelRatio > 1 ? value = '1' : '0';
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
// Initialize api
@ -131,7 +135,19 @@ define([
'Diagram Title': this.txtDiagramTitle,
'X Axis': this.txtXAxis,
'Y Axis': this.txtYAxis,
'Your text here': this.txtArt
'Your text here': this.txtArt,
"Error! Bookmark not defined.": this.txtBookmarkError,
"above": this.txtAbove,
"below": this.txtBelow,
"on page ": this.txtOnPage,
"Header": this.txtHeader,
"Footer": this.txtFooter,
" -Section ": this.txtSection,
"First Page ": this.txtFirstPage,
"Even Page ": this.txtEvenPage,
"Odd Page ": this.txtOddPage,
"Same as Previous": this.txtSameAsPrev,
"Current Document": this.txtCurrentDocument
};
styleNames.forEach(function(item){
translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
@ -371,10 +387,25 @@ define([
}
},
onDownloadAs: function() {
onDownloadAs: function(format) {
this._state.isFromGatewayDownloadAs = true;
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
(type && typeof type[1] === 'string') ? this.api.asc_DownloadOrigin(true) : this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
if (type && typeof type[1] === 'string')
this.api.asc_DownloadOrigin(true);
else {
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
_supported = [
Asc.c_oAscFileType.TXT,
Asc.c_oAscFileType.ODT,
Asc.c_oAscFileType.DOCX,
Asc.c_oAscFileType.HTML,
Asc.c_oAscFileType.PDF
];
if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.DOCX;
this.api.asc_DownloadAs(_format, true);
}
},
onProcessMouse: function(data) {
@ -767,10 +798,14 @@ define([
/** coauthoring begin **/
this.isLiveCommenting = Common.localStorage.getBool("de-settings-livecomment", true);
this.isLiveCommenting ? this.api.asc_showComments(Common.localStorage.getBool("de-settings-resolvedcomment", true)) : this.api.asc_hideComments();
Common.Utils.InternalSettings.set("de-settings-livecomment", this.isLiveCommenting);
value = Common.localStorage.getBool("de-settings-resolvedcomment", true);
Common.Utils.InternalSettings.set("de-settings-resolvedcomment", value);
this.isLiveCommenting ? this.api.asc_showComments(value) : this.api.asc_hideComments();
/** coauthoring end **/
value = Common.localStorage.getItem("de-settings-zoom");
Common.Utils.InternalSettings.set("de-settings-zoom", value);
var zf = (value!==null) ? parseInt(value) : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom) : 100);
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
@ -780,9 +815,11 @@ define([
value = Common.localStorage.getItem("de-show-tableline");
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
me.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
value = Common.localStorage.getBool("de-settings-spellcheck", true);
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
me.api.asc_setSpellCheck(value);
Common.localStorage.setBool("de-settings-showsnaplines", me.api.get_ShowSnapLines());
Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines());
function checkWarns() {
if (!window['AscDesktopEditor']) {
@ -806,11 +843,14 @@ define([
appHeader.setDocumentCaption(me.api.asc_getDocumentName());
me.updateWindowTitle(true);
me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode"));
value = Common.localStorage.getBool("de-settings-inputmode");
Common.Utils.InternalSettings.set("de-settings-inputmode", value);
me.api.SetTextBoxInputMode(value);
if (Common.Utils.isChrome) {
value = Common.localStorage.getBool("de-settings-inputsogou");
me.api.setInputParams({"SogouPinyin" : value});
Common.Utils.InternalSettings.set("de-settings-inputsogou", value);
}
/** coauthoring begin **/
@ -824,21 +864,23 @@ define([
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
value = Common.localStorage.getItem((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
if (value !== null)
me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
else
me.api.SetCollaborativeMarksShowType(me._state.fastCoauth ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
if (value == null) value = me._state.fastCoauth ? 'none' : 'last';
me.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
(value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges));
Common.Utils.InternalSettings.set((me._state.fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value);
} else if (!me.appOptions.isEdit && me.appOptions.canComments) {
me._state.fastCoauth = true;
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None);
me.api.asc_setAutoSaveGap(1);
Common.Utils.InternalSettings.set("de-settings-autosave", 1);
} else {
me._state.fastCoauth = false;
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
me.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None);
}
Common.Utils.InternalSettings.set("de-settings-coauthmode", me._state.fastCoauth);
/** coauthoring end **/
var application = me.getApplication();
@ -878,11 +920,12 @@ define([
if (value===null && me.appOptions.customization && me.appOptions.customization.autosave===false)
value = 0;
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-autosave", value);
me.api.asc_setAutoSaveGap(value);
if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true
me.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", me.appOptions.canForcesave);
Common.Utils.InternalSettings.set("de-settings-forcesave", me.appOptions.forcesave);
me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave);
}
@ -910,16 +953,14 @@ define([
me.api.UpdateInterfaceState();
me.fillTextArt(me.api.asc_getTextArtPreviews());
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
}
}, 50);
} else {
documentHolderController.getView().createDelayedElementsViewer();
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
Common.NotificationCenter.trigger('document:ready', 'main');
}
if (this.appOptions.canAnalytics && false)
@ -1033,6 +1074,7 @@ define([
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this.appOptions.trialMode = params.asc_getLicenseMode();
this.appOptions.canProtect = this.appOptions.isDesktopApp && this.api.asc_isSignaturesSupport();
if ( this.appOptions.isLightVersion ) {
this.appOptions.canUseHistory =
@ -1123,6 +1165,9 @@ define([
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.applyEditorMode();
@ -1151,6 +1196,7 @@ define([
var value = Common.localStorage.getItem('de-settings-unit');
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.Utils.InternalSettings.set("de-settings-unit", value);
me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
me.api.asc_SetViewRulers(!Common.localStorage.getBool('de-hidden-rulers'));
@ -1336,6 +1382,8 @@ define([
}
}
else {
Common.Gateway.reportWarning(id, config.msg);
config.title = this.notcriticalErrorTitle;
config.iconCls = 'warn';
config.buttons = ['ok'];
@ -1346,6 +1394,20 @@ define([
this.api.asc_DownloadAs();
else
(this.appOptions.canDownload) ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : this.api.asc_DownloadOrigin();
} else if (id == Asc.c_oAscError.ID.SplitCellMaxRows || id == Asc.c_oAscError.ID.SplitCellMaxCols || id == Asc.c_oAscError.ID.SplitCellRowsDivider) {
var me = this;
setTimeout(function(){
(new Common.Views.InsertTableDialog({
split: true,
handler: function(result, value) {
if (result == 'ok') {
if (me.api)
me.api.SplitCell(value.columns, value.rows);
}
me.onEditComplete();
}
})).show();
},10);
}
this._state.lostEditingRights = false;
this.onEditComplete();
@ -1750,6 +1812,7 @@ define([
var value = Common.localStorage.getItem("de-settings-unit");
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.Utils.InternalSettings.set("de-settings-unit", value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
this.getApplication().getController('Toolbar').getView().updateMetricUnit();
@ -1811,12 +1874,13 @@ define([
if (dontshow) window.localStorage.setItem("de-hide-try-undoredo", 1);
if (btn == 'custom') {
Common.localStorage.setItem("de-settings-coauthmode", 0);
Common.Utils.InternalSettings.set("de-settings-coauthmode", false);
this.api.asc_SetFastCollaborative(false);
this._state.fastCoauth = false;
Common.localStorage.setItem("de-settings-showchanges-strict", 'last');
this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.LastChanges);
}
this.fireEvent('editcomplete', this);
this.onEditComplete();
}, this)
});
},
@ -1839,6 +1903,7 @@ define([
}
if (this.appOptions.canForcesave) {
this.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", this.appOptions.canForcesave);
Common.Utils.InternalSettings.set("de-settings-forcesave", this.appOptions.forcesave);
this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
}
},
@ -1910,18 +1975,11 @@ define([
var pluginsData = (uiCustomize) ? plugins.UIpluginsData : plugins.pluginsData;
if (!pluginsData || pluginsData.length<1) return;
var arr = [],
baseUrl = _.isEmpty(plugins.url) ? "" : plugins.url;
if (baseUrl !== "")
console.warn("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration.");
var arr = [];
pluginsData.forEach(function(item){
item = baseUrl + item; // for compatibility with previous version of server, where plugins.url is used.
var value = Common.Utils.getConfigJson(item);
if (value) {
value.baseUrl = item.substring(0, item.lastIndexOf("config.json"));
value.oldVersion = (baseUrl !== "");
arr.push(value);
}
});
@ -1961,14 +2019,6 @@ define([
var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'word');
if ( visible ) pluginVisible = true;
var icons = itemVar.icons;
if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
icons = [];
itemVar.icons.forEach(function(icon){
icons.push(icon.substring(icon.lastIndexOf("\/")+1));
});
}
if (item.isUICustomizer ) {
visible && arrUI.push(item.baseUrl + itemVar.url);
} else {
@ -1976,8 +2026,8 @@ define([
model.set({
index: variationsArr.length,
url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
icons: icons,
url: itemVar.url,
icons: itemVar.icons,
visible: visible
});
@ -2138,6 +2188,18 @@ define([
txtStyle_List_Paragraph: 'List Paragraph',
saveTextText: 'Saving document...',
saveTitleText: 'Saving Document',
txtBookmarkError: "Error! Bookmark not defined.",
txtAbove: "above",
txtBelow: "below",
txtOnPage: "on page ",
txtHeader: "Header",
txtFooter: "Footer",
txtSection: " -Section ",
txtFirstPage: "First Page ",
txtEvenPage: "Even Page ",
txtOddPage: "Odd Page ",
txtSameAsPrev: "Same as Previous",
txtCurrentDocument: "Current Document",
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), DE.Controllers.Main || {}))

View file

@ -78,11 +78,13 @@ define([
this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.MailMerge] = {panelId: "id-mail-merge-settings", panel: rightMenu.mergeSettings, btn: rightMenu.btnMailMerge, hidden: 1, props: {}, locked: false};
this._settings[Common.Utils.documentSettingsType.MailMerge] = {panelId: "id-mail-merge-settings", panel: rightMenu.mergeSettings, btn: rightMenu.btnMailMerge, hidden: 1, props: {}, locked: false};
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false};
},
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
},
@ -96,7 +98,7 @@ define([
var panel = this._settings[type].panel;
var props = this._settings[type].props;
if (props && panel)
panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.MailMerge) ? undefined : props);
panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.MailMerge || type==Common.Utils.documentSettingsType.Signature) ? undefined : props);
} else if (minimized && type==Common.Utils.documentSettingsType.MailMerge) {
this.rightmenu.mergeSettings.disablePreviewMode();
}
@ -112,13 +114,14 @@ define([
in_equation = false,
needhide = true;
for (var i=0; i<this._settings.length; i++) {
if (i==Common.Utils.documentSettingsType.MailMerge) continue;
if (i==Common.Utils.documentSettingsType.MailMerge || i==Common.Utils.documentSettingsType.Signature) continue;
if (this._settings[i]) {
this._settings[i].hidden = 1;
this._settings[i].locked = false;
}
}
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = false;
this._settings[Common.Utils.documentSettingsType.Signature].locked = false;
var isChart = false;
for (i=0; i<SelectedObjects.length; i++)
@ -154,6 +157,8 @@ define([
this._settings[settingsType].locked = value.get_Locked();
if (!this._settings[Common.Utils.documentSettingsType.MailMerge].locked) // lock MailMerge-InsertField, если хотя бы один объект locked
this._settings[Common.Utils.documentSettingsType.MailMerge].locked = value.get_Locked();
if (!this._settings[Common.Utils.documentSettingsType.Signature].locked) // lock Signature, если хотя бы один объект locked
this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked();
}
if ( this._settings[Common.Utils.documentSettingsType.Header].locked ) { // если находимся в locked header/footer, то считаем, что все элементы в нем тоже недоступны
@ -179,7 +184,7 @@ define([
currentactive = -1;
} else {
if (pnl.btn.isDisabled()) pnl.btn.setDisabled(false);
if (i!=Common.Utils.documentSettingsType.MailMerge) lastactive = i;
if (i!=Common.Utils.documentSettingsType.MailMerge && i!=Common.Utils.documentSettingsType.Signature) lastactive = i;
if ( pnl.needShow ) {
pnl.needShow = false;
priorityactive = i;
@ -204,7 +209,7 @@ define([
if (active !== undefined) {
this.rightmenu.SetActivePane(active, open);
if (active!=Common.Utils.documentSettingsType.MailMerge)
if (active!=Common.Utils.documentSettingsType.MailMerge && active!=Common.Utils.documentSettingsType.Signature)
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
else
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel);
@ -321,7 +326,17 @@ define([
}
},
SetDisabled: function(disabled, allowMerge) {
onApiUpdateSignatures: function(valid, requested){
if (!this.rightmenu.signatureSettings) return;
var disabled = (!valid || valid.length<1) && (!requested || requested.length<1),
type = Common.Utils.documentSettingsType.Signature;
this._settings[type].hidden = disabled ? 1 : 0;
this._settings[type].btn.setDisabled(disabled);
this._settings[type].panel.setLocked(this._settings[type].locked);
},
SetDisabled: function(disabled, allowMerge, allowSignature) {
this.setMode({isEdit: !disabled});
if (this.rightmenu) {
this.rightmenu.paragraphSettings.disableControls(disabled);
@ -336,6 +351,10 @@ define([
}
this.rightmenu.chartSettings.disableControls(disabled);
if (!allowSignature && this.rightmenu.signatureSettings) {
this.rightmenu.btnSignature.setDisabled(disabled);
}
if (disabled) {
this.rightmenu.btnText.setDisabled(disabled);
this.rightmenu.btnTable.setDisabled(disabled);
@ -343,7 +362,6 @@ define([
this.rightmenu.btnHeaderFooter.setDisabled(disabled);
this.rightmenu.btnShape.setDisabled(disabled);
this.rightmenu.btnTextArt.setDisabled(disabled);
this.rightmenu.btnChart.setDisabled(disabled);
} else {
var selectedElements = this.api.getSelectedElements();

View file

@ -86,7 +86,7 @@ define([
me.statusbar.render(cfg);
me.statusbar.$el.css('z-index', 1);
$('.statusbar #label-zoom').css('min-width', 70);
$('.statusbar #label-zoom').css('min-width', 80);
if ( cfg.isEdit ) {
var review = DE.getController('Common.Controllers.ReviewChanges').getView();
@ -99,6 +99,8 @@ define([
me.btnSpelling = review.getButton('spelling', 'statusbar');
me.btnSpelling.render( me.statusbar.$layout.find('#btn-doc-spell') );
me.btnDocLang = review.getButton('doclang', 'statusbar');
me.btnDocLang.render( me.statusbar.$layout.find('#btn-doc-lang') );
} else {
me.statusbar.$el.find('.el-edit, .el-review').hide();
}

View file

@ -517,7 +517,7 @@ define([
if (!(index < 0)) {
this.toolbar.btnHorizontalAlign.menu.items[index].setChecked(true);
} else if (index == -255) {
this._clearChecked(this.toolbar.btnHorizontalAlign.menu);
this.toolbar.btnHorizontalAlign.menu.clearAll();
}
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign;
@ -581,14 +581,16 @@ define([
},
onApiPageSize: function(w, h) {
var width = this._state.pgorient ? w : h,
height = this._state.pgorient ? h : w;
if (Math.abs(this._state.pgsize[0] - w) > 0.01 ||
Math.abs(this._state.pgsize[1] - h) > 0.01) {
this._state.pgsize = [w, h];
if (this.toolbar.mnuPageSize) {
this._clearChecked(this.toolbar.mnuPageSize);
this.toolbar.mnuPageSize.clearAll();
_.each(this.toolbar.mnuPageSize.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
Math.abs(item.value[0] - w) < 0.01 && Math.abs(item.value[1] - h) < 0.01) {
Math.abs(item.value[0] - width) < 0.01 && Math.abs(item.value[1] - height) < 0.01) {
item.setChecked(true);
return false;
}
@ -609,7 +611,7 @@ define([
Math.abs(this._state.pgmargins[3] - right) > 0.01) {
this._state.pgmargins = [top, left, bottom, right];
if (this.toolbar.btnPageMargins.menu) {
this._clearChecked(this.toolbar.btnPageMargins.menu);
this.toolbar.btnPageMargins.menu.clearAll();
_.each(this.toolbar.btnPageMargins.menu.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
Math.abs(item.value[0] - top) < 0.01 && Math.abs(item.value[1] - left) < 0.01 &&
@ -656,7 +658,7 @@ define([
header_locked = pr.get_Locked();
in_header = true;
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
in_image = in_header = true;
in_image = true;
image_locked = pr.get_Locked();
if (pr && pr.get_ChartProperties())
in_chart = true;
@ -726,7 +728,7 @@ define([
need_disable = toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled();
toolbar.mnuInsertPageNum.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_header || in_equation && !btn_eq_state || this.api.asc_IsCursorInFootnote();
need_disable = paragraph_locked || header_locked || in_header || in_image || in_equation && !btn_eq_state || this.api.asc_IsCursorInFootnote();
toolbar.btnsPageBreak.disable(need_disable);
need_disable = paragraph_locked || header_locked || !can_add_image || in_equation;
@ -1371,9 +1373,9 @@ define([
me.api.put_Table(value.columns, value.rows);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Table');
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
@ -1605,7 +1607,7 @@ define([
case Asc.c_oAscDropCap.Margin: index = 2; break;
}
if (index < 0)
this._clearChecked(this.toolbar.btnDropCap.menu);
this.toolbar.btnDropCap.menu.clearAll();
else
this.toolbar.btnDropCap.menu.items[index].setChecked(true);
@ -1738,7 +1740,7 @@ define([
return;
if (index < 0)
this._clearChecked(this.toolbar.btnColumns.menu);
this.toolbar.btnColumns.menu.clearAll();
else
this.toolbar.btnColumns.menu.items[index].setChecked(true);
this._state.columns = index;
@ -2656,13 +2658,6 @@ define([
this._state.clrshd_asccolor = undefined;
},
_clearChecked: function(menu) {
_.each(menu.items, function(item){
if (item.setChecked)
item.setChecked(false, true);
});
},
_onInitEditorStyles: function(styles) {
window.styles_loaded = false;
@ -2847,11 +2842,18 @@ define([
me.toolbar.render(_.extend({isCompactView: compactview}, config));
if ( config.isEdit ) {
var tab = {action: 'review', caption: me.toolbar.textTabReview};
var $panel = DE.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel ) {
if ( $panel )
me.toolbar.addTab(tab, $panel, 3);
if (config.isDesktopApp && config.isOffline) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
}
}
},

View file

@ -8,6 +8,7 @@
<li id="fm-btn-save-desktop" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li id="fm-btn-rename" class="fm-btn" />
<li id="fm-btn-protect" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />
@ -30,4 +31,5 @@
<div id="panel-rights" class="content-box" />
<div id="panel-settings" class="content-box" />
<div id="panel-help" class="content-box" />
<div id="panel-protect" class="content-box" />
</div>

View file

@ -139,12 +139,15 @@
<div class="padding-large">
<div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div>
</div>
<div class="padding-large" >
<label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>
<div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-right" style="display: block;"></div>
<div class="padding-large" style="display: inline-block;margin-right: 7px;">
<label class="input-label"><%= scope.textAlign %></label>
<div id="paraadv-cmb-align"></div>
</div>
<div class="padding-large" style="display: inline-block;">
<label class="input-label"><%= scope.textLeader %></label>
<div id="paraadv-cmb-leader"></div>
</div>
<div style="margin-bottom: 45px;"></div>
<div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button>

View file

@ -16,6 +16,8 @@
</div>
<div id="id-textart-settings" class="settings-panel">
</div>
<div id="id-signature-settings" class="settings-panel">
</div>
</div>
<div class="tool-menu-btns">
<div class="ct-btn-category arrow-left" />
@ -27,5 +29,6 @@
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><i class="icon img-toolbarmenu btn-menu-chart">&nbsp;</i></button>
<button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon img-toolbarmenu btn-menu-textart">&nbsp;</i></button>
<button id="id-right-menu-mail-merge" class="btn btn-category arrow-left hidden" content-target="id-mail-merge-settings"><i class="icon img-toolbarmenu btn-menu-mail-merge">&nbsp;</i></button>
<button id="id-right-menu-signature" class="btn btn-category arrow-left hidden" content-target="id-signature-settings"><i class="icon img-toolbarmenu btn-menu-signature">&nbsp;</i></button>
</div>
</div>

View file

@ -0,0 +1,41 @@
<table cols="2">
<tr>
<td class="padding-large">
<label style="font-size: 18px;"><%= scope.strSignature %></label>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="signature-invisible-sign" style="width:100%;"></div>
</td>
</tr>
<tr class="requested">
<td class="padding-small">
<label class="header"><%= scope.strRequested %></label>
</td>
</tr>
<tr class="requested">
<td class="padding-large">
<div id="signature-requested-sign"></div>
</td>
</tr>
<tr class="valid">
<td class="padding-small">
<label class="header"><%= scope.strValid %></label>
</td>
</tr>
<tr class="valid">
<td class="padding-large">
<div id="signature-valid-sign"></div>
</td>
</tr>
<tr class="invalid">
<td class="padding-small">
<label class="header" style="color:#bb3d3d;"><%= scope.strInvalid %></label>
</td>
</tr>
<tr class="invalid">
<td><div id="signature-invalid-sign"></div></td>
</tr>
<tr class="finish-cell"></tr>
</table>

View file

@ -19,6 +19,7 @@
<div class="caret up img-commonctrl" />
</div>
</div>
<span id="btn-doc-lang" class="el-edit"></span>
<span id="btn-doc-spell" class="el-edit"></span>
<div class="separator short el-edit"></div>
<div id="btn-doc-review" class="el-edit el-review" style="display: inline-block;"></div>

View file

@ -612,6 +612,8 @@ define([
me._arrSpecialPaste = [];
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste] = me.textPaste;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = me.txtKeepTextOnly;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.insertAsNestedTable] = me.textNest;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.overwriteCells] = me.txtOverwriteCells;
pasteContainer = $('<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>');
me.cmpEl.append(pasteContainer);
@ -1527,7 +1529,6 @@ define([
this.api.asc_registerCallback('asc_onFocusObject', _.bind(onFocusObject, this));
this.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, this));
this.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, this));
}
return this;
@ -1814,14 +1815,39 @@ define([
caption: me.addCommentText
}).on('click', _.bind(me.addComment, me));
var menuSignatureViewSign = new Common.UI.MenuItem({caption: this.strSign, value: 0 }).on('click', _.bind(me.onSignatureClick, me));
var menuSignatureDetails = new Common.UI.MenuItem({caption: this.strDetails, value: 1 }).on('click', _.bind(me.onSignatureClick, me));
var menuSignatureViewSetup = new Common.UI.MenuItem({caption: this.strSetup, value: 2 }).on('click', _.bind(me.onSignatureClick, me));
var menuSignatureRemove = new Common.UI.MenuItem({caption: this.strDelete, value: 3 }).on('click', _.bind(me.onSignatureClick, me));
var menuViewSignSeparator = new Common.UI.MenuItem({caption: '--' });
this.viewModeMenu = new Common.UI.Menu({
initMenu: function (value) {
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties()));
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties())),
signGuid = (value.imgProps && value.imgProps.value && me.mode.canProtect) ? value.imgProps.value.asc_getSignatureId() : undefined,
signProps = (signGuid) ? me.api.asc_getSignatureSetup(signGuid) : null,
isInSign = !!signProps && me._canProtect,
canComment = !isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled;
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo() && !me._isDisabled);
menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewCopySeparator.setVisible(isInSign);
var isRequested = (signProps) ? signProps.asc_getRequested() : false;
menuSignatureViewSign.setVisible(isInSign && isRequested);
menuSignatureDetails.setVisible(isInSign && !isRequested);
menuSignatureViewSetup.setVisible(isInSign);
menuSignatureRemove.setVisible(isInSign && !isRequested);
menuViewSignSeparator.setVisible(canComment);
if (isInSign) {
menuSignatureViewSign.cmpEl.attr('data-value', signGuid); // sign
menuSignatureDetails.cmpEl.attr('data-value', signProps.asc_getId()); // view certificate
menuSignatureViewSetup.cmpEl.attr('data-value', signGuid); // view signature settings
menuSignatureRemove.cmpEl.attr('data-value', signGuid);
}
menuViewAddComment.setVisible(canComment);
menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true);
var cancopy = me.api && me.api.can_CopyCut();
@ -1831,6 +1857,11 @@ define([
menuViewCopy,
menuViewUndo,
menuViewCopySeparator,
menuSignatureViewSign,
menuSignatureDetails,
menuSignatureViewSetup,
menuSignatureRemove,
menuViewSignSeparator,
menuViewAddComment
]
}).on('hide:after', function (menu, e, isFromInputControl) {
@ -2150,6 +2181,10 @@ define([
value : 'cut'
}).on('click', _.bind(me.onCutCopyPaste, me));
var menuSignatureEditSign = new Common.UI.MenuItem({caption: this.strSign, value: 0 }).on('click', _.bind(me.onSignatureClick, me));
var menuSignatureEditSetup = new Common.UI.MenuItem({caption: this.strSetup, value: 2 }).on('click', _.bind(me.onSignatureClick, me));
var menuEditSignSeparator = new Common.UI.MenuItem({ caption: '--' });
this.pictureMenu = new Common.UI.Menu({
initMenu: function(value){
if (_.isUndefined(value.imgProps))
@ -2210,7 +2245,7 @@ define([
me.menuOriginalSize.setVisible(_.isNull(value.imgProps.value.get_ChartProperties()) && _.isNull(value.imgProps.value.get_ShapeProperties()) &&
!onlyCommonProps);
me.pictureMenu.items[7].setVisible(menuChartEdit.isVisible() || me.menuOriginalSize.isVisible());
me.pictureMenu.items[10].setVisible(menuChartEdit.isVisible() || me.menuOriginalSize.isVisible());
var islocked = value.imgProps.locked || (value.headerProps!==undefined && value.headerProps.locked);
if (menuChartEdit.isVisible())
@ -2233,12 +2268,26 @@ define([
menuImgCopy.setDisabled(!cancopy);
menuImgCut.setDisabled(islocked || !cancopy);
menuImgPaste.setDisabled(islocked);
var signGuid = (value.imgProps && value.imgProps.value && me.mode.canProtect) ? value.imgProps.value.asc_getSignatureId() : undefined,
isInSign = !!signGuid;
menuSignatureEditSign.setVisible(isInSign);
menuSignatureEditSetup.setVisible(isInSign);
menuEditSignSeparator.setVisible(isInSign);
if (isInSign) {
menuSignatureEditSign.cmpEl.attr('data-value', signGuid); // sign
menuSignatureEditSetup.cmpEl.attr('data-value', signGuid); // edit signature settings
}
},
items: [
menuImgCut,
menuImgCopy,
menuImgPaste,
{ caption: '--' },
menuSignatureEditSign,
menuSignatureEditSetup,
menuEditSignSeparator,
menuImageArrange,
menuImageAlign,
me.menuImageWrap,
@ -2318,10 +2367,9 @@ define([
if (me.api) {
me.api.SplitCell(value.columns, value.rows);
}
me.fireEvent('editcomplete', me);
Common.component.Analytics.trackEvent('DocumentHolder', 'Table');
}
me.fireEvent('editcomplete', me);
}
})).show();
}
@ -3298,13 +3346,32 @@ define([
}
},
onSignatureClick: function(item) {
var datavalue = item.cmpEl.attr('data-value');
switch (item.value) {
case 0:
Common.NotificationCenter.trigger('protect:sign', datavalue); //guid
break;
case 1:
this.api.asc_ViewCertificate(datavalue); //certificate id
break;
case 2:
Common.NotificationCenter.trigger('protect:signature', 'visible', this._isDisabled, datavalue);//guid, can edit settings for requested signature
break;
case 3:
this.api.asc_RemoveSignature(datavalue); //guid
break;
}
},
focus: function() {
var me = this;
_.defer(function(){ me.cmpEl.focus(); }, 50);
},
SetDisabled: function(state) {
SetDisabled: function(state, canProtect) {
this._isDisabled = state;
this._canProtect = canProtect;
},
alignmentText : 'Alignment',
@ -3476,7 +3543,13 @@ define([
txtDeleteChars: 'Delete enclosing characters',
txtDeleteCharsAndSeparators: 'Delete enclosing characters and separators',
txtKeepTextOnly: 'Keep text only',
textUndo: 'Undo'
textUndo: 'Undo',
strSign: 'Sign',
strDetails: 'Signature Details',
strSetup: 'Signature Setup',
strDelete: 'Remove Signature',
txtOverwriteCells: 'Overwrite cells',
textNest: 'Nest table'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -126,6 +126,13 @@ define([
canFocused: false
});
this.miProtect = new Common.UI.MenuItem({
el : $('#fm-btn-protect',this.el),
action : 'protect',
caption : this.btnProtectCaption,
canFocused: false
});
this.miRecent = new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -168,6 +175,7 @@ define([
this.miSaveAs,
this.miPrint,
this.miRename,
this.miProtect,
this.miRecent,
this.miNew,
new Common.UI.MenuItem({
@ -215,10 +223,11 @@ define([
show: function(panel, opts) {
if (this.isVisible() && panel===undefined) return;
var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info';
if (!panel)
panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info');
panel = this.active || defPanel;
this.$el.show();
this.selectMenu(panel, opts);
this.selectMenu(panel, opts, defPanel);
this.api.asc_enableKeyEvents(false);
this.fireEvent('menu:show', [this]);
@ -234,7 +243,8 @@ define([
applyMode: function() {
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miRename.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide']();
this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
this.miNew[this.mode.canCreateNew?'show':'hide']();
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
@ -270,8 +280,10 @@ define([
}
}
if (this.mode.isDesktopApp) {
if (this.mode.isDesktopApp && this.mode.isOffline) {
// this.$el.find('#fm-btn-back').hide();
this.panels['protect'] = (new DE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
this.panels['protect'].setMode(this.mode);
}
if (this.mode.canDownload) {
@ -302,16 +314,21 @@ define([
setApi: function(api) {
this.api = api;
this.panels['info'].setApi(api);
if (this.panels['protect']) this.panels['protect'].setApi(api);
},
loadDocument: function(data) {
this.document = data.doc;
},
selectMenu: function(menu, opts) {
selectMenu: function(menu, opts, defMenu) {
if ( menu ) {
var item = this._getMenuItem(menu),
var item = this._getMenuItem(menu),
panel = this.panels[menu];
if ( item.isDisabled() ) {
item = this._getMenuItem(defMenu);
panel = this.panels[defMenu];
}
if ( item && panel ) {
$('.fm-btn',this.el).removeClass('active');
item.$el.addClass('active');
@ -360,6 +377,7 @@ define([
btnSaveAsCaption : 'Save as',
textDownload : 'Download',
btnRenameCaption : 'Rename...',
btnCloseMenuCaption : 'Close Menu'
btnCloseMenuCaption : 'Close Menu',
btnProtectCaption: 'Protect\\Sign'
}, DE.Views.FileMenu || {}));
});

View file

@ -353,60 +353,55 @@ define([
},
updateSettings: function() {
this.chInputMode.setValue(Common.localStorage.getBool("de-settings-inputmode"));
Common.Utils.isChrome && this.chInputSogou.setValue(Common.localStorage.getBool("de-settings-inputsogou"));
this.chInputMode.setValue(Common.Utils.InternalSettings.get("de-settings-inputmode"));
Common.Utils.isChrome && this.chInputSogou.setValue(Common.Utils.InternalSettings.get("de-settings-inputsogou"));
var value = Common.localStorage.getItem("de-settings-zoom");
var value = Common.Utils.InternalSettings.get("de-settings-zoom");
value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : 100);
var item = this.cmbZoom.store.findWhere({value: value});
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
/** coauthoring begin **/
this.chLiveComment.setValue(Common.localStorage.getBool("de-settings-livecomment", true));
this.chResolvedComment.setValue(Common.localStorage.getBool("de-settings-resolvedcomment", true));
this.chLiveComment.setValue(Common.Utils.InternalSettings.get("de-settings-livecomment"));
this.chResolvedComment.setValue(Common.Utils.InternalSettings.get("de-settings-resolvedcomment"));
value = Common.localStorage.getItem("de-settings-coauthmode");
if (value===null && !Common.localStorage.itemExists("de-settings-autosave") &&
this.mode.customization && this.mode.customization.autosave===false)
value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
item = this.cmbCoAuthMode.store.findWhere({value: fast_coauth ? 1 : 0});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
this.fillShowChanges(fast_coauth);
value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
value = Common.Utils.InternalSettings.get((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
item = this.cmbShowChanges.store.findWhere({value: value});
this.cmbShowChanges.setValue(item ? item.get('value') : (fast_coauth) ? 'none' : 'last');
/** coauthoring end **/
value = Common.localStorage.getItem("de-settings-fontrender");
value = Common.Utils.InternalSettings.get("de-settings-fontrender");
item = this.cmbFontRender.store.findWhere({value: parseInt(value)});
this.cmbFontRender.setValue(item ? item.get('value') : (window.devicePixelRatio > 1 ? 1 : 0));
value = Common.localStorage.getItem("de-settings-unit");
item = this.cmbUnit.store.findWhere({value: parseInt(value)});
value = Common.Utils.InternalSettings.get("de-settings-unit");
item = this.cmbUnit.store.findWhere({value: value});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("de-settings-autosave");
if (value===null && this.mode.customization && this.mode.customization.autosave===false)
value = 0;
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
value = Common.Utils.InternalSettings.get("de-settings-autosave");
this.chAutosave.setValue(value == 1);
if (this.mode.canForcesave)
this.chForcesave.setValue(Common.localStorage.getBool("de-settings-forcesave", this.mode.canForcesave));
this.chForcesave.setValue(Common.Utils.InternalSettings.get("de-settings-forcesave"));
this.chSpell.setValue(Common.localStorage.getBool("de-settings-spellcheck", true));
this.chAlignGuides.setValue(Common.localStorage.getBool("de-settings-showsnaplines", true));
this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck"));
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
},
applySettings: function() {
Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
Common.Utils.isChrome && Common.localStorage.setItem("de-settings-inputsogou", this.chInputSogou.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue());
Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom"));
/** coauthoring begin **/
Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0);
@ -421,7 +416,7 @@ define([
if (this.mode.canForcesave)
Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
Common.localStorage.save();
if (this.menu) {
@ -875,6 +870,8 @@ define([
});
}
Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this));
return this;
},
@ -1097,4 +1094,174 @@ define([
}
}
});
DE.Views.FileMenuPanels.ProtectDoc = Common.UI.BaseView.extend(_.extend({
el: '#panel-protect',
menu: undefined,
template: _.template([
'<label id="id-fms-lbl-protect-header" style="font-size: 18px;"><%= scope.strProtect %></label>',
'<div id="id-fms-password">',
'<label class="header"><%= scope.strEncrypt %></label>',
'<div id="fms-btn-add-pwd" style="width:190px;"></div>',
'<table id="id-fms-view-pwd" cols="2" width="300">',
'<tr>',
'<td colspan="2"><span><%= scope.txtEncrypted %></span></td>',
'</tr>',
'<tr>',
'<td><div id="fms-btn-change-pwd" style="width:190px;"></div></td>',
'<td align="right"><div id="fms-btn-delete-pwd" style="width:190px; margin-left:20px;"></div></td>',
'</tr>',
'</table>',
'</div>',
'<div id="id-fms-signature">',
'<label class="header"><%= scope.strSignature %></label>',
'<div id="fms-btn-invisible-sign" style="width:190px; margin-bottom: 20px;"></div>',
'<div id="id-fms-signature-view"></div>',
'</div>'
].join('')),
initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.menu = options.menu;
var me = this;
this.templateSignature = _.template([
'<table cols="2" width="300" class="<% if (!hasRequested && !hasSigned) { %>hidden<% } %>"">',
'<tr>',
'<td colspan="2"><span><%= tipText %></span></td>',
'</tr>',
'<tr>',
'<td><label class="link signature-view-link">' + me.txtView + '</label></td>',
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">' + me.txtEdit + '</label></td>',
'</tr>',
'</table>'
].join(''));
},
render: function() {
$(this.el).html(this.template({scope: this}));
var protection = DE.getController('Common.Controllers.Protection').getView();
this.btnAddPwd = protection.getButton('add-password');
this.btnAddPwd.render(this.$el.find('#fms-btn-add-pwd'));
this.btnAddPwd.on('click', _.bind(this.closeMenu, this));
this.btnChangePwd = protection.getButton('change-password');
this.btnChangePwd.render(this.$el.find('#fms-btn-change-pwd'));
this.btnChangePwd.on('click', _.bind(this.closeMenu, this));
this.btnDeletePwd = protection.getButton('del-password');
this.btnDeletePwd.render(this.$el.find('#fms-btn-delete-pwd'));
this.btnDeletePwd.on('click', _.bind(this.closeMenu, this));
this.cntPassword = $('#id-fms-view-pwd');
this.btnAddInvisibleSign = protection.getButton('signature');
this.btnAddInvisibleSign.render(this.$el.find('#fms-btn-invisible-sign'));
this.btnAddInvisibleSign.on('click', _.bind(this.closeMenu, this));
this.cntSignature = $('#id-fms-signature');
this.cntSignatureView = $('#id-fms-signature-view');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
this.$el.on('click', '.signature-edit-link', _.bind(this.onEdit, this));
this.$el.on('click', '.signature-view-link', _.bind(this.onView, this));
return this;
},
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSignatures();
this.updateEncrypt();
},
setMode: function(mode) {
this.mode = mode;
this.cntSignature.toggleClass('hidden', !this.mode.canProtect);
},
setApi: function(o) {
this.api = o;
return this;
},
closeMenu: function() {
this.menu && this.menu.hide();
},
onEdit: function() {
this.menu && this.menu.hide();
var me = this;
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: this.txtEditWarning,
buttons: ['ok', 'cancel'],
primary: 'ok',
callback: function(btn) {
if (btn == 'ok') {
me.api.asc_RemoveAllSignatures();
}
}
});
},
onView: function() {
this.menu && this.menu.hide();
DE.getController('RightMenu').rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature, true);
},
updateSignatures: function(){
var requested = this.api.asc_getRequestSignatures(),
valid = this.api.asc_getSignatures(),
hasRequested = requested && requested.length>0,
hasValid = false,
hasInvalid = false;
_.each(valid, function(item, index){
if (item.asc_getValid()==0)
hasValid = true;
else
hasInvalid = true;
});
// hasRequested = true;
// hasValid = true;
// hasInvalid = true;
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
if (hasRequested)
tipText = this.txtRequestedSignatures + (tipText!="" ? "<br><br>" : "")+ tipText;
this.cntSignatureView.html(this.templateSignature({tipText: tipText, hasSigned: (hasValid || hasInvalid), hasRequested: hasRequested}));
},
updateEncrypt: function() {
this.cntPassword.toggleClass('hidden', this.btnAddPwd.isVisible());
},
strProtect: 'Protect Document',
strSignature: 'Signature',
txtView: 'View signatures',
txtEdit: 'Edit document',
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
txtRequestedSignatures: 'This document needs to be signed.',
notcriticalErrorTitle: 'Warning',
txtEditWarning: 'Editing will remove the signatures from the document.<br>Are you sure you want to continue?',
strEncrypt: 'Password',
txtEncrypted: 'This document has been protected by password'
}, DE.Views.FileMenuPanels.ProtectDoc || {}));
});

View file

@ -173,8 +173,11 @@ define([
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this._isFromFile) return;
this._isFromFile = true;
if (this.api) this.api.ChangeImageFromFile();
this.fireEvent('editcomplete', this);
this._isFromFile = false;
}, this));
this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
this.btnEditObject.on('click', _.bind(function(btn){

View file

@ -276,7 +276,7 @@ define([
}
if (this.mode.canChat) {
this.panelChat['hide']();
this.btnChat.toggle(false, true);
this.btnChat.toggle(false);
}
}
/** coauthoring end **/

View file

@ -42,7 +42,6 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
'common/main/lib/view/AdvancedSettingsWindow',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/CheckBox',
'common/main/lib/component/RadioBox',
'common/main/lib/component/ThemeColorPalette',
'common/main/lib/component/ColorButton',
'common/main/lib/component/ListView',
@ -410,24 +409,35 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
this.listenTo(this.tabList.store, 'remove', storechanged);
this.listenTo(this.tabList.store, 'reset', storechanged);
this.radioLeft = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-left'),
labelText: this.textTabLeft,
name: 'asc-radio-tab',
checked: true
this.cmbAlign = new Common.UI.ComboBox({
el : $('#paraadv-cmb-align'),
style : 'width: 85px;',
menuStyle : 'min-width: 85px;',
editable : false,
cls : 'input-group-nr',
data : [
{ value: 1, displayValue: this.textTabLeft },
{ value: 3, displayValue: this.textTabCenter },
{ value: 2, displayValue: this.textTabRight }
]
});
this.cmbAlign.setValue(1);
this.radioCenter = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-center'),
labelText: this.textTabCenter,
name: 'asc-radio-tab'
});
this.radioRight = new Common.UI.RadioBox({
el: $('#paragraphadv-radio-right'),
labelText: this.textTabRight,
name: 'asc-radio-tab'
this.cmbLeader = new Common.UI.ComboBox({
el : $('#paraadv-cmb-leader'),
style : 'width: 85px;',
menuStyle : 'min-width: 85px;',
editable : false,
cls : 'input-group-nr',
data : [
{ value: Asc.c_oAscTabLeader.None, displayValue: this.textNone },
{ value: Asc.c_oAscTabLeader.Dot, displayValue: '....................' },
{ value: Asc.c_oAscTabLeader.Hyphen, displayValue: '-----------------' },
{ value: Asc.c_oAscTabLeader.MiddleDot, displayValue: '·················' },
{ value: Asc.c_oAscTabLeader.Underscore,displayValue: '__________' }
]
});
this.cmbLeader.setValue(Asc.c_oAscTabLeader.None);
this.btnAddTab = new Common.UI.Button({
el: $('#paraadv-button-add-tab')
@ -562,7 +572,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
if (this._changedProps.get_Tabs()===null || this._changedProps.get_Tabs()===undefined)
this._changedProps.put_Tabs(new Asc.asc_CParagraphTabs());
this.tabList.store.each(function (item, index) {
var tab = new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(item.get('tabPos')), item.get('tabAlign'));
var tab = new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(item.get('tabPos')), item.get('tabAlign'), item.get('tabLeader'));
this._changedProps.get_Tabs().add_Tab(tab);
}, this);
}
@ -663,7 +673,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
rec.set({
tabPos: pos,
value: parseFloat(pos.toFixed(3)) + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: tab.get_Value()
tabAlign: tab.get_Value(),
tabLeader: tab.asc_getLeader()
});
arr.push(rec);
}
@ -1054,8 +1065,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
},
addTab: function(btn, eOpts){
var val = this.numTab.getNumberValue();
var align = this.radioLeft.getValue() ? 1 : (this.radioCenter.getValue() ? 3 : 2);
var val = this.numTab.getNumberValue(),
align = this.cmbAlign.getValue(),
leader = this.cmbLeader.getValue();
var store = this.tabList.store;
var rec = store.find(function(record){
@ -1063,13 +1075,15 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
});
if (rec) {
rec.set('tabAlign', align);
rec.set('tabLeader', leader);
this._tabListChanged = true;
} else {
rec = new Common.UI.DataViewModel();
rec.set({
tabPos: val,
value: val + ' ' + Common.Utils.Metric.getCurrentMetricName(),
tabAlign: align
tabAlign: align,
tabLeader: leader
});
store.add(rec);
}
@ -1110,8 +1124,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
rawData = record;
}
this.numTab.setValue(rawData.tabPos);
(rawData.tabAlign==1) ? this.radioLeft.setValue(true) : ((rawData.tabAlign==3) ? this.radioCenter.setValue(true) : this.radioRight.setValue(true));
this.cmbAlign.setValue(rawData.tabAlign);
this.cmbLeader.setValue(rawData.tabLeader);
},
hideTextOnlySettings: function(value) {
@ -1173,6 +1187,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem
tipNone: 'Set No Borders',
tipInner: 'Set Horizontal Inner Lines Only',
tipOuter: 'Set Outer Border Only',
noTabs: 'The specified tabs will appear in this field'
noTabs: 'The specified tabs will appear in this field',
textLeader: 'Leader',
textNone: 'None'
}, DE.Views.ParagraphSettingsAdvanced || {}));
});

View file

@ -57,6 +57,7 @@ define([
'documenteditor/main/app/view/ShapeSettings',
'documenteditor/main/app/view/MailMergeSettings',
'documenteditor/main/app/view/TextArtSettings',
'documenteditor/main/app/view/SignatureSettings',
'common/main/lib/component/Scroller'
], function (menuTemplate, $, _, Backbone) {
'use strict';
@ -194,6 +195,21 @@ define([
this.mergeSettings = new DE.Views.MailMergeSettings();
}
if (mode && mode.canProtect) {
this.btnSignature = new Common.UI.Button({
hint: this.txtSignatureSettings,
asctype: Common.Utils.documentSettingsType.Signature,
enableToggle: true,
disabled: true,
toggleGroup: 'tabpanelbtnsGroup'
});
this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature};
this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true);
this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this));
this.signatureSettings = new DE.Views.SignatureSettings();
}
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.right-panel'),
@ -223,6 +239,7 @@ define([
this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this));
if (this.mergeSettings) this.mergeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _.bind( fire, this));
},
setMode: function(mode) {
@ -303,6 +320,7 @@ define([
txtShapeSettings: 'Shape Settings',
txtTextArtSettings: 'Text Art Settings',
txtChartSettings: 'Chart Settings',
txtMailMergeSettings: 'Mail Merge Settings'
txtMailMergeSettings: 'Mail Merge Settings',
txtSignatureSettings: 'Signature Settings'
}, DE.Views.RightMenu || {}));
});

View file

@ -979,7 +979,8 @@ define([
// border colors
var stroke = shapeprops.get_stroke(),
strokeType = stroke.get_type(),
borderType;
borderType,
update = (this._state.StrokeColor == 'transparent' && this.BorderColor.Color !== 'transparent'); // border color was changed for shape without line and then shape was reselected (or apply other settings)
if (stroke) {
if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) {
@ -1005,7 +1006,7 @@ define([
type1 = typeof(this.BorderColor.Color);
type2 = typeof(this._state.StrokeColor);
if ( (type1 !== type2) || (type1=='object' &&
if ( update || (type1 !== type2) || (type1=='object' &&
(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue || this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)) ||
(type1!='object' && (this._state.StrokeColor.indexOf(this.BorderColor.Color)<0 || typeof(this.btnBorderColor.color)=='object'))) {
@ -1201,7 +1202,7 @@ define([
this.fillControls.push(this.btnInsertFromUrl);
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this.api) this.api.ChangeShapeImageFromFile();
if (this.api) this.api.ChangeShapeImageFromFile(this.BlipFillType);
this.fireEvent('editcomplete', this);
}, this));
this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));

View file

@ -0,0 +1,387 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* SignatureSettings.js
*
* Created by Julia Radzhabova on 5/24/17
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
define([
'text!documenteditor/main/app/template/SignatureSettings.template',
'jquery',
'underscore',
'backbone',
'common/main/lib/component/Button'
], function (menuTemplate, $, _, Backbone) {
'use strict';
DE.Views.SignatureSettings = Backbone.View.extend(_.extend({
el: '#id-signature-settings',
// Compile our stats template
template: _.template(menuTemplate),
// Delegated events for creating new items, and clearing completed ones.
events: {
},
options: {
alias: 'SignatureSettings'
},
initialize: function () {
this._state = {
DisabledEditing: false,
ready: false,
hasValid: false,
hasInvalid: false,
hasRequested: false,
tip: undefined
};
this._locked = false;
this.render();
},
render: function () {
this.$el.html(this.template({
scope: this
}));
var protection = DE.getController('Common.Controllers.Protection').getView();
this.btnAddInvisibleSign = protection.getButton('signature');
this.btnAddInvisibleSign.render(this.$el.find('#signature-invisible-sign'));
this.viewRequestedList = new Common.UI.DataView({
el: $('#signature-requested-sign'),
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="signature-item requested">',
'<div class="caret img-commonctrl nomargin"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'</div>'
].join(''))
});
this.viewValidList = new Common.UI.DataView({
el: $('#signature-valid-sign'),
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="signature-item">',
'<div class="caret img-commonctrl <% if (name == "" || date == "") { %>' + 'nomargin' + '<% } %>"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>'
].join(''))
});
this.viewInvalidList = new Common.UI.DataView({
el: $('#signature-invalid-sign'),
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="signature-item">',
'<div class="caret img-commonctrl <% if (name == "" || date == "") { %>' + 'nomargin' + '<% } %>"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>'
].join(''))
});
this.viewRequestedList.on('item:click', _.bind(this.onSelectSignature, this));
this.viewValidList.on('item:click', _.bind(this.onSelectSignature, this));
this.viewInvalidList.on('item:click', _.bind(this.onSelectSignature, this));
this.signatureMenu = new Common.UI.Menu({
menuAlign : 'tr-br',
items: [
{ caption: this.strSign, value: 0 },
{ caption: this.strDetails,value: 1 },
{ caption: this.strSetup, value: 2 },
{ caption: this.strDelete, value: 3 }
]
});
this.signatureMenu.on('item:click', _.bind(this.onMenuSignatureClick, this));
},
setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
}
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
return this;
},
ChangeSettings: function(props) {
if (!this._state.hasRequested && !this._state.hasValid && !this._state.hasInvalid)
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
},
setLocked: function (locked) {
this._locked = locked;
},
setMode: function(mode) {
this.mode = mode;
},
onApiUpdateSignatures: function(valid, requested){
if (!this._state.ready) return;
this.updateSignatures(valid, requested);
this.showSignatureTooltip(this._state.hasValid, this._state.hasInvalid);
},
updateSignatures: function(valid, requested){
var me = this,
requestedSignatures = [],
validSignatures = [],
invalidSignatures = [];
_.each(requested, function(item, index){
requestedSignatures.push({name: item.asc_getSigner1(), guid: item.asc_getGuid(), requested: true});
});
_.each(valid, function(item, index){
var item_date = item.asc_getDate();
var sign = {name: item.asc_getSigner1(), certificateId: item.asc_getId(), guid: item.asc_getGuid(), date: (!_.isEmpty(item_date)) ? new Date(item_date).toLocaleString() : '', invisible: !item.asc_getVisible()};
(item.asc_getValid()==0) ? validSignatures.push(sign) : invalidSignatures.push(sign);
});
// requestedSignatures = [{name: 'Hammish Mitchell', guid: '123', requested: true}, {name: 'Someone Somewhere', guid: '123', requested: true}, {name: 'Mary White', guid: '123', requested: true}, {name: 'John Black', guid: '123', requested: true}];
// validSignatures = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017', invisible: true}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
// invalidSignatures = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
me._state.hasValid = validSignatures.length>0;
me._state.hasInvalid = invalidSignatures.length>0;
me._state.hasRequested = requestedSignatures.length>0;
this.viewRequestedList.store.reset(requestedSignatures);
this.viewValidList.store.reset(validSignatures);
this.viewInvalidList.store.reset(invalidSignatures);
this.$el.find('.requested').toggleClass('hidden', !me._state.hasRequested);
this.$el.find('.valid').toggleClass('hidden', !me._state.hasValid);
this.$el.find('.invalid').toggleClass('hidden', !me._state.hasInvalid);
me.disableEditing(me._state.hasValid || me._state.hasInvalid);
},
onSelectSignature: function(picker, item, record, e){
if (!record) return;
var btn = $(e.target);
if (btn && btn.hasClass('caret')) {
var menu = this.signatureMenu;
if (menu.isVisible()) {
menu.hide();
return;
}
var showPoint, me = this,
currentTarget = $(e.currentTarget),
parent = $(this.el),
offset = currentTarget.offset(),
offsetParent = parent.offset();
showPoint = [offset.left - offsetParent.left + currentTarget.width(), offset.top - offsetParent.top + currentTarget.height()/2];
var menuContainer = parent.find('#menu-signature-container');
if (!menu.rendered) {
if (menuContainer.length < 1) {
menuContainer = $('<div id="menu-signature-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id);
parent.append(menuContainer);
}
menu.render(menuContainer);
menu.cmpEl.attr({tabindex: "-1"});
menu.on({
'show:after': function(cmp) {
if (cmp && cmp.menuAlignEl)
cmp.menuAlignEl.toggleClass('over', true);
},
'hide:after': function(cmp) {
if (cmp && cmp.menuAlignEl)
cmp.menuAlignEl.toggleClass('over', false);
}
});
}
var requested = record.get('requested'),
signed = (this._state.hasValid || this._state.hasInvalid);
menu.items[0].setVisible(requested);
menu.items[1].setVisible(!requested);
menu.items[2].setVisible(requested || !record.get('invisible'));
menu.items[3].setVisible(!requested);
menu.items[0].setDisabled(this._locked);
menu.items[3].setDisabled(this._locked);
menu.items[1].cmpEl.attr('data-value', record.get('certificateId')); // view certificate
menu.items[2].cmpEl.attr('data-value', signed ? 1 : 0); // view or edit signature settings
menu.cmpEl.attr('data-value', record.get('guid'));
menuContainer.css({left: showPoint[0], top: showPoint[1]});
menu.menuAlignEl = currentTarget;
menu.setOffset(-20, -currentTarget.height()/2 + 3);
menu.show();
_.delay(function() {
menu.cmpEl.focus();
}, 10);
e.stopPropagation();
e.preventDefault();
} else {
this.api.asc_gotoSignature(record.get('guid'));
}
},
onMenuSignatureClick: function(menu, item) {
var guid = menu.cmpEl.attr('data-value');
switch (item.value) {
case 0:
Common.NotificationCenter.trigger('protect:sign', guid);
break;
case 1:
this.api.asc_ViewCertificate(item.cmpEl.attr('data-value'));
break;
case 2:
Common.NotificationCenter.trigger('protect:signature', 'visible', !!parseInt(item.cmpEl.attr('data-value')), guid);// can edit settings for requested signature
break;
case 3:
this.api.asc_RemoveSignature(guid);
break;
}
},
onDocumentReady: function() {
this._state.ready = true;
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
this.showSignatureTooltip(this._state.hasValid, this._state.hasInvalid, this._state.hasRequested);
},
showSignatureTooltip: function(hasValid, hasInvalid, hasRequested) {
var me = this,
tip = me._state.tip;
if (!hasValid && !hasInvalid && !hasRequested) {
if (tip && tip.isVisible()) {
tip.close();
me._state.tip = undefined;
}
return;
}
var showLink = hasValid || hasInvalid,
tipText = (hasInvalid) ? me.txtSignedInvalid : (hasValid ? me.txtSigned : "");
if (hasRequested)
tipText = me.txtRequestedSignatures + "<br><br>" + tipText;
if (tip && tip.isVisible() && (tipText !== tip.text || showLink !== tip.showLink)) {
tip.close();
me._state.tip = undefined;
}
if (!me._state.tip) {
tip = new Common.UI.SynchronizeTip({
target : DE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
text : tipText,
showLink: showLink,
textLink: this.txtContinueEditing,
placement: 'left'
});
tip.on({
'dontshowclick': function() {
Common.UI.warning({
title: me.notcriticalErrorTitle,
msg: me.txtEditWarning,
buttons: ['ok', 'cancel'],
primary: 'ok',
callback: function(btn) {
if (btn == 'ok') {
tip.close();
me._state.tip = undefined;
me.api.asc_RemoveAllSignatures();
}
}
});
},
'closeclick': function() {
tip.close();
me._state.tip = undefined;
}
});
me._state.tip = tip;
tip.show();
}
},
disableEditing: function(disable) {
if (this._state.DisabledEditing != disable) {
this._state.DisabledEditing = disable;
var rightMenuController = DE.getController('RightMenu');
if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
rightMenuController.rightmenu.clearSelection();
rightMenuController.SetDisabled(disable, false, true);
DE.getController('Toolbar').DisableToolbar(disable, disable);
DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
var leftMenu = DE.getController('LeftMenu').leftMenu;
leftMenu.btnComments.setDisabled(disable);
var comments = DE.getController('Common.Controllers.Comments');
if (comments)
comments.setPreviewMode(disable);
}
},
strSignature: 'Signature',
strRequested: 'Requested signatures',
strValid: 'Valid signatures',
strInvalid: 'Invalid signatures',
strSign: 'Sign',
strDetails: 'Signature Details',
strSetup: 'Signature Setup',
txtSigned: 'Valid signatures has been added to the document. The document is protected from editing.',
txtSignedInvalid: 'Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.',
txtRequestedSignatures: 'This document needs to be signed.',
txtContinueEditing: 'Edit anyway',
notcriticalErrorTitle: 'Warning',
txtEditWarning: 'Editing will remove the signatures from the document.<br>Are you sure you want to continue?',
strDelete: 'Remove Signature'
}, DE.Views.SignatureSettings || {}));
});

View file

@ -373,8 +373,11 @@ define([
$parent.find('#status-label-lang').text(info.title);
var index = $parent.find('ul li a:contains("'+info.title+'")').parent().index();
index < 0 ? this.langMenu.saved = info.title :
this.langMenu.items[index-1].setChecked(true);
if (index < 0) {
this.langMenu.saved = info.title;
this.langMenu.clearAll();
} else
this.langMenu.items[index-1].setChecked(true);
}
},

View file

@ -243,8 +243,8 @@ define([
if (me.api) {
me.api.SplitCell(value.columns, value.rows);
}
me.fireEvent('editcomplete', me);
}
me.fireEvent('editcomplete', me);
}
})).show();
},

View file

@ -672,7 +672,8 @@ define([
// border colors
var stroke = shapeprops.asc_getLine(),
strokeType = (stroke) ? stroke.get_type() : null,
borderType;
borderType,
update = (this._state.StrokeColor == 'transparent' && this.BorderColor.Color !== 'transparent'); // border color was changed for shape without line and then shape was reselected (or apply other settings)
if (stroke) {
if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) {
@ -697,7 +698,7 @@ define([
type1 = typeof(this.BorderColor.Color);
type2 = typeof(this._state.StrokeColor);
if ( (type1 !== type2) || (type1=='object' &&
if ( update || (type1 !== type2) || (type1=='object' &&
(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue || this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)) ||
(type1!='object' && (this._state.StrokeColor.indexOf(this.BorderColor.Color)<0 || typeof(this.btnBorderColor.color)=='object'))) {

View file

@ -893,8 +893,8 @@ define([
iconCls: 'btn-colorschemas',
menu: new Common.UI.Menu({
items: [],
maxHeight: 600,
restoreHeight: 600
maxHeight: 560,
restoreHeight: 560
}).on('show:before', function (mnu) {
if (!this.scroller) {
this.scroller = new Common.UI.Scroller({
@ -904,23 +904,6 @@ define([
alwaysVisibleY: true
});
}
}).on('show:after', function (btn, e) {
var mnu = $(this.el).find('.dropdown-menu '),
docH = $(document).height(),
menuH = mnu.outerHeight(),
top = parseInt(mnu.css('top'));
if (menuH > docH) {
mnu.css('max-height', (docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom')) - 5) + 'px');
this.scroller.update({minScrollbarLength: 40});
} else if (mnu.height() < this.options.restoreHeight) {
mnu.css('max-height', (Math.min(docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom')) - 5, this.options.restoreHeight)) + 'px');
menuH = mnu.outerHeight();
if (top + menuH > docH) {
mnu.css('top', 0);
}
this.scroller.update({minScrollbarLength: 40});
}
})
});
this.toolbarControls.push(this.btnColorSchemas);
@ -1189,17 +1172,6 @@ define([
this.needShowSynchTip = false;
/** coauthoring end **/
me.$tabs.parent().on('click', '.ribtab', function (e) {
var tab = $(e.target).data('tab');
if (tab == 'file') {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
me.setTab(tab);
});
Common.NotificationCenter.on({
'window:resize': function() {
Common.UI.Mixtbar.prototype.onResize.apply(me, arguments);
@ -1225,6 +1197,21 @@ define([
return this;
},
onTabClick: function (e) {
var tab = $(e.target).data('tab'),
me = this;
if ( !me.isTabActive(tab) ) {
if ( tab == 'file' ) {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
}
Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments);
},
rendererComponents: function (html) {
var $host = $(html);
var _injectComponent = function (id, cmp) {
@ -2110,8 +2097,8 @@ define([
if (this.mnuColorSchema == null) {
this.mnuColorSchema = new Common.UI.Menu({
maxHeight: 600,
restoreHeight: 600
maxHeight: 560,
restoreHeight: 560
}).on('show:before', function (mnu) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
@ -2469,7 +2456,9 @@ define([
capImgWrapping: 'Wrapping',
capBtnComment: 'Comment',
textColumnsCustom: 'Custom Columns',
textSurface: 'Surface'
textSurface: 'Surface',
textTabCollaboration: 'Collaboration',
textTabProtect: 'Protection'
}
})(), DE.Views.Toolbar || {}));
});

View file

@ -153,6 +153,7 @@ require([
,'Common.Controllers.ExternalDiagramEditor'
,'Common.Controllers.ExternalMergeEditor'
,'Common.Controllers.ReviewChanges'
,'Common.Controllers.Protection'
]
});
@ -173,6 +174,7 @@ require([
'documenteditor/main/app/view/TableSettings',
'documenteditor/main/app/view/ShapeSettings',
'documenteditor/main/app/view/TextArtSettings',
'documenteditor/main/app/view/SignatureSettings',
'common/main/lib/util/utils',
'common/main/lib/util/LocalStorage',
'common/main/lib/controller/Fonts',
@ -186,6 +188,7 @@ require([
,'common/main/lib/controller/ExternalDiagramEditor'
,'common/main/lib/controller/ExternalMergeEditor'
,'common/main/lib/controller/ReviewChanges'
,'common/main/lib/controller/Protection'
], function() {
window.compareVersions = true;
app.start();

View file

@ -183,12 +183,29 @@
"Common.Views.OpenDialog.txtPassword": "Password",
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
"Common.Views.PasswordDialog.cancelButtonText": "Cancel",
"Common.Views.PasswordDialog.okButtonText": "OK",
"Common.Views.PasswordDialog.txtPassword": "Password",
"Common.Views.PasswordDialog.txtTitle": "Set Password",
"Common.Views.PasswordDialog.txtDescription": "A Password is required to open this document",
"Common.Views.PasswordDialog.txtRepeat": "Repeat password",
"Common.Views.PasswordDialog.txtIncorrectPwd": "Confirmation password is not identical",
"Common.Views.PluginDlg.textLoading": "Loading",
"Common.Views.Plugins.groupCaption": "Plugins",
"Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
"Common.Views.Plugins.textStop": "Stop",
"Common.Views.Protection.txtAddPwd": "Add password",
"Common.Views.Protection.txtEncrypt": "Encrypt",
"Common.Views.Protection.txtSignature": "Signature",
"Common.Views.Protection.hintAddPwd": "Encrypt with password",
"Common.Views.Protection.hintPwd": "Change or delete password",
"Common.Views.Protection.hintSignature": "Add digital signature or signature line",
"Common.Views.Protection.txtChangePwd": "Change password",
"Common.Views.Protection.txtDeletePwd": "Delete password",
"Common.Views.Protection.txtInvisibleSignature": "Add digital signature",
"Common.Views.Protection.txtSignatureLine": "Signature line",
"Common.Views.RenameDialog.cancelButtonText": "Cancel",
"Common.Views.RenameDialog.okButtonText": "Ok",
"Common.Views.RenameDialog.textName": "File name",
@ -207,10 +224,13 @@
"Common.Views.ReviewChanges.txtAcceptCurrent": "Accept Current Change",
"Common.Views.ReviewChanges.txtClose": "Close",
"Common.Views.ReviewChanges.txtDocLang": "Language",
"Common.Views.ReviewChanges.txtFinal": "All changes accepted (Preview)",
"Common.Views.ReviewChanges.txtMarkup": "All changes (Editing)",
"Common.Views.ReviewChanges.txtFinal": "All changes like accept (Preview)",
"Common.Views.ReviewChanges.txtMarkup": "Text with changes (Editing)",
"Common.Views.ReviewChanges.txtNext": "Next",
"Common.Views.ReviewChanges.txtOriginal": "All changes rejected (Preview)",
"Common.Views.ReviewChanges.txtOriginal": "Text without changes (Preview)",
"Common.Views.ReviewChanges.txtMarkupCap": "Markup",
"Common.Views.ReviewChanges.txtFinalCap": "Final",
"Common.Views.ReviewChanges.txtOriginalCap": "Original",
"Common.Views.ReviewChanges.txtPrev": "Previous",
"Common.Views.ReviewChanges.txtReject": "Reject",
"Common.Views.ReviewChanges.txtRejectAll": "Reject All Changes",
@ -219,6 +239,16 @@
"Common.Views.ReviewChanges.txtSpelling": "Spell Checking",
"Common.Views.ReviewChanges.txtTurnon": "Track Changes",
"Common.Views.ReviewChanges.txtView": "Display Mode",
"Common.Views.ReviewChanges.txtSharing": "Sharing",
"Common.Views.ReviewChanges.tipSharing": "Manage document access rights",
"Common.Views.ReviewChanges.txtCoAuthMode": "Co-editing Mode",
"Common.Views.ReviewChanges.tipCoAuthMode": "Set co-editing mode",
"Common.Views.ReviewChanges.strFast": "Fast",
"Common.Views.ReviewChanges.strStrict": "Strict",
"Common.Views.ReviewChanges.strFastDesc": "Real-time co-editing. All changes are saved automatically.",
"Common.Views.ReviewChanges.strStrictDesc": "Use the 'Save' button to sync the changes you and others make.",
"Common.Views.ReviewChanges.txtHistory": "Version History",
"Common.Views.ReviewChanges.tipHistory": "Show version history",
"Common.Views.ReviewChangesDialog.textTitle": "Review Changes",
"Common.Views.ReviewChangesDialog.txtAccept": "Accept",
"Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes",
@ -228,6 +258,32 @@
"Common.Views.ReviewChangesDialog.txtReject": "Reject",
"Common.Views.ReviewChangesDialog.txtRejectAll": "Reject All Changes",
"Common.Views.ReviewChangesDialog.txtRejectCurrent": "Reject Current Change",
"Common.Views.SignDialog.textTitle": "Sign Document",
"Common.Views.SignDialog.textPurpose": "Purpose for signing this document",
"Common.Views.SignDialog.textCertificate": "Certificate",
"Common.Views.SignDialog.textValid": "Valid from %1 to %2",
"Common.Views.SignDialog.textChange": "Change",
"Common.Views.SignDialog.cancelButtonText": "Cancel",
"Common.Views.SignDialog.okButtonText": "Ok",
"Common.Views.SignDialog.textInputName": "Input signer name",
"Common.Views.SignDialog.textUseImage": "or click 'Select Image' to use a picture as signature",
"Common.Views.SignDialog.textSelectImage": "Select Image",
"Common.Views.SignDialog.textSignature": "Signature looks as",
"Common.Views.SignDialog.tipFontName": "Font Name",
"Common.Views.SignDialog.tipFontSize": "Font Size",
"Common.Views.SignDialog.textBold": "Bold",
"Common.Views.SignDialog.textItalic": "Italic",
"Common.Views.SignSettingsDialog.textInfo": "Signer Info",
"Common.Views.SignSettingsDialog.textInfoName": "Name",
"Common.Views.SignSettingsDialog.textInfoTitle": "Signer Title",
"Common.Views.SignSettingsDialog.textInfoEmail": "E-mail",
"Common.Views.SignSettingsDialog.textInstructions": "Instructions for Signer",
"Common.Views.SignSettingsDialog.cancelButtonText": "Cancel",
"Common.Views.SignSettingsDialog.okButtonText": "Ok",
"Common.Views.SignSettingsDialog.txtEmpty": "This field is required",
"Common.Views.SignSettingsDialog.textAllowComment": "Allow signer to add comment in the signature dialog",
"Common.Views.SignSettingsDialog.textShowDate": "Show sign date in signature line",
"Common.Views.SignSettingsDialog.textTitle": "Signature Settings",
"DE.Controllers.LeftMenu.leavePageText": "All unsaved changes in this document will be lost.<br> Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.",
"DE.Controllers.LeftMenu.newDocumentTitle": "Unnamed document",
"DE.Controllers.LeftMenu.notcriticalErrorTitle": "Warning",
@ -322,6 +378,7 @@
"DE.Controllers.Main.txtButtons": "Buttons",
"DE.Controllers.Main.txtCallouts": "Callouts",
"DE.Controllers.Main.txtCharts": "Charts",
"DE.Controllers.Main.txtCurrentDocument": "Current Document",
"DE.Controllers.Main.txtDiagramTitle": "Chart Title",
"DE.Controllers.Main.txtEditingMode": "Set editing mode...",
"DE.Controllers.Main.txtErrorLoadHistory": "History loading failed",
@ -350,6 +407,17 @@
"DE.Controllers.Main.txtStyle_Title": "Title",
"DE.Controllers.Main.txtXAxis": "X Axis",
"DE.Controllers.Main.txtYAxis": "Y Axis",
"DE.Controllers.Main.txtBookmarkError": "Error! Bookmark not defined.",
"DE.Controllers.Main.txtAbove": "above",
"DE.Controllers.Main.txtBelow": "below",
"DE.Controllers.Main.txtOnPage": "on page ",
"DE.Controllers.Main.txtHeader": "Header",
"DE.Controllers.Main.txtFooter": "Footer",
"DE.Controllers.Main.txtSection": " -Section ",
"DE.Controllers.Main.txtFirstPage": "First Page ",
"DE.Controllers.Main.txtEvenPage": "Even Page ",
"DE.Controllers.Main.txtOddPage": "Odd Page ",
"DE.Controllers.Main.txtSameAsPrev": "Same as Previous",
"DE.Controllers.Main.unknownErrorText": "Unknown error.",
"DE.Controllers.Main.unsupportedBrowserErrorText ": "Your browser is not supported.",
"DE.Controllers.Main.uploadImageExtMessage": "Unknown image format.",
@ -903,6 +971,12 @@
"DE.Views.DocumentHolder.txtUngroup": "Ungroup",
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"DE.Views.DocumentHolder.strSign": "Sign",
"DE.Views.DocumentHolder.strDetails": "Signature Details",
"DE.Views.DocumentHolder.strSetup": "Signature Setup",
"DE.Views.DocumentHolder.strDelete": "Remove Signature",
"DE.Views.DocumentHolder.txtOverwriteCells": "Overwrite cells",
"DE.Views.DocumentHolder.textNest": "Nest table",
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
@ -964,6 +1038,7 @@
"DE.Views.FileMenu.btnSettingsCaption": "Advanced Settings...",
"DE.Views.FileMenu.btnToEditCaption": "Edit Document",
"DE.Views.FileMenu.textDownload": "Download",
"DE.Views.FileMenu.btnProtectCaption": "Protect\\Sign",
"DE.Views.FileMenuPanels.CreateNew.fromBlankText": "From Blank",
"DE.Views.FileMenuPanels.CreateNew.fromTemplateText": "From Template",
"DE.Views.FileMenuPanels.CreateNew.newDescriptionText": "Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",
@ -984,6 +1059,17 @@
"DE.Views.FileMenuPanels.DocumentInfo.txtWords": "Words",
"DE.Views.FileMenuPanels.DocumentRights.txtBtnAccessRights": "Change access rights",
"DE.Views.FileMenuPanels.DocumentRights.txtRights": "Persons who have rights",
"DE.Views.FileMenuPanels.ProtectDoc.strProtect": "Protect Document",
"DE.Views.FileMenuPanels.ProtectDoc.strSignature": "Signature",
"DE.Views.FileMenuPanels.ProtectDoc.txtView": "View signatures",
"DE.Views.FileMenuPanels.ProtectDoc.txtEdit": "Edit document",
"DE.Views.FileMenuPanels.ProtectDoc.txtSigned": "Valid signatures has been added to the document. The document is protected from editing.",
"DE.Views.FileMenuPanels.ProtectDoc.txtSignedInvalid": "Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.",
"DE.Views.FileMenuPanels.ProtectDoc.txtRequestedSignatures": "This document needs to be signed.",
"DE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning",
"DE.Views.FileMenuPanels.ProtectDoc.txtEditWarning": "Editing will remove the signatures from the document.<br>Are you sure you want to continue?",
"DE.Views.FileMenuPanels.ProtectDoc.strEncrypt": "Password",
"DE.Views.FileMenuPanels.ProtectDoc.txtEncrypted": "This document has been protected by password",
"DE.Views.FileMenuPanels.Settings.okButtonText": "Apply",
"DE.Views.FileMenuPanels.Settings.strAlignGuides": "Turn on alignment guides",
"DE.Views.FileMenuPanels.Settings.strAutoRecover": "Turn on autorecover",
@ -1300,6 +1386,8 @@
"DE.Views.ParagraphSettingsAdvanced.tipRight": "Set right border only",
"DE.Views.ParagraphSettingsAdvanced.tipTop": "Set top border only",
"DE.Views.ParagraphSettingsAdvanced.txtNoBorders": "No borders",
"DE.Views.ParagraphSettingsAdvanced.textLeader": "Leader",
"DE.Views.ParagraphSettingsAdvanced.textNone": "None",
"DE.Views.RightMenu.txtChartSettings": "Chart settings",
"DE.Views.RightMenu.txtHeaderFooterSettings": "Header and footer settings",
"DE.Views.RightMenu.txtImageSettings": "Image settings",
@ -1308,6 +1396,7 @@
"DE.Views.RightMenu.txtShapeSettings": "Shape settings",
"DE.Views.RightMenu.txtTableSettings": "Table settings",
"DE.Views.RightMenu.txtTextArtSettings": "Text Art settings",
"DE.Views.RightMenu.txtSignatureSettings": "Signature Settings",
"DE.Views.ShapeSettings.strBackground": "Background color",
"DE.Views.ShapeSettings.strChange": "Change Autoshape",
"DE.Views.ShapeSettings.strColor": "Color",
@ -1358,6 +1447,20 @@
"DE.Views.ShapeSettings.txtTight": "Tight",
"DE.Views.ShapeSettings.txtTopAndBottom": "Top and bottom",
"DE.Views.ShapeSettings.txtWood": "Wood",
"DE.Views.SignatureSettings.strSignature": "Signature",
"DE.Views.SignatureSettings.strRequested": "Requested signatures",
"DE.Views.SignatureSettings.strValid": "Valid signatures",
"DE.Views.SignatureSettings.strInvalid": "Invalid signatures",
"DE.Views.SignatureSettings.strSign": "Sign",
"DE.Views.SignatureSettings.strDetails": "Signature Details",
"DE.Views.SignatureSettings.strDelete": "Remove Signature",
"DE.Views.SignatureSettings.strSetup": "Signature Setup",
"DE.Views.SignatureSettings.txtSigned": "Valid signatures has been added to the document. The document is protected from editing.",
"DE.Views.SignatureSettings.txtSignedInvalid": "Some of the digital signatures in document are invalid or could not be verified. The document is protected from editing.",
"DE.Views.SignatureSettings.txtRequestedSignatures": "This document needs to be signed.",
"DE.Views.SignatureSettings.txtContinueEditing": "Edit anyway",
"DE.Views.SignatureSettings.notcriticalErrorTitle": "Warning",
"DE.Views.SignatureSettings.txtEditWarning": "Editing will remove the signatures from the document.<br>Are you sure you want to continue?",
"DE.Views.Statusbar.goToPageText": "Go to Page",
"DE.Views.Statusbar.pageIndexText": "Page {0} of {1}",
"DE.Views.Statusbar.tipFitPage": "Fit to page",
@ -1613,6 +1716,8 @@
"DE.Views.Toolbar.textTabInsert": "Insert",
"DE.Views.Toolbar.textTabLayout": "Layout",
"DE.Views.Toolbar.textTabReview": "Review",
"DE.Views.Toolbar.textTabCollaboration": "Collaboration",
"DE.Views.Toolbar.textTabProtect": "Protection",
"DE.Views.Toolbar.textTitleError": "Error",
"DE.Views.Toolbar.textToCurrent": "To current position",
"DE.Views.Toolbar.textTop": "Top: ",

View file

@ -350,6 +350,8 @@
"DE.Controllers.Main.txtStyle_Title": "Название",
"DE.Controllers.Main.txtXAxis": "Ось X",
"DE.Controllers.Main.txtYAxis": "Ось Y",
"DE.Controllers.Main.txtHeader": "Верхний колонтитул",
"DE.Controllers.Main.txtFooter": "Нижний колонтитул",
"DE.Controllers.Main.unknownErrorText": "Неизвестная ошибка.",
"DE.Controllers.Main.unsupportedBrowserErrorText ": "Ваш браузер не поддерживается.",
"DE.Controllers.Main.uploadImageExtMessage": "Неизвестный формат изображения.",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -144,7 +144,8 @@
width: 30%;
label {
font: bold 12px tahoma, arial, verdana, sans-serif;
font-weight: bold;
font-size: 12px;
}
}
@ -367,6 +368,27 @@
}
label, span {
font: 12px tahoma, arial, verdana, sans-serif;
font-size: 12px;
}
}
#panel-protect {
label, span {
font-size: 12px;
}
#file-menu-panel & {
padding: 30px 30px;
}
.header {
font-weight: bold;
margin: 30px 0 10px;
}
table {
td {
padding: 5px 0;
}
}
}

View file

@ -77,4 +77,4 @@ button.notify .btn-menu-comments {background-position: -0*@toolbar-icon-size -60
-webkit-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
}

View file

@ -105,6 +105,7 @@
/*menuTextArt*/
.button-normal-icon(btn-menu-textart, 54, @toolbar-icon-size);
.button-normal-icon(btn-menu-signature, 78, @toolbar-icon-size);
.button-otherstates-icon2(btn-category, @toolbar-icon-size);
@ -268,3 +269,55 @@ button:active:not(.disabled) .btn-change-shape {background-position: -56px -
.gradient-radial-center {
background-position: -100px -150px;
}
#signature-requested-sign,
#signature-valid-sign,
#signature-invalid-sign {
height: 100%;
overflow: hidden;
margin: 0 -10px 0 -15px;
.item {
display: block;
border: none;
width: 100%;
.box-shadow(none);
margin: 0;
&:hover,
&.over {
background-color: @secondary;
}
}
.signature-item {
padding: 5px 2px 5px 15px;
text-overflow: ellipsis;
min-height: 25px;
.name {
width: 100%;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
max-width: 160px;
text-overflow: ellipsis;
}
.caret {
width: 23px;
height: 14px;
border: 0;
background-position: -43px -150px;
margin: 8px 15px;
display: inline-block;
position: absolute;
right: 0;
&.nomargin {
margin-top: 0;
margin-bottom: 0;
}
}
}
}

View file

@ -1,13 +1,9 @@
@tabs-bg-color: #4f6279;
#toolbar {
//z-index: 101;
}
.toolbar {
&:not(.cover) {
z-index: 101;
z-index: 1001;
}
&.masked {
@ -312,12 +308,6 @@
.button-normal-icon(mmerge-first, 74, @toolbar-icon-size);
//.button-normal-icon(btn-columns, 75, @toolbar-icon-size);
//.button-normal-icon(btn-pagemargins, 76, @toolbar-icon-size);
//.button-normal-icon(btn-img-frwd, 83, @toolbar-icon-size);
//.button-normal-icon(btn-img-bkwd, 84, @toolbar-icon-size);
//.button-normal-icon(btn-img-wrap, 85, @toolbar-icon-size);
//.button-normal-icon(btn-img-group, 86, @toolbar-icon-size);
//.button-normal-icon(btn-img-align, 87, @toolbar-icon-size);
.button-normal-icon(btn-goback, 88, @toolbar-icon-size);
//.button-normal-icon(btn-insertimage, 17, @toolbar-icon-size);
//.button-normal-icon(btn-inserttable, 18, @toolbar-icon-size);
@ -327,12 +317,7 @@
//.button-normal-icon(btn-text, 46, @toolbar-icon-size);
//.button-normal-icon(btn-insertequation, 53, @toolbar-icon-size);
//.button-normal-icon(btn-dropcap, 50, @toolbar-icon-size);
//.button-normal-icon(btn-ic-doclang, 67, @toolbar-icon-size);
//.button-normal-icon(btn-notes, 78, @toolbar-icon-size);
//.button-normal-icon(review-prev, 79, @toolbar-icon-size);
//.button-normal-icon(review-next, 80, @toolbar-icon-size);
//.button-normal-icon(review-save, 81, @toolbar-icon-size);
//.button-normal-icon(review-deny, 82, @toolbar-icon-size);
.button-normal-icon(btn-ic-doclang, 67, @toolbar-icon-size);
@menu-icon-size: 22px;
.menu-icon-normal(mnu-wrap-inline, 0, @menu-icon-size);

View file

@ -866,6 +866,8 @@ define([
}
}
else {
Common.Gateway.reportWarning(id, config.msg);
config.title = this.notcriticalErrorTitle;
config.callback = _.bind(function(btn){
if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && (this.appOptions.canDownload || this.appOptions.canDownloadOrigin)) {

View file

@ -88,8 +88,10 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/word/Editor/GraphicObjects/WrapManager.js",
"../../../../sdkjs/word/Editor/CollaborativeEditing.js",
"../../../../sdkjs/word/Editor/DocumentContentElementBase.js",
"../../../../sdkjs/word/Editor/ParagraphContentBase.js",
"../../../../sdkjs/word/Editor/Comments.js",
"../../../../sdkjs/word/Editor/CommentsChanges.js",
"../../../../sdkjs/word/Editor/Bookmarks.js",
"../../../../sdkjs/word/Editor/Styles.js",
"../../../../sdkjs/word/Editor/StylesChanges.js",
"../../../../sdkjs/word/Editor/RevisionsChange.js",
@ -98,6 +100,8 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/word/Editor/Paragraph/ParaTextPrChanges.js",
"../../../../sdkjs/word/Editor/Paragraph/ParaDrawing.js",
"../../../../sdkjs/word/Editor/Paragraph/ParaDrawingChanges.js",
"../../../../sdkjs/word/Editor/Paragraph/ComplexFieldInstruction.js",
"../../../../sdkjs/word/Editor/Paragraph/ComplexField.js",
"../../../../sdkjs/word/Editor/Paragraph.js",
"../../../../sdkjs/word/Editor/ParagraphChanges.js",
"../../../../sdkjs/word/Editor/DocumentContentBase.js",
@ -109,8 +113,7 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/word/Editor/LogicDocumentController.js",
"../../../../sdkjs/word/Editor/DrawingsController.js",
"../../../../sdkjs/word/Editor/HeaderFooterController.js",
"../../../../sdkjs/word/Editor/FlowObjects.js",
"../../../../sdkjs/word/Editor/ParagraphContentBase.js",
"../../../../sdkjs/word/Editor/FlowObjects.js",
"../../../../sdkjs/word/Editor/Hyperlink.js",
"../../../../sdkjs/word/Editor/HyperlinkChanges.js",
"../../../../sdkjs/word/Editor/Field.js",

View file

@ -497,6 +497,8 @@ var ApplicationController = new(function(){
});
}
else {
Common.Gateway.reportWarning(id, message);
$('#id-critical-error-title').text(me.notcriticalErrorTitle);
$('#id-critical-error-message').text(message);
$('#id-critical-error-close').off();

View file

@ -155,6 +155,8 @@ require([
/** coauthoring end **/
,'Common.Controllers.Plugins'
,'Common.Controllers.ExternalDiagramEditor'
,'Common.Controllers.ReviewChanges'
,'Common.Controllers.Protection'
]
});
@ -175,6 +177,7 @@ require([
'presentationeditor/main/app/view/SlideSettings',
'presentationeditor/main/app/view/TableSettings',
'presentationeditor/main/app/view/TextArtSettings',
'presentationeditor/main/app/view/SignatureSettings',
'common/main/lib/util/utils',
'common/main/lib/util/LocalStorage',
'common/main/lib/controller/Fonts'
@ -185,6 +188,8 @@ require([
'common/main/lib/controller/Plugins',
'presentationeditor/main/app/view/ChartSettings',
'common/main/lib/controller/ExternalDiagramEditor'
,'common/main/lib/controller/ReviewChanges'
,'common/main/lib/controller/Protection'
], function() {
app.start();
});

View file

@ -94,8 +94,12 @@ define([
'hide': _.bind(this.onSearchDlgHide, this),
'search:back': _.bind(this.onQuerySearch, this, 'back'),
'search:next': _.bind(this.onQuerySearch, this, 'next')
},
'Common.Views.ReviewChanges': {
'collaboration:chat': _.bind(this.onShowHideChat, this)
}
});
Common.NotificationCenter.on('leftmenu:change', _.bind(this.onMenuChange, this));
},
onLaunch: function() {
@ -238,27 +242,35 @@ define([
},
applySettings: function(menu) {
this.api.SetTextBoxInputMode(Common.localStorage.getBool("pe-settings-inputmode"));
var value = Common.localStorage.getBool("pe-settings-inputmode");
Common.Utils.InternalSettings.set("pe-settings-inputmode", value);
this.api.SetTextBoxInputMode(value);
if (Common.Utils.isChrome) {
value = Common.localStorage.getBool("pe-settings-inputsogou");
Common.Utils.InternalSettings.set("pe-settings-inputsogou", value);
this.api.setInputParams({"SogouPinyin" : value});
}
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
this.api.asc_SetFastCollaborative(Common.localStorage.getBool("pe-settings-coauthmode", true));
value = Common.localStorage.getBool("pe-settings-coauthmode", true);
Common.Utils.InternalSettings.set("pe-settings-coauthmode", value);
this.api.asc_SetFastCollaborative(value);
}
/** coauthoring end **/
if (this.mode.isEdit) {
var value = Common.localStorage.getItem("pe-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = parseInt(Common.localStorage.getItem("pe-settings-autosave"));
Common.Utils.InternalSettings.set("pe-settings-autosave", value);
this.api.asc_setAutoSaveGap(value);
this.api.asc_setSpellCheck(Common.localStorage.getBool("pe-settings-spellcheck", true));
value = Common.localStorage.getBool("pe-settings-spellcheck", true);
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
this.api.asc_setSpellCheck(value);
}
this.api.put_ShowSnapLines( Common.localStorage.getBool("pe-settings-showsnaplines") );
this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("pe-settings-showsnaplines"));
menu.hide();
},
@ -533,18 +545,42 @@ define([
},
onPluginOpen: function(panel, type, action) {
if ( type == 'onboard' ) {
if ( action == 'open' ) {
if (type == 'onboard') {
if (action == 'open') {
this.leftMenu.close();
this.leftMenu.btnThumbs.toggle(false, false);
this.leftMenu.panelPlugins.show();
this.leftMenu.onBtnMenuClick({pressed:true, options: {action: 'plugins'}});
this.leftMenu.onBtnMenuClick({pressed: true, options: {action: 'plugins'}});
} else {
this.leftMenu.close();
}
}
},
onMenuChange: function (value) {
if ('hide' === value) {
if (this.leftMenu.btnComments.isActive() && this.api) {
this.leftMenu.btnComments.toggle(false);
this.leftMenu.onBtnMenuClick(this.leftMenu.btnComments);
// focus to sdk
this.api.asc_enableKeyEvents(true);
}
}
},
onShowHideChat: function(state) {
if (this.mode.canCoAuthoring && this.mode.canChat && !this.mode.isLightVersion) {
if (state) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu('chat');
} else {
this.leftMenu.btnChat.toggle(false, true);
this.leftMenu.onBtnMenuClick(this.leftMenu.btnChat);
}
}
},
textNoTextFound : 'Text not found',
newDocumentTitle : 'Unnamed document',
requestEditRightsText : 'Requesting editing rights...'

View file

@ -92,6 +92,9 @@ define([
this.addListeners({
'FileMenu': {
'settings:apply': _.bind(this.applySettings, this)
},
'Common.Views.ReviewChanges': {
'settings:apply': _.bind(this.applySettings, this)
}
});
},
@ -142,7 +145,8 @@ define([
'Slide subtitle': this.txtSlideSubtitle,
'Table': this.txtSldLtTTbl,
'Slide title': this.txtSlideTitle,
'Loading': this.txtLoading
'Loading': this.txtLoading,
'Click to add notes': this.txtAddNotes
}
});
@ -359,8 +363,17 @@ define([
}
},
onDownloadAs: function() {
this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
onDownloadAs: function(format) {
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
_supported = [
Asc.c_oAscFileType.PPTX,
Asc.c_oAscFileType.ODP,
Asc.c_oAscFileType.PDF
];
if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.PPTX;
this.api.asc_DownloadAs(_format, true);
},
onProcessMouse: function(data) {
@ -572,10 +585,13 @@ define([
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
value = Common.localStorage.getItem("pe-settings-zoom");
Common.Utils.InternalSettings.set("pe-settings-zoom", value);
var zf = (value!==null) ? parseInt(value) : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom) : -1);
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
me.api.asc_setSpellCheck(Common.localStorage.getBool("pe-settings-spellcheck", true));
value = Common.localStorage.getBool("pe-settings-spellcheck", true);
Common.Utils.InternalSettings.set("pe-settings-spellcheck", value);
me.api.asc_setSpellCheck(value);
function checkWarns() {
if (!window['AscDesktopEditor']) {
@ -599,11 +615,14 @@ define([
appHeader.setDocumentCaption( me.api.asc_getDocumentName() );
me.updateWindowTitle(true);
me.api.SetTextBoxInputMode(Common.localStorage.getBool("pe-settings-inputmode"));
value = Common.localStorage.getBool("pe-settings-inputmode");
Common.Utils.InternalSettings.set("pe-settings-inputmode", value);
me.api.SetTextBoxInputMode(value);
if (Common.Utils.isChrome) {
value = Common.localStorage.getBool("pe-settings-inputsogou");
me.api.setInputParams({"SogouPinyin" : value});
Common.Utils.InternalSettings.set("pe-settings-inputsogou", value);
}
/** coauthoring begin **/
@ -616,12 +635,16 @@ define([
me._state.fastCoauth = (value===null || parseInt(value) == 1);
} else {
me._state.fastCoauth = (!me.appOptions.isEdit && me.appOptions.canComments);
me._state.fastCoauth && me.api.asc_setAutoSaveGap(1);
if (me._state.fastCoauth) {
me.api.asc_setAutoSaveGap(1);
Common.Utils.InternalSettings.set("pe-settings-autosave", 1);
}
}
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
Common.Utils.InternalSettings.set("pe-settings-coauthmode", me._state.fastCoauth);
/** coauthoring end **/
Common.localStorage.setBool("pe-settings-showsnaplines", me.api.get_ShowSnapLines());
Common.Utils.InternalSettings.set("pe-settings-showsnaplines", me.api.get_ShowSnapLines());
var application = me.getApplication();
var toolbarController = application.getController('Toolbar'),
@ -662,9 +685,11 @@ define([
value = 0;
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
me.api.asc_setAutoSaveGap(value);
Common.Utils.InternalSettings.set("pe-settings-autosave", value);
if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true
me.appOptions.forcesave = Common.localStorage.getBool("pe-settings-forcesave", me.appOptions.canForcesave);
Common.Utils.InternalSettings.set("pe-settings-forcesave", me.appOptions.forcesave);
me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave);
}
@ -694,16 +719,14 @@ define([
toolbarController.onApiCoAuthoringDisconnect();
me.api.UpdateInterfaceState();
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
}
}, 50);
} else {
documentHolderController.getView('DocumentHolder').createDelayedElementsViewer();
if (me.appOptions.canBrandingExt)
Common.NotificationCenter.trigger('document:ready', 'main');
Common.NotificationCenter.trigger('document:ready', 'main');
}
if (this.appOptions.canAnalytics && false)
@ -814,6 +837,7 @@ define([
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
this.appOptions.trialMode = params.asc_getLicenseMode();
this.appOptions.canProtect = this.appOptions.isDesktopApp && this.api.asc_isSignaturesSupport();
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
@ -878,7 +902,8 @@ define([
application = this.getApplication(),
toolbarController = application.getController('Toolbar'),
rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');
fontsControllers = application.getController('Common.Controllers.Fonts'),
reviewController = application.getController('Common.Controllers.ReviewChanges');
// me.getStore('SlideLayouts');
fontsControllers && fontsControllers.setApi(me.api);
@ -886,6 +911,11 @@ define([
rightmenuController && rightmenuController.setApi(me.api);
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
if (me.appOptions.isDesktopApp && me.appOptions.isOffline)
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.applyEditorMode();
@ -914,6 +944,7 @@ define([
var value = Common.localStorage.getItem('pe-settings-unit');
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.Utils.InternalSettings.set("pe-settings-unit", value);
me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
if (me.api.asc_SetViewRulers) me.api.asc_SetViewRulers(!Common.localStorage.getBool('pe-hidden-rulers', true));
@ -1095,6 +1126,8 @@ define([
}
}
else {
Common.Gateway.reportWarning(id, config.msg);
config.title = this.notcriticalErrorTitle;
config.iconCls = 'warn';
config.buttons = ['ok'];
@ -1102,6 +1135,20 @@ define([
if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && this.appOptions.canDownload) {
Common.UI.Menu.Manager.hideAll();
(this.appOptions.isDesktopApp && this.appOptions.isOffline) ? this.api.asc_DownloadAs() : this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
} else if (id == Asc.c_oAscError.ID.SplitCellMaxRows || id == Asc.c_oAscError.ID.SplitCellMaxCols || id == Asc.c_oAscError.ID.SplitCellRowsDivider) {
var me = this;
setTimeout(function(){
(new Common.Views.InsertTableDialog({
split: true,
handler: function(result, value) {
if (result == 'ok') {
if (me.api)
me.api.SplitCell(value.columns, value.rows);
}
me.onEditComplete();
}
})).show();
},10);
}
this._state.lostEditingRights = false;
this.onEditComplete();
@ -1391,6 +1438,7 @@ define([
var value = Common.localStorage.getItem("pe-settings-unit");
value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.Utils.InternalSettings.set("pe-settings-unit", value);
this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
this.getApplication().getController('RightMenu').updateMetricUnit();
},
@ -1558,6 +1606,7 @@ define([
if (btn == 'custom') {
Common.localStorage.setItem("pe-settings-coauthmode", 0);
this.api.asc_SetFastCollaborative(false);
Common.Utils.InternalSettings.set("pe-settings-coauthmode", false);
this._state.fastCoauth = false;
}
this.onEditComplete();
@ -1583,6 +1632,7 @@ define([
}
if (this.appOptions.canForcesave) {
this.appOptions.forcesave = Common.localStorage.getBool("pe-settings-forcesave", this.appOptions.canForcesave);
Common.Utils.InternalSettings.set("pe-settings-forcesave", this.appOptions.forcesave);
this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
}
},
@ -1683,18 +1733,11 @@ define([
var pluginsData = (uiCustomize) ? plugins.UIpluginsData : plugins.pluginsData;
if (!pluginsData || pluginsData.length<1) return;
var arr = [],
baseUrl = _.isEmpty(plugins.url) ? "" : plugins.url;
if (baseUrl !== "")
console.warn("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration.");
var arr = [];
pluginsData.forEach(function(item){
item = baseUrl + item; // for compatibility with previouse version of server, where plugins.url is used.
var value = Common.Utils.getConfigJson(item);
if (value) {
value.baseUrl = item.substring(0, item.lastIndexOf("config.json"));
value.oldVersion = (baseUrl !== "");
arr.push(value);
}
});
@ -1734,14 +1777,6 @@ define([
var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'slide');
if ( visible ) pluginVisible = true;
var icons = itemVar.icons;
if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
icons = [];
itemVar.icons.forEach(function(icon){
icons.push(icon.substring(icon.lastIndexOf("\/")+1));
});
}
if ( item.isUICustomizer ) {
visible && arrUI.push(item.baseUrl + itemVar.url);
} else {
@ -1749,8 +1784,8 @@ define([
model.set({
index: variationsArr.length,
url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
icons: icons,
url: itemVar.url,
icons: itemVar.icons,
visible: visible
});
@ -1936,6 +1971,7 @@ define([
saveTitleText: 'Saving Document',
saveTextText: 'Saving document...',
txtLoading: 'Loading...',
txtAddNotes: 'Click to add notes',
warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.'
}
})(), PE.Controllers.Main || {}))

View file

@ -79,10 +79,12 @@ define([
this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false};
this._settings[Common.Utils.documentSettingsType.Signature] = {panelId: "id-signature-settings", panel: rightMenu.signatureSettings, btn: rightMenu.btnSignature, hidden: 1, props: {}, locked: false};
},
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
@ -97,7 +99,7 @@ define([
var panel = this._settings[type].panel;
var props = this._settings[type].props;
if (props && panel)
panel.ChangeSettings.call(panel, props);
panel.ChangeSettings.call(panel, (type==Common.Utils.documentSettingsType.Signature) ? undefined : props);
}
Common.NotificationCenter.trigger('layout:changed', 'rightmenu');
this.rightmenu.fireEvent('editcomplete', this.rightmenu);
@ -109,12 +111,14 @@ define([
var needhide = true;
for (var i=0; i<this._settings.length; i++) {
if (i==Common.Utils.documentSettingsType.Signature) continue;
if (this._settings[i]) {
this._settings[i].hidden = 1;
this._settings[i].locked = undefined;
}
}
this._settings[Common.Utils.documentSettingsType.Slide].hidden = (SelectedObjects.length>0) ? 0 : 1;
this._settings[Common.Utils.documentSettingsType.Signature].locked = false;
for (i=0; i<SelectedObjects.length; i++)
{
@ -152,7 +156,7 @@ define([
activePane = this.rightmenu.GetActivePane();
for (i=0; i<this._settings.length; i++) {
var pnl = this._settings[i];
if (pnl===undefined) continue;
if (pnl===undefined || pnl.btn===undefined || pnl.panel===undefined) continue;
if ( pnl.hidden ) {
if (!pnl.btn.isDisabled()) pnl.btn.setDisabled(true);
@ -160,7 +164,7 @@ define([
currentactive = -1;
} else {
if (pnl.btn.isDisabled()) pnl.btn.setDisabled(false);
if ( i!=Common.Utils.documentSettingsType.Slide )
if ( i!=Common.Utils.documentSettingsType.Slide && i!=Common.Utils.documentSettingsType.Signature)
lastactive = i;
if ( pnl.needShow ) {
pnl.needShow = false;
@ -190,7 +194,10 @@ define([
if (active !== undefined) {
this.rightmenu.SetActivePane(active, open);
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
if (active!=Common.Utils.documentSettingsType.Signature)
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
else
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel);
}
}
@ -200,11 +207,41 @@ define([
},
onCoAuthoringDisconnect: function() {
if (this.rightmenu)
this.rightmenu.SetDisabled('', true, true);
this.SetDisabled(true);
this.setMode({isEdit: false});
},
SetDisabled: function(disabled, allowSignature) {
this.setMode({isEdit: !disabled});
if (this.rightmenu) {
this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled);
this.rightmenu.paragraphSettings.disableControls(disabled);
this.rightmenu.shapeSettings.disableControls(disabled);
this.rightmenu.textartSettings.disableControls(disabled);
this.rightmenu.tableSettings.disableControls(disabled);
this.rightmenu.imageSettings.disableControls(disabled);
this.rightmenu.chartSettings.disableControls(disabled);
if (!allowSignature && this.rightmenu.signatureSettings) {
this.rightmenu.btnSignature.setDisabled(disabled);
}
if (disabled) {
this.rightmenu.btnSlide.setDisabled(disabled);
this.rightmenu.btnText.setDisabled(disabled);
this.rightmenu.btnTable.setDisabled(disabled);
this.rightmenu.btnImage.setDisabled(disabled);
this.rightmenu.btnShape.setDisabled(disabled);
this.rightmenu.btnTextArt.setDisabled(disabled);
this.rightmenu.btnChart.setDisabled(disabled);
} else {
var selectedElements = this.api.getSelectedElements();
if (selectedElements.length > 0)
this.onFocusObject(selectedElements);
}
}
},
onInsertTable: function() {
this._settings[Common.Utils.documentSettingsType.Table].needShow = true;
},
@ -268,6 +305,16 @@ define([
}
},
onApiUpdateSignatures: function(valid){
if (!this.rightmenu.signatureSettings) return;
var disabled = (!valid || valid.length<1),
type = Common.Utils.documentSettingsType.Signature;
this._settings[type].hidden = disabled ? 1 : 0;
this._settings[type].btn.setDisabled(disabled);
this._settings[type].panel.setLocked(this._settings[type].locked);
},
onApiCountPages: function(count) {
if (this._state.no_slides !== (count<=0) && this.editMode) {
this._state.no_slides = (count<=0);

View file

@ -84,7 +84,7 @@ define([
this.bindViewEvents(this.statusbar, this.events);
$('#status-label-zoom').css('min-width', 70);
$('#status-label-zoom').css('min-width', 80);
this.statusbar.btnZoomToPage.on('click', _.bind(this.onBtnZoomTo, this, 'topage'));
this.statusbar.btnZoomToWidth.on('click', _.bind(this.onBtnZoomTo, this, 'towidth'));
@ -208,6 +208,7 @@ define([
onBtnSpelling: function(d, b, e) {
Common.localStorage.setItem("pe-settings-spellcheck", d.pressed ? 1 : 0);
Common.Utils.InternalSettings.set("pe-settings-spellcheck", d.pressed);
this.api.asc_setSpellCheck(d.pressed);
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
},

View file

@ -121,6 +121,7 @@ define([
'insert:text' : this.onInsertText.bind(this),
'insert:textart' : this.onInsertTextart.bind(this),
'insert:shape' : this.onInsertShape.bind(this),
'add:slide' : this.onAddSlide.bind(this),
'change:compact' : this.onClickChangeCompact
},
'FileMenu': {
@ -166,8 +167,8 @@ define([
btn_id = cmp.closest('.btn-group').attr('id');
if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) {
if ( me.toolbar.btnsInsertText.pressed && !me.toolbar.btnsInsertText.contains(btn_id) ||
me.toolbar.btnsInsertShape.pressed && !me.toolbar.btnsInsertShape.contains(btn_id) )
if ( me.toolbar.btnsInsertText.pressed() && !me.toolbar.btnsInsertText.contains(btn_id) ||
me.toolbar.btnsInsertShape.pressed() && !me.toolbar.btnsInsertShape.contains(btn_id) )
{
me._isAddingShape = false;
@ -176,7 +177,7 @@ define([
me.toolbar.btnsInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
} else
if ( me.toolbar.btnsInsertShape.pressed && me.toolbar.btnsInsertShape.contains(btn_id) ) {
if ( me.toolbar.btnsInsertShape.pressed() && me.toolbar.btnsInsertShape.contains(btn_id) ) {
_.defer(function(){
me.api.StartAddShape('', false);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@ -188,10 +189,10 @@ define([
this.onApiEndAddShape = function() {
this.toolbar.fireEvent('insertshape', this.toolbar);
if ( this.toolbar.btnsInsertShape.pressed )
if ( this.toolbar.btnsInsertShape.pressed() )
this.toolbar.btnsInsertShape.toggle(false, true);
if ( this.toolbar.btnsInsertText.pressed )
if ( this.toolbar.btnsInsertText.pressed() )
this.toolbar.btnsInsertText.toggle(false, true);
$(document.body).off('mouseup', checkInsertAutoshape);
@ -225,6 +226,10 @@ define([
PE.getCollection('ShapeGroups').bind({
reset: me.onResetAutoshapes.bind(this)
});
PE.getCollection('SlideLayouts').bind({
reset: me.onResetSlides.bind(this)
});
},
attachUIEvents: function(toolbar) {
@ -232,8 +237,6 @@ define([
* UI Events
*/
toolbar.btnAddSlide.on('click', _.bind(this.onBtnAddSlide, this));
toolbar.mnuAddSlidePicker.on('item:click', _.bind(this.onAddSlide, this));
if (toolbar.mnuChangeSlidePicker)
toolbar.mnuChangeSlidePicker.on('item:click', _.bind(this.onChangeSlide, this));
toolbar.btnPreview.on('click', _.bind(this.onPreviewBtnClick, this));
@ -499,7 +502,7 @@ define([
if (!(index < 0)) {
btnHorizontalAlign.menu.items[index].setChecked(true);
} else if (index == -255) {
this._clearChecked(btnHorizontalAlign.menu);
btnHorizontalAlign.menu.clearAll();
}
if (btnHorizontalAlign.rendered) {
@ -532,7 +535,7 @@ define([
if (!(index < 0)) {
btnVerticalAlign.menu.items[index].setChecked(true);
} else if (index == -255) {
this._clearChecked(btnVerticalAlign.menu);
btnVerticalAlign.menu.clearAll();
}
if (btnVerticalAlign.rendered) {
@ -803,23 +806,16 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Open Document');
},
onAddSlide: function(picker, item, record) {
if (this.api) {
if (record)
this.api.AddSlide(record.get('data').idx);
onAddSlide: function(type) {
var me = this;
if ( this.api) {
this.api.AddSlide(type);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Slide');
}
},
onBtnAddSlide: function() {
this.api.AddSlide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Slide');
},
onChangeSlide: function(picker, item, record) {
if (this.api) {
if (record)
@ -1338,9 +1334,9 @@ define([
me.api.put_Table(value.columns, value.rows);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Table');
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
@ -1384,12 +1380,12 @@ define([
if ( status == 'begin' ) {
this._addAutoshape(true, 'textRect');
if ( !this.toolbar.btnsInsertText.pressed )
if ( !this.toolbar.btnsInsertText.pressed() )
this.toolbar.btnsInsertText.toggle(true, true);
} else
this._addAutoshape(false, 'textRect');
if ( this.toolbar.btnsInsertShape.pressed )
if ( this.toolbar.btnsInsertShape.pressed() )
this.toolbar.btnsInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
@ -1399,7 +1395,7 @@ define([
onInsertShape: function (type) {
var me = this;
if ( type == 'menu:hide' ) {
if ( me.toolbar.btnsInsertShape.pressed && !me._isAddingShape ) {
if ( me.toolbar.btnsInsertShape.pressed() && !me._isAddingShape ) {
me.toolbar.btnsInsertShape.toggle(false, true);
}
me._isAddingShape = false;
@ -1409,7 +1405,7 @@ define([
me._addAutoshape(true, type);
me._isAddingShape = true;
if ( me.toolbar.btnsInsertText.pressed )
if ( me.toolbar.btnsInsertText.pressed() )
me.toolbar.btnsInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@ -1423,7 +1419,7 @@ define([
me.toolbar.fireEvent('inserttextart', me.toolbar);
me.api.AddTextArt(data);
if ( me.toolbar.btnsInsertShape.pressed )
if ( me.toolbar.btnsInsertShape.pressed() )
me.toolbar.btnsInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@ -1717,6 +1713,12 @@ define([
}.bind(this));
},
onResetSlides: function () {
setTimeout(function () {
this.toolbar.updateAddSlideMenu(PE.getCollection('SlideLayouts'));
}.bind(this), 0);
},
fillEquations: function() {
if (!this.toolbar.btnInsertEquation.rendered || this.toolbar.btnInsertEquation.menu.items.length>0) return;
@ -1776,10 +1778,10 @@ define([
if (record)
me.api.asc_AddMath(record.get('data').equationType);
if (me.toolbar.btnsInsertText.pressed) {
if (me.toolbar.btnsInsertText.pressed()) {
me.toolbar.btnsInsertText.toggle(false, true);
}
if (me.toolbar.btnsInsertShape.pressed) {
if (me.toolbar.btnsInsertShape.pressed()) {
me.toolbar.btnsInsertShape.toggle(false, true);
}
@ -1948,13 +1950,6 @@ define([
this._state.clrtext_asccolor = undefined;
},
_clearChecked: function(menu) {
_.each(menu.items, function(item){
if (item.setChecked)
item.setChecked(false, true);
});
},
_onInitEditorThemes: function(editorThemes, documentThemes) {
var me = this;
window.styles_loaded = false;
@ -2041,14 +2036,17 @@ define([
this._state.activated = true;
},
DisableToolbar: function(disable) {
DisableToolbar: function(disable, viewMode) {
if (viewMode!==undefined) this.editMode = !viewMode;
disable = disable || !this.editMode;
var mask = $('.toolbar-mask');
if (disable && mask.length>0 || !disable && mask.length==0) return;
var toolbar = this.toolbar;
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: [toolbar.btnAddSlide, toolbar.btnChangeSlide, toolbar.btnPreview, toolbar.btnHide]});
this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: [toolbar.btnsAddSlide, toolbar.btnChangeSlide, toolbar.btnPreview, toolbar.btnHide]});
if(disable) {
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
Common.util.Shortcuts.suspendEvents('command+k, ctrl+k, alt+h, command+f5, ctrl+f5');
@ -2076,6 +2074,20 @@ define([
}
me.toolbar.render(_.extend({compactview: compactview}, config));
if ( config.isEdit ) {
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 3);
if (config.isDesktopApp && config.isOffline) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
}
}
},
onAppReady: function (config) {

View file

@ -8,6 +8,7 @@
<li id="fm-btn-save-desktop" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li id="fm-btn-rename" class="fm-btn" />
<li id="fm-btn-protect" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />
@ -29,4 +30,5 @@
<div id="panel-rights" class="content-box" />
<div id="panel-settings" class="content-box" />
<div id="panel-help" class="content-box" />
<div id="panel-protect" class="content-box" />
</div>

View file

@ -14,6 +14,8 @@
</div>
<div id="id-textart-settings" class="settings-panel">
</div>
<div id="id-signature-settings" class="settings-panel">
</div>
</div>
<div class="tool-menu-btns">
<div class="ct-btn-category arrow-left" />
@ -24,5 +26,6 @@
<button id="id-right-menu-table" class="btn btn-category arrow-left" content-target="id-table-settings"><i class="icon img-toolbarmenu btn-menu-table">&nbsp;</i></button>
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><i class="icon img-toolbarmenu btn-menu-chart">&nbsp;</i></button>
<button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><i class="icon img-toolbarmenu btn-menu-textart">&nbsp;</i></button>
<button id="id-right-menu-signature" class="btn btn-category arrow-left hidden" content-target="id-signature-settings"><i class="icon img-toolbarmenu btn-menu-signature">&nbsp;</i></button>
</div>
</div>

View file

@ -0,0 +1,31 @@
<table cols="2">
<tr>
<td class="padding-large">
<label style="font-size: 18px;"><%= scope.strSignature %></label>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="signature-invisible-sign" style="width:100%;"></div>
</td>
</tr>
<tr class="valid">
<td class="padding-small">
<label class="header"><%= scope.strValid %></label>
</td>
</tr>
<tr class="valid">
<td class="padding-large">
<div id="signature-valid-sign"></div>
</td>
</tr>
<tr class="invalid">
<td class="padding-small">
<label class="header" style="color:#bb3d3d;"><%= scope.strInvalid %></label>
</td>
</tr>
<tr class="invalid">
<td><div id="signature-invalid-sign"></div></td>
</tr>
<tr class="finish-cell"></tr>
</table>

View file

@ -41,13 +41,13 @@
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-addslide"></span>
</div>
<div class="group" style="display:none;"></div>
</section>
<section class="box-panels">
<section class="panel" data-tab="home">
<div class="group">
<span class="btn-slot text x-huge slot-addslide"></span>
</div>
<div class="group" style="display:none;"></div>
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-changeslide"></span>
@ -123,6 +123,10 @@
</div>
</section>
<section class="panel" data-tab="ins">
<div class="group">
<span class="btn-slot text x-huge slot-addslide"></span>
</div>
<div class="group" style="display:none;"></div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-inserttable"></span>

View file

@ -67,7 +67,8 @@ define([
me._currentSpellObj = undefined;
me._currLang = {};
me._state = {};
me._isDisabled = false;
/** coauthoring begin **/
var usersStore = PE.getCollection('Common.Collections.Users');
/** coauthoring end **/
@ -212,7 +213,7 @@ define([
var showObjectMenu = function(event, docElement, eOpts){
if (me.api){
var obj = (me.mode.isEdit) ? fillMenuProps(me.api.getSelectedElements()) : fillViewMenuProps(me.api.getSelectedElements());
var obj = (me.mode.isEdit && !me._isDisabled) ? fillMenuProps(me.api.getSelectedElements()) : fillViewMenuProps(me.api.getSelectedElements());
if (obj) showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts);
}
};
@ -220,8 +221,7 @@ define([
var onContextMenu = function(event){
_.delay(function(){
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
if (me.mode.isEdit)
showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
!me._isDisabled && showPopupMenu.call(me, me.slideMenu, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);
} else {
showObjectMenu.call(me, event);
}
@ -231,7 +231,7 @@ define([
var onFocusObject = function(selectedElements) {
if (me.currentMenu && me.currentMenu.isVisible()){
if (me.api.asc_getCurrentFocusObject() === 0 ){ // thumbnails
if (me.slideMenu===me.currentMenu) {
if (me.slideMenu===me.currentMenu && !me._isDisabled) {
var isHidden = false;
_.each(selectedElements, function(element, index) {
if (Asc.c_oAscTypeSelectElement.Slide == element.get_ObjectType()) {
@ -243,7 +243,7 @@ define([
me.currentMenu.alignPosition();
}
} else {
var obj = (me.mode.isEdit) ? fillMenuProps(selectedElements) : fillViewMenuProps(selectedElements);
var obj = (me.mode.isEdit && !me._isDisabled) ? fillMenuProps(selectedElements) : fillViewMenuProps(selectedElements);
if (obj) {
if (obj.menu_to_show===me.currentMenu) {
me.currentMenu.options.initMenu(obj.menu_props);
@ -296,6 +296,10 @@ define([
$('ul.dropdown-menu', me.currentMenu.el).focus();
}
}
if (key == Common.UI.Keys.ESC) {
Common.UI.Menu.Manager.hideAll();
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
}
}
};
@ -578,7 +582,7 @@ define([
var onDialogAddHyperlink = function() {
var win, props, text;
if (me.api && me.mode.isEdit){
if (me.api && me.mode.isEdit && !me._isDisabled){
var handlerDlg = function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
@ -671,7 +675,7 @@ define([
};
var onDoubleClickOnChart = function(chart) {
if (me.mode.isEdit) {
if (me.mode.isEdit && !me._isDisabled) {
var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
if (diagramEditor && chart) {
@ -1490,6 +1494,69 @@ define([
me._state.themeLock = false;
};
var onShowSpecialPasteOptions = function(specialPasteShowOptions) {
var coord = specialPasteShowOptions.asc_getCellCoord(),
pasteContainer = me.cmpEl.find('#special-paste-container'),
pasteItems = specialPasteShowOptions.asc_getOptions();
// Prepare menu container
if (pasteContainer.length < 1) {
me._arrSpecialPaste = [];
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste] = me.textPaste;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly] = me.txtKeepTextOnly;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture] = me.txtPastePicture;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting] = me.txtPasteSourceFormat;
me._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting] = me.txtPasteDestFormat;
pasteContainer = $('<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>');
me.cmpEl.append(pasteContainer);
me.btnSpecialPaste = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'btn-paste',
menu : new Common.UI.Menu({items: []})
});
me.btnSpecialPaste.render($('#id-document-holder-btn-special-paste')) ;
}
if (pasteItems.length>0) {
var menu = me.btnSpecialPaste.menu;
for (var i = 0; i < menu.items.length; i++) {
menu.removeItem(menu.items[i]);
i--;
}
var group_prev = -1;
_.each(pasteItems, function(menuItem, index) {
var mnu = new Common.UI.MenuItem({
caption: me._arrSpecialPaste[menuItem],
value: menuItem,
checkable: true,
toggleGroup : 'specialPasteGroup'
}).on('click', function(item, e) {
me.api.asc_SpecialPaste(item.value);
setTimeout(function(){menu.hide();}, 100);
});
menu.addItem(mnu);
});
(menu.items.length>0) && menu.items[0].setChecked(true, true);
}
if (coord.asc_getX()<0 || coord.asc_getY()<0) {
if (pasteContainer.is(':visible')) pasteContainer.hide();
} else {
var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3];
pasteContainer.css({left: showPoint[0], top : showPoint[1]});
pasteContainer.show();
}
};
var onHideSpecialPasteOptions = function() {
var pasteContainer = me.cmpEl.find('#special-paste-container');
if (pasteContainer.is(':visible'))
pasteContainer.hide();
};
this.setApi = function(o) {
me.api = o;
@ -1511,6 +1578,9 @@ define([
me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me));
me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me));
me.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, me));
me.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, me));
}
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, me));
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me));
@ -1711,10 +1781,10 @@ define([
this.viewModeMenu = new Common.UI.Menu({
initMenu: function (value) {
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo());
menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo() && !me._isDisabled);
menuViewCopySeparator.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewAddComment.setVisible(!value.isChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewAddComment.setDisabled(value.locked);
},
items: [
@ -1905,7 +1975,7 @@ define([
el : $('#id-docholder-menu-changeslide'),
parentMenu : mnuChangeSlide.menu,
showLast: false,
restoreHeight: 300,
// restoreHeight: 300,
style: 'max-height: 300px;',
store : PE.getCollection('SlideLayouts'),
itemTemplate: _.template([
@ -1939,7 +2009,7 @@ define([
me.slideThemeMenu = new Common.UI.DataView({
el : $('#id-docholder-menu-changetheme'),
parentMenu : mnuChangeTheme.menu,
restoreHeight: 300,
// restoreHeight: 300,
style: 'max-height: 300px;',
store : PE.getCollection('SlideThemes'),
itemTemplate: _.template([
@ -1986,9 +2056,9 @@ define([
if (me.api) {
me.api.SplitCell(value.columns, value.rows);
}
me.fireEvent('editcomplete', me);
Common.component.Analytics.trackEvent('DocumentHolder', 'Table Split');
}
me.fireEvent('editcomplete', me);
}
})).show();
}
@ -3131,6 +3201,10 @@ define([
}
},
SetDisabled: function(state) {
this._isDisabled = state;
},
insertRowAboveText : 'Row Above',
insertRowBelowText : 'Row Below',
insertColumnLeftText : 'Column Left',
@ -3285,7 +3359,11 @@ define([
langText: 'Select Language',
textUndo: 'Undo',
txtSlideHide: 'Hide Slide',
txtChangeTheme: 'Change Theme'
txtChangeTheme: 'Change Theme',
txtKeepTextOnly: 'Keep text only',
txtPastePicture: 'Picture',
txtPasteSourceFormat: 'Keep source formatting',
txtPasteDestFormat: 'Use destination theme'
}, PE.Views.DocumentHolder || {}));
});

View file

@ -227,10 +227,18 @@ define([
}
}
);
this.previewControls = $(this.el).find('.preview-controls');
$(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){
var fselem = (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement );
me.btnFullScreen.cmpEl.toggleClass('fullscreen', fselem !== undefined && fselem !== null);
setTimeout( function() {
me.previewControls.css('display', '');
me.$el.css('cursor', '');
},100);
if (Common.Utils.isIE) { // for tooltips in IE
me.btnFullScreen.updateHint( fselem ? '' : me.txtFullScreen);
me.btnPrev.updateHint( fselem ? '' : me.txtPrev);
@ -242,18 +250,17 @@ define([
});
if (Common.Utils.isIE) {
el.find('.preview-controls').css('opacity', '0.4');
me.previewControls.css('opacity', '0.4');
}
this.separatorFullScreen = el.find('.separator.fullscreen');
var controls = $(this.el).find('.preview-controls');
controls.on('mouseenter', function(e) {
me.previewControls.on('mouseenter', function(e) {
clearTimeout(me.timerMove);
controls.addClass('over');
me.previewControls.addClass('over');
});
controls.on('mouseleave', function(e) {
controls.removeClass('over');
me.previewControls.on('mouseleave', function(e) {
me.previewControls.removeClass('over');
});
},
@ -274,18 +281,17 @@ define([
}
var me = this;
var controls = $(this.el).find('.preview-controls');
controls.css('display', 'none');
me.previewControls.css('display', 'none');
me.$el.css('cursor', 'none');
setTimeout(function(){
me.$el.on('mousemove', function() {
clearTimeout(me.timerMove);
controls.css('display', '');
me.previewControls.css('display', '');
me.$el.css('cursor', '');
if (!controls.hasClass('over'))
if (!me.previewControls.hasClass('over'))
me.timerMove = setTimeout(function () {
controls.css('display', 'none');
me.previewControls.css('display', 'none');
me.$el.css('cursor', 'none');
}, 3000);
@ -372,6 +378,8 @@ define([
fullScreen: function(element) {
if (this.mode.isDesktopApp || Common.Utils.isIE11) return;
if (element) {
this.previewControls.css('display', 'none');
this.$el.css('cursor', 'none');
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.webkitRequestFullscreen) {
@ -386,6 +394,8 @@ define([
fullScreenCancel: function () {
if (this.mode.isDesktopApp || Common.Utils.isIE11) return;
this.previewControls.css('display', 'none');
this.$el.css('cursor', 'none');
if(document.cancelFullScreen) {
document.cancelFullScreen();
} else if(document.webkitCancelFullScreen ) {

View file

@ -129,6 +129,13 @@ define([
canFocused: false
});
this.miProtect = new Common.UI.MenuItem({
el : $('#fm-btn-protect',this.el),
action : 'protect',
caption : this.btnProtectCaption,
canFocused: false
});
this.miRecent = new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -164,6 +171,7 @@ define([
this.miSaveAs,
this.miPrint,
this.miRename,
this.miProtect,
this.miRecent,
this.miNew,
new Common.UI.MenuItem({
@ -210,10 +218,12 @@ define([
show: function(panel) {
if (this.isVisible() && panel===undefined) return;
var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info';
if (!panel)
panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info');
panel = this.active || defPanel;
this.$el.show();
this.selectMenu(panel);
this.selectMenu(panel, defPanel);
this.api.asc_enableKeyEvents(false);
this.fireEvent('menu:show', [this]);
@ -228,7 +238,8 @@ define([
applyMode: function() {
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miRename.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miProtect[(this.mode.isEdit && this.mode.isDesktopApp && this.mode.isOffline) ?'show':'hide']();
this.miProtect.$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide']();
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
this.miNew[this.mode.canCreateNew?'show':'hide']();
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
@ -264,8 +275,10 @@ define([
}
}
if (this.mode.targetApp == 'desktop') {
if (this.mode.isDesktopApp && this.mode.isOffline) {
this.$el.find('#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider').hide();
this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render();
this.panels['protect'].setMode(this.mode);
}
this.panels['help'].setLangConfig(this.mode.lang);
@ -288,6 +301,7 @@ define([
setApi: function(api) {
this.api = api;
if (this.panels['protect']) this.panels['protect'].setApi(api);
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
},
@ -295,10 +309,14 @@ define([
this.document = data.doc;
},
selectMenu: function(menu) {
selectMenu: function(menu, defMenu) {
if ( menu ) {
var item = this._getMenuItem(menu),
var item = this._getMenuItem(menu),
panel = this.panels[menu];
if ( item.isDisabled() ) {
item = this._getMenuItem(defMenu);
panel = this.panels[defMenu];
}
if ( item && panel ) {
$('.fm-btn',this.el).removeClass('active');
item.$el.addClass('active');
@ -354,6 +372,7 @@ define([
btnSettingsCaption : 'Advanced Settings...',
btnSaveAsCaption : 'Save as',
btnRenameCaption : 'Rename...',
btnCloseMenuCaption : 'Close Menu'
btnCloseMenuCaption : 'Close Menu',
btnProtectCaption: 'Protect\\Sign'
}, PE.Views.FileMenu || {}));
});

View file

@ -296,43 +296,36 @@ define([
},
updateSettings: function() {
this.chSpell.setValue(Common.localStorage.getBool("pe-settings-spellcheck", true));
this.chSpell.setValue(Common.Utils.InternalSettings.get("pe-settings-spellcheck"));
this.chInputMode.setValue(Common.localStorage.getBool("pe-settings-inputmode"));
Common.Utils.isChrome && this.chInputSogou.setValue(Common.localStorage.getBool("pe-settings-inputsogou"));
this.chInputMode.setValue(Common.Utils.InternalSettings.get("pe-settings-inputmode"));
Common.Utils.isChrome && this.chInputSogou.setValue(Common.Utils.InternalSettings.get("pe-settings-inputsogou"));
var value = Common.localStorage.getItem("pe-settings-zoom");
var value = Common.Utils.InternalSettings.get("pe-settings-zoom");
value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : -1);
var item = this.cmbZoom.store.findWhere({value: value});
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
/** coauthoring begin **/
value = Common.localStorage.getItem("pe-settings-coauthmode");
if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") &&
this.mode.customization && this.mode.customization.autosave===false)
value = 0; // use customization.autosave only when pe-settings-coauthmode and pe-settings-autosave are null
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
var fast_coauth = Common.Utils.InternalSettings.get("pe-settings-coauthmode");
item = this.cmbCoAuthMode.store.findWhere({value: fast_coauth ? 1 : 0});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
/** coauthoring end **/
value = Common.localStorage.getItem("pe-settings-unit");
item = this.cmbUnit.store.findWhere({value: parseInt(value)});
value = Common.Utils.InternalSettings.get("pe-settings-unit");
item = this.cmbUnit.store.findWhere({value: value});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("pe-settings-autosave");
if (value===null && this.mode.customization && this.mode.customization.autosave===false)
value = 0;
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
value = Common.Utils.InternalSettings.get("pe-settings-autosave");
this.chAutosave.setValue(value == 1);
if (this.mode.canForcesave) {
this.chForcesave.setValue(Common.localStorage.getBool("pe-settings-forcesave", this.mode.canForcesave));
this.chForcesave.setValue(Common.Utils.InternalSettings.get("pe-settings-forcesave"));
}
this.chAlignGuides.setValue(Common.localStorage.getBool("pe-settings-showsnaplines", true));
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("pe-settings-showsnaplines"));
},
applySettings: function() {
@ -340,6 +333,7 @@ define([
Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
Common.Utils.isChrome && Common.localStorage.setItem("pe-settings-inputsogou", this.chInputSogou.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue());
Common.Utils.InternalSettings.set("pe-settings-zoom", Common.localStorage.getItem("pe-settings-zoom"));
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
Common.localStorage.setItem("pe-settings-coauthmode", this.cmbCoAuthMode.getValue());
@ -349,7 +343,8 @@ define([
Common.localStorage.setItem("pe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
if (this.mode.canForcesave)
Common.localStorage.setItem("pe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("pe-settings-showsnaplines", this.chAlignGuides.isChecked());
Common.localStorage.save();
if (this.menu) {
@ -670,6 +665,8 @@ define([
});
}
Common.NotificationCenter.on('collaboration:sharing', _.bind(this.changeAccessRights, this));
return this;
},
@ -866,4 +863,167 @@ define([
}
}
});
PE.Views.FileMenuPanels.ProtectDoc = Common.UI.BaseView.extend(_.extend({
el: '#panel-protect',
menu: undefined,
template: _.template([
'<label id="id-fms-lbl-protect-header" style="font-size: 18px;"><%= scope.strProtect %></label>',
'<div id="id-fms-password">',
'<label class="header"><%= scope.strEncrypt %></label>',
'<div id="fms-btn-add-pwd" style="width:190px;"></div>',
'<table id="id-fms-view-pwd" cols="2" width="300">',
'<tr>',
'<td colspan="2"><span><%= scope.txtEncrypted %></span></td>',
'</tr>',
'<tr>',
'<td><div id="fms-btn-change-pwd" style="width:190px;"></div></td>',
'<td align="right"><div id="fms-btn-delete-pwd" style="width:190px; margin-left:20px;"></div></td>',
'</tr>',
'</table>',
'</div>',
'<div id="id-fms-signature">',
'<label class="header"><%= scope.strSignature %></label>',
'<div id="fms-btn-invisible-sign" style="width:190px; margin-bottom: 20px;"></div>',
'<div id="id-fms-signature-view"></div>',
'</div>'
].join('')),
initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.menu = options.menu;
var me = this;
this.templateSignature = _.template([
'<table cols="2" width="300" class="<% if (!hasSigned) { %>hidden<% } %>"">',
'<tr>',
'<td colspan="2"><span><%= tipText %></span></td>',
'</tr>',
'<tr>',
'<td><label class="link signature-view-link">' + me.txtView + '</label></td>',
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">' + me.txtEdit + '</label></td>',
'</tr>',
'</table>'
].join(''));
},
render: function() {
$(this.el).html(this.template({scope: this}));
var protection = PE.getController('Common.Controllers.Protection').getView();
this.btnAddPwd = protection.getButton('add-password');
this.btnAddPwd.render(this.$el.find('#fms-btn-add-pwd'));
this.btnAddPwd.on('click', _.bind(this.closeMenu, this));
this.btnChangePwd = protection.getButton('change-password');
this.btnChangePwd.render(this.$el.find('#fms-btn-change-pwd'));
this.btnChangePwd.on('click', _.bind(this.closeMenu, this));
this.btnDeletePwd = protection.getButton('del-password');
this.btnDeletePwd.render(this.$el.find('#fms-btn-delete-pwd'));
this.btnDeletePwd.on('click', _.bind(this.closeMenu, this));
this.cntPassword = $('#id-fms-view-pwd');
this.btnAddInvisibleSign = protection.getButton('signature');
this.btnAddInvisibleSign.render(this.$el.find('#fms-btn-invisible-sign'));
this.btnAddInvisibleSign.on('click', _.bind(this.closeMenu, this));
this.cntSignature = $('#id-fms-signature');
this.cntSignatureView = $('#id-fms-signature-view');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
this.$el.on('click', '.signature-edit-link', _.bind(this.onEdit, this));
this.$el.on('click', '.signature-view-link', _.bind(this.onView, this));
return this;
},
show: function() {
Common.UI.BaseView.prototype.show.call(this,arguments);
this.updateSignatures();
this.updateEncrypt();
},
setMode: function(mode) {
this.mode = mode;
this.cntSignature.toggleClass('hidden', !this.mode.canProtect);
},
setApi: function(o) {
this.api = o;
return this;
},
closeMenu: function() {
this.menu && this.menu.hide();
},
onEdit: function() {
this.menu && this.menu.hide();
var me = this;
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: this.txtEditWarning,
buttons: ['ok', 'cancel'],
primary: 'ok',
callback: function(btn) {
if (btn == 'ok') {
me.api.asc_RemoveAllSignatures();
}
}
});
},
onView: function() {
this.menu && this.menu.hide();
PE.getController('RightMenu').rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature, true);
},
updateSignatures: function(){
var valid = this.api.asc_getSignatures(),
hasValid = false,
hasInvalid = false;
_.each(valid, function(item, index){
if (item.asc_getValid()==0)
hasValid = true;
else
hasInvalid = true;
});
// hasValid = true;
// hasInvalid = true;
var tipText = (hasInvalid) ? this.txtSignedInvalid : (hasValid ? this.txtSigned : "");
this.cntSignatureView.html(this.templateSignature({tipText: tipText, hasSigned: (hasValid || hasInvalid)}));
},
updateEncrypt: function() {
this.cntPassword.toggleClass('hidden', this.btnAddPwd.isVisible());
},
strProtect: 'Protect Presentation',
strSignature: 'Signature',
txtView: 'View signatures',
txtEdit: 'Edit presentation',
txtSigned: 'Valid signatures has been added to the presentation. The presentation is protected from editing.',
txtSignedInvalid: 'Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.',
notcriticalErrorTitle: 'Warning',
txtEditWarning: 'Editing will remove the signatures from the presentation.<br>Are you sure you want to continue?',
strEncrypt: 'Password',
txtEncrypted: 'This presentation has been protected by password'
}, PE.Views.FileMenuPanels.ProtectDoc || {}));
});

View file

@ -127,8 +127,11 @@ define([
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this._isFromFile) return;
this._isFromFile = true;
if (this.api) this.api.ChangeImageFromFile();
this.fireEvent('editcomplete', this);
this._isFromFile = false;
}, this));
this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
this.btnEditObject.on('click', _.bind(function(btn){

View file

@ -282,7 +282,7 @@ define([
}
if (this.mode.canChat) {
this.panelChat['hide']();
this.btnChat.toggle(false, true);
this.btnChat.toggle(false);
}
}
/** coauthoring end **/

View file

@ -56,6 +56,7 @@ define([
'presentationeditor/main/app/view/ShapeSettings',
'presentationeditor/main/app/view/SlideSettings',
'presentationeditor/main/app/view/TextArtSettings',
'presentationeditor/main/app/view/SignatureSettings',
'common/main/lib/component/Scroller'
], function (menuTemplate, $, _, Backbone) {
'use strict';
@ -143,7 +144,7 @@ define([
return this;
},
render: function () {
render: function (mode) {
var el = $(this.el);
this.trigger('render:before', this);
@ -178,6 +179,21 @@ define([
this.shapeSettings = new PE.Views.ShapeSettings();
this.textartSettings = new PE.Views.TextArtSettings();
if (mode && mode.canProtect) {
this.btnSignature = new Common.UI.Button({
hint: this.txtSignatureSettings,
asctype: Common.Utils.documentSettingsType.Signature,
enableToggle: true,
disabled: true,
toggleGroup: 'tabpanelbtnsGroup'
});
this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature};
this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true);
this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this));
this.signatureSettings = new PE.Views.SignatureSettings();
}
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.right-panel'),
@ -206,6 +222,7 @@ define([
this.tableSettings.setApi(api).on('editcomplete', _.bind( fire, this));
this.shapeSettings.setApi(api).on('editcomplete', _.bind( fire, this));
this.textartSettings.setApi(api).on('editcomplete', _.bind( fire, this));
if (this.signatureSettings) this.signatureSettings.setApi(api).on('editcomplete', _.bind( fire, this));
},
setMode: function(mode) {
@ -263,23 +280,6 @@ define([
return (this.minimizedMode) ? null : this.$el.find(".settings-panel.active")[0].id;
},
SetDisabled: function(id, disabled, all) {
if (all) {
this.slideSettings.SetSlideDisabled(disabled, disabled, disabled);
this.paragraphSettings.disableControls(disabled);
this.shapeSettings.disableControls(disabled);
this.tableSettings.disableControls(disabled);
this.imageSettings.disableControls(disabled);
this.chartSettings.disableControls(disabled);
} else {
var cmp = $("#" + id);
if (disabled !== cmp.hasClass('disabled')) {
cmp.toggleClass('disabled', disabled);
(disabled) ? cmp.attr({disabled: disabled}) : cmp.removeAttr('disabled');
}
}
},
clearSelection: function() {
var target_pane = $(".right-panel");
target_pane.find('> .active').removeClass('active');
@ -299,6 +299,7 @@ define([
txtShapeSettings: 'Shape Settings',
txtTextArtSettings: 'Text Art Settings',
txtSlideSettings: 'Slide Settings',
txtChartSettings: 'Chart Settings'
txtChartSettings: 'Chart Settings',
txtSignatureSettings: 'Signature Settings'
}, PE.Views.RightMenu || {}));
});

View file

@ -892,7 +892,8 @@ define([
// border colors
var stroke = props.get_stroke(),
strokeType = stroke.get_type(),
borderType;
borderType,
update = (this._state.StrokeColor == 'transparent' && this.BorderColor.Color !== 'transparent'); // border color was changed for shape without line and then shape was reselected (or apply other settings)
if (stroke) {
if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) {
@ -918,7 +919,7 @@ define([
type1 = typeof(this.BorderColor.Color);
type2 = typeof(this._state.StrokeColor);
if ( (type1 !== type2) || (type1=='object' &&
if ( update || (type1 !== type2) || (type1=='object' &&
(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue || this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)) ||
(type1!='object' && (this._state.StrokeColor.indexOf(this.BorderColor.Color)<0 || typeof(this.btnBorderColor.color)=='object'))) {
@ -1114,7 +1115,7 @@ define([
this.fillControls.push(this.btnInsertFromUrl);
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this.api) this.api.ChangeShapeImageFromFile();
if (this.api) this.api.ChangeShapeImageFromFile(this.BlipFillType);
this.fireEvent('editcomplete', this);
}, this));
this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));

View file

@ -0,0 +1,341 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* SignatureSettings.js
*
* Created by Julia Radzhabova on 5/24/17
* Copyright (c) 2017 Ascensio System SIA. All rights reserved.
*
*/
define([
'text!presentationeditor/main/app/template/SignatureSettings.template',
'jquery',
'underscore',
'backbone',
'common/main/lib/component/Button'
], function (menuTemplate, $, _, Backbone) {
'use strict';
PE.Views.SignatureSettings = Backbone.View.extend(_.extend({
el: '#id-signature-settings',
// Compile our stats template
template: _.template(menuTemplate),
// Delegated events for creating new items, and clearing completed ones.
events: {
},
options: {
alias: 'SignatureSettings'
},
initialize: function () {
this._state = {
DisabledEditing: false,
ready: false,
hasValid: false,
hasInvalid: false,
tip: undefined
};
this._locked = false;
this.render();
},
render: function () {
this.$el.html(this.template({
scope: this
}));
var protection = PE.getController('Common.Controllers.Protection').getView();
this.btnAddInvisibleSign = protection.getButton('signature');
this.btnAddInvisibleSign.render(this.$el.find('#signature-invisible-sign'));
this.viewValidList = new Common.UI.DataView({
el: $('#signature-valid-sign'),
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="signature-item">',
'<div class="caret img-commonctrl <% if (name == "" || date == "") { %>' + 'nomargin' + '<% } %>"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>'
].join(''))
});
this.viewInvalidList = new Common.UI.DataView({
el: $('#signature-invalid-sign'),
enableKeyEvents: false,
itemTemplate: _.template([
'<div id="<%= id %>" class="signature-item">',
'<div class="caret img-commonctrl <% if (name == "" || date == "") { %>' + 'nomargin' + '<% } %>"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>'
].join(''))
});
this.viewValidList.on('item:click', _.bind(this.onSelectSignature, this));
this.viewInvalidList.on('item:click', _.bind(this.onSelectSignature, this));
this.signatureMenu = new Common.UI.Menu({
menuAlign : 'tr-br',
items: [
{ caption: this.strDetails,value: 1 },
{ caption: this.strDelete, value: 3 }
]
});
this.signatureMenu.on('item:click', _.bind(this.onMenuSignatureClick, this));
},
setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
}
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
return this;
},
ChangeSettings: function(props) {
if (!this._state.hasValid && !this._state.hasInvalid)
this.updateSignatures(this.api.asc_getSignatures());
},
setLocked: function (locked) {
this._locked = locked;
},
setMode: function(mode) {
this.mode = mode;
},
onApiUpdateSignatures: function(valid){
if (!this._state.ready) return;
this.updateSignatures(valid);
this.showSignatureTooltip(this._state.hasValid, this._state.hasInvalid);
},
updateSignatures: function(valid){
var me = this,
validSignatures = [],
invalidSignatures = [];
_.each(valid, function(item, index){
var item_date = item.asc_getDate();
var sign = {name: item.asc_getSigner1(), certificateId: item.asc_getId(), guid: item.asc_getGuid(), date: (!_.isEmpty(item_date)) ? new Date(item_date).toLocaleString() : '', invisible: !item.asc_getVisible()};
(item.asc_getValid()==0) ? validSignatures.push(sign) : invalidSignatures.push(sign);
});
// validSignatures = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017', invisible: true}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
// invalidSignatures = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
me._state.hasValid = validSignatures.length>0;
me._state.hasInvalid = invalidSignatures.length>0;
this.viewValidList.store.reset(validSignatures);
this.viewInvalidList.store.reset(invalidSignatures);
this.$el.find('.valid').toggleClass('hidden', !me._state.hasValid);
this.$el.find('.invalid').toggleClass('hidden', !me._state.hasInvalid);
me.disableEditing(me._state.hasValid || me._state.hasInvalid);
},
onSelectSignature: function(picker, item, record, e){
if (!record) return;
var btn = $(e.target);
if (btn && btn.hasClass('caret')) {
var menu = this.signatureMenu;
if (menu.isVisible()) {
menu.hide();
return;
}
var showPoint, me = this,
currentTarget = $(e.currentTarget),
parent = $(this.el),
offset = currentTarget.offset(),
offsetParent = parent.offset();
showPoint = [offset.left - offsetParent.left + currentTarget.width(), offset.top - offsetParent.top + currentTarget.height()/2];
var menuContainer = parent.find('#menu-signature-container');
if (!menu.rendered) {
if (menuContainer.length < 1) {
menuContainer = $('<div id="menu-signature-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id);
parent.append(menuContainer);
}
menu.render(menuContainer);
menu.cmpEl.attr({tabindex: "-1"});
menu.on({
'show:after': function(cmp) {
if (cmp && cmp.menuAlignEl)
cmp.menuAlignEl.toggleClass('over', true);
},
'hide:after': function(cmp) {
if (cmp && cmp.menuAlignEl)
cmp.menuAlignEl.toggleClass('over', false);
}
});
}
menu.items[1].setDisabled(this._locked);
menu.items[0].cmpEl.attr('data-value', record.get('certificateId')); // view certificate
menu.cmpEl.attr('data-value', record.get('guid'));
menuContainer.css({left: showPoint[0], top: showPoint[1]});
menu.menuAlignEl = currentTarget;
menu.setOffset(-20, -currentTarget.height()/2 + 3);
menu.show();
_.delay(function() {
menu.cmpEl.focus();
}, 10);
e.stopPropagation();
e.preventDefault();
}
},
onMenuSignatureClick: function(menu, item) {
var guid = menu.cmpEl.attr('data-value');
switch (item.value) {
case 1:
this.api.asc_ViewCertificate(item.cmpEl.attr('data-value'));
break;
case 3:
this.api.asc_RemoveSignature(guid);
break;
}
},
onDocumentReady: function() {
this._state.ready = true;
this.updateSignatures(this.api.asc_getSignatures(), this.api.asc_getRequestSignatures());
this.showSignatureTooltip(this._state.hasValid, this._state.hasInvalid);
},
showSignatureTooltip: function(hasValid, hasInvalid) {
var me = this,
tip = me._state.tip;
if (!hasValid && !hasInvalid) {
if (tip && tip.isVisible()) {
tip.close();
me._state.tip = undefined;
}
return;
}
var showLink = hasValid || hasInvalid,
tipText = (hasInvalid) ? me.txtSignedInvalid : (hasValid ? me.txtSigned : "");
if (tip && tip.isVisible() && (tipText !== tip.text || showLink !== tip.showLink)) {
tip.close();
me._state.tip = undefined;
}
if (!me._state.tip) {
tip = new Common.UI.SynchronizeTip({
target : PE.getController('RightMenu').getView('RightMenu').btnSignature.btnEl,
text : tipText,
showLink: showLink,
textLink: this.txtContinueEditing,
placement: 'left'
});
tip.on({
'dontshowclick': function() {
Common.UI.warning({
title: me.notcriticalErrorTitle,
msg: me.txtEditWarning,
buttons: ['ok', 'cancel'],
primary: 'ok',
callback: function(btn) {
if (btn == 'ok') {
tip.close();
me._state.tip = undefined;
me.api.asc_RemoveAllSignatures();
}
}
});
},
'closeclick': function() {
tip.close();
me._state.tip = undefined;
}
});
me._state.tip = tip;
tip.show();
}
},
disableEditing: function(disable) {
if (this._state.DisabledEditing != disable) {
this._state.DisabledEditing = disable;
var rightMenuController = PE.getController('RightMenu');
if (disable && rightMenuController.rightmenu.GetActivePane() !== 'id-signature-settings')
rightMenuController.rightmenu.clearSelection();
rightMenuController.SetDisabled(disable, true);
PE.getController('Toolbar').DisableToolbar(disable, disable);
PE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
var leftMenu = PE.getController('LeftMenu').leftMenu;
leftMenu.btnComments.setDisabled(disable);
var comments = PE.getController('Common.Controllers.Comments');
if (comments)
comments.setPreviewMode(disable);
}
},
strSignature: 'Signature',
strValid: 'Valid signatures',
strInvalid: 'Invalid signatures',
strDetails: 'Signature Details',
txtSigned: 'Valid signatures has been added to the presentation. The presentation is protected from editing.',
txtSignedInvalid: 'Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.',
txtContinueEditing: 'Edit anyway',
notcriticalErrorTitle: 'Warning',
txtEditWarning: 'Editing will remove the signatures from the presentation.<br>Are you sure you want to continue?',
strDelete: 'Remove Signature'
}, PE.Views.SignatureSettings || {}));
});

View file

@ -655,7 +655,7 @@ define([
el: $('#slide-button-from-file')
});
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this.api) this.api.ChangeSlideImageFromFile();
if (this.api) this.api.ChangeSlideImageFromFile(this.BlipFillType);
this.fireEvent('editcomplete', this);
}, this));
this.FillItems.push(this.btnInsertFromFile);

View file

@ -224,6 +224,11 @@ define([
}
},
onPrimary: function() {
this._handleInput('ok');
return false;
},
setSettings: function (type, pagewitdh, pageheight) {
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(pagewitdh), true);
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(pageheight), true);

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