From 954322e3e066d0b597aadc9ee88e1a7bb0392309 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 10 Jul 2019 13:53:37 +0300 Subject: [PATCH] [PE] Add header/footer settings to the right panel --- .../main/app/controller/RightMenu.js | 6 ++- .../main/app/template/SlideSettings.template | 18 +++++++- .../main/app/view/SlideSettings.js | 45 +++++++++++++++++-- apps/presentationeditor/main/locale/en.json | 2 + 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index 7dba2eed8..ce0e8a958 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -135,6 +135,7 @@ define([ this._settings[settingsType].lockedBackground = value.get_LockBackground(); this._settings[settingsType].lockedEffects = value.get_LockTranzition(); this._settings[settingsType].lockedTiming = value.get_LockTiming(); + this._settings[settingsType].lockedHeader = !!value.get_LockHeader && value.get_LockHeader(); } else { this._settings[settingsType].locked = value.get_Locked(); if (settingsType == Common.Utils.documentSettingsType.Shape && value.asc_getTextArtProperties()) { @@ -178,7 +179,8 @@ define([ if (pnl.locked!==undefined) this.rightmenu.slideSettings.SetSlideDisabled(this._state.no_slides || pnl.lockedBackground || pnl.locked, this._state.no_slides || pnl.lockedEffects || pnl.locked, - this._state.no_slides || pnl.lockedTiming || pnl.locked); + this._state.no_slides || pnl.lockedTiming || pnl.locked, + this._state.no_slides || pnl.lockedHeader || pnl.locked); } else pnl.panel.setLocked(pnl.locked); } @@ -214,7 +216,7 @@ define([ SetDisabled: function(disabled, allowSignature) { this.setMode({isEdit: !disabled}); if (this.rightmenu) { - this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled); + this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled, disabled); this.rightmenu.paragraphSettings.disableControls(disabled); this.rightmenu.shapeSettings.disableControls(disabled); this.rightmenu.textartSettings.disableControls(disabled); diff --git a/apps/presentationeditor/main/app/template/SlideSettings.template b/apps/presentationeditor/main/app/template/SlideSettings.template index 366822d65..fbe24606d 100644 --- a/apps/presentationeditor/main/app/template/SlideSettings.template +++ b/apps/presentationeditor/main/app/template/SlideSettings.template @@ -116,9 +116,25 @@ - + + + +
+ + + + +
+ + + + +
+ + + \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index cbab1e457..742ab375a 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -79,7 +79,8 @@ define([ this._stateDisabled = { background: true, effects: true, - timing: true + timing: true, + header: true }; this._state = { @@ -249,6 +250,20 @@ define([ if (this.api) this.api.SlideTimingApplyToAll(); this.fireEvent('editcomplete', this); }, this)); + + this.chSlideNum = new Common.UI.CheckBox({ + el: $('#slide-checkbox-slidenum'), + labelText: this.strSlideNum, + disabled: true + }); + this.chSlideNum.on('change', _.bind(this.onHeaderChange, this, 'slidenum')); + + this.chDateTime = new Common.UI.CheckBox({ + el: $('#slide-checkbox-datetime'), + labelText: this.strDateTime, + disabled: true + }); + this.chDateTime.on('change', _.bind(this.onHeaderChange, this, 'datetime')); }, render: function () { @@ -1011,6 +1026,15 @@ define([ this.fireEvent('editcomplete', this); }, + onHeaderChange: function(type, field, newValue, oldValue, eOpts){ + if (this.api && !this._noApply) { + var props = this.api.asc_getHeaderFooterProperties(); + props.get_Slide()[(type=='slidenum') ? 'put_ShowSlideNum' : 'put_ShowDateTime'](field.getValue()=='checked'); + this.api.asc_setHeaderFooterProperties(props); + } + this.fireEvent('editcomplete', this); + }, + UpdateThemeColors: function() { if (!this.btnBackColor) { this.btnBackColor = new Common.UI.ColorButton({ @@ -1419,11 +1443,19 @@ define([ this._state.GradColor = color; } + + value = this.api.asc_getHeaderFooterProperties(); + if (value) { + var slideprops = value.get_Slide() || new AscCommonSlide.CAscHFProps(); + this.chSlideNum.setValue(!!slideprops.get_ShowSlideNum(), true); + this.chDateTime.setValue(!!slideprops.get_ShowDateTime(), true); + } + this._noApply = false; } }, - SetSlideDisabled: function(background, effects, timing) { + SetSlideDisabled: function(background, effects, timing, header) { if (this._initSettings) return; if (background !== this._stateDisabled.background) { @@ -1448,6 +1480,11 @@ define([ this.btnApplyToAll.setDisabled(timing); this._stateDisabled.timing = timing; } + if (header !== this._stateDisabled.header) { + this.chSlideNum.setDisabled(header); + this.chDateTime.setDisabled(header); + this._stateDisabled.header = header; + } }, strColor : 'Color', @@ -1520,6 +1557,8 @@ define([ textDirection: 'Direction', textStyle: 'Style', textGradient: 'Gradient', - textSec: 's' + textSec: 's', + strSlideNum: 'Show Slide Number', + strDateTime: 'Show Date and Time' }, PE.Views.SlideSettings || {})); }); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index a32674647..5c2765cbe 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1522,6 +1522,8 @@ "PE.Views.SlideSettings.txtLeather": "Leather", "PE.Views.SlideSettings.txtPapyrus": "Papyrus", "PE.Views.SlideSettings.txtWood": "Wood", + "PE.Views.SlideSettings.strSlideNum": "Show Slide Number", + "PE.Views.SlideSettings.strDateTime": "Show Date and Time", "PE.Views.SlideshowSettings.cancelButtonText": "Cancel", "PE.Views.SlideshowSettings.okButtonText": "OK", "PE.Views.SlideshowSettings.textLoop": "Loop continuously until 'Esc' is pressed",