2016-04-01 13:17:09 +00:00
/ *
*
2017-01-17 14:58:08 +00:00
* ( c ) Copyright Ascensio System Limited 2010 - 2017
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
*
* You can contact Ascensio System SIA at Lubanas st . 125 a - 25 , Riga , Latvia ,
* EU , LV - 1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
2016-03-11 00:48:53 +00:00
define ( [
'common/main/lib/view/DocumentAccessDialog'
] , 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 }
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) { %>' ,
'<td><span class="btn-doc-format <%= item.imgCls %>" /></td>' ,
'<% }) %>' ,
'</tr>' ,
'<% }) %>' ,
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( { rows : this . formats } ) ) ;
$ ( '.btn-doc-format' , this . el ) . on ( 'click' , _ . bind ( this . onFormatClick , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
this . flatFormats = _ . flatten ( this . formats ) ;
return this ;
} ,
onFormatClick : function ( e ) {
var format = /\s(\w+)/ . exec ( e . currentTarget . className ) ;
if ( format ) {
format = format [ 1 ] ;
var item = _ . findWhere ( this . flatFormats , { imgCls : format } ) ;
if ( item && this . menu ) {
this . menu . fireEvent ( 'saveas:format' , [ this . menu , item . type ] ) ;
}
}
}
} ) ;
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">' ,
'<div id="panel-settings-general" style="width:100%; height:100%;" class="no-padding main-settings-panel active"></div>' ,
'<div id="panel-settings-print" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>' ,
'</div>' ,
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( ) ) ;
this . generalSettings = new SSE . Views . FileMenuPanels . MainSettingsGeneral ( { menu : this . menu } ) ;
this . generalSettings . options = { alias : 'MainSettingsGeneral' } ;
this . generalSettings . render ( ) ;
this . printSettings = SSE . getController ( 'Print' ) . getView ( 'MainSettingsPrint' ) ;
this . printSettings . menu = this . menu ;
this . printSettings . render ( $ ( '#panel-settings-print' ) ) ;
this . viewSettingsPicker = new Common . UI . DataView ( {
el : $ ( '#id-settings-menu' ) ,
store : new Common . UI . DataViewStore ( [
{ name : this . txtGeneral , panel : this . generalSettings , iconCls : 'mnu-settings-general' , selected : true } ,
2016-04-01 13:01:12 +00:00
{ name : this . txtPageSettings , panel : this . printSettings , iconCls : 'mnu-print' }
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>'
] . join ( '' ) )
} ) ;
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 ) ) ;
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
var item = this . viewSettingsPicker . getSelectedRec ( ) ;
if ( item [ 0 ] ) {
item [ 0 ] . get ( 'panel' ) . show ( ) ;
}
} ,
setMode : function ( mode ) {
this . mode = mode ;
if ( ! this . mode . canPrint )
this . viewSettingsPicker . store . pop ( ) ;
this . generalSettings && this . generalSettings . setMode ( this . mode ) ;
} ,
setApi : function ( api ) {
this . generalSettings && this . generalSettings . setApi ( api ) ;
} ,
txtGeneral : 'General' ,
2016-04-01 13:01:12 +00:00
txtPageSettings : 'Page Settings'
2016-03-11 00:48:53 +00:00
} , SSE . Views . FileMenuPanels . Settings || { } ) ) ;
SSE . Views . MainSettingsPrint = Common . UI . BaseView . extend ( _ . extend ( {
menu : undefined ,
template : _ . template ( [
'<table class="main"><tbody>' ,
'<tr>' ,
'<td class="left"><label><%= scope.textSettings %></label></td>' ,
'<td class="right"><div id="advsettings-print-combo-sheets" class="input-group-nr" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"><label><%= scope.textPageSize %></label></td>' ,
'<td class="right"><div id="advsettings-print-combo-pages" class="input-group-nr" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"><label><%= scope.textPageOrientation %></label></td>' ,
'<td class="right"><span id="advsettings-print-combo-orient" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
2016-04-01 13:01:12 +00:00
'<tr>' ,
'<td class="left"><label><%= scope.textPageScaling %></label></td>' ,
'<td class="right"><span id="advsettings-print-combo-layout" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr>' ,
'<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>' ,
'<td class="right" style="vertical-align: top;"><div id="advsettings-margins">' ,
'<table cols="2" class="no-padding">' ,
'<tr>' ,
'<td><label><%= scope.strTop %></label></td>' ,
'<td><label><%= scope.strBottom %></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td><div id="advsettings-spin-margin-top"></div></td>' ,
'<td><div id="advsettings-spin-margin-bottom"></div></td>' ,
'</tr>' ,
'<tr>' ,
'<td><label><%= scope.strLeft %></label></td>' ,
'<td><label><%= scope.strRight %></label></td>' ,
'</tr>' ,
'<tr>' ,
'<td><div id="advsettings-spin-margin-left"></div></td>' ,
'<td><div id="advsettings-spin-margin-right"></div></td>' ,
'</tr>' ,
'</table>' ,
'</div></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left" style="vertical-align: top;"><label><%= scope.strPrint %></label></td>' ,
'<td class="right" style="vertical-align: top;"><div id="advsettings-print">' ,
'<div id="advsettings-print-chb-grid" style="margin-bottom: 10px;"/>' ,
'<div id="advsettings-print-chb-rows"/>' ,
'</div></td>' ,
'</tr>' , '<tr class="divider"></tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"></td>' ,
'<td class="right"><button id="advsettings-print-button-save" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>' ,
'</tr>' ,
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
this . spinners = [ ] ;
this . _initSettings = true ;
} ,
render : function ( parentEl ) {
if ( parentEl )
this . setElement ( parentEl , false ) ;
$ ( this . el ) . html ( this . template ( { scope : this } ) ) ;
this . cmbSheet = new Common . UI . ComboBox ( {
el : $ ( '#advsettings-print-combo-sheets' ) ,
2016-04-01 13:01:12 +00:00
style : 'width: 242px;' ,
menuStyle : 'min-width: 242px;max-height: 280px;' ,
2016-03-11 00:48:53 +00:00
editable : false ,
cls : 'input-group-nr' ,
2016-04-01 13:01:12 +00:00
data : [ ]
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbPaperSize = new Common . UI . ComboBox ( {
el : $ ( '#advsettings-print-combo-pages' ) ,
2016-04-01 13:01:12 +00:00
style : 'width: 242px;' ,
menuStyle : 'max-height: 280px; min-width: 242px;' ,
2016-03-11 00:48:53 +00:00
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-07 10:49:15 +00:00
{ 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.1|209.9' , displayValue : 'A5 (14,81cm x 20,99cm)' , caption : 'A5' } ,
{ value : '176|250.1' , displayValue : 'B5 (17,6cm x 25,01cm)' , caption : 'B5' } ,
{ value : '104.8|241.3' , displayValue : 'Envelope #10 (10,48cm x 24,13cm)' , caption : 'Envelope #10' } ,
{ value : '110.1|220.1' , displayValue : 'Envelope DL (11,01cm x 22,01cm)' , caption : 'Envelope DL' } ,
{ value : '279.4|431.7' , displayValue : 'Tabloid (27,94cm x 43,17cm)' , caption : 'Tabloid' } ,
{ value : '297|420.1' , displayValue : 'A3 (29,7cm x 42,01cm)' , 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' }
2016-03-11 00:48:53 +00:00
]
} ) ;
this . cmbPaperOrientation = new Common . UI . ComboBox ( {
el : $ ( '#advsettings-print-combo-orient' ) ,
2016-04-01 13:01:12 +00:00
style : 'width: 132px;' ,
menuStyle : 'min-width: 132px;' ,
2016-03-11 00:48:53 +00:00
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-05 11:52:34 +00:00
{ value : Asc . c _oAscPageOrientation . PagePortrait , displayValue : this . strPortrait } ,
{ value : Asc . c _oAscPageOrientation . PageLandscape , displayValue : this . strLandscape }
2016-03-11 00:48:53 +00:00
]
} ) ;
2016-04-01 13:01:12 +00:00
this . cmbLayout = new Common . UI . ComboBox ( {
el : $ ( '#advsettings-print-combo-layout' ) ,
style : 'width: 242px;' ,
menuStyle : 'min-width: 242px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
{ value : 0 , displayValue : this . textActualSize } ,
{ value : 1 , displayValue : this . textFitPage } ,
{ value : 2 , displayValue : this . textFitCols } ,
{ value : 3 , displayValue : this . textFitRows }
]
} ) ;
2016-03-11 00:48:53 +00:00
this . chPrintGrid = new Common . UI . CheckBox ( {
el : $ ( '#advsettings-print-chb-grid' ) ,
labelText : this . textPrintGrid
} ) ;
this . chPrintRows = new Common . UI . CheckBox ( {
el : $ ( '#advsettings-print-chb-rows' ) ,
labelText : this . textPrintHeadings
} ) ;
this . spnMarginTop = new Common . UI . MetricSpinner ( {
el : $ ( '#advsettings-spin-margin-top' ) ,
step : . 1 ,
2016-04-01 13:01:12 +00:00
width : 110 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 48.25 ,
minValue : 0
} ) ;
this . spinners . push ( this . spnMarginTop ) ;
this . spnMarginBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#advsettings-spin-margin-bottom' ) ,
step : . 1 ,
2016-04-01 13:01:12 +00:00
width : 110 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 48.25 ,
minValue : 0
} ) ;
this . spinners . push ( this . spnMarginBottom ) ;
this . spnMarginLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#advsettings-spin-margin-left' ) ,
step : . 1 ,
2016-04-01 13:01:12 +00:00
width : 110 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 48.25 ,
minValue : 0
} ) ;
this . spinners . push ( this . spnMarginLeft ) ;
this . spnMarginRight = new Common . UI . MetricSpinner ( {
el : $ ( '#advsettings-spin-margin-right' ) ,
step : . 1 ,
2016-04-01 13:01:12 +00:00
width : 110 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 48.25 ,
minValue : 0
} ) ;
this . spinners . push ( this . spnMarginRight ) ;
this . btnOk = new Common . UI . Button ( {
el : '#advsettings-print-button-save'
} ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
this . fireEvent ( 'render:after' , this ) ;
return this ;
} ,
updateMetricUnit : function ( ) {
if ( this . spinners ) {
for ( var i = 0 ; i < this . spinners . length ; i ++ ) {
var spinner = this . spinners [ i ] ;
2016-04-06 13:38:54 +00:00
spinner . setDefaultUnit ( Common . Utils . Metric . getCurrentMetricName ( ) ) ;
2016-04-06 15:17:40 +00:00
spinner . setStep ( Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ? 1 : 0.1 ) ;
2016-03-11 00:48:53 +00:00
}
}
2016-04-07 10:49:15 +00:00
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 ) ;
2016-04-07 12:13:16 +00:00
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 ( ) + ')' ) ;
2016-04-07 10:49:15 +00:00
}
this . cmbPaperSize . onResetItems ( ) ;
2016-03-11 00:48:53 +00:00
} ,
applySettings : function ( ) {
if ( this . menu ) {
this . menu . fireEvent ( 'settings:apply' , [ this . menu ] ) ;
}
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
if ( this . _initSettings ) {
this . updateMetricUnit ( ) ;
this . _initSettings = false ;
}
this . fireEvent ( 'show' , this ) ;
} ,
okButtonText : 'Save' ,
strPortrait : 'Portrait' ,
strLandscape : 'Landscape' ,
textPrintGrid : 'Print Gridlines' ,
textPrintHeadings : 'Print Rows and Columns Headings' ,
strLeft : 'Left' ,
strRight : 'Right' ,
strTop : 'Top' ,
strBottom : 'Bottom' ,
strMargins : 'Margins' ,
textPageSize : 'Page Size' ,
textPageOrientation : 'Page Orientation' ,
strPrint : 'Print' ,
2016-04-01 13:01:12 +00:00
textSettings : 'Settings for' ,
textPageScaling : 'Scaling' ,
textActualSize : 'Actual Size' ,
textFitPage : 'Fit Sheet on One Page' ,
textFitCols : 'Fit All Columns on One Page' ,
textFitRows : 'Fit All Rows on One Page'
2016-03-11 00:48:53 +00:00
} , SSE . Views . MainSettingsPrint || { } ) ) ;
SSE . Views . FileMenuPanels . MainSettingsGeneral = Common . UI . BaseView . extend ( _ . extend ( {
el : '#panel-settings-general' ,
menu : undefined ,
template : _ . template ( [
'<table class="main"><tbody>' ,
/** 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>' ,
'<td class="right"><div id="fms-chb-live-comment"/></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>' ,
'<td class="right"><div id="fms-chb-resolved-comment"/></td>' ,
2017-06-14 11:53:29 +00:00
'</tr>' , '<tr class="divider comments"></tr>' ,
2017-10-06 10:57:35 +00:00
'<tr class="edit sogou">' ,
'<td class="left"><label><%= scope.txtInput %></label></td>' ,
'<td class="right"><div id="fms-chb-input-sogou"/></td>' ,
2017-10-06 11:04:01 +00:00
'</tr>' , '<tr class="divider edit sogou"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr class="autosave">' ,
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>' ,
'<td class="right"><span id="fms-chb-autosave" /></td>' ,
'</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>' ,
'<td class="right"><span id="fms-chb-forcesave" /></td>' ,
'</tr>' , '<tr class="divider forcesave"></tr>' ,
2016-03-11 00:48:53 +00:00
'<tr class="coauth changes">' ,
'<td class="left"><label><%= scope.strCoAuthMode %></label></td>' ,
'<td class="right">' ,
'<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;"/>' ,
'<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>' ,
'</tr>' , '<tr class="divider coauth changes"></tr>' ,
/** coauthoring end **/
'<tr>' ,
'<td class="left"><label><%= scope.strZoom %></label></td>' ,
'<td class="right"><div id="fms-cmb-zoom" class="input-group-nr" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
'<tr>' ,
'<td class="left"><label><%= scope.strFontRender %></label></td>' ,
'<td class="right"><span id="fms-cmb-font-render" /></td>' ,
'</tr>' , '<tr class="divider"></tr>' ,
'<tr class="edit">' ,
'<td class="left"><label><%= scope.strUnit %></label></td>' ,
'<td class="right"><span id="fms-cmb-unit" /></td>' ,
'</tr>' , '<tr class="divider edit"></tr>' ,
'<tr class="edit">' ,
'<td class="left"><label><%= scope.strFuncLocale %></label></td>' ,
'<td class="right">' ,
'<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;"/>' ,
'<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">' ,
'<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;"/>' ,
'<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>' ,
2016-03-11 00:48:53 +00:00
'<tr>' ,
'<td class="left"></td>' ,
'<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>' ,
'</tr>' ,
'</tbody></table>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( { scope : this } ) ) ;
/** coauthoring begin **/
this . chLiveComment = new Common . UI . CheckBox ( {
el : $ ( '#fms-chb-live-comment' ) ,
labelText : this . strLiveComment
2017-06-06 08:31:30 +00:00
} ) . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . chResolvedComment . setDisabled ( field . getValue ( ) !== 'checked' ) ;
} , this ) ) ;
this . chResolvedComment = new Common . UI . CheckBox ( {
el : $ ( '#fms-chb-resolved-comment' ) ,
labelText : this . strResolvedComment
2016-03-11 00:48:53 +00:00
} ) ;
2017-10-06 10:57:35 +00:00
this . chInputSogou = new Common . UI . CheckBox ( {
el : $ ( '#fms-chb-input-sogou' ) ,
labelText : this . strInputSogou
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbCoAuthMode = new Common . UI . ComboBox ( {
el : $ ( '#fms-cmb-coauth-mode' ) ,
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 }
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
2016-03-25 07:48:19 +00:00
if ( record . value == 1 && ( this . chAutosave . getValue ( ) !== 'checked' ) )
this . chAutosave . setValue ( 1 ) ;
2016-03-11 00:48:53 +00:00
this . lblCoAuthMode . text ( record . descValue ) ;
} , this ) ) ;
this . lblCoAuthMode = $ ( '#fms-lbl-coauth-mode' ) ;
/** coauthoring end **/
this . cmbZoom = new Common . UI . ComboBox ( {
el : $ ( '#fms-cmb-zoom' ) ,
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
2016-09-13 08:28:21 +00:00
menuStyle : 'max-height: 210px;' ,
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%" } ,
{ value : 200 , displayValue : "200%" }
]
} ) ;
this . cmbFontRender = new Common . UI . ComboBox ( {
el : $ ( '#fms-cmb-font-render' ) ,
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
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 } ,
{ value : Asc . c _oAscFontRenderingModeType . hinting , displayValue : this . txtNative }
2016-03-11 00:48:53 +00:00
]
} ) ;
this . chAutosave = new Common . UI . CheckBox ( {
el : $ ( '#fms-chb-autosave' ) ,
labelText : this . strAutosave
2016-03-25 07:48:19 +00:00
} ) . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( field . getValue ( ) !== 'checked' && this . cmbCoAuthMode . getValue ( ) ) {
this . cmbCoAuthMode . setValue ( 0 ) ;
this . lblCoAuthMode . text ( this . strCoAuthModeDescStrict ) ;
}
} , this ) ) ;
2016-03-11 00:48:53 +00:00
this . lblAutosave = $ ( '#fms-lbl-autosave' ) ;
2017-04-11 11:05:56 +00:00
this . chForcesave = new Common . UI . CheckBox ( {
el : $ ( '#fms-chb-forcesave' ) ,
labelText : this . strForcesave
} ) ;
2016-03-11 00:48:53 +00:00
this . cmbUnit = new Common . UI . ComboBox ( {
el : $ ( '#fms-cmb-unit' ) ,
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 }
2016-03-11 00:48:53 +00:00
]
} ) ;
this . cmbFuncLocale = new Common . UI . ComboBox ( {
el : $ ( '#fms-cmb-func-locale' ) ,
style : 'width: 160px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
{ value : 'en' , displayValue : this . txtEn , exampleValue : this . txtExampleEn } ,
{ value : 'de' , displayValue : this . txtDe , exampleValue : this . txtExampleDe } ,
2017-04-11 11:05:56 +00:00
{ value : 'ru' , displayValue : this . txtRu , exampleValue : this . txtExampleRu } ,
{ value : 'pl' , displayValue : this . txtPl , exampleValue : this . txtExamplePl }
2016-03-11 00:48:53 +00:00
]
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
this . updateFuncExample ( record . exampleValue ) ;
} , this ) ) ;
2017-05-12 10:07:06 +00:00
var regdata = [ { value : 0x042C } , { value : 0x0405 } , { value : 0x0407 } , { value : 0x0408 } , { value : 0x0C09 } , { value : 0x0809 } , { value : 0x0409 } , { value : 0x0C0A } ,
{ value : 0x040B } , { value : 0x040C } , { value : 0x0410 } , { value : 0x0411 } , { value : 0x0412 } , { value : 0x0426 } , { value : 0x0415 } , { value : 0x0416 } ,
{ value : 0x0816 } , { value : 0x0419 } , { value : 0x0424 } , { value : 0x041F } , { value : 0x0422 } , { value : 0x042A } , { value : 0x0804 } ] ;
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 ( {
el : $ ( '#fms-cmb-reg-settings' ) ,
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 %>">' ,
'<input type="text" class="form-control">' ,
'<span class="icon input-icon lang-flag"></span>' ,
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>' ,
'<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 ( '' ) )
2016-03-11 00:48:53 +00:00
} ) . on ( 'selected' , _ . bind ( function ( combo , record ) {
this . updateRegionalExample ( record . value ) ;
} , this ) ) ;
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
this . btnApply = new Common . UI . Button ( {
el : '#fms-btn-apply'
} ) ;
this . btnApply . on ( 'click' , _ . bind ( this . applySettings , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
this . updateSettings ( ) ;
} ,
setMode : function ( mode ) {
this . mode = mode ;
2017-06-14 11:53:29 +00:00
$ ( 'tr.edit' , this . el ) [ mode . isEdit ? 'show' : 'hide' ] ( ) ;
2016-03-25 07:48:19 +00:00
$ ( 'tr.autosave' , this . el ) [ mode . isEdit ? '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' ] ( ) ;
2017-06-14 11:53:29 +00:00
$ ( 'tr.comments' , this . el ) [ mode . canCoAuthoring && mode . canComments ? 'show' : 'hide' ] ( ) ;
2016-12-20 14:29:37 +00:00
$ ( 'tr.coauth.changes' , this . el ) [ mode . isEdit && ! mode . isOffline && mode . canCoAuthoring ? 'show' : 'hide' ] ( ) ;
2017-10-06 10:57:35 +00:00
$ ( 'tr.sogou' , this . el ) [ mode . isEdit && Common . Utils . isChrome ? 'show' : '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" ) ) ;
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-06 10:57:35 +00:00
Common . Utils . isChrome && this . chInputSogou . setValue ( Common . Utils . InternalSettings . get ( "sse-settings-inputsogou" ) ) ;
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 ) } ) ;
2016-04-05 11:52:34 +00:00
this . cmbFontRender . setValue ( item ? item . get ( 'value' ) : ( window . devicePixelRatio > 1 ? Asc . c _oAscFontRenderingModeType . noHinting : Asc . c _oAscFontRenderingModeType . hintingAndSubpixeling ) ) ;
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 } ) ;
if ( ! item )
item = this . cmbFuncLocale . store . findWhere ( { value : value . split ( "-" ) [ 0 ] } ) ;
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 ) ;
2016-03-11 00:48:53 +00:00
} ,
applySettings : function ( ) {
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 ) ;
2016-12-20 14:29:37 +00:00
if ( this . mode . isEdit && ! this . mode . isOffline && this . mode . canCoAuthoring )
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-coauthmode" , this . cmbCoAuthMode . getValue ( ) ) ;
/** coauthoring end **/
2017-10-06 10:57:35 +00:00
Common . Utils . isChrome && Common . localStorage . setItem ( "sse-settings-inputsogou" , this . chInputSogou . isChecked ( ) ? 1 : 0 ) ;
2016-03-11 00:48:53 +00:00
Common . localStorage . setItem ( "sse-settings-fontrender" , this . cmbFontRender . getValue ( ) ) ;
Common . localStorage . setItem ( "sse-settings-unit" , this . cmbUnit . getValue ( ) ) ;
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 ( ) ) ;
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 ) ;
text = text + ' ' + this . api . asc _getLocaleExample ( arr [ 5 ] , ( new Date ( ) ) . getExcelDateWithTime ( ) , landId ) ;
2017-01-17 10:15:36 +00:00
text = text + ' ' + this . api . asc _getLocaleExample ( arr [ 6 ] , ( new Date ( ) ) . 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 ) {
$ ( '#fms-lbl-func-locale' ) . text ( _ . isEmpty ( text ) ? '' : this . strRegSettingsEx + text ) ;
} ,
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' ,
2016-03-11 00:48:53 +00:00
txtExampleEn : ' SUM; MIN; MAX; COUNT' ,
txtExampleDe : ' SUMME; MIN; MAX; ANZAHL' ,
txtExampleRu : ' С У М М ; МИН; М А К С ; СЧЁТ' ,
2017-04-11 11:05:56 +00:00
txtExamplePl : ' SUMA; MIN; MAX; ILE.LICZB' ,
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)' ,
2017-10-06 10:57:35 +00:00
strResolvedComment : 'Turn on display of the resolved comments' ,
txtInput : 'Alternate Input' ,
strInputSogou : 'Turn on Sogou Pinyin input'
2016-03-11 00:48:53 +00:00
} , SSE . Views . FileMenuPanels . MainSettingsGeneral || { } ) ) ;
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 ( ) {
$ ( this . el ) . html ( this . template ( ) ) ;
this . viewRecentPicker = new Common . UI . DataView ( {
el : $ ( '#id-recent-view' ) ,
store : new Common . UI . DataViewStore ( this . recent ) ,
itemTemplate : _ . template ( [
'<div class="recent-wrap">' ,
'<div class="recent-icon"></div>' ,
'<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>' ,
'<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . viewRecentPicker . on ( 'item:click' , _ . bind ( this . onRecentFileClick , this ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
return this ;
} ,
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 ( [
'<h3 style="margin-top: 20px;"><%= scope.fromBlankText %></h3><hr noshade />' ,
'<div class="blank-document">' ,
'<div class="blank-document-btn"></div>' ,
'<div class="blank-document-info">' ,
'<h3><%= scope.newDocumentText %></h3>' ,
'<%= scope.newDescriptionText %>' ,
'</div>' ,
'</div>' ,
'<h3><%= scope.fromTemplateText %></h3><hr noshade />' ,
'<div class="thumb-list">' ,
'<% _.each(docs, function(item) { %>' ,
'<div class="thumb-wrap" template="<%= item.url %>">' ,
'<div class="thumb"<% if (!_.isEmpty(item.icon)) { %> style="background-image: url(<%= item.icon %>);" <% } %> />' ,
'<div class="title"><%= item.name %></div>' ,
'</div>' ,
'<% }) %>' ,
'</div>'
] . join ( '' ) ) ,
initialize : function ( options ) {
Common . UI . BaseView . prototype . initialize . call ( this , arguments ) ;
this . menu = options . menu ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( {
scope : this ,
docs : this . options [ 0 ] . docs
} ) ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
return this ;
} ,
_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 ] ) ;
} ,
fromBlankText : 'From Blank' ,
newDocumentText : 'New Spreadsheet' ,
newDescriptionText : 'Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.' ,
fromTemplateText : 'From Template'
} , 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 ( [
'<table class="main">' ,
'<tr>' ,
'<td class="left"><label>' + this . txtTitle + '</label></td>' ,
'<td class="right"><label id="id-info-title">-</label></td>' ,
'</tr>' ,
'<tr class="author">' ,
'<td class="left"><label>' + this . txtAuthor + '</label></td>' ,
'<td class="right"><span class="userLink" id="id-info-author">-</span></td>' ,
'</tr>' ,
'<tr class="placement">' ,
'<td class="left"><label>' + this . txtPlacement + '</label></td>' ,
'<td class="right"><label id="id-info-placement">-</label></td>' ,
'</tr>' ,
'<tr class="date">' ,
'<td class="left"><label>' + this . txtDate + '</label></td>' ,
'<td class="right"><label id="id-info-date">-</label></td>' ,
'</tr>' ,
'<tr class="divider date"></tr>' ,
'</table>'
] . join ( '' ) ) ;
this . menu = options . menu ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( ) ) ;
this . lblTitle = $ ( '#id-info-title' ) ;
this . lblPlacement = $ ( '#id-info-placement' ) ;
this . lblDate = $ ( '#id-info-date' ) ;
this . lblAuthor = $ ( '#id-info-author' ) ;
this . rendered = true ;
this . updateInfo ( this . doc ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
} ,
hide : function ( ) {
Common . UI . BaseView . prototype . hide . call ( this , arguments ) ;
} ,
updateInfo : function ( doc ) {
this . doc = doc ;
if ( ! this . rendered )
return ;
doc = doc || { } ;
this . lblTitle . text ( ( doc . title ) ? doc . title : '-' ) ;
if ( doc . info ) {
if ( doc . info . author )
this . lblAuthor . text ( doc . info . author ) ;
this . _ShowHideInfoItem ( 'author' , doc . info . author !== undefined && doc . info . author !== null ) ;
if ( doc . info . created )
this . lblDate . text ( doc . info . created ) ;
this . _ShowHideInfoItem ( 'date' , doc . info . created !== undefined && doc . info . created !== null ) ;
if ( doc . info . folder )
this . lblPlacement . text ( doc . info . folder ) ;
this . _ShowHideInfoItem ( 'placement' , doc . info . folder !== undefined && doc . info . folder !== null ) ;
} else
this . _ShowHideDocInfo ( false ) ;
} ,
_ShowHideInfoItem : function ( cls , visible ) {
$ ( 'tr.' + cls , this . el ) [ visible ? 'show' : 'hide' ] ( ) ;
} ,
_ShowHideDocInfo : function ( visible ) {
this . _ShowHideInfoItem ( 'date' , visible ) ;
this . _ShowHideInfoItem ( 'placement' , visible ) ;
this . _ShowHideInfoItem ( 'author' , visible ) ;
} ,
setMode : function ( mode ) {
return this ;
} ,
txtTitle : 'Document Title' ,
txtAuthor : 'Author' ,
txtPlacement : 'Placement' ,
txtDate : 'Creation Date'
} , 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 ( [
'<table class="main">' ,
'<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 ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( ) ) ;
this . cntRights = $ ( '#id-info-rights' ) ;
this . btnEditRights = new Common . UI . Button ( {
el : '#id-info-btn-edit'
} ) ;
this . btnEditRights . on ( 'click' , _ . bind ( this . changeAccessRights , this ) ) ;
this . rendered = true ;
this . updateInfo ( this . doc ) ;
if ( _ . isUndefined ( this . scroller ) ) {
this . scroller = new Common . UI . Scroller ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
2017-10-12 10:43:23 +00:00
Common . NotificationCenter . on ( 'collaboration:sharing' , _ . bind ( this . changeAccessRights , this ) ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this , arguments ) ;
} ,
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 ) ;
this . _ShowHideInfoItem ( 'edit-rights' , ! ! this . sharingSettingsUrl && this . sharingSettingsUrl . length && this . _readonlyRights !== true ) ;
} 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 ) {
this . sharingSettingsUrl = mode . sharingSettingsUrl ;
return this ;
} ,
changeAccessRights : function ( btn , event , opts ) {
if ( this . _docAccessDlg ) return ;
var me = this ;
me . _docAccessDlg = new Common . Views . DocumentAccessDialog ( {
settingsurl : this . sharingSettingsUrl
} ) ;
me . _docAccessDlg . on ( 'accessrights' , function ( obj , rights ) {
me . doc . info . sharingSettings = rights ;
me . _ShowHideInfoItem ( 'rights' , me . doc . info . sharingSettings !== undefined && me . doc . info . sharingSettings !== null && me . doc . info . sharingSettings . length > 0 ) ;
me . cntRights . html ( me . templateRights ( { users : me . doc . info . sharingSettings } ) ) ;
} ) . on ( 'close' , function ( obj ) {
me . _docAccessDlg = undefined ;
} ) ;
me . _docAccessDlg . show ( ) ;
} ,
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 ;
this . urlPref = 'resources/help/en/' ;
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 ;
$ ( this . el ) . html ( this . template ( ) ) ;
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 ) {
me . iFrame . src = me . urlPref + record . get ( 'src' ) ;
} ) ;
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 ) {
lang = lang . split ( "-" ) [ 0 ] ;
var config = {
dataType : 'json' ,
error : function ( ) {
if ( me . urlPref . indexOf ( 'resources/help/en/' ) < 0 ) {
me . urlPref = 'resources/help/en/' ;
store . url = 'resources/help/en/Contents.json' ;
store . fetch ( config ) ;
} else {
me . urlPref = 'resources/help/en/' ;
store . reset ( me . en _data ) ;
}
} ,
success : function ( ) {
var rec = store . at ( 0 ) ;
me . viewHelpPicker . selectRecord ( rec ) ;
me . iFrame . src = me . urlPref + rec . get ( 'src' ) ;
}
} ;
store . url = 'resources/help/' + lang + '/Contents.json' ;
store . fetch ( config ) ;
this . urlPref = 'resources/help/' + lang + '/' ;
}
} ,
show : function ( ) {
Common . UI . BaseView . prototype . show . call ( this ) ;
if ( ! this . _scrollerInited ) {
this . viewHelpPicker . scroller . update ( ) ;
this . _scrollerInited = true ;
}
}
} ) ;
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-01-22 11:35:40 +00:00
'<td colspan="2"><span style="cursor: default;"><%= scope.txtEncrypted %></span></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-01-22 11:35:40 +00:00
'<td colspan="2"><span style="cursor: default;"><%= tipText %></span></td>' ,
2017-11-17 14:35:40 +00:00
'</tr>' ,
'<tr>' ,
'<td><label class="link signature-view-link">' + me . txtView + '</label></td>' ,
'<td align="right"><label class="link signature-edit-link <% if (!hasSigned) { %>hidden<% } %>">' + me . txtEdit + '</label></td>' ,
'</tr>' ,
2017-09-13 08:57:30 +00:00
'</table>'
] . join ( '' ) ) ;
} ,
render : function ( ) {
$ ( this . el ) . html ( this . template ( { scope : this } ) ) ;
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
2017-11-17 14:35:40 +00:00
this . cntPassword = $ ( '#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 ( {
el : $ ( this . el ) ,
suppressScrollX : true
} ) ;
}
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 ( ) ;
2017-09-13 08:57:30 +00:00
} ,
setMode : function ( mode ) {
this . mode = mode ;
2017-11-17 14:35:40 +00:00
this . cntSignature . toggleClass ( 'hidden' , ! this . mode . canProtect ) ;
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 ( ) {
this . cntPassword . 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 || { } ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;