[PE][SSE] Load live viewer

This commit is contained in:
Julia Radzhabova 2022-04-05 22:36:00 +03:00
parent 70f5a0ef62
commit fdd92f2797
6 changed files with 77 additions and 7 deletions

View file

@ -349,6 +349,10 @@ define([
Common.Utils.InternalSettings.set("pe-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
} else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
fast_coauth = Common.localStorage.getBool("pe-settings-view-coauthmode", false);
Common.Utils.InternalSettings.set("pe-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
/** coauthoring end **/

View file

@ -1168,7 +1168,9 @@ define([
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.FeaturesManager.init(this.editorConfig.customization.features);
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);
// change = true by default in editor, change = false by default in viewer
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) ||
!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ;
this.loadCoAuthSettings();
this.applyModeCommonElements();
@ -1210,6 +1212,16 @@ define([
fastCoauth = (value===null || parseInt(value) == 1);
} else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) {
fastCoauth = true;
} else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer
if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
} else {
value = Common.localStorage.getItem("pe-settings-view-coauthmode");
if (value===null) {
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
}
}
fastCoauth = (parseInt(value) == 1);
} else {
fastCoauth = false;
autosave = 0;

View file

@ -231,6 +231,10 @@ define([
'<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>',
'<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',
'</tr>','<tr class="divider coauth changes"></tr>',
'<tr class="live-viewer">',
'<td class="left"><label><%= scope.txtLiveViewer %></label></td>',
'<td class="right"><div id="fms-chb-live-viewer"></div></td>',
'</tr>','<tr class="divider live-viewer"></tr>',
/** coauthoring end **/
'<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>',
@ -351,6 +355,14 @@ define([
this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode');
/** coauthoring end **/
this.chLiveViewer = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-live-viewer'),
labelText: this.strShowOthersChanges,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.chAutosave = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-autosave'),
labelText: this.strAutosave,
@ -526,6 +538,7 @@ define([
/** coauthoring begin **/
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide']();
/** coauthoring end **/
$('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
$('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
@ -556,6 +569,7 @@ define([
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
/** coauthoring end **/
this.chLiveViewer.setValue(Common.Utils.InternalSettings.get("pe-settings-coauthmode"));
value = Common.Utils.InternalSettings.get("pe-settings-fontrender");
item = this.cmbFontRender.store.findWhere({value: parseInt(value)});
@ -609,14 +623,17 @@ define([
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring) {
Common.localStorage.setItem("pe-settings-coauthmode", this.cmbCoAuthMode.getValue());
} else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
Common.localStorage.setItem("pe-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0);
}
/** coauthoring end **/
Common.localStorage.setItem("pe-settings-fontrender", this.cmbFontRender.getValue());
var item = this.cmbFontRender.store.findWhere({value: 'custom'});
Common.localStorage.setItem("pe-settings-cachemode", item && !item.get('checked') ? 0 : 1);
Common.localStorage.setItem("pe-settings-unit", this.cmbUnit.getValue());
if (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pe-settings-coauthmode"))
if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pe-settings-coauthmode")))
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.Utils.InternalSettings.set("pe-settings-showsnaplines", this.chAlignGuides.isChecked());
@ -702,7 +719,9 @@ define([
strTheme: 'Theme',
txtThemeLight: 'Light',
txtThemeDark: 'Dark',
txtAutoCorrect: 'AutoCorrect options...'
txtAutoCorrect: 'AutoCorrect options...',
strShowOthersChanges: 'Show changes from other users',
txtLiveViewer: 'Real-time Collaboration Changes'
}, PE.Views.FileMenuPanels.Settings || {}));
PE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({

View file

@ -449,6 +449,10 @@ define([
Common.Utils.InternalSettings.set("sse-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
} else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
fast_coauth = Common.localStorage.getBool("sse-settings-view-coauthmode", false);
Common.Utils.InternalSettings.set("sse-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
/** coauthoring end **/

View file

@ -1265,8 +1265,10 @@ define([
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments;
// change = true by default in editor, change = false by default in viewer
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.appOptions.canCoAuthoring &&
!(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);
!(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) ||
!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ;
if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) {
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
@ -1323,6 +1325,16 @@ define([
fastCoauth = (value===null || parseInt(value) == 1);
} else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) {
fastCoauth = true;
} else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer
if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
} else {
value = Common.localStorage.getItem("sse-settings-view-coauthmode");
if (value===null) {
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
}
}
fastCoauth = (parseInt(value) == 1);
} else {
fastCoauth = false;
autosave = 0;

View file

@ -312,6 +312,10 @@ define([
'<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>',
'<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',
'</tr>','<tr class="divider coauth changes"></tr>',
'<tr class="live-viewer">',
'<td class="left"><label><%= scope.txtLiveViewer %></label></td>',
'<td class="right"><div id="fms-chb-live-viewer"></div></td>',
'</tr>','<tr class="divider live-viewer"></tr>',
/** coauthoring end **/
'<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>',
@ -438,6 +442,14 @@ define([
this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode');
/** coauthoring end **/
this.chLiveViewer = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-live-viewer'),
labelText: this.strShowOthersChanges,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.cmbZoom = new Common.UI.ComboBox({
el : $markup.findById('#fms-cmb-zoom'),
style : 'width: 160px;',
@ -756,6 +768,7 @@ define([
$('tr.forcesave', this.el)[mode.canForcesave ? 'show' : 'hide']();
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
if ( !Common.UI.Themes.available() ) {
@ -783,6 +796,7 @@ define([
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
/** coauthoring end **/
this.chLiveViewer.setValue(Common.Utils.InternalSettings.get("sse-settings-coauthmode"));
value = Common.Utils.InternalSettings.get("sse-settings-fontrender");
item = this.cmbFontRender.store.findWhere({value: parseInt(value)});
@ -873,13 +887,16 @@ define([
Common.localStorage.setItem("sse-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0);
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && this.mode.canChangeCoAuthoring)
Common.localStorage.setItem("sse-settings-coauthmode", this.cmbCoAuthMode.getValue());
else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
Common.localStorage.setItem("sse-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0);
}
/** coauthoring end **/
Common.localStorage.setItem("sse-settings-r1c1", this.chR1C1Style.isChecked() ? 1 : 0);
Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue());
var item = this.cmbFontRender.store.findWhere({value: 'custom'});
Common.localStorage.setItem("sse-settings-cachemode", item && !item.get('checked') ? 0 : 1);
Common.localStorage.setItem("sse-settings-unit", this.cmbUnit.getValue());
if (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("sse-settings-coauthmode"))
if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("sse-settings-coauthmode")))
Common.localStorage.setItem("sse-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
if (this.mode.canForcesave)
Common.localStorage.setItem("sse-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
@ -1052,7 +1069,9 @@ define([
txtExamplePt: 'SOMA; MÍNIMO; MÁXIMO; CONTAR',
txtExamplePtbr: 'SOMA; MÍNIMO; MÁXIMO; CONT.NÚM',
txtExampleSv: 'SUMMA; MIN; MAX; ANTAL',
txtExampleTr: 'TOPLA; MİN; MAK; BAĞ_DEĞ_SAY'
txtExampleTr: 'TOPLA; MİN; MAK; BAĞ_DEĞ_SAY',
strShowOthersChanges: 'Show changes from other users',
txtLiveViewer: 'Real-time Collaboration Changes'
}, SSE.Views.FileMenuPanels.MainSettingsGeneral || {}));