2016-04-01 13:17:09 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-04-01 13:17:09 +00:00
*
* 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
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-04-01 13:17:09 +00:00
*
* 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
*
* /
2016-03-11 00:48:53 +00:00
define ( [
2020-07-03 12:15:17 +00:00
'common/main/lib/view/DocumentAccessDialog' ,
'common/main/lib/view/AutoCorrectDialog'
2016-03-11 00:48:53 +00:00
] , function ( ) {
'use strict' ;
! SSE . Views . FileMenuPanels && ( SSE . Views . FileMenuPanels = { } ) ;
SSE . Views . FileMenuPanels . ViewSaveAs = Common . UI . BaseView . extend ( {
el : '#panel-saveas' ,
menu : undefined ,
formats : [ [
2016-04-05 11:52:34 +00:00
{ name : 'XLSX' , imgCls : 'xlsx' , type : Asc . c _oAscFileType . XLSX } ,
{ name : 'PDF' , imgCls : 'pdf' , type : Asc . c _oAscFileType . PDF } ,
{ name : 'ODS' , imgCls : 'ods' , type : Asc . c _oAscFileType . ODS } ,
{ name : 'CSV' , imgCls : 'csv' , type : Asc . c _oAscFileType . CSV }
2019-02-21 13:10:37 +00:00
] , [
{ name : 'XLTX' , imgCls : 'xltx' , type : Asc . c _oAscFileType . XLTX } ,
{ name : 'PDFA' , imgCls : 'pdfa' , type : Asc . c _oAscFileType . PDFA } ,
2021-07-20 18:30:09 +00:00
{ name : 'OTS' , imgCls : 'ots' , type : Asc . c _oAscFileType . OTS } ,
{ name : 'XLSM' , imgCls : 'xlsm' , type : Asc . c _oAscFileType . XLSM }
2016-03-11 00:48:53 +00:00
]
// ,[
2016-04-05 11:52:34 +00:00
// {name: 'HTML', imgCls: 'html', type: Asc.c_oAscFileType.HTML}
2016-03-11 00:48:53 +00:00
// ]
] ,
template : _ . template ( [
'<table><tbody>' ,
'<% _.each(rows, function(row) { %>' ,
'<tr>' ,
'<% _.each(row, function(item) { %>' ,
2021-07-20 18:30:09 +00:00
'<% if (item.type!==Asc.c_oAscFileType.XLSM || fileType=="xlsm") { %>' ,
2021-06-10 20:05:49 +00:00
'<td><div><svg class="btn-doc-format" format="<%= item.type %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">' ,
2018-04-17 12:07:30 +00:00
'<use xlink:href="#svg-format-<%= item.imgCls %>"></use>' ,
'</svg></div></td>' ,
2021-07-20 18:30:09 +00:00
'<% } %>' ,
2016-03-11 00:48:53 +00:00
'<% }) %>' ,
'</tr>' ,
'<% }) %>' ,
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2021-07-20 18:30:09 +00:00
this . fileType = options . fileType ;
2016-03-11 00:48:53 +00:00
} ,
render : function ( ) {
2021-07-20 18:30:09 +00:00
this . $el . html ( this . template ( { rows : this . formats , fileType : ( this . fileType || 'xlsx' ) . toLowerCase ( ) } ) ) ;
2016-03-11 00:48:53 +00:00
$ ( '.btn-doc-format' , this . el ) . on ( 'click' , _ . bind ( this . onFormatClick , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
return this ;
} ,
2020-06-11 11:00:23 +00:00
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . scroller && this . scroller . update ( ) ;
} ,
2016-03-11 00:48:53 +00:00
onFormatClick : function ( e ) {
2018-04-24 11:54:29 +00:00
var type = e . currentTarget . attributes [ 'format' ] ;
if ( ! _ . isUndefined ( type ) && this . menu ) {
this . menu . fireEvent ( 'saveas:format' , [ this . menu , parseInt ( type . value ) ] ) ;
2016-03-11 00:48:53 +00:00
}
}
} ) ;
2018-09-27 12:25:15 +00:00
SSE . Views . FileMenuPanels . ViewSaveCopy = Common . UI . BaseView . extend ( {
el : '#panel-savecopy' ,
menu : undefined ,
formats : [ [
{ name : 'XLSX' , imgCls : 'xlsx' , type : Asc . c _oAscFileType . XLSX , ext : '.xlsx' } ,
{ name : 'PDF' , imgCls : 'pdf' , type : Asc . c _oAscFileType . PDF , ext : '.pdf' } ,
{ name : 'ODS' , imgCls : 'ods' , type : Asc . c _oAscFileType . ODS , ext : '.ods' } ,
{ name : 'CSV' , imgCls : 'csv' , type : Asc . c _oAscFileType . CSV , ext : '.csv' }
2019-02-21 13:10:37 +00:00
] , [
{ name : 'XLTX' , imgCls : 'xltx' , type : Asc . c _oAscFileType . XLTX , ext : '.xltx' } ,
{ name : 'PDFA' , imgCls : 'pdfa' , type : Asc . c _oAscFileType . PDFA , ext : '.pdf' } ,
2021-07-20 18:30:09 +00:00
{ name : 'OTS' , imgCls : 'ots' , type : Asc . c _oAscFileType . OTS , ext : '.ots' } ,
{ name : 'XLSM' , imgCls : 'xlsm' , type : Asc . c _oAscFileType . XLSM , ext : '.xlsm' }
2018-09-27 12:25:15 +00:00
]
// ,[
// {name: 'HTML', imgCls: 'html', type: Asc.c_oAscFileType.HTML, ext: '.html'}
// ]
] ,
template : _ . template ( [
'<table><tbody>' ,
'<% _.each(rows, function(row) { %>' ,
'<tr>' ,
'<% _.each(row, function(item) { %>' ,
2021-07-20 18:30:09 +00:00
'<% if (item.type!==Asc.c_oAscFileType.XLSM || fileType=="xlsm") { %>' ,
2021-11-23 17:29:56 +00:00
'<td><div><svg class="btn-doc-format" format="<%= item.type %>", format-ext="<%= item.ext %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">' ,
2018-09-27 12:25:15 +00:00
'<use xlink:href="#svg-format-<%= item.imgCls %>"></use>' ,
'</svg></div></td>' ,
2021-07-20 18:30:09 +00:00
'<% } %>' ,
2018-09-27 12:25:15 +00:00
'<% }) %>' ,
'</tr>' ,
'<% }) %>' ,
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2021-07-20 18:30:09 +00:00
this . fileType = options . fileType ;
2018-09-27 12:25:15 +00:00
} ,
render : function ( ) {
2021-07-20 18:30:09 +00:00
this . $el . html ( this . template ( { rows : this . formats , fileType : ( this . fileType || 'xlsx' ) . toLowerCase ( ) } ) ) ;
2018-09-27 12:25:15 +00:00
$ ( '.btn-doc-format' , this . el ) . on ( 'click' , _ . bind ( this . onFormatClick , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2018-09-27 12:25:15 +00:00
} ) ;
}
return this ;
} ,
2020-06-11 11:00:23 +00:00
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . scroller && this . scroller . update ( ) ;
} ,
2018-09-27 12:25:15 +00:00
onFormatClick : function ( e ) {
var type = e . currentTarget . attributes [ 'format' ] ,
ext = e . currentTarget . attributes [ 'format-ext' ] ;
if ( ! _ . isUndefined ( type ) && ! _ . isUndefined ( ext ) && this . menu ) {
this . menu . fireEvent ( 'savecopy:format' , [ this . menu , parseInt ( type . value ) , ext . value ] ) ;
}
}
} ) ;
2016-03-11 00:48:53 +00:00
SSE . Views . FileMenuPanels . Settings = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-settings' ,
menu : undefined ,
template : _ . template ( [
'<div style="width:100%; height:100%; position: relative;">' ,
'<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>' ,
'<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">' ,
2020-06-11 11:00:23 +00:00
'<div id="panel-settings-general" style="width:100%; height:100%;position:relative;" class="no-padding main-settings-panel active"></div>' ,
'<div id="panel-settings-spellcheck" style="width:100%; height:100%;position:relative;" class="no-padding main-settings-panel"></div>' ,
2016-03-11 00:48:53 +00:00
'</div>' ,
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
2019-08-27 14:26:14 +00:00
render : function ( node ) {
var $markup = $ ( this . template ( { scope : this } ) ) ;
2016-03-11 00:48:53 +00:00
this . generalSettings = new SSE . Views . FileMenuPanels . MainSettingsGeneral ( { menu : this . menu } ) ;
this . generalSettings . options = { alias : 'MainSettingsGeneral' } ;
2019-08-27 14:26:14 +00:00
this . generalSettings . render ( $markup . findById ( '#panel-settings-general' ) ) ;
2016-03-11 00:48:53 +00:00
2019-11-18 14:19:32 +00:00
this . spellcheckSettings = new SSE . Views . FileMenuPanels . MainSpellCheckSettings ( { menu : this . menu } ) ;
this . spellcheckSettings . render ( $markup . findById ( '#panel-settings-spellcheck' ) ) ;
2016-03-11 00:48:53 +00:00
this . viewSettingsPicker = new Common . UI . DataView ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-settings-menu' ) ,
2016-03-11 00:48:53 +00:00
store : new Common . UI . DataViewStore ( [
2021-06-22 17:18:23 +00:00
{ name : this . txtGeneral , panel : this . generalSettings , iconCls : 'toolbar__icon btn-settings' , contentTarget : 'panel-settings-general' , selected : true } ,
{ name : this . txtSpellChecking , panel : this . spellcheckSettings , iconCls : 'toolbar__icon btn-ic-docspell' , contentTarget : 'panel-settings-spellcheck' }
2016-03-11 00:48:53 +00:00
] ) ,
itemTemplate : _ . template ( [
'<div id="<%= id %>" class="settings-item-wrap">' ,
'<div class="settings-icon <%= iconCls %>" style="display: inline-block;" >' ,
'</div><%= name %>' ,
'</div>'
2021-06-14 17:28:51 +00:00
] . join ( '' ) ) ,
itemDataHint : '2' ,
itemDataHintDirection : 'left' ,
itemDataHintOffset : [ - 2 , 20 ]
2016-03-11 00:48:53 +00:00
} ) ;
this . viewSettingsPicker . on ( 'item:select' , _ . bind ( function ( dataview , itemview , record ) {
var panel = record . get ( 'panel' ) ;
$ ( '#id-settings-content > div' ) . removeClass ( 'active' ) ;
panel . $el . addClass ( 'active' ) ;
panel . show ( ) ;
} , this ) ) ;
2019-08-27 14:26:14 +00:00
this . $el = $ ( node ) . html ( $markup ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
var item = this . viewSettingsPicker . getSelectedRec ( ) ;
2019-06-27 11:18:01 +00:00
item && item . get ( 'panel' ) . show ( ) ;
2016-03-11 00:48:53 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
this . generalSettings && this . generalSettings . setMode ( this . mode ) ;
2019-11-27 12:55:39 +00:00
this . spellcheckSettings && this . spellcheckSettings . setMode ( this . mode ) ;
2019-11-28 13:13:50 +00:00
if ( ! this . mode . isEdit ) {
2021-12-30 14:12:21 +00:00
$ ( this . viewSettingsPicker . dataViewItems [ 1 ] . el ) . hide ( ) ;
2020-01-09 12:31:14 +00:00
if ( this . spellcheckSettings && this . spellcheckSettings . $el && this . spellcheckSettings . $el . hasClass ( 'active' ) )
this . viewSettingsPicker . selectByIndex ( 0 ) ;
2019-11-28 13:13:50 +00:00
}
2016-03-11 00:48:53 +00:00
} ,
setApi : function ( api ) {
this . generalSettings && this . generalSettings . setApi ( api ) ;
2020-07-03 12:15:17 +00:00
this . spellcheckSettings && this . spellcheckSettings . setApi ( api ) ;
2016-03-11 00:48:53 +00:00
} ,
2021-06-28 17:12:31 +00:00
SetDisabled : function ( disabled ) {
2020-09-23 16:01:44 +00:00
if ( disabled ) {
$ ( this . viewSettingsPicker . dataViewItems [ 1 ] . el ) . hide ( ) ;
2021-07-01 21:54:55 +00:00
this . viewSettingsPicker . selectByIndex ( 0 , true ) ;
2020-09-23 16:01:44 +00:00
} else {
if ( this . mode . isEdit ) {
2021-12-30 14:12:21 +00:00
$ ( this . viewSettingsPicker . dataViewItems [ 1 ] . el ) . show ( ) ;
2020-09-23 16:01:44 +00:00
}
}
} ,
2016-03-11 00:48:53 +00:00
txtGeneral : 'General' ,
2019-11-18 14:19:32 +00:00
txtPageSettings : 'Page Settings' ,
2019-11-27 14:33:33 +00:00
txtSpellChecking : 'Spell checking'
2016-03-11 00:48:53 +00:00
} , SSE . Views . FileMenuPanels . Settings || { } ) ) ;
SSE . Views . FileMenuPanels . MainSettingsGeneral = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-settings-general' ,
menu : undefined ,
template : _ . template ( [
2020-08-07 12:27:04 +00:00
'<div>' ,
'<div class="flex-settings">' ,
'<table class="main" style="margin: 30px 0 0;"><tbody>' ,
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
2017-06-14 11:53:29 +00:00
'<tr class="comments">' ,
2016-03-11 00:48:53 +00:00
'<td class="left"><label><%= scope.txtLiveComment %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-chb-live-comment"></div></td>' ,
2017-06-14 11:53:29 +00:00
'</tr>' , '<tr class="divider comments"></tr>' ,
'<tr class="comments">' ,
2017-06-06 08:31:30 +00:00
'<td class="left"></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-chb-resolved-comment"></div></td>' ,
2017-06-14 11:53:29 +00:00
'</tr>' , '<tr class="divider comments"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr class="autosave">' ,
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><span id="fms-chb-autosave"></span></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' , '<tr class="divider autosave"></tr>' ,
2017-04-11 11:05:56 +00:00
'<tr class="forcesave">' ,
'<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><span id="fms-chb-forcesave"></span></td>' ,
2017-04-11 11:05:56 +00:00
'</tr>' , '<tr class="divider forcesave"></tr>' ,
2018-11-14 15:11:36 +00:00
'<tr>' ,
'<td class="left"><label><%= scope.textRefStyle %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-chb-r1c1-style"></div></td>' ,
2018-11-14 15:11:36 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr class="coauth changes">' ,
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>' ,
'<td class="right">' ,
2020-06-05 13:10:48 +00:00
'<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>' ,
2016-03-11 00:48:53 +00:00
'<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>' ,
'</tr>' , '<tr class="divider coauth changes"></tr>' ,
/** coauthoring end **/
2021-02-16 12:08:39 +00:00
'<tr class="themes">' ,
2021-02-06 10:06:33 +00:00
'<td class="left"><label><%= scope.strTheme %></label></td>' ,
'<td class="right"><span id="fms-cmb-theme"></span></td>' ,
2021-04-02 19:36:08 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr>' ,
'<td class="left"><label><%= scope.strZoom %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-cmb-zoom" class="input-group-nr"></div></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"><label><%= scope.strFontRender %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><span id="fms-cmb-font-render"></span></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
2020-12-23 13:47:13 +00:00
'<tr>' ,
2016-03-11 00:48:53 +00:00
'<td class="left"><label><%= scope.strUnit %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><span id="fms-cmb-unit"></span></td>' ,
2020-12-23 13:47:13 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr class="edit">' ,
'<td class="left"><label><%= scope.strFuncLocale %></label></td>' ,
'<td class="right">' ,
2020-06-05 13:10:48 +00:00
'<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>' ,
2016-03-11 00:48:53 +00:00
'<label id="fms-lbl-func-locale" style="vertical-align: middle;"><%= scope.strFuncLocaleEx %></label></div></td>' ,
'</tr>' , '<tr class="divider edit"></tr>' ,
2017-06-14 11:53:29 +00:00
'<tr class="edit">' ,
2016-03-11 00:48:53 +00:00
'<td class="left"><label><%= scope.strRegSettings %></label></td>' ,
'<td class="right">' ,
2020-06-05 13:10:48 +00:00
'<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>' ,
2016-03-11 00:48:53 +00:00
'<label id="fms-lbl-reg-settings" style="vertical-align: middle;"></label></div></td>' ,
2017-06-14 11:53:29 +00:00
'</tr>' , '<tr class="divider edit"></tr>' ,
2019-11-19 11:42:40 +00:00
'<tr class="edit">' ,
'<td class="left"><label><%= scope.strSeparator %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-chb-separator-settings"></div></td>' ,
2019-11-19 11:42:40 +00:00
'</tr>' ,
'<tr class="edit">' ,
'<td class="left"></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-decimal-separator"></div><label class="label-separator" style="margin-left: 10px; padding-top: 4px;"><%= scope.strDecimalSeparator %></label></td>' ,
2019-11-19 11:42:40 +00:00
'</tr>' ,
'<tr class="edit">' ,
'<td class="left"></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><div id="fms-thousands-separator"></div><label class="label-separator" style="margin-left: 10px; padding-top: 4px;"><%= scope.strThousandsSeparator %></label></td>' ,
2019-11-19 11:42:40 +00:00
'</tr>' , '<tr class="divider edit"></tr>' ,
2020-06-03 17:49:54 +00:00
'<tr class="edit">' ,
'<td class="left"><label><%= scope.strPaste %></label></td>' ,
2020-06-05 17:34:50 +00:00
'<td class="right"><div id="fms-chb-paste-settings"></div></td>' ,
2020-06-03 17:49:54 +00:00
'</tr>' , '<tr class="divider edit"></tr>' ,
2020-05-22 14:55:35 +00:00
'<tr class="macros">' ,
'<td class="left"><label><%= scope.strMacrosSettings %></label></td>' ,
'<td class="right">' ,
2020-06-05 17:34:50 +00:00
'<div><div id="fms-cmb-macros" style="display: inline-block; margin-right: 15px;vertical-align: middle;"></div>' ,
2020-05-22 14:55:35 +00:00
'<label id="fms-lbl-macros" style="vertical-align: middle;"><%= scope.txtWarnMacrosDesc %></label></div></td>' ,
'</tr>' , '<tr class="divider macros"></tr>' ,
2020-11-17 21:38:48 +00:00
'<tr class="fms-btn-apply">' ,
'<td class="left"></td>' ,
2021-06-14 17:28:51 +00:00
'<td class="right" style="padding-top:15px; padding-bottom: 15px;"><button class="btn normal dlg-btn primary" data-hint="3" data-hint-direction="bottom" data-hint-offset="big"><%= scope.okButtonText %></button></td>' ,
2020-11-17 21:38:48 +00:00
'</tr>' ,
2020-08-07 12:27:04 +00:00
'</tbody></table>' ,
'</div>' ,
2020-11-17 21:38:48 +00:00
'<div class="fms-flex-apply hidden">' ,
2020-08-07 12:27:04 +00:00
'<table class="main" style="margin: 10px 0;"><tbody>' ,
2016-03-11 00:48:53 +00:00
'<tr>' ,
'<td class="left"></td>' ,
2021-08-12 12:39:47 +00:00
'<td class="right"><button class="btn normal dlg-btn primary" data-hint="3" data-hint-direction="bottom" data-hint-offset="big"><%= scope.okButtonText %></button></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' ,
2020-08-07 12:27:04 +00:00
'</tbody></table>' ,
'</div>' ,
'</div>'
2016-03-11 00:48:53 +00:00
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
2019-08-27 14:26:14 +00:00
render : function ( node ) {
var me = this ;
var $markup = $ ( this . template ( { scope : this } ) ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
this . chLiveComment = new Common . UI . CheckBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-chb-live-comment' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strLiveComment ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-08-27 14:26:14 +00:00
} ) . on ( 'change' , function ( field , newValue , oldValue , eOpts ) {
me . chResolvedComment . setDisabled ( field . getValue ( ) !== 'checked' ) ;
} ) ;
2017-06-06 08:31:30 +00:00
this . chResolvedComment = new Common . UI . CheckBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-chb-resolved-comment' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strResolvedComment ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2016-03-11 00:48:53 +00:00
} ) ;
2018-11-14 15:11:36 +00:00
this . chR1C1Style = new Common . UI . CheckBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-chb-r1c1-style' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strR1C1 ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2018-11-14 15:11:36 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbCoAuthMode = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-coauth-mode' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
{ value : 1 , displayValue : this . strFast , descValue : this . strCoAuthModeDescFast } ,
{ value : 0 , displayValue : this . strStrict , descValue : this . strCoAuthModeDescStrict }
2021-06-14 17:28:51 +00:00
] ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2019-08-27 14:26:14 +00:00
} ) . on ( 'selected' , function ( combo , record ) {
if ( record . value == 1 && ( me . chAutosave . getValue ( ) !== 'checked' ) )
me . chAutosave . setValue ( 1 ) ;
me . lblCoAuthMode . text ( record . descValue ) ;
} ) ;
2016-03-11 00:48:53 +00:00
2019-08-27 14:26:14 +00:00
this . lblCoAuthMode = $markup . findById ( '#fms-lbl-coauth-mode' ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring end **/
this . cmbZoom = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-zoom' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
2020-08-07 12:27:04 +00:00
menuStyle : 'max-height: 157px;' ,
2016-03-11 00:48:53 +00:00
data : [
{ value : 50 , displayValue : "50%" } ,
{ value : 60 , displayValue : "60%" } ,
{ value : 70 , displayValue : "70%" } ,
{ value : 80 , displayValue : "80%" } ,
{ value : 90 , displayValue : "90%" } ,
{ value : 100 , displayValue : "100%" } ,
{ value : 110 , displayValue : "110%" } ,
{ value : 120 , displayValue : "120%" } ,
{ value : 150 , displayValue : "150%" } ,
{ value : 175 , displayValue : "175%" } ,
2021-12-01 15:27:40 +00:00
{ value : 200 , displayValue : "200%" } ,
{ value : 300 , displayValue : "300%" } ,
{ value : 400 , displayValue : "400%" } ,
{ value : 500 , displayValue : "500%" }
2021-06-14 17:28:51 +00:00
] ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2016-03-11 00:48:53 +00:00
} ) ;
2020-02-17 13:43:02 +00:00
var itemsTemplate =
_ . template ( [
'<% _.each(items, function(item) { %>' ,
2021-12-14 13:46:44 +00:00
'<li id="<%= item.id %>" data-value="<%= item.value %>" <% if (item.value === "custom") { %> class="border-top" style="margin-top: 5px;padding-top: 5px;" <% } %> ><a tabindex="-1" type="menuitem" <% if (typeof(item.checked) !== "undefined" && item.checked) { %> class="checked" <% } %> ><%= scope.getDisplayValue(item) %></a></li>' ,
2020-02-17 13:43:02 +00:00
'<% }); %>'
] . join ( '' ) ) ;
2016-03-11 00:48:53 +00:00
this . cmbFontRender = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-font-render' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
2020-02-17 13:43:02 +00:00
itemsTemplate : itemsTemplate ,
2016-03-11 00:48:53 +00:00
data : [
2016-04-05 11:52:34 +00:00
{ value : Asc . c _oAscFontRenderingModeType . hintingAndSubpixeling , displayValue : this . txtWin } ,
{ value : Asc . c _oAscFontRenderingModeType . noHinting , displayValue : this . txtMac } ,
2020-02-17 13:43:02 +00:00
{ value : Asc . c _oAscFontRenderingModeType . hinting , displayValue : this . txtNative } ,
{ value : 'custom' , displayValue : this . txtCacheMode }
2021-06-14 17:28:51 +00:00
] ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2016-03-11 00:48:53 +00:00
} ) ;
2020-02-17 13:43:02 +00:00
this . cmbFontRender . on ( 'selected' , _ . bind ( this . onFontRenderSelected , this ) ) ;
2016-03-11 00:48:53 +00:00
this . chAutosave = new Common . UI . CheckBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-chb-autosave' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strAutosave ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-08-27 14:26:14 +00:00
} ) . on ( 'change' , function ( field , newValue , oldValue , eOpts ) {
if ( field . getValue ( ) !== 'checked' && me . cmbCoAuthMode . getValue ( ) ) {
me . cmbCoAuthMode . setValue ( 0 ) ;
me . lblCoAuthMode . text ( me . strCoAuthModeDescStrict ) ;
2016-03-25 07:48:19 +00:00
}
2019-08-27 14:26:14 +00:00
} ) ;
this . lblAutosave = $markup . findById ( '#fms-lbl-autosave' ) ;
2017-04-11 11:05:56 +00:00
this . chForcesave = new Common . UI . CheckBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-chb-forcesave' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strForcesave ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2017-04-11 11:05:56 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbUnit = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-unit' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
{ value : Common . Utils . Metric . c _MetricUnits [ 'cm' ] , displayValue : this . txtCm } ,
2016-04-06 15:17:40 +00:00
{ value : Common . Utils . Metric . c _MetricUnits [ 'pt' ] , displayValue : this . txtPt } ,
{ value : Common . Utils . Metric . c _MetricUnits [ 'inch' ] , displayValue : this . txtInch }
2021-06-14 17:28:51 +00:00
] ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2016-03-11 00:48:53 +00:00
} ) ;
2021-07-17 14:42:57 +00:00
var formula _arr = [ ] ;
SSE . Collections . formulasLangs . forEach ( function ( item ) {
var str = item . replace ( /[\-_]/ , '' ) ;
str = str . charAt ( 0 ) . toUpperCase ( ) + str . substring ( 1 , str . length ) ;
formula _arr . push ( { value : item , displayValue : me [ 'txt' + str + 'lang' ] || me [ 'txt' + str ] , exampleValue : me [ 'txtExample' + str ] || me . txtExampleEn } ) ;
} ) ;
2021-05-20 21:02:35 +00:00
formula _arr . sort ( function ( a , b ) {
if ( a . displayValue < b . displayValue ) return - 1 ;
if ( a . displayValue > b . displayValue ) return 1 ;
return 0 ;
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbFuncLocale = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-func-locale' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
2021-05-20 20:49:01 +00:00
menuStyle : 'max-height: 185px;' ,
2016-03-11 00:48:53 +00:00
editable : false ,
cls : 'input-group-nr' ,
2021-07-01 13:47:01 +00:00
data : formula _arr ,
2021-06-14 17:28:51 +00:00
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2019-08-27 14:26:14 +00:00
} ) . on ( 'selected' , function ( combo , record ) {
me . updateFuncExample ( record . exampleValue ) ;
} ) ;
2016-03-11 00:48:53 +00:00
2021-08-02 13:52:33 +00:00
var regdata = [ { value : 0x042C } , { value : 0x0402 } , { value : 0x0405 } , { value : 0x0C07 } , { value : 0x0407 } , { value : 0x0807 } , { value : 0x0408 } , { value : 0x0C09 } , { value : 0x0809 } , { value : 0x0409 } , { value : 0x0C0A } , { value : 0x080A } ,
2022-01-21 17:00:17 +00:00
{ value : 0x040B } , { value : 0x040C } , { value : 0x100C } , { value : 0x0410 } , { value : 0x0411 } , { value : 0x0412 } , { value : 0x0426 } , { value : 0x040E } , { value : 0x0413 } , { value : 0x0415 } , { value : 0x0416 } ,
2018-12-05 15:10:58 +00:00
{ value : 0x0816 } , { value : 0x0419 } , { value : 0x041B } , { value : 0x0424 } , { value : 0x081D } , { value : 0x041D } , { value : 0x041F } , { value : 0x0422 } , { value : 0x042A } , { value : 0x0804 } ] ;
2017-05-12 10:07:06 +00:00
regdata . forEach ( function ( item ) {
var langinfo = Common . util . LanguageInfo . getLocalLanguageName ( item . value ) ;
item . displayValue = langinfo [ 1 ] ;
item . langName = langinfo [ 0 ] ;
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbRegSettings = new Common . UI . ComboBox ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#fms-cmb-reg-settings' ) ,
2016-03-11 00:48:53 +00:00
style : 'width: 160px;' ,
2016-04-20 11:14:25 +00:00
menuStyle : 'max-height: 185px;' ,
2016-03-11 00:48:53 +00:00
editable : false ,
cls : 'input-group-nr' ,
2017-05-12 10:07:06 +00:00
data : regdata ,
template : _ . template ( [
'<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">' ,
2021-06-14 17:28:51 +00:00
'<input type="text" class="form-control" style="padding-left: 25px !important;" data-hint="3" data-hint-direction="bottom" data-hint-offset="big">' ,
2017-05-12 10:07:06 +00:00
'<span class="icon input-icon lang-flag"></span>' ,
2021-01-18 20:27:47 +00:00
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">' ,
'<span class="caret" />' ,
'</button>' ,
2017-05-12 10:07:06 +00:00
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">' ,
'<% _.each(items, function(item) { %>' ,
'<li id="<%= item.id %>" data-value="<%= item.value %>">' ,
'<a tabindex="-1" type="menuitem" style="padding-left: 26px !important;">' ,
'<i class="icon lang-flag <%= item.langName %>" style="position: absolute;margin-left:-21px;"></i>' ,
'<%= scope.getDisplayValue(item) %>' ,
'</a>' ,
'</li>' ,
'<% }); %>' ,
'</ul>' ,
'</span>' ] . join ( '' ) )
2019-08-27 14:26:14 +00:00
} ) . on ( 'selected' , function ( combo , record ) {
me . updateRegionalExample ( record . value ) ;
2019-12-09 11:53:06 +00:00
var isBaseSettings = me . chSeparator . getValue ( ) ;
if ( isBaseSettings === 'checked' ) {
me . inputDecimalSeparator . setValue ( me . api . asc _getDecimalSeparator ( record . value ) , true ) ;
me . inputThousandsSeparator . setValue ( me . api . asc _getGroupSeparator ( record . value ) , true ) ;
}
2019-08-27 14:26:14 +00:00
} ) ;
2017-05-12 10:07:06 +00:00
if ( this . cmbRegSettings . scroller ) this . cmbRegSettings . scroller . update ( { alwaysVisibleY : true } ) ;
2016-03-11 00:48:53 +00:00
2019-11-19 11:42:40 +00:00
this . chSeparator = new Common . UI . CheckBox ( {
el : $markup . findById ( '#fms-chb-separator-settings' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strUseSeparatorsBasedOnRegionalSettings ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-11-29 08:29:13 +00:00
} ) . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var checked = field . getValue ( ) === 'checked' ;
2019-12-06 13:46:11 +00:00
if ( checked ) {
2019-12-09 11:53:06 +00:00
var lang = this . cmbRegSettings . getValue ( ) ,
decimal = this . api . asc _getDecimalSeparator ( _ . isNumber ( lang ) ? lang : undefined ) ,
group = this . api . asc _getGroupSeparator ( _ . isNumber ( lang ) ? lang : undefined ) ;
2019-12-06 13:46:11 +00:00
this . inputDecimalSeparator . setValue ( decimal ) ;
this . inputThousandsSeparator . setValue ( group ) ;
}
2019-11-29 08:29:13 +00:00
this . inputDecimalSeparator . setDisabled ( checked ) ;
this . inputThousandsSeparator . setDisabled ( checked ) ;
2019-12-09 13:28:27 +00:00
if ( checked ) {
this . $el . find ( '.label-separator' ) . addClass ( 'disabled' ) ;
} else {
this . $el . find ( '.label-separator' ) . removeClass ( 'disabled' ) ;
}
2019-11-29 08:29:13 +00:00
} , this ) ) ;
2019-11-19 11:42:40 +00:00
var keyDown = function ( event ) {
var key = event . key ,
value = event . target . value ;
if ( key !== 'ArrowLeft' && key !== 'ArrowDown' && key !== 'ArrowUp' && key !== 'ArrowRight' &&
2019-12-09 11:53:06 +00:00
key !== 'Home' && key !== 'End' && key !== 'Backspace' && key !== 'Delete' && value . length > 0 &&
event . target . selectionEnd - event . target . selectionStart === 0 ) {
2019-11-19 11:42:40 +00:00
event . preventDefault ( ) ;
}
} ;
this . inputDecimalSeparator = new Common . UI . InputField ( {
el : $markup . findById ( '#fms-decimal-separator' ) ,
2019-12-09 11:53:06 +00:00
style : 'width: 35px;' ,
2021-06-14 17:28:51 +00:00
validateOnBlur : false ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-11-19 11:42:40 +00:00
} ) ;
var $decimalSeparatorInput = this . inputDecimalSeparator . $el . find ( 'input' ) ;
$decimalSeparatorInput . on ( 'keydown' , keyDown ) ;
this . inputThousandsSeparator = new Common . UI . InputField ( {
el : $markup . findById ( '#fms-thousands-separator' ) ,
2019-12-09 11:53:06 +00:00
style : 'width: 35px;' ,
2021-06-14 17:28:51 +00:00
validateOnBlur : false ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-11-19 11:42:40 +00:00
} ) ;
var $thousandsSeparatorInput = this . inputThousandsSeparator . $el . find ( 'input' ) ;
$thousandsSeparatorInput . on ( 'keydown' , keyDown ) ;
2020-05-22 14:55:35 +00:00
this . cmbMacros = new Common . UI . ComboBox ( {
el : $markup . findById ( '#fms-cmb-macros' ) ,
style : 'width: 160px;' ,
editable : false ,
2020-11-17 21:38:48 +00:00
menuCls : 'menu-aligned' ,
2020-05-22 14:55:35 +00:00
cls : 'input-group-nr' ,
data : [
{ value : 2 , displayValue : this . txtStopMacros , descValue : this . txtStopMacrosDesc } ,
{ value : 0 , displayValue : this . txtWarnMacros , descValue : this . txtWarnMacrosDesc } ,
{ value : 1 , displayValue : this . txtRunMacros , descValue : this . txtRunMacrosDesc }
2021-06-14 17:28:51 +00:00
] ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2020-05-22 14:55:35 +00:00
} ) . on ( 'selected' , function ( combo , record ) {
me . lblMacrosDesc . text ( record . descValue ) ;
} ) ;
this . lblMacrosDesc = $markup . findById ( '#fms-lbl-macros' ) ;
2020-06-03 17:49:54 +00:00
this . chPaste = new Common . UI . CheckBox ( {
el : $markup . findById ( '#fms-chb-paste-settings' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strPasteButton ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2020-06-03 17:49:54 +00:00
} ) ;
2021-02-06 10:06:33 +00:00
this . cmbTheme = new Common . UI . ComboBox ( {
el : $markup . findById ( '#fms-cmb-theme' ) ,
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
2021-06-14 17:28:51 +00:00
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-02-06 10:06:33 +00:00
} ) ;
2020-11-17 21:38:48 +00:00
$markup . find ( '.btn.primary' ) . each ( function ( index , el ) {
( new Common . UI . Button ( {
el : $ ( el )
} ) ) . on ( 'click' , _ . bind ( me . applySettings , me ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;
2020-08-07 12:27:04 +00:00
this . pnlSettings = $markup . find ( '.flex-settings' ) . addBack ( ) . filter ( '.flex-settings' ) ;
2020-11-17 21:38:48 +00:00
this . pnlApply = $markup . find ( '.fms-flex-apply' ) . addBack ( ) . filter ( '.fms-flex-apply' ) ;
this . pnlTable = this . pnlSettings . find ( 'table' ) ;
this . trApply = $markup . find ( '.fms-btn-apply' ) ;
2020-08-07 12:27:04 +00:00
2019-08-27 14:26:14 +00:00
this . $el = $ ( node ) . html ( $markup ) ;
2016-03-11 00:48:53 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2020-08-07 12:27:04 +00:00
el : this . pnlSettings ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
2020-08-07 12:27:04 +00:00
Common . NotificationCenter . on ( {
'window:resize' : function ( ) {
me . isVisible ( ) && me . updateScroller ( ) ;
}
} ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . updateSettings ( ) ;
2020-08-07 12:27:04 +00:00
this . updateScroller ( ) ;
} ,
isVisible : function ( ) {
return ( this . $el || $ ( this . el ) ) . is ( ":visible" ) ;
} ,
updateScroller : function ( ) {
if ( this . scroller ) {
2020-11-17 21:38:48 +00:00
Common . UI . Menu . Manager . hideAll ( ) ;
var scrolled = this . $el . height ( ) < this . pnlTable . height ( ) + 25 + this . pnlApply . height ( ) ;
this . pnlApply . toggleClass ( 'hidden' , ! scrolled ) ;
this . trApply . toggleClass ( 'hidden' , scrolled ) ;
this . pnlSettings . css ( 'overflow' , scrolled ? 'hidden' : 'visible' ) ;
2020-08-07 12:27:04 +00:00
this . scroller . update ( ) ;
this . pnlSettings . toggleClass ( 'bordered' , this . scroller . isVisible ( ) ) ;
}
2016-03-11 00:48:53 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
2021-04-02 19:36:08 +00:00
var fast _coauth = Common . Utils . InternalSettings . get ( "sse-settings-coauthmode" ) ;
2017-06-14 11:53:29 +00:00
$ ( 'tr.edit' , this . el ) [ mode . isEdit ? 'show' : 'hide' ] ( ) ;
2021-04-02 19:36:08 +00:00
$ ( 'tr.autosave' , this . el ) [ mode . isEdit && ( mode . canChangeCoAuthoring || ! fast _coauth ) ? 'show' : 'hide' ] ( ) ;
2016-03-18 13:48:33 +00:00
if ( this . mode . isDesktopApp && this . mode . isOffline ) {
2016-03-11 00:48:53 +00:00
this . chAutosave . setCaption ( this . strAutoRecover ) ;
this . lblAutosave . text ( this . textAutoRecover ) ;
}
2017-04-11 11:05:56 +00:00
$ ( 'tr.forcesave' , this . el ) [ mode . canForcesave ? 'show' : 'hide' ] ( ) ;
2018-12-17 08:37:43 +00:00
$ ( 'tr.comments' , this . el ) [ mode . canCoAuthoring ? 'show' : 'hide' ] ( ) ;
2021-04-02 19:36:08 +00:00
$ ( 'tr.coauth.changes' , this . el ) [ mode . isEdit && ! mode . isOffline && mode . canCoAuthoring && mode . canChangeCoAuthoring ? 'show' : 'hide' ] ( ) ;
2020-05-22 14:55:35 +00:00
$ ( 'tr.macros' , this . el ) [ ( mode . customization && mode . customization . macros === false ) ? 'hide' : 'show' ] ( ) ;
2021-02-16 12:08:39 +00:00
if ( ! Common . UI . Themes . available ( ) ) {
$ ( 'tr.themes, tr.themes + tr.divider' , this . el ) . hide ( ) ;
}
2016-03-11 00:48:53 +00:00
} ,
setApi : function ( api ) {
this . api = api ;
} ,
updateSettings : function ( ) {
2017-10-04 15:44:01 +00:00
var value = Common . Utils . InternalSettings . get ( "sse-settings-zoom" ) ;
2016-09-13 08:28:21 +00:00
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 ) ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
2017-10-04 15:44:01 +00:00
this . chLiveComment . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-livecomment" ) ) ;
this . chResolvedComment . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-resolvedcomment" ) ) ;
2018-11-14 15:11:36 +00:00
this . chR1C1Style . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-r1c1" ) ) ;
2016-03-11 00:48:53 +00:00
2017-10-04 15:44:01 +00:00
var fast _coauth = Common . Utils . InternalSettings . get ( "sse-settings-coauthmode" ) ;
item = this . cmbCoAuthMode . store . findWhere ( { value : fast _coauth ? 1 : 0 } ) ;
2016-03-11 00:48:53 +00:00
this . cmbCoAuthMode . setValue ( item ? item . get ( 'value' ) : 1 ) ;
this . lblCoAuthMode . text ( item ? item . get ( 'descValue' ) : this . strCoAuthModeDescFast ) ;
/** coauthoring end **/
2017-10-04 15:44:01 +00:00
value = Common . Utils . InternalSettings . get ( "sse-settings-fontrender" ) ;
2016-03-11 00:48:53 +00:00
item = this . cmbFontRender . store . findWhere ( { value : parseInt ( value ) } ) ;
2020-02-17 08:57:44 +00:00
this . cmbFontRender . setValue ( item ? item . get ( 'value' ) : Asc . c _oAscFontRenderingModeType . hintingAndSubpixeling ) ;
2020-02-17 13:43:02 +00:00
this . _fontRender = this . cmbFontRender . getValue ( ) ;
value = Common . Utils . InternalSettings . get ( "sse-settings-cachemode" ) ;
item = this . cmbFontRender . store . findWhere ( { value : 'custom' } ) ;
item && value && item . set ( 'checked' , ! ! value ) ;
item && value && this . cmbFontRender . cmpEl . find ( '#' + item . get ( 'id' ) + ' a' ) . addClass ( 'checked' ) ;
2016-03-11 00:48:53 +00:00
2017-10-04 15:44:01 +00:00
value = Common . Utils . InternalSettings . get ( "sse-settings-unit" ) ;
item = this . cmbUnit . store . findWhere ( { value : value } ) ;
2016-04-08 08:55:15 +00:00
this . cmbUnit . setValue ( item ? parseInt ( item . get ( 'value' ) ) : Common . Utils . Metric . getDefaultMetric ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _oldUnits = this . cmbUnit . getValue ( ) ;
2017-10-04 15:44:01 +00:00
value = Common . Utils . InternalSettings . get ( "sse-settings-autosave" ) ;
this . chAutosave . setValue ( value == 1 ) ;
2016-03-11 00:48:53 +00:00
2017-04-11 11:05:56 +00:00
if ( this . mode . canForcesave ) {
2017-10-04 15:44:01 +00:00
this . chForcesave . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-forcesave" ) ) ;
2017-04-11 11:05:56 +00:00
}
2017-10-04 15:44:01 +00:00
value = Common . Utils . InternalSettings . get ( "sse-settings-func-locale" ) ;
2016-03-11 00:48:53 +00:00
item = this . cmbFuncLocale . store . findWhere ( { value : value } ) ;
2019-01-18 14:03:28 +00:00
if ( ! item && value )
2018-01-24 11:40:59 +00:00
item = this . cmbFuncLocale . store . findWhere ( { value : value . split ( /[\-\_]/ ) [ 0 ] } ) ;
2016-03-11 00:48:53 +00:00
this . cmbFuncLocale . setValue ( item ? item . get ( 'value' ) : 'en' ) ;
this . updateFuncExample ( item ? item . get ( 'exampleValue' ) : this . txtExampleEn ) ;
2017-06-01 13:48:33 +00:00
value = this . api . asc _getLocale ( ) ;
if ( value ) {
item = this . cmbRegSettings . store . findWhere ( { value : value } ) ;
this . cmbRegSettings . setValue ( item ? item . get ( 'value' ) : Common . util . LanguageInfo . getLocalLanguageName ( value ) [ 1 ] ) ;
2017-08-15 14:09:40 +00:00
item && ( value = this . cmbRegSettings . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
} else {
2017-08-15 14:09:40 +00:00
value = this . mode . lang ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( this . mode . lang ) ) : 0x0409 ;
this . cmbRegSettings . setValue ( Common . util . LanguageInfo . getLocalLanguageName ( value ) [ 1 ] ) ;
2016-03-11 00:48:53 +00:00
}
2017-08-15 14:09:40 +00:00
this . updateRegionalExample ( value ) ;
2019-11-29 08:29:13 +00:00
2019-12-06 13:46:11 +00:00
var isBaseSettings = Common . Utils . InternalSettings . get ( "sse-settings-use-base-separator" ) ;
2019-12-09 11:53:06 +00:00
this . chSeparator . setValue ( isBaseSettings , true ) ;
2019-12-06 13:46:11 +00:00
var decimal ,
group ;
if ( ! isBaseSettings ) {
2019-12-09 11:53:06 +00:00
decimal = Common . Utils . InternalSettings . get ( "sse-settings-decimal-separator" ) || this . api . asc _getDecimalSeparator ( ) ;
group = Common . Utils . InternalSettings . get ( "sse-settings-group-separator" ) || this . api . asc _getGroupSeparator ( ) ;
2019-12-06 13:46:11 +00:00
} else {
2019-12-09 11:53:06 +00:00
var lang = this . cmbRegSettings . getValue ( ) ;
decimal = this . api . asc _getDecimalSeparator ( _ . isNumber ( lang ) ? lang : undefined ) ;
group = this . api . asc _getGroupSeparator ( _ . isNumber ( lang ) ? lang : undefined ) ;
2019-12-06 13:46:11 +00:00
}
this . inputDecimalSeparator . setValue ( decimal ) ;
this . inputThousandsSeparator . setValue ( group ) ;
2019-11-29 08:29:13 +00:00
this . inputDecimalSeparator . setDisabled ( isBaseSettings ) ;
this . inputThousandsSeparator . setDisabled ( isBaseSettings ) ;
2019-12-09 13:28:27 +00:00
if ( isBaseSettings ) {
this . $el . find ( '.label-separator' ) . addClass ( 'disabled' ) ;
} else {
this . $el . find ( '.label-separator' ) . removeClass ( 'disabled' ) ;
}
2020-05-22 14:55:35 +00:00
item = this . cmbMacros . store . findWhere ( { value : Common . Utils . InternalSettings . get ( "sse-macros-mode" ) } ) ;
this . cmbMacros . setValue ( item ? item . get ( 'value' ) : 0 ) ;
this . lblMacrosDesc . text ( item ? item . get ( 'descValue' ) : this . txtWarnMacrosDesc ) ;
2020-06-03 17:49:54 +00:00
this . chPaste . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-paste-button" ) ) ;
2021-02-06 10:06:33 +00:00
2021-04-18 14:32:39 +00:00
var data = [ ] ;
for ( var t in Common . UI . Themes . map ( ) ) {
data . push ( { value : t , displayValue : Common . UI . Themes . get ( t ) . text } ) ;
}
if ( data . length ) {
this . cmbTheme . setData ( data ) ;
item = this . cmbTheme . store . findWhere ( { value : Common . UI . Themes . currentThemeId ( ) } ) ;
this . cmbTheme . setValue ( item ? item . get ( 'value' ) : Common . UI . Themes . defaultThemeId ( ) ) ;
}
2016-03-11 00:48:53 +00:00
} ,
applySettings : function ( ) {
2021-02-06 10:06:33 +00:00
Common . UI . Themes . setTheme ( this . cmbTheme . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-zoom" , this . cmbZoom . getValue ( ) ) ;
2017-10-04 15:44:01 +00:00
Common . Utils . InternalSettings . set ( "sse-settings-zoom" , Common . localStorage . getItem ( "sse-settings-zoom" ) ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
Common . localStorage . setItem ( "sse-settings-livecomment" , this . chLiveComment . isChecked ( ) ? 1 : 0 ) ;
2017-06-06 08:31:30 +00:00
Common . localStorage . setItem ( "sse-settings-resolvedcomment" , this . chResolvedComment . isChecked ( ) ? 1 : 0 ) ;
2021-04-02 19:36:08 +00:00
if ( this . mode . isEdit && ! this . mode . isOffline && this . mode . canCoAuthoring && this . mode . canChangeCoAuthoring )
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-coauthmode" , this . cmbCoAuthMode . getValue ( ) ) ;
/** coauthoring end **/
2018-11-14 15:11:36 +00:00
Common . localStorage . setItem ( "sse-settings-r1c1" , this . chR1C1Style . isChecked ( ) ? 1 : 0 ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-fontrender" , this . cmbFontRender . getValue ( ) ) ;
2020-02-17 13:43:02 +00:00
var item = this . cmbFontRender . store . findWhere ( { value : 'custom' } ) ;
Common . localStorage . setItem ( "sse-settings-cachemode" , item && ! item . get ( 'checked' ) ? 0 : 1 ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-unit" , this . cmbUnit . getValue ( ) ) ;
2021-04-02 19:36:08 +00:00
if ( this . mode . canChangeCoAuthoring || ! Common . Utils . InternalSettings . get ( "sse-settings-coauthmode" ) )
Common . localStorage . setItem ( "sse-settings-autosave" , this . chAutosave . isChecked ( ) ? 1 : 0 ) ;
2017-04-11 11:05:56 +00:00
if ( this . mode . canForcesave )
Common . localStorage . setItem ( "sse-settings-forcesave" , this . chForcesave . isChecked ( ) ? 1 : 0 ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-func-locale" , this . cmbFuncLocale . getValue ( ) ) ;
if ( this . cmbRegSettings . getSelectedRecord ( ) )
Common . localStorage . setItem ( "sse-settings-reg-settings" , this . cmbRegSettings . getValue ( ) ) ;
2019-12-06 13:46:11 +00:00
var value ,
isChecked = this . chSeparator . isChecked ( ) ;
if ( ! isChecked ) {
value = this . inputDecimalSeparator . getValue ( ) ;
if ( value . length > 0 ) {
Common . localStorage . setItem ( "sse-settings-decimal-separator" , value ) ;
Common . Utils . InternalSettings . set ( "sse-settings-decimal-separator" , value ) ;
}
value = this . inputThousandsSeparator . getValue ( ) ;
if ( value . length > 0 ) {
Common . localStorage . setItem ( "sse-settings-group-separator" , value ) ;
Common . Utils . InternalSettings . set ( "sse-settings-group-separator" , value ) ;
}
2019-11-29 08:29:13 +00:00
}
2019-12-06 13:46:11 +00:00
Common . localStorage . setBool ( "sse-settings-use-base-separator" , isChecked ) ;
Common . Utils . InternalSettings . set ( "sse-settings-use-base-separator" , isChecked ) ;
2019-11-29 08:29:13 +00:00
2020-05-22 14:55:35 +00:00
Common . localStorage . setItem ( "sse-macros-mode" , this . cmbMacros . getValue ( ) ) ;
2020-06-05 10:08:32 +00:00
Common . Utils . InternalSettings . set ( "sse-macros-mode" , this . cmbMacros . getValue ( ) ) ;
2020-05-22 14:55:35 +00:00
2020-06-03 17:49:54 +00:00
Common . localStorage . setItem ( "sse-settings-paste-button" , this . chPaste . isChecked ( ) ? 1 : 0 ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . save ( ) ;
if ( this . menu ) {
this . menu . fireEvent ( 'settings:apply' , [ this . menu ] ) ;
if ( this . _oldUnits !== this . cmbUnit . getValue ( ) )
Common . NotificationCenter . trigger ( 'settings:unitschanged' , this ) ;
}
} ,
updateRegionalExample : function ( landId ) {
if ( this . api ) {
2017-01-17 09:45:48 +00:00
var text = '' ;
if ( landId ) {
var info = new Asc . asc _CFormatCellsInfo ( ) ;
info . asc _setType ( Asc . c _oAscNumFormatType . None ) ;
info . asc _setSymbol ( landId ) ;
var arr = this . api . asc _getFormatCells ( info ) ; // all formats
2017-01-17 12:58:20 +00:00
text = this . api . asc _getLocaleExample ( arr [ 4 ] , 1000.01 , landId ) ;
2018-04-17 13:11:14 +00:00
text = text + ' ' + this . api . asc _getLocaleExample ( arr [ 5 ] , Asc . cDate ( ) . getExcelDateWithTime ( ) , landId ) ;
text = text + ' ' + this . api . asc _getLocaleExample ( arr [ 6 ] , Asc . cDate ( ) . getExcelDateWithTime ( ) , landId ) ;
2017-01-17 09:45:48 +00:00
}
2016-03-11 00:48:53 +00:00
$ ( '#fms-lbl-reg-settings' ) . text ( _ . isEmpty ( text ) ? '' : this . strRegSettingsEx + text ) ;
}
2017-05-12 10:07:06 +00:00
var icon = this . cmbRegSettings . $el . find ( '.input-icon' ) ,
plang = icon . attr ( 'lang' ) ,
langName = Common . util . LanguageInfo . getLocalLanguageName ( landId ) [ 0 ] ;
if ( plang ) icon . removeClass ( plang ) ;
icon . addClass ( langName ) . attr ( 'lang' , langName ) ;
2016-03-11 00:48:53 +00:00
} ,
updateFuncExample : function ( text ) {
2021-05-20 20:49:01 +00:00
$ ( '#fms-lbl-func-locale' ) . text ( _ . isEmpty ( text ) ? '' : this . strRegSettingsEx + ' ' + text ) ;
2016-03-11 00:48:53 +00:00
} ,
2020-02-17 13:43:02 +00:00
onFontRenderSelected : function ( combo , record ) {
if ( record . value == 'custom' ) {
var item = combo . store . findWhere ( { value : 'custom' } ) ;
item && item . set ( 'checked' , ! record . checked ) ;
combo . cmpEl . find ( '#' + record . id + ' a' ) . toggleClass ( 'checked' , ! record . checked ) ;
combo . setValue ( this . _fontRender ) ;
}
this . _fontRender = combo . getValue ( ) ;
} ,
2016-03-11 00:48:53 +00:00
strLiveComment : 'Turn on option' ,
strZoom : 'Default Zoom Value' ,
okButtonText : 'Apply' ,
/** coauthoring begin **/
txtLiveComment : 'Live Commenting' ,
/** coauthoring end **/
txtWin : 'as Windows' ,
txtMac : 'as OS X' ,
txtNative : 'Native' ,
strFontRender : 'Font Hinting' ,
strUnit : 'Unit of Measurement' ,
txtCm : 'Centimeter' ,
txtPt : 'Point' ,
strAutosave : 'Turn on autosave' ,
textAutoSave : 'Autosave' ,
txtEn : 'English' ,
txtDe : 'Deutsch' ,
txtRu : 'Russian' ,
2017-04-11 11:05:56 +00:00
txtPl : 'Polish' ,
2018-03-30 09:48:54 +00:00
txtEs : 'Spanish' ,
2018-04-06 13:37:41 +00:00
txtFr : 'French' ,
2019-03-26 11:23:42 +00:00
txtIt : 'Italian' ,
2021-05-20 20:49:01 +00:00
txtExampleEn : 'SUM; MIN; MAX; COUNT' ,
txtExampleDe : 'SUMME; MIN; MAX; ANZAHL' ,
txtExampleRu : 'С У М М ; МИН; М А К С ; СЧЁТ' ,
txtExamplePl : 'SUMA; MIN; MAX; ILE.LICZB' ,
txtExampleEs : 'SUMA; MIN; MAX; CALCULAR' ,
txtExampleFr : 'SOMME; MIN; MAX; NB' ,
txtExampleIt : 'SOMMA; MIN; MAX; CONTA.NUMERI' ,
2016-03-11 00:48:53 +00:00
strFuncLocale : 'Formula Language' ,
strFuncLocaleEx : 'Example: SUM; MIN; MAX; COUNT' ,
strRegSettings : 'Regional Settings' ,
strRegSettingsEx : 'Example: ' ,
strCoAuthMode : 'Co-editing mode' ,
strCoAuthModeDescFast : 'Other users will see your changes at once' ,
strCoAuthModeDescStrict : 'You will need to accept changes before you can see them' ,
strFast : 'Fast' ,
strStrict : 'Strict' ,
textAutoRecover : 'Autorecover' ,
2016-04-06 15:17:40 +00:00
strAutoRecover : 'Turn on autorecover' ,
2017-04-11 11:05:56 +00:00
txtInch : 'Inch' ,
textForceSave : 'Save to Server' ,
2017-06-06 08:31:30 +00:00
strForcesave : 'Always save to server (otherwise save to server on document close)' ,
2018-11-14 15:11:36 +00:00
strResolvedComment : 'Turn on display of the resolved comments' ,
textRefStyle : 'Reference Style' ,
2019-11-19 11:42:40 +00:00
strR1C1 : 'Turn on R1C1 style' ,
strSeparator : 'Separator' ,
strUseSeparatorsBasedOnRegionalSettings : 'Use separators based on regional settings' ,
strDecimalSeparator : 'Decimal separator' ,
2020-02-17 13:43:02 +00:00
strThousandsSeparator : 'Thousands separator' ,
2020-05-22 14:55:35 +00:00
txtCacheMode : 'Default cache mode' ,
strMacrosSettings : 'Macros Settings' ,
txtWarnMacros : 'Show Notification' ,
txtRunMacros : 'Enable All' ,
txtStopMacros : 'Disable All' ,
txtWarnMacrosDesc : 'Disable all macros with notification' ,
txtRunMacrosDesc : 'Enable all macros without notification' ,
2020-06-03 17:49:54 +00:00
txtStopMacrosDesc : 'Disable all macros without notification' ,
strPaste : 'Cut, copy and paste' ,
2021-02-06 10:06:33 +00:00
strTheme : 'Theme' ,
txtThemeLight : 'Light' ,
txtThemeDark : 'Dark' ,
2021-05-20 20:49:01 +00:00
strPasteButton : 'Show Paste Options button when content is pasted' ,
2021-05-28 09:22:29 +00:00
txtBe : 'Belarusian' ,
2021-05-20 20:49:01 +00:00
txtBg : 'Bulgarian' ,
txtCa : 'Catalan' ,
txtZh : 'Chinese' ,
txtCs : 'Czech' ,
txtDa : 'Danish' ,
txtNl : 'Dutch' ,
txtFi : 'Finnish' ,
txtEl : 'Greek' ,
txtHu : 'Hungarian' ,
txtId : 'Indonesian' ,
txtJa : 'Japanese' ,
txtKo : 'Korean' ,
txtLv : 'Latvian' ,
txtLo : 'Lao' ,
txtNb : 'Norwegian' ,
2021-07-14 20:31:40 +00:00
txtPtlang : 'Portuguese (Portugal)' ,
2021-07-17 14:42:57 +00:00
txtPtbr : 'Portuguese (Brazil)' ,
2021-05-20 20:49:01 +00:00
txtRo : 'Romanian' ,
txtSk : 'Slovak' ,
txtSl : 'Slovenian' ,
txtSv : 'Swedish' ,
txtTr : 'Turkish' ,
txtUk : 'Ukrainian' ,
txtVi : 'Vietnamese' ,
2021-05-28 09:22:29 +00:00
txtExampleBe : 'С У М М ; МИН; М А К С ; СЧЁТ' ,
2021-05-20 20:49:01 +00:00
txtExampleCa : 'SUMA; MIN; MAX; COMPT' ,
txtExampleCs : 'SUMA; MIN; MAX; POČET' ,
txtExampleDa : 'SUM; MIN; MAKS; TÆL' ,
txtExampleNl : 'SOM; MIN; MAX; AANTAL' ,
txtExampleFi : 'SUMMA; MIN; MAKS; LASKE' ,
txtExampleHu : 'SZUM; MIN; MAX; DARAB' ,
txtExampleNb : 'SUMMER; MIN; STØRST; ANTALL' ,
txtExamplePt : 'SOMA; MÍNIMO; MÁXIMO; CONTAR' ,
2021-07-17 14:42:57 +00:00
txtExamplePtbr : 'SOMA; MÍNIMO; MÁXIMO; CONT.NÚM' ,
2021-05-20 20:49:01 +00:00
txtExampleSv : 'SUMMA; MIN; MAX; ANTAL' ,
txtExampleTr : 'TOPLA; MİN; MAK; BAĞ_DEĞ_SAY'
} , SSE . Views . FileMenuPanels . MainSettingsGeneral || { } ) ) ;
2016-03-11 00:48:53 +00:00
2019-11-18 14:19:32 +00:00
SSE . Views . FileMenuPanels . MainSpellCheckSettings = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-settings-spellcheck' ,
menu : undefined ,
template : _ . template ( [
2020-08-07 12:27:04 +00:00
'<table class="main" style="margin: 30px 0;"><tbody>' ,
2021-11-02 12:56:37 +00:00
'<tr class="spellcheck">' ,
2019-11-27 14:16:35 +00:00
'<td class="left" style="padding-bottom: 8px;"><label><%= scope.strDictionaryLanguage %></label></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right" style="padding-bottom: 8px;"><span id="fms-cmb-dictionary-language"></span></td>' ,
2019-11-27 14:16:35 +00:00
'</tr>' ,
2021-11-02 12:56:37 +00:00
'<tr class="spellcheck">' ,
2019-11-27 14:16:35 +00:00
'<td class="left" style="padding-bottom: 8px;"></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right" style="padding-bottom: 8px;"><span id="fms-chb-ignore-uppercase-words"></span></td>' ,
2019-11-27 14:16:35 +00:00
'</tr>' ,
2021-11-02 12:56:37 +00:00
'<tr class="spellcheck">' ,
2019-11-27 14:16:35 +00:00
'<td class="left"></td>' ,
2020-06-05 13:10:48 +00:00
'<td class="right"><span id="fms-chb-ignore-numbers-words"></span></td>' ,
2021-11-02 12:56:37 +00:00
'</tr>' , '<tr class="divider spellcheck"></tr>' ,
2020-07-03 12:15:17 +00:00
'<tr>' ,
'<td class="left"><label><%= scope.txtProofing %></label></td>' ,
2021-06-14 17:28:51 +00:00
'<td class="right"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="3" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtAutoCorrect %></button></div></td>' ,
2020-07-03 12:15:17 +00:00
'</tr>' , '<tr class="divider"></tr>' ,
2019-11-27 14:16:35 +00:00
'<tr>' ,
'<td class="left"></td>' ,
2021-06-14 17:28:51 +00:00
'<td class="right"><button id="fms-spellcheck-btn-apply" class="btn normal dlg-btn primary" data-hint="3" data-hint-direction="bottom" data-hint-offset="big"><%= scope.okButtonText %></button></td>' ,
2019-11-27 12:55:39 +00:00
'</tr>' ,
2019-11-18 14:19:32 +00:00
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
render : function ( node ) {
var me = this ;
var $markup = $ ( this . template ( { scope : this } ) ) ;
this . chIgnoreUppercase = new Common . UI . CheckBox ( {
el : $markup . findById ( '#fms-chb-ignore-uppercase-words' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strIgnoreWordsInUPPERCASE ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-11-18 14:19:32 +00:00
} ) ;
this . chIgnoreNumbers = new Common . UI . CheckBox ( {
el : $markup . findById ( '#fms-chb-ignore-numbers-words' ) ,
2021-06-14 17:28:51 +00:00
labelText : this . strIgnoreWordsWithNumbers ,
dataHint : '3' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-11-18 14:19:32 +00:00
} ) ;
this . cmbDictionaryLanguage = new Common . UI . ComboBox ( {
el : $markup . findById ( '#fms-cmb-dictionary-language' ) ,
cls : 'input-group-nr' ,
2019-11-27 14:16:35 +00:00
style : 'width: 267px;' ,
2019-11-18 14:19:32 +00:00
editable : false ,
2021-06-14 17:28:51 +00:00
menuStyle : 'min-width: 267px; max-height: 209px;' ,
dataHint : '3' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2019-11-18 14:19:32 +00:00
} ) ;
2020-07-03 12:15:17 +00:00
this . btnAutoCorrect = new Common . UI . Button ( {
el : $markup . findById ( '#fms-btn-auto-correct' )
} ) ;
this . btnAutoCorrect . on ( 'click' , _ . bind ( this . autoCorrect , this ) ) ;
2019-11-18 14:19:32 +00:00
this . btnApply = new Common . UI . Button ( {
2019-11-27 12:55:39 +00:00
el : $markup . findById ( '#fms-spellcheck-btn-apply' )
2019-11-18 14:19:32 +00:00
} ) ;
this . btnApply . on ( 'click' , _ . bind ( this . applySettings , this ) ) ;
this . $el = $ ( node ) . html ( $markup ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2019-11-18 14:19:32 +00:00
} ) ;
}
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . updateSettings ( ) ;
2020-06-11 11:00:23 +00:00
this . scroller && this . scroller . update ( ) ;
2019-11-18 14:19:32 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
2021-11-02 12:56:37 +00:00
$ ( 'tr.spellcheck' , this . el ) [ Common . UI . FeaturesManager . canChange ( 'spellcheck' ) ? 'show' : 'hide' ] ( ) ;
2019-11-18 14:19:32 +00:00
} ,
setApi : function ( api ) {
this . api = api ;
} ,
updateSettings : function ( ) {
2021-11-02 12:56:37 +00:00
if ( ! Common . UI . FeaturesManager . canChange ( 'spellcheck' ) ) return ;
2019-11-28 07:46:49 +00:00
var arrLang = SSE . getController ( 'Spellcheck' ) . loadLanguages ( ) ,
allLangs = arrLang [ 0 ] ,
2019-11-28 13:13:50 +00:00
langs = arrLang [ 1 ] ,
change = arrLang [ 2 ] ;
2019-11-27 12:55:39 +00:00
var sessionValue = Common . Utils . InternalSettings . get ( "sse-spellcheck-locale" ) ,
value ;
if ( sessionValue )
value = parseInt ( sessionValue ) ;
else
value = this . mode . lang ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( this . mode . lang ) ) : 0x0409 ;
2019-11-28 07:46:49 +00:00
if ( langs && langs . length > 0 ) {
2019-11-28 13:13:50 +00:00
if ( this . cmbDictionaryLanguage . store . length === 0 || change ) {
this . cmbDictionaryLanguage . setData ( langs ) ;
}
2019-11-27 12:55:39 +00:00
var item = this . cmbDictionaryLanguage . store . findWhere ( { value : value } ) ;
if ( ! item && allLangs [ value ] ) {
value = allLangs [ value ] [ 0 ] . split ( /[\-\_]/ ) [ 0 ] ;
2019-11-28 07:46:49 +00:00
item = this . cmbDictionaryLanguage . store . find ( function ( model ) {
2019-11-27 12:55:39 +00:00
return model . get ( 'shortName' ) . indexOf ( value ) == 0 ;
} ) ;
}
this . cmbDictionaryLanguage . setValue ( item ? item . get ( 'value' ) : langs [ 0 ] . value ) ;
value = this . cmbDictionaryLanguage . getValue ( ) ;
2019-11-28 07:46:49 +00:00
if ( value !== parseInt ( sessionValue ) ) {
2019-11-27 12:55:39 +00:00
Common . Utils . InternalSettings . set ( "sse-spellcheck-locale" , value ) ;
}
2019-11-18 14:19:32 +00:00
} else {
this . cmbDictionaryLanguage . setValue ( Common . util . LanguageInfo . getLocalLanguageName ( value ) [ 1 ] ) ;
this . cmbDictionaryLanguage . setDisabled ( true ) ;
}
2019-11-27 12:55:39 +00:00
this . chIgnoreUppercase . setValue ( Common . Utils . InternalSettings . get ( "sse-spellcheck-ignore-uppercase-words" ) ) ;
this . chIgnoreNumbers . setValue ( Common . Utils . InternalSettings . get ( "sse-spellcheck-ignore-numbers-words" ) ) ;
2019-11-18 14:19:32 +00:00
} ,
applySettings : function ( ) {
2021-11-02 12:56:37 +00:00
if ( ! Common . UI . FeaturesManager . canChange ( 'spellcheck' ) ) return ;
2019-11-27 12:55:39 +00:00
var value = this . chIgnoreUppercase . isChecked ( ) ;
Common . localStorage . setBool ( "sse-spellcheck-ignore-uppercase-words" , value ) ;
Common . Utils . InternalSettings . set ( "sse-spellcheck-ignore-uppercase-words" , value ) ;
value = this . chIgnoreNumbers . isChecked ( ) ;
Common . localStorage . setBool ( "sse-spellcheck-ignore-numbers-words" , value ) ;
Common . Utils . InternalSettings . set ( "sse-spellcheck-ignore-numbers-words" , value ) ;
2019-11-29 11:56:06 +00:00
if ( ! this . cmbDictionaryLanguage . isDisabled ( ) ) {
value = this . cmbDictionaryLanguage . getValue ( ) ;
Common . localStorage . setItem ( "sse-spellcheck-locale" , value ) ;
Common . Utils . InternalSettings . set ( "sse-spellcheck-locale" , value ) ;
}
2019-11-18 14:19:32 +00:00
2019-11-27 12:55:39 +00:00
Common . localStorage . save ( ) ;
if ( this . menu ) {
this . menu . fireEvent ( 'spellcheck:apply' , [ this . menu ] ) ;
}
2019-11-18 14:19:32 +00:00
} ,
2020-07-03 12:15:17 +00:00
autoCorrect : function ( ) {
2020-10-29 12:12:49 +00:00
if ( this . dlgAutoCorrect && this . dlgAutoCorrect . isVisible ( ) ) return ;
this . dlgAutoCorrect = new Common . Views . AutoCorrectDialog ( {
2020-07-24 17:58:17 +00:00
api : this . api
2020-10-29 12:12:49 +00:00
} ) ;
this . dlgAutoCorrect . show ( ) ;
2020-07-03 12:15:17 +00:00
} ,
2019-11-18 14:19:32 +00:00
strIgnoreWordsInUPPERCASE : 'Ignore words in UPPERCASE' ,
strIgnoreWordsWithNumbers : 'Ignore words with numbers' ,
2019-11-27 12:55:39 +00:00
strDictionaryLanguage : 'Dictionary language' ,
2020-07-03 12:15:17 +00:00
okButtonText : 'Apply' ,
txtProofing : 'Proofing' ,
txtAutoCorrect : 'AutoCorrect options...'
2019-11-18 14:19:32 +00:00
} , SSE . Views . FileMenuPanels . MainSpellCheckSettings || { } ) ) ;
2016-03-11 00:48:53 +00:00
SSE . Views . FileMenuPanels . RecentFiles = Common . UI . BaseView . extend ( {
el : '#panel-recentfiles' ,
menu : undefined ,
template : _ . template ( [
'<div id="id-recent-view" style="margin: 20px 0;"></div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
this . recent = options . recent ;
} ,
render : function ( ) {
2019-08-27 14:26:14 +00:00
this . $el . html ( this . template ( ) ) ;
2016-03-11 00:48:53 +00:00
this . viewRecentPicker = new Common . UI . DataView ( {
el : $ ( '#id-recent-view' ) ,
store : new Common . UI . DataViewStore ( this . recent ) ,
itemTemplate : _ . template ( [
'<div class="recent-wrap">' ,
2020-06-11 16:36:37 +00:00
'<div class="recent-icon">' ,
'<svg>' ,
'<use xlink:href="#svg-file-recent"></use>' ,
'</svg>' ,
'</div>' ,
2020-04-30 15:35:30 +00:00
'<div class="file-name"><% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %></div>' ,
'<div class="file-info"><% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %></div>' ,
2016-03-11 00:48:53 +00:00
'</div>'
] . join ( '' ) )
} ) ;
this . viewRecentPicker . on ( 'item:click' , _ . bind ( this . onRecentFileClick , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
return this ;
} ,
2020-06-11 11:00:23 +00:00
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . scroller && this . scroller . update ( ) ;
} ,
2016-03-11 00:48:53 +00:00
onRecentFileClick : function ( view , itemview , record ) {
if ( this . menu )
this . menu . fireEvent ( 'recent:open' , [ this . menu , record . get ( 'url' ) ] ) ;
}
} ) ;
SSE . Views . FileMenuPanels . CreateNew = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-createnew' ,
menu : undefined ,
events : function ( ) {
return {
'click .blank-document-btn' : _ . bind ( this . _onBlankDocument , this ) ,
'click .thumb-list .thumb-wrap' : _ . bind ( this . _onDocumentTemplate , this )
} ;
} ,
template : _ . template ( [
2021-08-19 22:19:56 +00:00
'<h3 style="margin-top: 20px;"><%= scope.txtCreateNew %></h3>' ,
2016-03-11 00:48:53 +00:00
'<div class="thumb-list">' ,
2021-08-24 15:30:55 +00:00
'<% if (blank) { %> ' ,
2021-08-23 20:13:08 +00:00
'<div class="blank-document">' ,
2021-11-23 17:29:56 +00:00
'<div class="blank-document-btn" data-hint="2" data-hint-direction="left-top" data-hint-offset="10, 1">' ,
2021-08-23 00:24:48 +00:00
'<svg class="btn-blank-format"><use xlink:href="#svg-format-blank"></use></svg>' ,
'</div>' ,
2021-08-24 11:52:58 +00:00
'<div class="title"><%= scope.txtBlank %></div>' ,
2021-08-23 00:24:48 +00:00
'</div>' ,
2021-08-24 15:30:55 +00:00
'<% } %>' ,
2021-08-19 22:19:56 +00:00
'<% _.each(docs, function(item, index) { %>' ,
2021-11-23 17:29:56 +00:00
'<div class="thumb-wrap" template="<%= item.url %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="22, 13">' ,
2021-08-19 22:19:56 +00:00
'<div class="thumb" ' ,
2021-08-23 00:24:48 +00:00
'<% if (!_.isEmpty(item.image)) {%> ' ,
2020-04-30 15:35:30 +00:00
' style="background-image: url(<%= item.image %>);">' ,
2021-08-19 22:19:56 +00:00
' <%} else {' +
'print(\"><svg class=\'btn-blank-format\'><use xlink:href=\'#svg-file-template\'></use></svg>\")' +
' } %>' ,
'</div>' ,
2021-08-24 10:38:19 +00:00
'<div class="title"><%= Common.Utils.String.htmlEncode(item.title || item.name || "") %></div>' ,
2016-03-11 00:48:53 +00:00
'</div>' ,
'<% }) %>' ,
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2021-08-24 15:30:55 +00:00
this . docs = options . docs ;
this . blank = ! ! options . blank ;
2016-03-11 00:48:53 +00:00
} ,
render : function ( ) {
2019-08-27 14:26:14 +00:00
this . $el . html ( this . template ( {
2016-03-11 00:48:53 +00:00
scope : this ,
2021-08-24 15:30:55 +00:00
docs : this . docs ,
blank : this . blank
2016-03-11 00:48:53 +00:00
} ) ) ;
2021-08-24 15:30:55 +00:00
var docs = ( this . blank ? [ { title : this . txtBlank } ] : [ ] ) . concat ( this . docs ) ;
2021-08-23 20:13:08 +00:00
var thumbsElm = this . $el . find ( '.thumb-wrap, .blank-document' ) ;
2021-08-19 22:19:56 +00:00
_ . each ( thumbsElm , function ( tmb , index ) {
$ ( tmb ) . find ( '.title' ) . tooltip ( {
title : docs [ index ] . title ,
2021-08-24 09:04:32 +00:00
placement : 'cursor'
2021-08-19 22:19:56 +00:00
} ) ;
} ) ;
2016-03-11 00:48:53 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
return this ;
} ,
2020-06-11 11:00:23 +00:00
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . scroller && this . scroller . update ( ) ;
} ,
2016-03-11 00:48:53 +00:00
_onBlankDocument : function ( ) {
if ( this . menu )
this . menu . fireEvent ( 'create:new' , [ this . menu , 'blank' ] ) ;
} ,
_onDocumentTemplate : function ( e ) {
if ( this . menu )
this . menu . fireEvent ( 'create:new' , [ this . menu , e . currentTarget . attributes [ 'template' ] . value ] ) ;
} ,
2021-08-24 11:52:58 +00:00
txtBlank : 'Blank spreadsheet' ,
txtCreateNew : 'Create New'
2016-03-11 00:48:53 +00:00
} , SSE . Views . FileMenuPanels . CreateNew || { } ) ) ;
SSE . Views . FileMenuPanels . DocumentInfo = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-info' ,
menu : undefined ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . rendered = false ;
this . template = _ . template ( [
2020-08-07 12:27:04 +00:00
'<div class="flex-settings">' ,
'<table class="main" style="margin: 30px 0 0;">' ,
2019-05-16 08:52:49 +00:00
'<tr>' ,
'<td class="left"><label>' + this . txtPlacement + '</label></td>' ,
'<td class="right"><label id="id-info-placement">-</label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="left"><label>' + this . txtOwner + '</label></td>' ,
'<td class="right"><label id="id-info-owner">-</label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="left"><label>' + this . txtUploaded + '</label></td>' ,
'<td class="right"><label id="id-info-uploaded">-</label></td>' ,
'</tr>' ,
'<tr class="divider general"></tr>' ,
'<tr class="divider general"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr>' ,
'<td class="left"><label>' + this . txtTitle + '</label></td>' ,
2019-05-16 08:52:49 +00:00
'<td class="right"><div id="id-info-title"></div></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' ,
2019-08-09 07:04:43 +00:00
'<tr>' ,
'<td class="left"><label>' + this . txtSubject + '</label></td>' ,
'<td class="right"><div id="id-info-subject"></div></td>' ,
'</tr>' ,
2019-05-16 08:52:49 +00:00
'<tr>' ,
'<td class="left"><label>' + this . txtComment + '</label></td>' ,
'<td class="right"><div id="id-info-comment"></div></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' ,
2019-05-16 08:52:49 +00:00
'<tr class="divider"></tr>' ,
'<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"><label>' + this . txtModifyDate + '</label></td>' ,
'<td class="right"><label id="id-info-modify-date"></label></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' ,
2019-05-16 08:52:49 +00:00
'<tr>' ,
'<td class="left"><label>' + this . txtModifyBy + '</label></td>' ,
'<td class="right"><label id="id-info-modify-by"></label></td>' ,
2018-11-06 09:58:02 +00:00
'</tr>' ,
2019-05-16 08:52:49 +00:00
'<tr class="divider modify">' ,
'<tr class="divider modify">' ,
'<tr>' ,
2019-08-02 08:47:28 +00:00
'<td class="left"><label>' + this . txtCreated + '</label></td>' ,
2019-05-16 08:52:49 +00:00
'<td class="right"><label id="id-info-date"></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="left"><label>' + this . txtAppName + '</label></td>' ,
'<td class="right"><label id="id-info-appname"></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="left" style="vertical-align: top;"><label style="margin-top: 3px;">' + this . txtAuthor + '</label></td>' ,
'<td class="right" style="vertical-align: top;"><div id="id-info-author">' ,
'<table>' ,
'<tr>' ,
'<td><div id="id-info-add-author"><input type="text" spellcheck="false" class="form-control" placeholder="' + this . txtAddAuthor + '"></div></td>' ,
'</tr>' ,
'</table>' ,
'</div></td>' ,
2016-03-11 00:48:53 +00:00
'</tr>' ,
2020-08-07 12:27:04 +00:00
'<tr style="height: 5px;"></tr>' ,
'</table>' ,
'</div>' ,
'<div id="fms-flex-apply">' ,
'<table class="main" style="margin: 10px 0;">' ,
2019-09-06 14:38:29 +00:00
'<tr>' ,
'<td class="left"></td>' ,
2021-06-14 17:28:51 +00:00
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.okButtonText %></button></td>' ,
2019-09-06 14:38:29 +00:00
'</tr>' ,
2020-08-07 12:27:04 +00:00
'</table>' ,
'</div>'
2016-03-11 00:48:53 +00:00
] . join ( '' ) ) ;
this . menu = options . menu ;
2019-06-21 11:34:40 +00:00
this . coreProps = null ;
this . authors = [ ] ;
2019-08-28 08:46:56 +00:00
this . _locked = false ;
2016-03-11 00:48:53 +00:00
} ,
2019-08-27 14:26:14 +00:00
render : function ( node ) {
2019-05-16 08:52:49 +00:00
var me = this ;
2019-09-18 14:54:16 +00:00
var $markup = $ ( me . template ( { scope : me } ) ) ;
2019-05-16 08:52:49 +00:00
// server info
2019-08-27 14:26:14 +00:00
this . lblPlacement = $markup . findById ( '#id-info-placement' ) ;
this . lblOwner = $markup . findById ( '#id-info-owner' ) ;
this . lblUploaded = $markup . findById ( '#id-info-uploaded' ) ;
2019-05-16 08:52:49 +00:00
// edited info
2019-06-21 13:35:23 +00:00
var keyDownBefore = function ( input , e ) {
if ( e . keyCode === Common . UI . Keys . ESC ) {
var newVal = input . _input . val ( ) ,
oldVal = input . getValue ( ) ;
if ( newVal !== oldVal ) {
input . setValue ( oldVal ) ;
e . stopPropagation ( ) ;
}
}
} ;
2019-05-16 08:52:49 +00:00
this . inputTitle = new Common . UI . InputField ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-info-title' ) ,
2019-05-16 08:52:49 +00:00
style : 'width: 200px;' ,
placeHolder : this . txtAddText ,
2021-06-14 17:28:51 +00:00
validateOnBlur : false ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-06-21 13:35:23 +00:00
} ) . on ( 'keydown:before' , keyDownBefore ) ;
2019-05-16 08:52:49 +00:00
this . inputSubject = new Common . UI . InputField ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-info-subject' ) ,
2019-05-16 08:52:49 +00:00
style : 'width: 200px;' ,
placeHolder : this . txtAddText ,
2021-06-14 17:28:51 +00:00
validateOnBlur : false ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-06-21 13:35:23 +00:00
} ) . on ( 'keydown:before' , keyDownBefore ) ;
2019-05-16 08:52:49 +00:00
this . inputComment = new Common . UI . InputField ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-info-comment' ) ,
2019-05-16 08:52:49 +00:00
style : 'width: 200px;' ,
placeHolder : this . txtAddText ,
2021-06-14 17:28:51 +00:00
validateOnBlur : false ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-06-21 13:35:23 +00:00
} ) . on ( 'keydown:before' , keyDownBefore ) ;
2019-05-16 08:52:49 +00:00
// modify info
2019-08-27 14:26:14 +00:00
this . lblModifyDate = $markup . findById ( '#id-info-modify-date' ) ;
this . lblModifyBy = $markup . findById ( '#id-info-modify-by' ) ;
2019-05-16 08:52:49 +00:00
// creation info
2019-08-27 14:26:14 +00:00
this . lblDate = $markup . findById ( '#id-info-date' ) ;
this . lblApplication = $markup . findById ( '#id-info-appname' ) ;
this . tblAuthor = $markup . findById ( '#id-info-author table' ) ;
this . trAuthor = $markup . findById ( '#id-info-add-author' ) . closest ( 'tr' ) ;
2021-12-03 14:08:41 +00:00
this . authorTpl = '<tr><td><div style="display: inline-block;width: 200px;"><input type="text" spellcheck="false" class="form-control" readonly="true" value="{0}" ></div><div class="tool close img-commonctrl" data-hint="2" data-hint-direction="right" data-hint-offset="small"></div></td></tr>' ;
2019-05-16 08:52:49 +00:00
this . tblAuthor . on ( 'click' , function ( e ) {
2019-08-27 14:26:14 +00:00
var btn = $markup . find ( e . target ) ;
2019-06-21 12:19:56 +00:00
if ( btn . hasClass ( 'close' ) && ! btn . hasClass ( 'disabled' ) ) {
2019-05-16 08:52:49 +00:00
var el = btn . closest ( 'tr' ) ,
idx = me . tblAuthor . find ( 'tr' ) . index ( el ) ;
el . remove ( ) ;
2019-06-21 11:34:40 +00:00
me . authors . splice ( idx , 1 ) ;
2020-08-07 12:27:04 +00:00
me . updateScroller ( true ) ;
2019-05-16 08:52:49 +00:00
}
} ) ;
this . inputAuthor = new Common . UI . InputField ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-info-add-author' ) ,
2019-05-16 08:52:49 +00:00
style : 'width: 200px;' ,
validateOnBlur : false ,
2021-06-14 17:28:51 +00:00
placeHolder : this . txtAddAuthor ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2019-09-06 14:38:29 +00:00
} ) . on ( 'changed:after' , function ( input , newValue , oldValue , e ) {
2019-06-21 12:37:11 +00:00
if ( newValue == oldValue ) return ;
2019-05-16 08:52:49 +00:00
var val = newValue . trim ( ) ;
if ( ! ! val && val !== oldValue . trim ( ) ) {
2019-09-06 14:38:29 +00:00
var isFromApply = e && e . relatedTarget && ( e . relatedTarget . id == 'fminfo-btn-apply' ) ;
2019-05-16 08:52:49 +00:00
val . split ( /\s*[,;]\s*/ ) . forEach ( function ( item ) {
var str = item . trim ( ) ;
if ( str ) {
2019-06-21 11:34:40 +00:00
me . authors . push ( item ) ;
2019-09-06 14:38:29 +00:00
if ( ! isFromApply ) {
var div = $ ( Common . Utils . String . format ( me . authorTpl , Common . Utils . String . htmlEncode ( str ) ) ) ;
me . trAuthor . before ( div ) ;
2020-08-07 12:27:04 +00:00
me . updateScroller ( ) ;
2019-09-06 14:38:29 +00:00
}
2019-05-16 08:52:49 +00:00
}
} ) ;
2019-09-06 14:38:29 +00:00
! isFromApply && me . inputAuthor . setValue ( '' ) ;
2019-05-16 08:52:49 +00:00
}
2019-06-21 13:35:23 +00:00
} ) . on ( 'keydown:before' , keyDownBefore ) ;
2016-03-11 00:48:53 +00:00
2019-09-06 14:38:29 +00:00
this . btnApply = new Common . UI . Button ( {
2019-10-08 09:11:07 +00:00
el : $markup . findById ( '#fminfo-btn-apply' )
2019-09-06 14:38:29 +00:00
} ) ;
this . btnApply . on ( 'click' , _ . bind ( this . applySettings , this ) ) ;
2020-08-07 12:27:04 +00:00
this . pnlInfo = $markup . find ( '.flex-settings' ) . addBack ( ) . filter ( '.flex-settings' ) ;
this . pnlApply = $markup . findById ( '#fms-flex-apply' ) ;
2016-03-11 00:48:53 +00:00
this . rendered = true ;
this . updateInfo ( this . doc ) ;
2019-08-27 14:26:14 +00:00
this . $el = $ ( node ) . html ( $markup ) ;
2016-03-11 00:48:53 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2020-08-07 12:27:04 +00:00
el : this . pnlInfo ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
2020-08-07 12:27:04 +00:00
Common . NotificationCenter . on ( {
'window:resize' : function ( ) {
me . isVisible ( ) && me . updateScroller ( ) ;
}
} ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
2019-05-16 08:52:49 +00:00
this . updateFileInfo ( ) ;
2020-08-07 12:27:04 +00:00
this . scroller && this . scroller . scrollTop ( 0 ) ;
this . updateScroller ( ) ;
2016-03-11 00:48:53 +00:00
} ,
hide : function ( ) {
Common . UI . BaseView . prototype . hide . call ( this , arguments ) ;
} ,
2020-08-07 12:27:04 +00:00
updateScroller : function ( destroy ) {
if ( this . scroller ) {
2020-08-11 16:33:58 +00:00
this . scroller . update ( destroy ? { } : undefined ) ;
2020-08-07 12:27:04 +00:00
this . pnlInfo . toggleClass ( 'bordered' , this . scroller . isVisible ( ) ) ;
}
} ,
2016-03-11 00:48:53 +00:00
updateInfo : function ( doc ) {
this . doc = doc ;
if ( ! this . rendered )
return ;
2019-05-16 08:52:49 +00:00
var visible = false ;
2016-03-11 00:48:53 +00:00
doc = doc || { } ;
if ( doc . info ) {
2019-05-16 08:52:49 +00:00
// server info
2016-03-11 00:48:53 +00:00
if ( doc . info . folder )
this . lblPlacement . text ( doc . info . folder ) ;
2019-05-16 08:52:49 +00:00
visible = this . _ShowHideInfoItem ( this . lblPlacement , doc . info . folder !== undefined && doc . info . folder !== null ) || visible ;
2021-02-04 13:05:49 +00:00
var value = doc . info . owner ;
2019-07-30 09:05:48 +00:00
if ( value )
this . lblOwner . text ( value ) ;
visible = this . _ShowHideInfoItem ( this . lblOwner , ! ! value ) || visible ;
2021-02-04 13:05:49 +00:00
value = doc . info . uploaded ;
2019-07-30 09:05:48 +00:00
if ( value )
this . lblUploaded . text ( value ) ;
visible = this . _ShowHideInfoItem ( this . lblUploaded , ! ! value ) || visible ;
2016-03-11 00:48:53 +00:00
} else
this . _ShowHideDocInfo ( false ) ;
2019-05-16 08:52:49 +00:00
$ ( 'tr.divider.general' , this . el ) [ visible ? 'show' : 'hide' ] ( ) ;
2018-11-06 09:58:02 +00:00
var appname = ( this . api ) ? this . api . asc _getAppProps ( ) : null ;
if ( appname ) {
2020-11-02 13:48:44 +00:00
appname = ( appname . asc _getApplication ( ) || '' ) + ( appname . asc _getAppVersion ( ) ? ' ' : '' ) + ( appname . asc _getAppVersion ( ) || '' ) ;
2018-11-06 09:58:02 +00:00
this . lblApplication . text ( appname ) ;
}
2019-05-16 08:52:49 +00:00
this . _ShowHideInfoItem ( this . lblApplication , ! ! appname ) ;
2019-06-21 11:34:40 +00:00
this . coreProps = ( this . api ) ? this . api . asc _getCoreProps ( ) : null ;
if ( this . coreProps ) {
var value = this . coreProps . asc _getCreated ( ) ;
2019-05-16 08:52:49 +00:00
if ( value )
2019-12-09 07:49:39 +00:00
this . lblDate . text ( value . toLocaleString ( this . mode . lang , { year : 'numeric' , month : '2-digit' , day : '2-digit' } ) + ' ' + value . toLocaleString ( this . mode . lang , { timeStyle : 'short' } ) ) ;
2019-05-16 08:52:49 +00:00
this . _ShowHideInfoItem ( this . lblDate , ! ! value ) ;
}
} ,
updateFileInfo : function ( ) {
if ( ! this . rendered )
return ;
var me = this ,
props = ( this . api ) ? this . api . asc _getCoreProps ( ) : null ,
value ;
2019-06-21 11:34:40 +00:00
this . coreProps = props ;
2019-05-16 08:52:49 +00:00
// var app = (this.api) ? this.api.asc_getAppProps() : null;
// if (app) {
// value = app.asc_getTotalTime();
// if (value)
// this.lblEditTime.text(value + ' ' + this.txtMinutes);
// }
// this._ShowHideInfoItem(this.lblEditTime, !!value);
if ( props ) {
var visible = false ;
value = props . asc _getModified ( ) ;
if ( value )
2019-12-09 07:49:39 +00:00
this . lblModifyDate . text ( value . toLocaleString ( this . mode . lang , { year : 'numeric' , month : '2-digit' , day : '2-digit' } ) + ' ' + value . toLocaleString ( this . mode . lang , { timeStyle : 'short' } ) ) ;
2019-05-16 08:52:49 +00:00
visible = this . _ShowHideInfoItem ( this . lblModifyDate , ! ! value ) || visible ;
value = props . asc _getLastModifiedBy ( ) ;
if ( value )
2021-03-26 11:29:16 +00:00
this . lblModifyBy . text ( AscCommon . UserInfoParser . getParsedName ( value ) ) ;
2019-05-16 08:52:49 +00:00
visible = this . _ShowHideInfoItem ( this . lblModifyBy , ! ! value ) || visible ;
$ ( 'tr.divider.modify' , this . el ) [ visible ? 'show' : 'hide' ] ( ) ;
value = props . asc _getTitle ( ) ;
this . inputTitle . setValue ( value || '' ) ;
value = props . asc _getSubject ( ) ;
this . inputSubject . setValue ( value || '' ) ;
value = props . asc _getDescription ( ) ;
this . inputComment . setValue ( value || '' ) ;
2019-09-06 14:38:29 +00:00
this . inputAuthor . setValue ( '' ) ;
2019-05-16 08:52:49 +00:00
this . tblAuthor . find ( 'tr:not(:last-of-type)' ) . remove ( ) ;
2019-06-21 11:34:40 +00:00
this . authors = [ ] ;
2019-05-16 08:52:49 +00:00
value = props . asc _getCreator ( ) ; //"123\"\"\"\<\>,456";
value && value . split ( /\s*[,;]\s*/ ) . forEach ( function ( item ) {
var div = $ ( Common . Utils . String . format ( me . authorTpl , Common . Utils . String . htmlEncode ( item ) ) ) ;
me . trAuthor . before ( div ) ;
2019-06-21 11:34:40 +00:00
me . authors . push ( item ) ;
2019-05-16 08:52:49 +00:00
} ) ;
2019-08-28 08:46:56 +00:00
this . tblAuthor . find ( '.close' ) . toggleClass ( 'hidden' , ! this . mode . isEdit ) ;
2019-10-31 07:16:53 +00:00
! this . mode . isEdit && this . _ShowHideInfoItem ( this . tblAuthor , ! ! this . authors . length ) ;
2019-05-16 08:52:49 +00:00
}
2019-08-28 08:46:56 +00:00
this . SetDisabled ( ) ;
2016-03-11 00:48:53 +00:00
} ,
2019-05-16 08:52:49 +00:00
_ShowHideInfoItem : function ( el , visible ) {
el . closest ( 'tr' ) [ visible ? 'show' : 'hide' ] ( ) ;
return visible ;
2016-03-11 00:48:53 +00:00
} ,
_ShowHideDocInfo : function ( visible ) {
2019-05-16 08:52:49 +00:00
this . _ShowHideInfoItem ( this . lblPlacement , visible ) ;
this . _ShowHideInfoItem ( this . lblOwner , visible ) ;
this . _ShowHideInfoItem ( this . lblUploaded , visible ) ;
2016-03-11 00:48:53 +00:00
} ,
setMode : function ( mode ) {
2019-08-28 08:46:56 +00:00
this . mode = mode ;
this . inputAuthor . setVisible ( mode . isEdit ) ;
2020-08-07 12:27:04 +00:00
this . pnlApply . toggleClass ( 'hidden' , ! mode . isEdit ) ;
2019-08-28 08:46:56 +00:00
this . tblAuthor . find ( '.close' ) . toggleClass ( 'hidden' , ! mode . isEdit ) ;
2019-10-31 07:16:53 +00:00
if ( ! mode . isEdit ) {
this . inputTitle . _input . attr ( 'placeholder' , '' ) ;
this . inputSubject . _input . attr ( 'placeholder' , '' ) ;
this . inputComment . _input . attr ( 'placeholder' , '' ) ;
this . inputAuthor . _input . attr ( 'placeholder' , '' ) ;
}
2019-08-28 08:46:56 +00:00
this . SetDisabled ( ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
2018-11-06 09:58:02 +00:00
setApi : function ( o ) {
this . api = o ;
2019-06-21 12:19:56 +00:00
this . api . asc _registerCallback ( 'asc_onLockCore' , _ . bind ( this . onLockCore , this ) ) ;
2018-11-06 09:58:02 +00:00
this . updateInfo ( this . doc ) ;
return this ;
} ,
2019-06-21 12:19:56 +00:00
onLockCore : function ( lock ) {
2019-08-28 08:46:56 +00:00
this . _locked = lock ;
this . updateFileInfo ( ) ;
} ,
SetDisabled : function ( ) {
var disable = ! this . mode . isEdit || this . _locked ;
this . inputTitle . setDisabled ( disable ) ;
this . inputSubject . setDisabled ( disable ) ;
this . inputComment . setDisabled ( disable ) ;
this . inputAuthor . setDisabled ( disable ) ;
this . tblAuthor . find ( '.close' ) . toggleClass ( 'disabled' , this . _locked ) ;
this . tblAuthor . toggleClass ( 'disabled' , disable ) ;
2019-09-06 14:38:29 +00:00
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 ( ) ;
2019-06-21 12:19:56 +00:00
} ,
2019-05-16 08:52:49 +00:00
txtPlacement : 'Location' ,
txtOwner : 'Owner' ,
txtUploaded : 'Uploaded' ,
txtAppName : 'Application' ,
txtTitle : 'Title' ,
txtSubject : 'Subject' ,
txtComment : 'Comment' ,
txtModifyDate : 'Last Modified' ,
txtModifyBy : 'Last Modified By' ,
2019-08-02 08:47:28 +00:00
txtCreated : 'Created' ,
2016-03-11 00:48:53 +00:00
txtAuthor : 'Author' ,
2019-05-16 08:52:49 +00:00
txtAddAuthor : 'Add Author' ,
txtAddText : 'Add Text' ,
2019-09-06 14:38:29 +00:00
txtMinutes : 'min' ,
okButtonText : 'Apply'
2016-03-11 00:48:53 +00:00
} , SSE . Views . FileMenuPanels . DocumentInfo || { } ) ) ;
SSE . Views . FileMenuPanels . DocumentRights = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-rights' ,
menu : undefined ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . rendered = false ;
this . template = _ . template ( [
2020-08-07 12:27:04 +00:00
'<table class="main" style="margin: 30px 0;">' ,
2016-03-11 00:48:53 +00:00
'<tr class="rights">' ,
'<td class="left" style="vertical-align: top;"><label>' + this . txtRights + '</label></td>' ,
'<td class="right"><div id="id-info-rights"></div></td>' ,
'</tr>' ,
'<tr class="edit-rights">' ,
'<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary custom" style="margin-right: 10px;">' + this . txtBtnAccessRights + '</button></td>' ,
'</tr>' ,
'</table>'
] . join ( '' ) ) ;
this . templateRights = _ . template ( [
'<table>' ,
'<% _.each(users, function(item) { %>' ,
'<tr>' ,
'<td><span class="userLink <% if (item.isLink) { %>sharedLink<% } %>"></span><span><%= Common.Utils.String.htmlEncode(item.user) %></span></td>' ,
'<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>' ,
'</tr>' ,
'<% }); %>' ,
'</table>'
] . join ( '' ) ) ;
this . menu = options . menu ;
} ,
2019-08-27 14:26:14 +00:00
render : function ( node ) {
var $markup = $ ( this . template ( ) ) ;
2016-03-11 00:48:53 +00:00
2019-08-27 14:26:14 +00:00
this . cntRights = $markup . findById ( '#id-info-rights' ) ;
2016-03-11 00:48:53 +00:00
this . btnEditRights = new Common . UI . Button ( {
2019-08-27 14:26:14 +00:00
el : $markup . findById ( '#id-info-btn-edit' )
2016-03-11 00:48:53 +00:00
} ) ;
this . btnEditRights . on ( 'click' , _ . bind ( this . changeAccessRights , this ) ) ;
this . rendered = true ;
this . updateInfo ( this . doc ) ;
2019-08-27 14:26:14 +00:00
this . $el = $ ( node ) . html ( $markup ) ;
2016-03-11 00:48:53 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2016-03-11 00:48:53 +00:00
} ) ;
}
2019-10-09 10:23:40 +00:00
Common . NotificationCenter . on ( 'collaboration:sharingupdate' , this . updateSharingSettings . bind ( this ) ) ;
2019-08-27 14:26:14 +00:00
Common . NotificationCenter . on ( 'collaboration:sharingdeny' , this . onLostEditRights . bind ( this ) ) ;
2017-10-12 10:43:23 +00:00
2016-03-11 00:48:53 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
2020-06-11 11:00:23 +00:00
this . scroller && this . scroller . update ( ) ;
2016-03-11 00:48:53 +00:00
} ,
hide : function ( ) {
Common . UI . BaseView . prototype . hide . call ( this , arguments ) ;
} ,
updateInfo : function ( doc ) {
this . doc = doc ;
if ( ! this . rendered )
return ;
doc = doc || { } ;
if ( doc . info ) {
if ( doc . info . sharingSettings )
this . cntRights . html ( this . templateRights ( { users : doc . info . sharingSettings } ) ) ;
this . _ShowHideInfoItem ( 'rights' , doc . info . sharingSettings !== undefined && doc . info . sharingSettings !== null && doc . info . sharingSettings . length > 0 ) ;
2019-11-28 13:54:14 +00:00
this . _ShowHideInfoItem ( 'edit-rights' , ( ! ! this . sharingSettingsUrl && this . sharingSettingsUrl . length || this . mode . canRequestSharingSettings ) && this . _readonlyRights !== true ) ;
2016-03-11 00:48:53 +00:00
} else
this . _ShowHideDocInfo ( false ) ;
} ,
_ShowHideInfoItem : function ( cls , visible ) {
$ ( 'tr.' + cls , this . el ) [ visible ? 'show' : 'hide' ] ( ) ;
} ,
_ShowHideDocInfo : function ( visible ) {
this . _ShowHideInfoItem ( 'rights' , visible ) ;
this . _ShowHideInfoItem ( 'edit-rights' , visible ) ;
} ,
setMode : function ( mode ) {
2019-11-28 13:54:14 +00:00
this . mode = mode ;
2016-03-11 00:48:53 +00:00
this . sharingSettingsUrl = mode . sharingSettingsUrl ;
return this ;
} ,
changeAccessRights : function ( btn , event , opts ) {
2019-10-09 10:23:40 +00:00
Common . NotificationCenter . trigger ( 'collaboration:sharing' ) ;
2019-07-11 15:00:11 +00:00
} ,
updateSharingSettings : function ( rights ) {
this . _ShowHideInfoItem ( 'rights' , this . doc . info . sharingSettings !== undefined && this . doc . info . sharingSettings !== null && this . doc . info . sharingSettings . length > 0 ) ;
this . cntRights . html ( this . templateRights ( { users : this . doc . info . sharingSettings } ) ) ;
} ,
2016-03-11 00:48:53 +00:00
onLostEditRights : function ( ) {
this . _readonlyRights = true ;
if ( ! this . rendered )
return ;
this . _ShowHideInfoItem ( 'edit-rights' , false ) ;
} ,
txtRights : 'Persons who have rights' ,
txtBtnAccessRights : 'Change access rights'
} , SSE . Views . FileMenuPanels . DocumentRights || { } ) ) ;
SSE . Views . FileMenuPanels . Help = Common . UI . BaseView . extend ( {
el : '#panel-help' ,
menu : undefined ,
template : _ . template ( [
'<div style="width:100%; height:100%; position: relative;">' ,
2018-01-15 14:08:35 +00:00
'<div id="id-help-contents" style="position: absolute; width:220px; top: 0; bottom: 0;" class="no-padding"></div>' ,
'<div id="id-help-frame" style="position: absolute; left: 220px; top: 0; right: 0; bottom: 0;" class="no-padding"></div>' ,
2016-03-11 00:48:53 +00:00
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2021-05-11 22:33:51 +00:00
this . urlPref = 'resources/help/{{DEFAULT_LANG}}/' ;
2020-08-25 16:38:52 +00:00
this . openUrl = null ;
2016-03-11 00:48:53 +00:00
this . en _data = [
2018-01-15 14:32:17 +00:00
{ "src" : "ProgramInterface/ProgramInterface.htm" , "name" : "Introducing Spreadsheet Editor user interface" , "headername" : "Program Interface" } ,
{ "src" : "ProgramInterface/FileTab.htm" , "name" : "File tab" } ,
{ "src" : "ProgramInterface/HomeTab.htm" , "name" : "Home Tab" } ,
{ "src" : "ProgramInterface/InsertTab.htm" , "name" : "Insert tab" } ,
{ "src" : "ProgramInterface/PluginsTab.htm" , "name" : "Plugins tab" } ,
{ "src" : "UsageInstructions/OpenCreateNew.htm" , "name" : "Create a new spreadsheet or open an existing one" , "headername" : "Basic operations" } ,
{ "src" : "UsageInstructions/CopyPasteData.htm" , "name" : "Cut/copy/paste data" } ,
{ "src" : "UsageInstructions/UndoRedo.htm" , "name" : "Undo/redo your actions" } ,
{ "src" : "UsageInstructions/ManageSheets.htm" , "name" : "Manage sheets" , "headername" : "Operations with sheets" } ,
{ "src" : "UsageInstructions/FontTypeSizeStyle.htm" , "name" : "Set font type, size, style, and colors" , "headername" : "Cell text formatting" } ,
{ "src" : "UsageInstructions/AddHyperlinks.htm" , "name" : "Add hyperlinks" } ,
{ "src" : "UsageInstructions/ClearFormatting.htm" , "name" : "Clear text, format in a cell, copy cell format" } ,
{ "src" : "UsageInstructions/AddBorders.htm" , "name" : "Add borders" , "headername" : "Editing cell properties" } ,
{ "src" : "UsageInstructions/AlignText.htm" , "name" : "Align data in cells" } ,
{ "src" : "UsageInstructions/MergeCells.htm" , "name" : "Merge cells" } ,
{ "src" : "UsageInstructions/ChangeNumberFormat.htm" , "name" : "Change number format" } ,
{ "src" : "UsageInstructions/InsertDeleteCells.htm" , "name" : "Manage cells, rows, and columns" , "headername" : "Editing rows/columns" } ,
{ "src" : "UsageInstructions/SortData.htm" , "name" : "Sort and filter data" } ,
{ "src" : "UsageInstructions/InsertFunction.htm" , "name" : "Insert function" , "headername" : "Work with functions" } ,
{ "src" : "UsageInstructions/UseNamedRanges.htm" , "name" : "Use named ranges" } ,
{ "src" : "UsageInstructions/InsertImages.htm" , "name" : "Insert images" , "headername" : "Operations on objects" } ,
{ "src" : "UsageInstructions/InsertChart.htm" , "name" : "Insert chart" } ,
{ "src" : "UsageInstructions/InsertAutoshapes.htm" , "name" : "Insert and format autoshapes" } ,
{ "src" : "UsageInstructions/InsertTextObjects.htm" , "name" : "Insert text objects" } ,
{ "src" : "UsageInstructions/ManipulateObjects.htm" , "name" : "Manipulate objects" } ,
{ "src" : "UsageInstructions/InsertEquation.htm" , "name" : "Insert equations" , "headername" : "Math equations" } ,
{ "src" : "HelpfulHints/CollaborativeEditing.htm" , "name" : "Collaborative spreadsheet editing" , "headername" : "Spreadsheet co-editing" } ,
{ "src" : "UsageInstructions/ViewDocInfo.htm" , "name" : "View file information" , "headername" : "Tools and settings" } ,
{ "src" : "UsageInstructions/SavePrintDownload.htm" , "name" : "Save/print/download your spreadsheet" } ,
{ "src" : "HelpfulHints/AdvancedSettings.htm" , "name" : "Advanced settings of Spreadsheet Editor" } ,
{ "src" : "HelpfulHints/Navigation.htm" , "name" : "View settings and navigation tools" } ,
{ "src" : "HelpfulHints/Search.htm" , "name" : "Search and replace functions" } ,
{ "src" : "HelpfulHints/About.htm" , "name" : "About Spreadsheet Editor" , "headername" : "Helpful hints" } ,
{ "src" : "HelpfulHints/SupportedFormats.htm" , "name" : "Supported formats of spreadsheets" } ,
{ "src" : "HelpfulHints/KeyboardShortcuts.htm" , "name" : "Keyboard shortcuts" }
2016-03-11 00:48:53 +00:00
] ;
if ( Common . Utils . isIE ) {
window . onhelp = function ( ) { return false ; }
}
} ,
render : function ( ) {
var me = this ;
2019-08-27 14:26:14 +00:00
this . $el . html ( this . template ( ) ) ;
2016-03-11 00:48:53 +00:00
this . viewHelpPicker = new Common . UI . DataView ( {
el : $ ( '#id-help-contents' ) ,
store : new Common . UI . DataViewStore ( [ ] ) ,
keyMoveDirection : 'vertical' ,
itemTemplate : _ . template ( [
'<div id="<%= id %>" class="help-item-wrap">' ,
'<div class="caption"><%= name %></div>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . viewHelpPicker . on ( 'item:add' , function ( dataview , itemview , record ) {
if ( record . has ( 'headername' ) ) {
$ ( itemview . el ) . before ( '<div class="header-name">' + record . get ( 'headername' ) + '</div>' ) ;
}
} ) ;
this . viewHelpPicker . on ( 'item:select' , function ( dataview , itemview , record ) {
2020-08-25 16:38:52 +00:00
me . onSelectItem ( record . get ( 'src' ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;
this . iFrame = document . createElement ( 'iframe' ) ;
this . iFrame . src = "" ;
this . iFrame . align = "top" ;
this . iFrame . frameBorder = "0" ;
this . iFrame . width = "100%" ;
this . iFrame . height = "100%" ;
Common . Gateway . on ( 'internalcommand' , function ( data ) {
if ( data . type == 'help:hyperlink' ) {
var src = data . data ;
var rec = me . viewHelpPicker . store . find ( function ( record ) {
return ( src . indexOf ( record . get ( 'src' ) ) > 0 ) ;
} ) ;
if ( rec ) {
me . viewHelpPicker . selectRecord ( rec , true ) ;
me . viewHelpPicker . scrollToRecord ( rec ) ;
}
}
} ) ;
$ ( '#id-help-frame' ) . append ( this . iFrame ) ;
return this ;
} ,
setLangConfig : function ( lang ) {
var me = this ;
var store = this . viewHelpPicker . store ;
if ( lang ) {
2018-01-24 11:40:59 +00:00
lang = lang . split ( /[\-\_]/ ) [ 0 ] ;
2016-03-11 00:48:53 +00:00
var config = {
dataType : 'json' ,
error : function ( ) {
2021-05-11 22:33:51 +00:00
if ( me . urlPref . indexOf ( 'resources/help/{{DEFAULT_LANG}}/' ) < 0 ) {
me . urlPref = 'resources/help/{{DEFAULT_LANG}}/' ;
store . url = 'resources/help/{{DEFAULT_LANG}}/Contents.json' ;
2016-03-11 00:48:53 +00:00
store . fetch ( config ) ;
} else {
2021-05-11 22:33:51 +00:00
me . urlPref = 'resources/help/{{DEFAULT_LANG}}/' ;
2016-03-11 00:48:53 +00:00
store . reset ( me . en _data ) ;
}
} ,
success : function ( ) {
2020-08-25 16:38:52 +00:00
var rec = me . openUrl ? store . find ( function ( record ) {
return ( me . openUrl . indexOf ( record . get ( 'src' ) ) >= 0 ) ;
} ) : store . at ( 0 ) ;
if ( rec ) {
me . viewHelpPicker . selectRecord ( rec , true ) ;
me . viewHelpPicker . scrollToRecord ( rec ) ;
}
me . onSelectItem ( me . openUrl ? me . openUrl : rec . get ( 'src' ) ) ;
2016-03-11 00:48:53 +00:00
}
} ;
store . url = 'resources/help/' + lang + '/Contents.json' ;
store . fetch ( config ) ;
this . urlPref = 'resources/help/' + lang + '/' ;
}
} ,
2020-08-25 16:38:52 +00:00
show : function ( url ) {
2016-03-11 00:48:53 +00:00
Common . UI . BaseView . prototype . show . call ( this ) ;
if ( ! this . _scrollerInited ) {
this . viewHelpPicker . scroller . update ( ) ;
this . _scrollerInited = true ;
}
2020-08-25 16:38:52 +00:00
if ( url ) {
if ( this . viewHelpPicker . store . length > 0 ) {
var rec = this . viewHelpPicker . store . find ( function ( record ) {
return ( url . indexOf ( record . get ( 'src' ) ) >= 0 ) ;
} ) ;
if ( rec ) {
this . viewHelpPicker . selectRecord ( rec , true ) ;
this . viewHelpPicker . scrollToRecord ( rec ) ;
}
this . onSelectItem ( url ) ;
} else
this . openUrl = url ;
}
} ,
onSelectItem : function ( src ) {
this . iFrame . src = this . urlPref + src ;
2016-03-11 00:48:53 +00:00
}
} ) ;
2017-09-13 08:57:30 +00:00
SSE . Views . FileMenuPanels . ProtectDoc = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-protect' ,
menu : undefined ,
template : _ . template ( [
2017-11-17 14:35:40 +00:00
'<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>' ,
2018-04-27 13:14:18 +00:00
'<td colspan="2"><label style="cursor: default;"><%= scope.txtEncrypted %></label></td>' ,
2017-11-17 14:35:40 +00:00
'</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>'
2017-09-13 08:57:30 +00:00
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2017-11-17 14:35:40 +00:00
var me = this ;
this . templateSignature = _ . template ( [
'<table cols="2" width="300" class="<% if (!hasRequested && !hasSigned) { %>hidden<% } %>"">' ,
'<tr>' ,
2018-04-27 13:14:18 +00:00
'<td colspan="2"><label style="cursor: default;"><%= tipText %></label></td>' ,
2017-11-17 14:35:40 +00:00
'</tr>' ,
'<tr>' ,
2021-12-03 12:38:00 +00:00
'<td><label class="link signature-view-link" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium">' + me . txtView + '</label></td>' ,
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium">' + me . txtEdit + '</label></td>' ,
2017-11-17 14:35:40 +00:00
'</tr>' ,
2017-09-13 08:57:30 +00:00
'</table>'
] . join ( '' ) ) ;
} ,
render : function ( ) {
2019-08-27 14:26:14 +00:00
this . $el . html ( this . template ( { scope : this } ) ) ;
2017-09-13 08:57:30 +00:00
2017-11-17 14:35:40 +00:00
var protection = SSE . getController ( 'Common.Controllers.Protection' ) . getView ( ) ;
2017-09-13 08:57:30 +00:00
2017-11-17 14:35:40 +00:00
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 ) ) ;
2017-09-13 08:57:30 +00:00
2018-08-01 16:08:24 +00:00
this . cntPassword = $ ( '#id-fms-password' ) ;
this . cntPasswordView = $ ( '#id-fms-view-pwd' ) ;
2017-09-13 08:57:30 +00:00
2017-11-17 14:35:40 +00:00
this . btnAddInvisibleSign = protection . getButton ( 'signature' ) ;
this . btnAddInvisibleSign . render ( this . $el . find ( '#fms-btn-invisible-sign' ) ) ;
this . btnAddInvisibleSign . on ( 'click' , _ . bind ( this . closeMenu , this ) ) ;
2017-09-13 08:57:30 +00:00
2017-11-17 14:35:40 +00:00
this . cntSignature = $ ( '#id-fms-signature' ) ;
this . cntSignatureView = $ ( '#id-fms-signature-view' ) ;
2017-09-13 08:57:30 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
2019-08-27 14:26:14 +00:00
el : this . $el ,
2020-06-11 11:00:23 +00:00
suppressScrollX : true ,
alwaysVisibleY : true
2017-09-13 08:57:30 +00:00
} ) ;
}
2017-11-17 14:35:40 +00:00
this . $el . on ( 'click' , '.signature-edit-link' , _ . bind ( this . onEdit , this ) ) ;
this . $el . on ( 'click' , '.signature-view-link' , _ . bind ( this . onView , this ) ) ;
2017-09-13 08:57:30 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . updateSignatures ( ) ;
2017-11-17 14:35:40 +00:00
this . updateEncrypt ( ) ;
2020-06-11 11:00:23 +00:00
this . scroller && this . scroller . update ( ) ;
2017-09-13 08:57:30 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
2018-08-01 16:08:24 +00:00
this . cntSignature . toggleClass ( 'hidden' , ! this . mode . isSignatureSupport ) ;
this . cntPassword . toggleClass ( 'hidden' , ! this . mode . isPasswordSupport ) ;
2017-09-13 08:57:30 +00:00
} ,
setApi : function ( o ) {
this . api = o ;
return this ;
} ,
2017-11-17 14:35:40 +00:00
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 ( ) ;
}
}
} ) ;
2017-09-13 08:57:30 +00:00
} ,
2017-11-17 14:35:40 +00:00
onView : function ( ) {
this . menu && this . menu . hide ( ) ;
SSE . getController ( 'RightMenu' ) . rightmenu . SetActivePane ( Common . Utils . documentSettingsType . Signature , true ) ;
2017-09-13 08:57:30 +00:00
} ,
updateSignatures : function ( ) {
var requested = this . api . asc _getRequestSignatures ( ) ,
valid = this . api . asc _getSignatures ( ) ,
2017-11-17 14:35:40 +00:00
hasRequested = requested && requested . length > 0 ,
hasValid = false ,
hasInvalid = false ;
2017-09-13 08:57:30 +00:00
_ . each ( valid , function ( item , index ) {
2017-11-17 14:35:40 +00:00
if ( item . asc _getValid ( ) == 0 )
hasValid = true ;
else
hasInvalid = true ;
2017-09-13 08:57:30 +00:00
} ) ;
2017-11-10 07:50:01 +00:00
2017-11-17 14:35:40 +00:00
// hasRequested = true;
// hasValid = true;
// hasInvalid = true;
2017-11-10 07:50:01 +00:00
2017-11-17 14:35:40 +00:00
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 } ) ) ;
} ,
2017-11-10 07:50:01 +00:00
2017-11-17 14:35:40 +00:00
updateEncrypt : function ( ) {
2018-08-01 16:08:24 +00:00
this . cntPasswordView . toggleClass ( 'hidden' , this . btnAddPwd . isVisible ( ) ) ;
2017-09-13 08:57:30 +00:00
} ,
2017-11-19 08:02:09 +00:00
strProtect : 'Protect Workbook' ,
2017-12-06 11:37:06 +00:00
strSignature : 'With Signature' ,
2017-11-17 14:35:40 +00:00
txtView : 'View signatures' ,
2017-11-19 08:02:09 +00:00
txtEdit : 'Edit workbook' ,
txtSigned : 'Valid signatures has been added to the workbook. The workbook is protected from editing.' ,
txtSignedInvalid : 'Some of the digital signatures in workbook are invalid or could not be verified. The workbook is protected from editing.' ,
txtRequestedSignatures : 'This workbook needs to be signed.' ,
2017-11-17 14:35:40 +00:00
notcriticalErrorTitle : 'Warning' ,
2017-11-19 08:02:09 +00:00
txtEditWarning : 'Editing will remove the signatures from the workbook.<br>Are you sure you want to continue?' ,
2017-12-06 11:37:06 +00:00
strEncrypt : 'With Password' ,
2017-11-19 08:02:09 +00:00
txtEncrypted : 'This workbook has been protected by password'
2017-09-13 08:57:30 +00:00
} , SSE . Views . FileMenuPanels . ProtectDoc || { } ) ) ;
2021-10-19 16:03:31 +00:00
SSE . Views . PrintWithPreview = Common . UI . BaseView . extend ( _ . extend ( {
2021-10-18 08:21:30 +00:00
el : '#panel-print' ,
menu : undefined ,
template : _ . template ( [
'<div style="width:100%; height:100%; position: relative;">' ,
2021-10-18 16:35:23 +00:00
'<div id="id-print-settings" class="no-padding">' ,
'<div class="print-settings">' ,
'<div class="flex-settings ps-container oo settings-container">' ,
'<table style="width: 100%;">' ,
2021-10-18 08:21:30 +00:00
'<tbody>' ,
2021-10-18 16:35:23 +00:00
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>' ,
'<tr><td class="padding-small"><div id="print-combo-range" style="width: 248px;"></div></td></tr>' ,
'<tr><td class="padding-large"><div id="print-chb-ignore" style="width: 248px;"></div></td></tr>' ,
'<tr><td><label class="header"><%= scope.txtSettingsOfSheet %></label></td></tr>' ,
'<tr><td class="padding-large"><div id="print-combo-sheets" style="width: 248px;"></div></td></tr>' ,
'<tr><td><label class="header"><%= scope.txtPageSize %></label></td></tr>' ,
'<tr><td class="padding-large"><div id="print-combo-pages" style="width: 248px;"></div></td></tr>' ,
'<tr><td><label class="header"><%= scope.txtPageOrientation %></label></td></tr>' ,
'<tr><td class="padding-large"><div id="print-combo-orient" style="width: 134px;"></div></td></tr>' ,
'<tr><td><label class="header"><%= scope.txtScaling %></label></td></tr>' ,
'<tr><td class="padding-large"><div id="print-combo-layout" style="width: 248px;"></div></td></tr>' ,
'<tr><td class="padding-small"><label class="header"><%= scope.txtPrintTitles %></label></td></tr>' ,
2021-10-18 08:21:30 +00:00
'<tr><td><label><%= scope.txtRepeatRowsAtTop %></label></td></tr>' ,
2021-10-18 16:35:23 +00:00
'<tr><td class="padding-small">' ,
'<table><tbody><tr>' ,
'<td><div id="print-txt-top" style="width: 163px; margin-right: 8px;"></div></td>' ,
'<td><div id="print-presets-top" style="width: 77px;"></div></td>' ,
'</tr></tbody></table>' ,
'</td></tr>' ,
2021-10-18 08:21:30 +00:00
'<tr><td><label><%= scope.txtRepeatColumnsAtLeft %></label></td></tr>' ,
2021-10-18 16:35:23 +00:00
'<tr><td class="padding-large">' ,
'<table><tbody><tr>' ,
'<td><div id="print-txt-left" style="width: 163px; margin-right: 8px;"></div></td>' ,
'<td><div id="print-presets-left" style="width: 77px;"></div></td>' ,
'</tr></tbody></table>' ,
'</td></tr>' ,
'<tr><td class="padding-small"><label class="header"><%= scope.txtMargins %></label></td></tr>' ,
'<tr><td>' ,
'<table>' ,
'<tbody>' ,
'<tr>' ,
'<td><label><%= scope.txtTop %></label></td>' ,
'<td><label><%= scope.txtBottom %></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="padding-small"><div id="print-spin-margin-top" style="margin-right: 8px;"></div></td>' ,
'<td class="padding-small"><div id="print-spin-margin-bottom" style="margin-right: 8px;"></div></td>' ,
'</tr>' ,
'<tr>' ,
'<td><label><%= scope.txtLeft %></label></td>' ,
'<td><label><%= scope.txtRight %></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td class="padding-large"><div id="print-spin-margin-left"></div></td>' ,
'<td class="padding-large"><div id="print-spin-margin-right"></div></td>' ,
'</tr>' ,
'</tbody>' ,
'</table>' ,
'</td></tr>' ,
'<tr><td class="padding-small"><label class="header"><%= scope.txtGridlinesAndHeadings %></label></td></tr>' ,
'<tr><td class="padding-small"><div id="print-chb-grid" style="width: 248px;"></div></td></tr>' ,
'<tr><td class="padding-large"><div id="print-chb-rows" style="width: 248px;"></div></td></tr>' ,
'<tr><td class="padding-large"><label class="link" id="print-header-footer-settings" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtHeaderFooterSettings %></label></td></tr>' ,
2021-10-22 18:17:45 +00:00
//'<tr><td class="padding-large"><button type="button" class="btn btn-text-default" id="print-apply-all" style="width: 118px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtApplyToAllSheets %></button></td></tr>',
2021-10-18 16:35:23 +00:00
'<tr class="fms-btn-apply"><td>' ,
'<div class="footer justify">' ,
2021-11-26 07:28:27 +00:00
'<button id="print-btn-print-0" class="btn normal dlg-btn primary" result="print" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button>' ,
'<button id="print-btn-save-0" class="btn normal dlg-btn" result="save" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtSave %></button>' ,
2021-10-18 16:35:23 +00:00
'</div>' ,
'</td></tr>' ,
2021-10-18 08:21:30 +00:00
'</tbody>' ,
'</table>' ,
'</div>' ,
'<div class="fms-flex-apply hidden">' ,
'<div class="footer justify">' ,
2021-11-26 07:28:27 +00:00
'<button id="print-btn-print-1" class="btn normal dlg-btn primary" result="print" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button>' ,
'<button id="print-btn-save-1" class="btn normal dlg-btn" result="save" style="width: 96px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtSave %></button>' ,
2021-10-18 08:21:30 +00:00
'</div>' ,
'</div>' ,
'</div>' ,
'</div>' ,
2021-10-18 16:35:23 +00:00
'<div id="print-preview-box" style="position: absolute; left: 280px; top: 0; right: 0; bottom: 0;" class="no-padding">' ,
'<div id="print-preview"></div>' ,
2021-10-22 18:17:45 +00:00
'<div id="print-navigation">' ,
'<div id="print-prev-page" style="display: inline-block; margin-right: 4px;"></div>' ,
'<div id="print-next-page" style="display: inline-block;"></div>' ,
2021-10-25 08:37:28 +00:00
'<div class="page-number">' ,
'<label><%= scope.txtPage %></label>' ,
'<div id="print-number-page"></div>' ,
'<label id="print-count-page"><%= scope.txtOf %></label>' ,
'</div>' ,
'<label id="print-active-sheet"><%= scope.txtSheet %></label>' ,
2021-10-22 18:17:45 +00:00
'</div>' ,
2021-10-18 08:21:30 +00:00
'</div>' ,
2022-02-07 21:04:34 +00:00
'<div id="print-preview-empty" class="hidden">' ,
'<div><%= scope.txtEmptyTable %></div>' ,
'</div>' ,
2021-10-18 08:21:30 +00:00
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
2021-10-18 16:35:23 +00:00
this . spinners = [ ] ;
2021-10-19 16:03:31 +00:00
this . _initSettings = true ;
2021-10-18 08:21:30 +00:00
} ,
render : function ( node ) {
2021-10-18 16:35:23 +00:00
var me = this ;
2021-10-18 08:21:30 +00:00
var $markup = $ ( this . template ( { scope : this } ) ) ;
this . cmbRange = new Common . UI . ComboBox ( {
el : $markup . findById ( '#print-combo-range' ) ,
2021-10-18 16:35:23 +00:00
menuStyle : 'min-width: 248px;max-height: 280px;' ,
2021-10-18 08:21:30 +00:00
editable : false ,
takeFocusOnClose : true ,
cls : 'input-group-nr' ,
data : [
{ value : Asc . c _oAscPrintType . ActiveSheets , displayValue : this . txtCurrentSheet } ,
{ value : Asc . c _oAscPrintType . EntireWorkbook , displayValue : this . txtAllSheets } ,
{ value : Asc . c _oAscPrintType . Selection , displayValue : this . txtSelection }
2021-10-22 18:17:45 +00:00
] ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
2021-10-20 14:56:06 +00:00
this . cmbRange . on ( 'selected' , _ . bind ( this . comboRangeChange , this ) ) ;
2021-10-18 08:21:30 +00:00
2021-10-18 16:35:23 +00:00
this . chIgnorePrintArea = new Common . UI . CheckBox ( {
el : $markup . findById ( '#print-chb-ignore' ) ,
2021-10-22 18:17:45 +00:00
labelText : this . txtIgnore ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2021-10-18 16:35:23 +00:00
} ) ;
2021-10-18 08:21:30 +00:00
this . cmbSheet = new Common . UI . ComboBox ( {
el : $markup . findById ( '#print-combo-sheets' ) ,
2021-10-18 16:35:23 +00:00
menuStyle : 'min-width: 248px;max-height: 280px;' ,
2021-10-18 08:21:30 +00:00
editable : false ,
cls : 'input-group-nr' ,
data : [ ] ,
2021-10-22 18:17:45 +00:00
takeFocusOnClose : true ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
this . cmbPaperSize = new Common . UI . ComboBox ( {
el : $markup . findById ( '#print-combo-pages' ) ,
2021-10-18 16:35:23 +00:00
menuStyle : 'max-height: 280px; min-width: 248px;' ,
2021-10-18 08:21:30 +00:00
editable : false ,
takeFocusOnClose : true ,
cls : 'input-group-nr' ,
data : [
{ value : '215.9|279.4' , displayValue : 'US Letter (21,59cm x 27,94cm)' , caption : 'US Letter' } ,
{ value : '215.9|355.6' , displayValue : 'US Legal (21,59cm x 35,56cm)' , caption : 'US Legal' } ,
{ value : '210|297' , displayValue : 'A4 (21cm x 29,7cm)' , caption : 'A4' } ,
{ value : '148|210' , displayValue : 'A5 (14,8cm x 21cm)' , caption : 'A5' } ,
{ value : '176|250' , displayValue : 'B5 (17,6cm x 25cm)' , caption : 'B5' } ,
{ value : '104.8|241.3' , displayValue : 'Envelope #10 (10,48cm x 24,13cm)' , caption : 'Envelope #10' } ,
{ value : '110|220' , displayValue : 'Envelope DL (11cm x 22cm)' , caption : 'Envelope DL' } ,
{ value : '279.4|431.8' , displayValue : 'Tabloid (27,94cm x 43,18cm)' , caption : 'Tabloid' } ,
{ value : '297|420' , displayValue : 'A3 (29,7cm x 42cm)' , caption : 'A3' } ,
{ value : '304.8|457.1' , displayValue : 'Tabloid Oversize (30,48cm x 45,71cm)' , caption : 'Tabloid Oversize' } ,
{ value : '196.8|273' , displayValue : 'ROC 16K (19,68cm x 27,3cm)' , caption : 'ROC 16K' } ,
{ value : '119.9|234.9' , displayValue : 'Envelope Choukei 3 (11,99cm x 23,49cm)' , caption : 'Envelope Choukei 3' } ,
{ value : '330.2|482.5' , displayValue : 'Super B/A3 (33,02cm x 48,25cm)' , caption : 'Super B/A3' }
2021-10-22 18:17:45 +00:00
] ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
this . cmbPaperOrientation = new Common . UI . ComboBox ( {
el : $markup . findById ( '#print-combo-orient' ) ,
2021-10-18 16:35:23 +00:00
menuStyle : 'min-width: 134px;' ,
2021-10-18 08:21:30 +00:00
editable : false ,
takeFocusOnClose : true ,
cls : 'input-group-nr' ,
data : [
{ value : Asc . c _oAscPageOrientation . PagePortrait , displayValue : this . txtPortrait } ,
{ value : Asc . c _oAscPageOrientation . PageLandscape , displayValue : this . txtLandscape }
2021-10-22 18:17:45 +00:00
] ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
var itemsTemplate =
_ . template ( [
'<% _.each(items, function(item) { %>' ,
2021-12-14 13:46:44 +00:00
'<li id="<%= item.id %>" data-value="<%= item.value %>" <% if (item.value === "customoptions") { %> class="border-top" style="margin-top: 5px;padding-top: 5px;" <% } %> ><a tabindex="-1" type="menuitem">' ,
2021-10-18 08:21:30 +00:00
'<%= scope.getDisplayValue(item) %>' ,
'</a></li>' ,
'<% }); %>'
] . join ( '' ) ) ;
this . cmbLayout = new Common . UI . ComboBox ( {
el : $markup . findById ( '#print-combo-layout' ) ,
2021-10-18 16:35:23 +00:00
menuStyle : 'min-width: 248px;' ,
2021-10-18 08:21:30 +00:00
editable : false ,
takeFocusOnClose : true ,
cls : 'input-group-nr' ,
data : [
{ value : 0 , displayValue : this . txtActualSize } ,
{ value : 1 , displayValue : this . txtFitPage } ,
{ value : 2 , displayValue : this . txtFitCols } ,
{ value : 3 , displayValue : this . txtFitRows } ,
{ value : 'customoptions' , displayValue : this . txtCustomOptions }
] ,
2021-10-22 18:17:45 +00:00
itemsTemplate : itemsTemplate ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
2021-10-21 12:20:32 +00:00
this . txtRangeTop = new Common . UI . InputField ( {
2021-10-18 08:21:30 +00:00
el : $markup . findById ( '#print-txt-top' ) ,
allowBlank : true ,
2021-10-22 18:17:45 +00:00
validateOnChange : true ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2021-10-18 08:21:30 +00:00
} ) ;
this . btnPresetsTop = new Common . UI . Button ( {
parentEl : $markup . findById ( '#print-presets-top' ) ,
cls : 'btn-text-menu-default' ,
caption : this . txtRepeat ,
2021-10-18 16:35:23 +00:00
style : 'width: 77px;' ,
2021-10-22 18:17:45 +00:00
menu : true ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
2021-10-21 12:20:32 +00:00
this . txtRangeLeft = new Common . UI . InputField ( {
2021-10-18 08:21:30 +00:00
el : $markup . findById ( '#print-txt-left' ) ,
allowBlank : true ,
2021-10-22 18:17:45 +00:00
validateOnChange : true ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2021-10-18 08:21:30 +00:00
} ) ;
this . btnPresetsLeft = new Common . UI . Button ( {
parentEl : $markup . findById ( '#print-presets-left' ) ,
cls : 'btn-text-menu-default' ,
caption : this . txtRepeat ,
2021-10-18 16:35:23 +00:00
style : 'width: 77px;' ,
2021-10-22 18:17:45 +00:00
menu : true ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 08:21:30 +00:00
} ) ;
2021-10-18 16:35:23 +00:00
this . spnMarginTop = new Common . UI . MetricSpinner ( {
el : $markup . findById ( '#print-spin-margin-top' ) ,
step : . 1 ,
width : 120 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 48.25 ,
2021-10-22 18:17:45 +00:00
minValue : 0 ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 16:35:23 +00:00
} ) ;
this . spinners . push ( this . spnMarginTop ) ;
this . spnMarginBottom = new Common . UI . MetricSpinner ( {
el : $markup . findById ( '#print-spin-margin-bottom' ) ,
step : . 1 ,
width : 120 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 48.25 ,
2021-10-22 18:17:45 +00:00
minValue : 0 ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 16:35:23 +00:00
} ) ;
this . spinners . push ( this . spnMarginBottom ) ;
this . spnMarginLeft = new Common . UI . MetricSpinner ( {
el : $markup . findById ( '#print-spin-margin-left' ) ,
step : . 1 ,
width : 120 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 48.25 ,
2021-10-22 18:17:45 +00:00
minValue : 0 ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 16:35:23 +00:00
} ) ;
this . spinners . push ( this . spnMarginLeft ) ;
this . spnMarginRight = new Common . UI . MetricSpinner ( {
el : $markup . findById ( '#print-spin-margin-right' ) ,
step : . 1 ,
width : 120 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 48.25 ,
2021-10-22 18:17:45 +00:00
minValue : 0 ,
dataHint : '2' ,
dataHintDirection : 'bottom' ,
dataHintOffset : 'big'
2021-10-18 16:35:23 +00:00
} ) ;
this . spinners . push ( this . spnMarginRight ) ;
this . chPrintGrid = new Common . UI . CheckBox ( {
el : $markup . findById ( '#print-chb-grid' ) ,
2021-10-22 18:17:45 +00:00
labelText : this . txtPrintGrid ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2021-10-18 16:35:23 +00:00
} ) ;
this . chPrintRows = new Common . UI . CheckBox ( {
el : $markup . findById ( '#print-chb-rows' ) ,
2021-10-22 18:17:45 +00:00
labelText : this . txtPrintHeadings ,
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
2021-10-18 16:35:23 +00:00
} ) ;
2021-10-22 18:17:45 +00:00
/ * t h i s . b t n A p p l y A l l = n e w C o m m o n . U I . B u t t o n ( {
2021-10-18 16:35:23 +00:00
el : $markup . findById ( '#print-apply-all' )
2021-10-22 18:17:45 +00:00
} ) ; * /
2021-10-18 16:35:23 +00:00
this . pnlSettings = $markup . find ( '.flex-settings' ) . addBack ( ) . filter ( '.flex-settings' ) ;
this . pnlApply = $markup . find ( '.fms-flex-apply' ) . addBack ( ) . filter ( '.fms-flex-apply' ) ;
this . pnlTable = $ ( this . pnlSettings . find ( 'table' ) [ 0 ] ) ;
this . trApply = $markup . find ( '.fms-btn-apply' ) ;
2021-11-26 07:28:27 +00:00
this . btnsSave = [ ] ;
this . btnsPrint = [ ] ;
for ( var i = 0 ; i < 2 ; i ++ ) {
this . btnsSave . push ( new Common . UI . Button ( {
el : $markup . findById ( '#print-btn-save-' + i )
} ) ) ;
this . btnsPrint . push ( new Common . UI . Button ( {
el : $markup . findById ( '#print-btn-print-' + i )
} ) ) ;
}
2021-10-19 16:03:31 +00:00
2021-10-22 18:17:45 +00:00
this . btnPrevPage = new Common . UI . Button ( {
parentEl : $markup . findById ( '#print-prev-page' ) ,
cls : 'btn-prev-page' ,
iconCls : 'arrow' ,
dataHint : '2' ,
dataHintDirection : 'top'
} ) ;
this . btnNextPage = new Common . UI . Button ( {
parentEl : $markup . findById ( '#print-next-page' ) ,
cls : 'btn-next-page' ,
iconCls : 'arrow' ,
dataHint : '2' ,
dataHintDirection : 'top'
} ) ;
2021-10-25 08:37:28 +00:00
this . countOfPages = $markup . findById ( '#print-count-page' ) ;
this . txtNumberPage = new Common . UI . InputField ( {
el : $markup . findById ( '#print-number-page' ) ,
allowBlank : true ,
validateOnChange : true ,
2021-10-27 17:22:23 +00:00
style : 'width: 50px;' ,
maskExp : /[0-9]/ ,
validation : function ( value ) {
if ( /(^[0-9]+$)/ . test ( value ) ) {
value = parseInt ( value ) ;
if ( undefined !== value && value > 0 && value <= me . pageCount )
return true ;
}
return me . txtPageNumInvalid ;
} ,
2021-10-25 08:37:28 +00:00
dataHint : '2' ,
dataHintDirection : 'left' ,
dataHintOffset : 'small'
} ) ;
this . txtActiveSheet = $markup . findById ( '#print-active-sheet' ) ;
2021-10-18 08:21:30 +00:00
this . $el = $ ( node ) . html ( $markup ) ;
2021-10-18 16:35:23 +00:00
2021-10-20 14:56:06 +00:00
this . $el . on ( 'click' , '#print-header-footer-settings' , _ . bind ( this . openHeaderSettings , this ) ) ;
this . $headerSettings = $ ( '#print-header-footer-settings' ) ;
2022-02-07 21:04:34 +00:00
this . $previewBox = $ ( '#print-preview-box' ) ;
this . $previewEmpty = $ ( '#print-preview-empty' ) ;
2021-10-18 16:35:23 +00:00
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : this . pnlSettings ,
suppressScrollX : true ,
alwaysVisibleY : true
} ) ;
}
Common . NotificationCenter . on ( {
'window:resize' : function ( ) {
me . isVisible ( ) && me . updateScroller ( ) ;
}
} ) ;
2021-10-19 16:03:31 +00:00
this . updateMetricUnit ( ) ;
this . fireEvent ( 'render:after' , this ) ;
2021-10-18 08:21:30 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
2021-10-19 16:03:31 +00:00
if ( this . _initSettings ) {
this . updateMetricUnit ( ) ;
this . _initSettings = false ;
}
2021-10-18 16:35:23 +00:00
this . updateScroller ( ) ;
2021-10-19 16:03:31 +00:00
this . fireEvent ( 'show' , this ) ;
2021-10-18 16:35:23 +00:00
} ,
updateScroller : function ( ) {
if ( this . scroller ) {
Common . UI . Menu . Manager . hideAll ( ) ;
var scrolled = this . $el . height ( ) < this . pnlTable . height ( ) + 25 + this . pnlApply . height ( ) ;
this . pnlApply . toggleClass ( 'hidden' , ! scrolled ) ;
this . trApply . toggleClass ( 'hidden' , scrolled ) ;
this . pnlSettings . css ( 'overflow' , scrolled ? 'hidden' : 'visible' ) ;
this . scroller . update ( ) ;
this . pnlSettings . toggleClass ( 'bordered' , this . scroller . isVisible ( ) ) ;
}
2021-10-18 08:21:30 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
} ,
setApi : function ( api ) {
} ,
2021-10-19 16:03:31 +00:00
updateMetricUnit : function ( ) {
if ( this . spinners ) {
for ( var i = 0 ; i < this . spinners . length ; i ++ ) {
var spinner = this . spinners [ i ] ;
spinner . setDefaultUnit ( Common . Utils . Metric . getCurrentMetricName ( ) ) ;
spinner . setStep ( Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ? 1 : 0.1 ) ;
}
}
var store = this . cmbPaperSize . store ;
for ( var i = 0 ; i < store . length ; i ++ ) {
var item = store . at ( i ) ,
value = item . get ( 'value' ) ,
pagewidth = /^\d{3}\.?\d*/ . exec ( value ) ,
pageheight = /\d{3}\.?\d*$/ . exec ( value ) ;
item . set ( 'displayValue' , item . get ( 'caption' ) + ' (' + parseFloat ( Common . Utils . Metric . fnRecalcFromMM ( pagewidth ) . toFixed ( 2 ) ) + Common . Utils . Metric . getCurrentMetricName ( ) + ' x ' +
parseFloat ( Common . Utils . Metric . fnRecalcFromMM ( pageheight ) . toFixed ( 2 ) ) + Common . Utils . Metric . getCurrentMetricName ( ) + ')' ) ;
}
this . cmbPaperSize . onResetItems ( ) ;
} ,
2021-10-18 08:21:30 +00:00
2021-10-19 16:03:31 +00:00
addCustomScale : function ( add ) {
if ( add ) {
this . cmbLayout . setData ( [
{ value : 0 , displayValue : this . txtActualSize } ,
{ value : 1 , displayValue : this . txtFitPage } ,
{ value : 2 , displayValue : this . txtFitCols } ,
{ value : 3 , displayValue : this . txtFitRows } ,
{ value : 4 , displayValue : this . txtCustom } ,
{ value : 'customoptions' , displayValue : this . txtCustomOptions }
] ) ;
} else {
this . cmbLayout . setData ( [
{ value : 0 , displayValue : this . txtActualSize } ,
{ value : 1 , displayValue : this . txtFitPage } ,
{ value : 2 , displayValue : this . txtFitCols } ,
{ value : 3 , displayValue : this . txtFitRows } ,
{ value : 'customoptions' , displayValue : this . txtCustomOptions }
] ) ;
}
2021-10-18 08:21:30 +00:00
} ,
2021-10-19 16:03:31 +00:00
applySettings : function ( ) {
if ( this . menu ) {
this . menu . fireEvent ( 'settings:apply' , [ this . menu ] ) ;
}
} ,
2021-10-18 16:35:23 +00:00
2021-10-19 16:03:31 +00:00
isVisible : function ( ) {
return ( this . $el || $ ( this . el ) ) . is ( ":visible" ) ;
2021-10-18 16:35:23 +00:00
} ,
2021-10-20 14:56:06 +00:00
setRange : function ( value ) {
this . cmbRange . setValue ( value ) ;
} ,
getRange : function ( ) {
return this . cmbRange . getValue ( ) ;
} ,
setIgnorePrintArea : function ( value ) {
this . chIgnorePrintArea . setValue ( value ) ;
} ,
getIgnorePrintArea : function ( ) {
return ( this . chIgnorePrintArea . getValue ( ) == 'checked' ) ;
} ,
comboRangeChange : function ( combo , record ) {
this . fireEvent ( 'changerange' , this ) ;
} ,
openHeaderSettings : function ( ) {
SSE . getController ( 'Toolbar' ) . onEditHeaderClick ( ) ;
} ,
2021-10-25 08:37:28 +00:00
updateCountOfPages : function ( count ) {
this . countOfPages . text (
Common . Utils . String . format ( this . txtOf , count )
) ;
2021-10-27 17:22:23 +00:00
this . pageCount = count ;
2021-10-25 08:37:28 +00:00
} ,
updateActiveSheet : function ( name ) {
this . txtActiveSheet . text (
Common . Utils . String . format ( this . txtSheet , name )
) ;
} ,
2021-10-27 17:22:23 +00:00
updateCurrentPage : function ( index ) {
this . txtNumberPage . setValue ( index + 1 ) ;
} ,
2021-10-18 08:21:30 +00:00
txtPrint : 'Print' ,
txtSave : 'Save' ,
txtPrintRange : 'Print range' ,
txtCurrentSheet : 'Current sheet' ,
txtAllSheets : 'All sheets' ,
txtSelection : 'Selection' ,
txtSettingsOfSheet : 'Settings of sheet' ,
txtPageSize : 'Page size' ,
txtPageOrientation : 'Page orientation' ,
txtPortrait : 'Portrait' ,
txtLandscape : 'Landscape' ,
txtScaling : 'Scaling' ,
txtActualSize : 'Actual Size' ,
txtFitPage : 'Fit Sheet on One Page' ,
txtFitCols : 'Fit All Columns on One Page' ,
txtFitRows : 'Fit All Rows on One Pag' ,
2021-10-19 16:03:31 +00:00
txtCustom : 'Custom' ,
2021-10-18 08:21:30 +00:00
txtCustomOptions : 'Custom Options' ,
txtPrintTitles : 'Print titles' ,
txtRepeatRowsAtTop : 'Repeat rows at top' ,
txtRepeatColumnsAtLeft : 'Repeat columns at left' ,
2021-10-18 16:35:23 +00:00
txtRepeat : 'Repeat...' ,
txtMargins : 'Margins' ,
txtTop : 'Top' ,
txtBottom : 'Bottom' ,
txtLeft : 'Left' ,
txtRight : 'Right' ,
txtGridlinesAndHeadings : 'Gridlines and headings' ,
txtPrintGrid : 'Print gridlines' ,
txtPrintHeadings : 'Print row and columns headings' ,
txtHeaderFooterSettings : 'Header/footer settings' ,
txtApplyToAllSheets : 'Apply to all sheets' ,
2021-10-25 08:37:28 +00:00
txtIgnore : 'Ignore print area' ,
txtPage : 'Page' ,
txtOf : 'of {0}' ,
2021-10-27 17:22:23 +00:00
txtSheet : 'Sheet: {0}' ,
2022-02-07 21:04:34 +00:00
txtPageNumInvalid : 'Page number invalid' ,
txtEmptyTable : 'There is nothing to print because the table is empty'
2021-11-26 10:51:11 +00:00
} , SSE . Views . PrintWithPreview || { } ) ) ;
2021-10-18 08:21:30 +00:00
2016-03-11 00:48:53 +00:00
} ) ;