Commit 9f20d9d4 authored by Julia Radzhabova's avatar Julia Radzhabova

[DE][SSE] Open protected files.

parent be7c3de4
......@@ -61,18 +61,24 @@ define([
header : true,
cls : 'open-dlg',
contentTemplate : '',
title : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT')
title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT')
}, options);
this.template = options.template || [
'<div class="box" style="height:' + (_options.height - 85) + 'px;">',
'<div class="content-panel" >',
'<% if (type == Asc.c_oAscAdvancedOptionsID.DRM) { %>',
'<label class="header">' + t.txtPassword + '</label>',
'<div id="id-password-txt" style="margin-bottom:15px;"></div>',
'<% } else { %>',
'<label class="header">' + t.txtEncoding + '</label>',
'<div id="id-codepages-combo" class="input-group-nr" style="margin-bottom:15px;"></div>',
'<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>',
'<label class="header">' + t.txtDelimiter + '</label>',
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 110px;"></div>',
'<% } %>',
'<% } %>',
'</div>',
'</div>',
......@@ -97,13 +103,36 @@ define([
if (this.$window) {
this.$window.find('.tool').hide();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.initCodePages();
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
var me = this;
me.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'),
type: 'password',
allowBlank: false,
validateOnBlur: false
});
} else
this.initCodePages();
}
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
var me = this;
setTimeout(function(){
me.inputPwd.cmpEl.find('input').focus();
}, 500);
}
},
onBtnClick: function (event) {
if (this.handler && this.cmbEncoding) {
this.handler.call(this, this.cmbEncoding.getValue(), this.cmbDelimiter ? this.cmbDelimiter.getValue() : null);
if (this.handler) {
if (this.cmbEncoding)
this.handler.call(this, this.cmbEncoding.getValue(), this.cmbDelimiter ? this.cmbDelimiter.getValue() : null);
else
this.handler.call(this, this.inputPwd.getValue());
}
this.close();
......@@ -311,7 +340,9 @@ define([
txtEncoding : "Encoding ",
txtSpace : "Space",
txtTab : "Tab",
txtTitle : "Choose %1 options"
txtTitle : "Choose %1 options",
txtPassword : "Password",
txtTitleProtected : "Protected File"
}, Common.Views.OpenDialog || {}));
});
\ No newline at end of file
......@@ -1592,14 +1592,14 @@ define([
},
onAdvancedOptions: function(advOptions) {
var type = advOptions.asc_getOptionId();
var type = advOptions.asc_getOptionId(),
me = this, dlg;
if (type == Asc.c_oAscAdvancedOptionsID.TXT) {
var me = this;
var dlg = new Common.Views.OpenDialog({
dlg = new Common.Views.OpenDialog({
type: type,
codepages: advOptions.asc_getOptions().asc_getCodePages(),
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
handler: function (encoding, delimiter) {
handler: function (encoding) {
me.isShowOpenDialog = false;
if (me && me.api) {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding));
......@@ -1607,11 +1607,22 @@ define([
}
}
});
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
dlg = new Common.Views.OpenDialog({
type: type,
handler: function (value) {
me.isShowOpenDialog = false;
if (me && me.api) {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value));
me.loadMask && me.loadMask.show();
}
}
});
}
if (dlg) {
this.isShowOpenDialog = true;
this.loadMask && this.loadMask.hide();
this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
dlg.show();
}
},
......
......@@ -159,6 +159,8 @@
"Common.Views.OpenDialog.okButtonText": "OK",
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
"Common.Views.OpenDialog.txtPassword": "Password",
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
"Common.Views.Plugins.strPlugins": "Add-ons",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
......
......@@ -1304,10 +1304,10 @@ define([
},
onAdvancedOptions: function(advOptions) {
var type = advOptions.asc_getOptionId();
var type = advOptions.asc_getOptionId(),
me = this, dlg;
if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
var me = this;
var dlg = new Common.Views.OpenDialog({
dlg = new Common.Views.OpenDialog({
type: type,
codepages: advOptions.asc_getOptions().asc_getCodePages(),
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
......@@ -1319,11 +1319,22 @@ define([
}
}
});
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
dlg = new Common.Views.OpenDialog({
type: type,
handler: function (value) {
me.isShowOpenDialog = false;
if (me && me.api) {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value));
me.loadMask && me.loadMask.show();
}
}
});
}
if (dlg) {
this.isShowOpenDialog = true;
this.loadMask && this.loadMask.hide();
this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
dlg.show();
}
},
......
......@@ -86,6 +86,8 @@
"Common.Views.OpenDialog.txtSpace": "Space",
"Common.Views.OpenDialog.txtTab": "Tab",
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
"Common.Views.OpenDialog.txtPassword": "Password",
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
"Common.Views.Plugins.strPlugins": "Add-ons",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment