Fix Bug 42728

This commit is contained in:
Julia Radzhabova 2019-09-06 17:38:29 +03:00
parent 6cb3ad703f
commit 5031a3d9b0
6 changed files with 105 additions and 87 deletions

View file

@ -768,6 +768,11 @@ define([
'</table>',
'</div></td>',
'</tr>',
'<tr class="divider"></tr>',
'<tr>',
'<td class="left"></td>',
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
'</tr>',
'</table>'
].join(''));
@ -780,7 +785,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
$(this.el).html(this.template({scope: this}));
var me = this;
@ -814,33 +819,18 @@ define([
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputSubject = new Common.UI.InputField({
el : $('#id-info-subject'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputComment = new Common.UI.InputField({
el : $('#id-info-comment'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
// modify info
@ -861,10 +851,6 @@ define([
idx = me.tblAuthor.find('tr').index(el);
el.remove();
me.authors.splice(idx, 1);
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
}
});
@ -873,27 +859,31 @@ define([
style : 'width: 200px;',
validateOnBlur: false,
placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) {
}).on('changed:after', function(input, newValue, oldValue, e) {
if (newValue == oldValue) return;
var val = newValue.trim();
if (!!val && val !== oldValue.trim()) {
var isFromApply = e && e.relatedTarget && (e.relatedTarget.id == 'fminfo-btn-apply');
val.split(/\s*[,;]\s*/).forEach(function(item){
var str = item.trim();
if (str) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
me.authors.push(item);
if (!isFromApply) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
}
}
});
me.inputAuthor.setValue('');
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
!isFromApply && me.inputAuthor.setValue('');
}
}).on('keydown:before', keyDownBefore);
this.btnApply = new Common.UI.Button({
el: '#fminfo-btn-apply'
});
this.btnApply.on('click', _.bind(this.applySettings, this));
this.rendered = true;
this.updateInfo(this.doc);
@ -1002,6 +992,7 @@ define([
value = props.asc_getDescription();
this.inputComment.setValue(value || '');
this.inputAuthor.setValue('');
this.tblAuthor.find('tr:not(:last-of-type)').remove();
this.authors = [];
value = props.asc_getCreator();//"123\"\"\"\<\>,456";
@ -1053,6 +1044,7 @@ define([
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.btnApply.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
@ -1114,6 +1106,18 @@ define([
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
this.btnApply.setDisabled(this._locked);
},
applySettings: function() {
if (this.coreProps && this.api) {
this.coreProps.asc_putTitle(this.inputTitle.getValue());
this.coreProps.asc_putSubject(this.inputSubject.getValue());
this.coreProps.asc_putDescription(this.inputComment.getValue());
this.coreProps.asc_putCreator(this.authors.join(';'));
this.api.asc_setCoreProps(this.coreProps);
}
this.menu.hide();
},
txtPlacement: 'Location',
@ -1136,7 +1140,8 @@ define([
txtAuthor: 'Author',
txtAddAuthor: 'Add Author',
txtAddText: 'Add Text',
txtMinutes: 'min'
txtMinutes: 'min',
okButtonText: 'Apply'
}, DE.Views.FileMenuPanels.DocumentInfo || {}));
DE.Views.FileMenuPanels.DocumentRights = Common.UI.BaseView.extend(_.extend({

View file

@ -1386,6 +1386,7 @@
"DE.Views.FileMenuPanels.DocumentInfo.txtTitle": "Title",
"DE.Views.FileMenuPanels.DocumentInfo.txtUploaded": "Uploaded",
"DE.Views.FileMenuPanels.DocumentInfo.txtWords": "Words",
"DE.Views.FileMenuPanels.DocumentInfo.okButtonText": "Apply",
"DE.Views.FileMenuPanels.DocumentRights.txtBtnAccessRights": "Change access rights",
"DE.Views.FileMenuPanels.DocumentRights.txtRights": "Persons who have rights",
"DE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning",

View file

@ -654,6 +654,11 @@ define([
'</table>',
'</div></td>',
'</tr>',
'<tr class="divider"></tr>',
'<tr>',
'<td class="left"></td>',
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
'</tr>',
'</table>'
].join(''));
@ -664,7 +669,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
$(this.el).html(this.template({scope: this}));
var me = this;
@ -690,33 +695,18 @@ define([
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputSubject = new Common.UI.InputField({
el : $('#id-info-subject'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputComment = new Common.UI.InputField({
el : $('#id-info-comment'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
// modify info
@ -737,10 +727,6 @@ define([
idx = me.tblAuthor.find('tr').index(el);
el.remove();
me.authors.splice(idx, 1);
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
}
});
@ -749,27 +735,31 @@ define([
style : 'width: 200px;',
validateOnBlur: false,
placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) {
}).on('changed:after', function(input, newValue, oldValue, e) {
if (newValue == oldValue) return;
var val = newValue.trim();
if (!!val && val !== oldValue.trim()) {
var isFromApply = e && e.relatedTarget && (e.relatedTarget.id == 'fminfo-btn-apply');
val.split(/\s*[,;]\s*/).forEach(function(item){
var str = item.trim();
if (str) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
me.authors.push(item);
if (!isFromApply) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
}
}
});
me.inputAuthor.setValue('');
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
!isFromApply && me.inputAuthor.setValue('');
}
}).on('keydown:before', keyDownBefore);
this.btnApply = new Common.UI.Button({
el: '#fminfo-btn-apply'
});
this.btnApply.on('click', _.bind(this.applySettings, this));
this.rendered = true;
this.updateInfo(this.doc);
@ -875,6 +865,7 @@ define([
value = props.asc_getDescription();
this.inputComment.setValue(value || '');
this.inputAuthor.setValue('');
this.tblAuthor.find('tr:not(:last-of-type)').remove();
this.authors = [];
value = props.asc_getCreator();//"123\"\"\"\<\>,456";
@ -902,6 +893,7 @@ define([
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.btnApply.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
@ -927,6 +919,18 @@ define([
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
this.btnApply.setDisabled(this._locked);
},
applySettings: function() {
if (this.coreProps && this.api) {
this.coreProps.asc_putTitle(this.inputTitle.getValue());
this.coreProps.asc_putSubject(this.inputSubject.getValue());
this.coreProps.asc_putDescription(this.inputComment.getValue());
this.coreProps.asc_putCreator(this.authors.join(';'));
this.api.asc_setCoreProps(this.coreProps);
}
this.menu.hide();
},
txtPlacement: 'Location',
@ -943,7 +947,8 @@ define([
txtAuthor: 'Author',
txtAddAuthor: 'Add Author',
txtAddText: 'Add Text',
txtMinutes: 'min'
txtMinutes: 'min',
okButtonText: 'Apply'
}, PE.Views.FileMenuPanels.DocumentInfo || {}));
PE.Views.FileMenuPanels.DocumentRights = Common.UI.BaseView.extend(_.extend({

View file

@ -1176,6 +1176,7 @@
"PE.Views.FileMenuPanels.DocumentInfo.txtSubject": "Subject",
"PE.Views.FileMenuPanels.DocumentInfo.txtTitle": "Title",
"PE.Views.FileMenuPanels.DocumentInfo.txtUploaded": "Uploaded",
"PE.Views.FileMenuPanels.DocumentInfo.okButtonText": "Apply",
"PE.Views.FileMenuPanels.DocumentRights.txtBtnAccessRights": "Change access rights",
"PE.Views.FileMenuPanels.DocumentRights.txtRights": "Persons who have rights",
"PE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning",

View file

@ -1103,6 +1103,11 @@ define([
'</table>',
'</div></td>',
'</tr>',
'<tr class="divider"></tr>',
'<tr>',
'<td class="left"></td>',
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
'</tr>',
'</table>'
].join(''));
@ -1113,7 +1118,7 @@ define([
},
render: function() {
$(this.el).html(this.template());
$(this.el).html(this.template({scope: this}));
var me = this;
@ -1139,33 +1144,18 @@ define([
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putTitle(me.inputTitle.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputSubject = new Common.UI.InputField({
el : $('#id-info-subject'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putSubject(me.inputSubject.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
this.inputComment = new Common.UI.InputField({
el : $('#id-info-comment'),
style : 'width: 200px;',
placeHolder : this.txtAddText,
validateOnBlur: false
}).on('changed:after', function(input, newValue, oldValue) {
if (newValue !== oldValue && me.coreProps && me.api) {
me.coreProps.asc_putDescription(me.inputComment.getValue());
me.api.asc_setCoreProps(me.coreProps);
}
}).on('keydown:before', keyDownBefore);
// modify info
@ -1186,10 +1176,6 @@ define([
idx = me.tblAuthor.find('tr').index(el);
el.remove();
me.authors.splice(idx, 1);
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
}
});
@ -1198,27 +1184,31 @@ define([
style : 'width: 200px;',
validateOnBlur: false,
placeHolder: this.txtAddAuthor
}).on('changed:after', function(input, newValue, oldValue) {
}).on('changed:after', function(input, newValue, oldValue, e) {
if (newValue == oldValue) return;
var val = newValue.trim();
if (!!val && val !== oldValue.trim()) {
var isFromApply = e && e.relatedTarget && (e.relatedTarget.id == 'fminfo-btn-apply');
val.split(/\s*[,;]\s*/).forEach(function(item){
var str = item.trim();
if (str) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
me.authors.push(item);
if (!isFromApply) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div);
}
}
});
me.inputAuthor.setValue('');
if (me.coreProps && me.api) {
me.coreProps.asc_putCreator(me.authors.join(';'));
me.api.asc_setCoreProps(me.coreProps);
}
!isFromApply && me.inputAuthor.setValue('');
}
}).on('keydown:before', keyDownBefore);
this.btnApply = new Common.UI.Button({
el: '#fminfo-btn-apply'
});
this.btnApply.on('click', _.bind(this.applySettings, this));
this.rendered = true;
this.updateInfo(this.doc);
@ -1324,6 +1314,7 @@ define([
value = props.asc_getDescription();
this.inputComment.setValue(value || '');
this.inputAuthor.setValue('');
this.tblAuthor.find('tr:not(:last-of-type)').remove();
this.authors = [];
value = props.asc_getCreator();//"123\"\"\"\<\>,456";
@ -1351,6 +1342,7 @@ define([
setMode: function(mode) {
this.mode = mode;
this.inputAuthor.setVisible(mode.isEdit);
this.btnApply.setVisible(mode.isEdit);
this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit);
this.SetDisabled();
return this;
@ -1376,6 +1368,18 @@ define([
this.inputAuthor.setDisabled(disable);
this.tblAuthor.find('.close').toggleClass('disabled', this._locked);
this.tblAuthor.toggleClass('disabled', disable);
this.btnApply.setDisabled(this._locked);
},
applySettings: function() {
if (this.coreProps && this.api) {
this.coreProps.asc_putTitle(this.inputTitle.getValue());
this.coreProps.asc_putSubject(this.inputSubject.getValue());
this.coreProps.asc_putDescription(this.inputComment.getValue());
this.coreProps.asc_putCreator(this.authors.join(';'));
this.api.asc_setCoreProps(this.coreProps);
}
this.menu.hide();
},
txtPlacement: 'Location',
@ -1391,7 +1395,8 @@ define([
txtAuthor: 'Author',
txtAddAuthor: 'Add Author',
txtAddText: 'Add Text',
txtMinutes: 'min'
txtMinutes: 'min',
okButtonText: 'Apply'
}, SSE.Views.FileMenuPanels.DocumentInfo || {}));
SSE.Views.FileMenuPanels.DocumentRights = Common.UI.BaseView.extend(_.extend({

View file

@ -1533,6 +1533,7 @@
"SSE.Views.FileMenuPanels.DocumentInfo.txtSubject": "Subject",
"SSE.Views.FileMenuPanels.DocumentInfo.txtTitle": "Title",
"SSE.Views.FileMenuPanels.DocumentInfo.txtUploaded": "Uploaded",
"SSE.Views.FileMenuPanels.DocumentInfo.okButtonText": "Apply",
"SSE.Views.FileMenuPanels.DocumentRights.txtBtnAccessRights": "Change access rights",
"SSE.Views.FileMenuPanels.DocumentRights.txtRights": "Persons who have rights",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.okButtonText": "Apply",