[DE] Added Protection tab with the ability to encrypt and sign document.
This commit is contained in:
parent
f40757d3f0
commit
9e458a51f8
240
apps/common/main/lib/controller/Protection.js
Normal file
240
apps/common/main/lib/controller/Protection.js
Normal file
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
*
|
||||
* (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.SetDisabled, 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) {
|
||||
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(this.onApiSignatureClick, this));
|
||||
// this.api.asc_registerCallback('asc_onUpdateSignatures', _.bind(this.onApiUpdateSignatures, this));
|
||||
}
|
||||
}
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||
}
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
this.appConfig = mode;
|
||||
|
||||
this.view = this.createView('Common.Views.Protection', {
|
||||
mode: mode
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
onDocumentPassword: function(hasPassword) {
|
||||
if (!this.view) return;
|
||||
this.view.btnAddPwd.setVisible(!hasPassword);
|
||||
this.view.btnPwd.setVisible(hasPassword);
|
||||
},
|
||||
|
||||
SetDisabled: function(state) {
|
||||
// if (this.dlgChanges)
|
||||
// this.dlgChanges.close();
|
||||
this.view && this.view.SetDisabled(state);
|
||||
},
|
||||
|
||||
onPasswordClick: function(btn, opts){
|
||||
switch (opts) {
|
||||
case 'add': this.addPassword(); break;
|
||||
// case 'delete': this.deletePassword(); break;
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onSignatureClick: function(btn, opts){
|
||||
switch (opts) {
|
||||
case 'invisible': this.addInvisibleSignature(); break;
|
||||
case 'visible': this.addVisibleSignature(); 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) {
|
||||
var me = this;
|
||||
},
|
||||
|
||||
addPassword: function() {
|
||||
var me = this,
|
||||
win = new Common.Views.PasswordDialog({
|
||||
api: me.api,
|
||||
signType: 'invisible',
|
||||
handler: function(result, props) {
|
||||
if (result == 'ok') {
|
||||
me.api.setCurrentPassword(props);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete');
|
||||
}
|
||||
});
|
||||
|
||||
win.show();
|
||||
},
|
||||
|
||||
deletePassword: function() {
|
||||
this.api.resetPassword();
|
||||
},
|
||||
|
||||
addInvisibleSignature: function(btn) {
|
||||
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(btn) {
|
||||
var me = this,
|
||||
win = new Common.Views.SignSettingsDialog({
|
||||
handler: function(dlg, result) {
|
||||
if (result == 'ok') {
|
||||
me.api.asc_AddSignatureLine2(dlg.getSettings());
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete');
|
||||
}
|
||||
});
|
||||
|
||||
win.show();
|
||||
},
|
||||
|
||||
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();
|
||||
},
|
||||
|
||||
onApiSignatureClick: function(guid, width, height) {
|
||||
this.signVisibleSignature(guid, width, height);
|
||||
}
|
||||
|
||||
|
||||
}, Common.Controllers.Protection || {}));
|
||||
});
|
178
apps/common/main/lib/view/PasswordDialog.js
Normal file
178
apps/common/main/lib/view/PasswordDialog.js
Normal file
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
*
|
||||
* (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 class="content-panel" >',
|
||||
// '<label style="margin-bottom:15px;">' + t.txtDescription + '</label>',
|
||||
// '<label>' + t.txtPassword + '</label>',
|
||||
// '<div id="id-password-txt" style="margin-bottom:15px;"></div>',
|
||||
// '<label>' + t.txtRepeat + '</label>',
|
||||
// '<div id="id-repeat-txt" style="margin-bottom:15px;"></div>',
|
||||
// '</div>',
|
||||
'</div>',
|
||||
'<div class="separator horizontal"/>',
|
||||
'<div class="footer center">',
|
||||
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">' + t.okButtonText + '</button>',
|
||||
'<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.Password || {}));
|
||||
});
|
233
apps/common/main/lib/view/Protection.js
Normal file
233
apps/common/main/lib/view/Protection.js
Normal file
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
*
|
||||
* (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.btnAddPwd.on('click', function (e) {
|
||||
me.fireEvent('protect:password', [me.btnAddPwd, 'add']);
|
||||
});
|
||||
|
||||
this.btnPwd.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('protect:password', [menu, item.value]);
|
||||
});
|
||||
|
||||
if (me.appConfig.canProtect) {
|
||||
this.btnSignature.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('protect:signature', [menu, item.value]);
|
||||
});
|
||||
|
||||
this.btnsInvisibleSignature.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('protect:signature', [b, 'invisible']);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
options: {},
|
||||
|
||||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||
|
||||
this.appConfig = options.mode;
|
||||
|
||||
if ( this.appConfig.isDesktopApp && this.appConfig.isOffline ) {
|
||||
this.btnAddPwd = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'review-prev',
|
||||
caption: this.txtEncrypt
|
||||
});
|
||||
|
||||
this.btnPwd = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-ic-reviewview',
|
||||
caption: this.txtEncrypt,
|
||||
menu: true
|
||||
});
|
||||
|
||||
if (this.appConfig.canProtect)
|
||||
this.btnSignature = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-ic-reviewview',
|
||||
caption: this.txtSignature,
|
||||
menu: true
|
||||
});
|
||||
}
|
||||
|
||||
this.btnsInvisibleSignature = [];
|
||||
|
||||
var filter = Common.localStorage.getKeysFilter();
|
||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||
|
||||
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.hintSignature);
|
||||
me.btnSignature.setMenu(
|
||||
new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
caption: me.txtInvisibleSignature,
|
||||
value: 'invisible'
|
||||
},
|
||||
{
|
||||
caption: me.txtSignatureLine,
|
||||
value: 'visible'
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
}
|
||||
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.btnPwd.setVisible(false);
|
||||
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({});
|
||||
this.btnsInvisibleSignature.push(button);
|
||||
|
||||
return button;
|
||||
}
|
||||
},
|
||||
|
||||
SetDisabled: function (state, langs) {
|
||||
this.btnsInvisibleSignature && this.btnsInvisibleSignature.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
}, this);
|
||||
this.btnSignature && this.btnSignature.setDisabled(state);
|
||||
},
|
||||
|
||||
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',
|
||||
txtInvisibleSignature: 'Add digital signature',
|
||||
txtSignatureLine: 'Signature line'
|
||||
|
||||
}
|
||||
}()), Common.Views.Protection || {}));
|
||||
});
|
|
@ -163,6 +163,7 @@ require([
|
|||
,'Common.Controllers.ExternalDiagramEditor'
|
||||
,'Common.Controllers.ExternalMergeEditor'
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -197,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();
|
||||
});
|
||||
|
|
|
@ -1106,6 +1106,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();
|
||||
|
|
|
@ -2849,8 +2849,15 @@ define([
|
|||
var tab = {action: 'review', caption: me.toolbar.textTabReview};
|
||||
var $panel = DE.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};
|
||||
var $panel = this.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
|
||||
|
||||
if ( $panel )
|
||||
me.toolbar.addTab(tab, $panel, 4);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -726,36 +726,6 @@ define([
|
|||
me.mode.isEdit = false;
|
||||
};
|
||||
|
||||
var onSignatureClick = function(guid, width, height) {
|
||||
if (_.isUndefined(me.fontStore)) {
|
||||
me.fontStore = new Common.Collections.Fonts();
|
||||
var fonts = DE.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, height: height},
|
||||
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();
|
||||
};
|
||||
|
||||
var onTextLanguage = function(langid) {
|
||||
me._currLang.id = langid;
|
||||
};
|
||||
|
@ -1559,8 +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));
|
||||
|
||||
this.api.asc_registerCallback('asc_onSignatureClick', _.bind(onSignatureClick, this));
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -314,7 +314,7 @@ define([
|
|||
'dontshowclick': function() {
|
||||
tip.close();
|
||||
// me.api.editSingedDoc();
|
||||
me.disableEditing(false);
|
||||
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.
|
||||
},
|
||||
'closeclick': function() {
|
||||
tip.close();
|
||||
|
|
|
@ -2520,7 +2520,8 @@ define([
|
|||
capImgWrapping: 'Wrapping',
|
||||
capBtnComment: 'Comment',
|
||||
textColumnsCustom: 'Custom Columns',
|
||||
textSurface: 'Surface'
|
||||
textSurface: 'Surface',
|
||||
textTabProtect: 'Protection'
|
||||
}
|
||||
})(), DE.Views.Toolbar || {}));
|
||||
});
|
||||
|
|
|
@ -153,6 +153,7 @@ require([
|
|||
,'Common.Controllers.ExternalDiagramEditor'
|
||||
,'Common.Controllers.ExternalMergeEditor'
|
||||
,'Common.Controllers.ReviewChanges'
|
||||
,'Common.Controllers.Protection'
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -187,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();
|
||||
|
|
|
@ -232,7 +232,7 @@ define([
|
|||
'dontshowclick': function() {
|
||||
tip.close();
|
||||
// me.api.editSingedDoc();
|
||||
me.disableEditing(false);
|
||||
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.me.disableEditing(false);
|
||||
},
|
||||
'closeclick': function() {
|
||||
tip.close();
|
||||
|
|
|
@ -314,7 +314,7 @@ define([
|
|||
'dontshowclick': function() {
|
||||
tip.close();
|
||||
// me.api.editSingedDoc();
|
||||
me.disableEditing(false);
|
||||
// me.disableEditing(false); // call in the asc_onUpdateSignatures event callback.
|
||||
},
|
||||
'closeclick': function() {
|
||||
tip.close();
|
||||
|
|
Loading…
Reference in a new issue