diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 00504db9f..5f17aef78 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -309,6 +309,9 @@ define([ toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this)); toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); + toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header')); + toolbar.btnInsDateTime.on('click', _.bind(this.onEditHeaderClick, this, 'datetime')); + toolbar.btnInsSlideNum.on('click', _.bind(this.onEditHeaderClick, this, 'slidenum')); this.onSetupCopyStyleButton(); }, @@ -619,7 +622,7 @@ define([ this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, this.toolbar.btnPaste, this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertChart, this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign, - this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme + this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme, this.toolbar.btnEditHeader, this.toolbar.btnInsDateTime, this.toolbar.btnInsSlideNum ]}); this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape, this.toolbar.btnInsertEquation, this.toolbar.btnInsertTextArt) }); @@ -674,13 +677,14 @@ define([ if (paragraph_locked!==undefined && this._state.prcontrolsdisable !== paragraph_locked) { if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked; - this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls.concat(me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum)}); } if (this._state.no_paragraph !== no_paragraph) { if (this._state.activated) this._state.no_paragraph = no_paragraph; this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls}); this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]}); + this.toolbar.lockToolbar(PE.enumLock.paragraphLock, !no_paragraph && this._state.prcontrolsdisable, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]}); } if (this._state.no_text !== no_text) { @@ -1443,6 +1447,25 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); }, + onEditHeaderClick: function(type, e) { + var selectedElements = this.api.getSelectedElements(), + in_text = false; + + for (var i=0; i < selectedElements.length; i++) { + if (selectedElements[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) { + in_text = true; + break; + } + } + if (in_text && type=='slidenum') { + this.api.asc_addSlideNumber(); + } else if (in_text && type=='datetime') { + //insert date time + } else { + //insert header/footer + } + }, + onClearStyleClick: function(btn, e) { if (this.api) this.api.ClearFormating(); diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 9bb562b76..0b8287bc6 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -121,6 +121,12 @@
+
+ + + +
+
diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 617568a23..dd41fa3ed 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -571,6 +571,33 @@ define([ }); me.slideOnlyControls.push(me.btnInsertTextArt); + me.btnEditHeader = new Common.UI.Button({ + id: 'id-toolbar-btn-editheader', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-editheader', + caption: me.capBtnInsHeader, + lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart] + }); + me.slideOnlyControls.push(me.btnEditHeader); + + me.btnInsDateTime = new Common.UI.Button({ + id: 'id-toolbar-btn-datetime', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-editheader', + caption: me.capBtnDateTime, + lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart] + }); + me.slideOnlyControls.push(me.btnInsDateTime); + + me.btnInsSlideNum = new Common.UI.Button({ + id: 'id-toolbar-btn-slidenum', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-editheader', + caption: me.capBtnSlideNum, + lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart] + }); + me.slideOnlyControls.push(me.btnInsSlideNum); + me.btnColorSchemas = new Common.UI.Button({ id: 'id-toolbar-btn-colorschemas', cls: 'btn-toolbar', @@ -917,6 +944,9 @@ define([ _injectComponent('#slot-btn-colorschemas', this.btnColorSchemas); _injectComponent('#slot-btn-slidesize', this.btnSlideSize); _injectComponent('#slot-field-styles', this.listTheme); + _injectComponent('#slot-btn-editheader', this.btnEditHeader); + _injectComponent('#slot-btn-datetime', this.btnInsDateTime); + _injectComponent('#slot-btn-slidenum', this.btnInsSlideNum); this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'btn-insertimage', this.capInsertImage, [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true); @@ -1024,6 +1054,9 @@ define([ this.btnShapeAlign.updateHint(this.tipShapeAlign); this.btnShapeArrange.updateHint(this.tipShapeArrange); this.btnSlideSize.updateHint(this.tipSlideSize); + this.btnEditHeader.updateHint(this.tipEditHeader); + this.btnInsDateTime.updateHint(this.tipDateTime); + this.btnInsSlideNum.updateHint(this.tipSlideNum); // set menus @@ -1654,7 +1687,13 @@ define([ textTabProtect: 'Protection', mniImageFromStorage: 'Image from Storage', txtSlideAlign: 'Align to Slide', - txtObjectsAlign: 'Align Selected Objects' + txtObjectsAlign: 'Align Selected Objects', + tipEditHeader: 'Edit Header or Footer', + tipSlideNum: 'Insert slide number', + tipDateTime: 'Insert current date and time', + capBtnInsHeader: 'Header/Footer', + capBtnSlideNum: 'Slide Number', + capBtnDateTime: 'Date & Time' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file