diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js
index 392a61ebb..8c465e99a 100644
--- a/apps/presentationeditor/main/app/controller/LeftMenu.js
+++ b/apps/presentationeditor/main/app/controller/LeftMenu.js
@@ -61,7 +61,7 @@ define([
'Common.Views.Chat': {
'hide': _.bind(this.onHideChat, this)
},
- 'Statusbar': {
+ 'Common.Views.Header': {
'click:users': _.bind(this.clickStatusbarUsers, this)
},
'LeftMenu': {
@@ -83,7 +83,9 @@ define([
'recent:open': _.bind(this.onOpenRecent, this)
},
'Toolbar': {
- 'file:settings': _.bind(this.clickToolbarSettings,this)
+ 'file:settings': _.bind(this.clickToolbarSettings,this),
+ 'file:open': this.clickToolbarTab.bind(this, 'file'),
+ 'file:close': this.clickToolbarTab.bind(this, 'other')
},
'SearchDialog': {
'hide': _.bind(this.onSearchDlgHide, this),
@@ -216,16 +218,12 @@ define([
if (close_menu) {
menu.hide();
- this.leftMenu.btnFile.toggle(false, true);
- this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
},
clickSaveAsFormat: function(menu, format) {
this.api.asc_DownloadAs(format);
menu.hide();
- this.leftMenu.btnFile.toggle(false, true);
- this.menuExpand(this.leftMenu.btnFile, 'files', false);
},
applySettings: function(menu) {
@@ -242,12 +240,9 @@ define([
value = Common.localStorage.getItem("pe-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
- value = Common.localStorage.getItem("pe-settings-showsnaplines");
- this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);
+ this.api.put_ShowSnapLines( Common.localStorage.getBool("pe-settings-showsnaplines") );
menu.hide();
- this.leftMenu.btnFile.toggle(false, true);
- this.menuExpand(this.leftMenu.btnFile, 'files', false);
},
onCreateNew: function(menu, type) {
@@ -260,16 +255,12 @@ define([
if (menu) {
menu.hide();
- this.leftMenu.btnFile.toggle(false, true);
- this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
},
onOpenRecent: function(menu, url) {
if (menu) {
menu.hide();
- this.leftMenu.btnFile.toggle(false, true);
- this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
var recentDocPage = window.open(url);
@@ -280,15 +271,18 @@ define([
},
clickToolbarSettings: function(obj) {
- if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == 'opts')
- this.leftMenu.close();
- else
- this.leftMenu.showMenu('file:opts');
+ this.leftMenu.showMenu('file:opts');
+ },
+
+ clickToolbarTab: function (tab, e) {
+ if (tab == 'file')
+ this.leftMenu.menuFile.show(); else
+ this.leftMenu.menuFile.hide();
},
/** coauthoring begin **/
clickStatusbarUsers: function() {
- this.leftMenu.btnFile.panel.panels['rights'].changeAccessRights();
+ this.leftMenu.menuFile.panels['rights'].changeAccessRights();
},
onHideChat: function() {
@@ -384,7 +378,7 @@ define([
},
menuFilesHide: function(obj) {
- $(this.leftMenu.btnFile.el).blur();
+ // $(this.leftMenu.btnFile.el).blur();
},
/** coauthoring begin **/
@@ -431,12 +425,11 @@ define([
case 'search':
if ((!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) {
Common.UI.Menu.Manager.hideAll();
- var full_menu_pressed = (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed);
+ var full_menu_pressed = this.leftMenu.btnAbout.pressed;
this.showSearchDlg(true);
this.leftMenu.btnSearch.toggle(true,true);
- this.leftMenu.btnFile.toggle(false);
this.leftMenu.btnAbout.toggle(false);
- full_menu_pressed && this.menuExpand(this.leftMenu.btnFile, 'files', false);
+ full_menu_pressed && this.menuExpand(this.leftMenu.btnAbout, 'files', false);
}
return false;
case 'save':
@@ -463,6 +456,12 @@ define([
return false;
case 'escape':
// if (!this.leftMenu.isOpened()) return true;
+ // TODO:
+ if ( this.leftMenu.menuFile.isVisible() ) {
+ this.leftMenu.menuFile.hide();
+ return false;
+ }
+
var statusbar = PE.getController('Statusbar');
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
if (menu_opened.length) {
@@ -476,7 +475,8 @@ define([
return false;
}
}
- if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
+
+ if ( this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
$(e.target).parents('#left-menu').length ) {
this.leftMenu.close();
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index 831b30f29..a27255e85 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -427,8 +427,8 @@ define([
case Asc.c_oAscAsyncAction['ForceSaveButton']:
clearTimeout(this._state.timerSave);
force = true;
- title = this.saveTitleText;
- text = this.saveTextText;
+ // title = this.saveTitleText;
+ // text = this.saveTextText;
break;
case Asc.c_oAscAsyncAction['ForceSaveTimeout']:
@@ -503,8 +503,10 @@ define([
if (!this.isShowOpenDialog)
this.loadMask.show();
- }
- else {
+ } else
+ if ( action.id == Asc.c_oAscAsyncAction.Save ) {
+ appHeader.setSaveStatus('begin');
+ } else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
}
},
@@ -529,6 +531,8 @@ define([
me._isDocReady = true;
+ Common.NotificationCenter.trigger('app:ready', me.appOptions);
+
me.api.SetDrawingFreeze(false);
me.hidePreloader();
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
@@ -577,6 +581,7 @@ define([
Common.localStorage.setItem("pe-settings-showsnaplines", me.api.get_ShowSnapLines() ? 1 : 0);
+ var application = me.getApplication();
var toolbarController = application.getController('Toolbar'),
statusbarController = application.getController('Statusbar'),
documentHolderController = application.getController('DocumentHolder'),
@@ -753,16 +758,18 @@ define([
this.updatePlugins(this.plugins, true);
this.applyModeCommonElements();
- this.applyModeEditorElements();
- this.api.asc_setViewMode(!this.appOptions.isEdit);
+ if ( this.appOptions.isEdit ) {
+ this.applyModeEditorElements();
+ } else {
+ Common.NotificationCenter.trigger('app:face', this.appOptions);
- this.api.asc_LoadDocument();
-
- if (!this.appOptions.isEdit) {
this.hidePreloader();
this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
}
+
+ this.api.asc_setViewMode(!this.appOptions.isEdit);
+ this.api.asc_LoadDocument();
},
applyModeCommonElements: function() {
@@ -868,6 +875,8 @@ define([
if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights);
} else if (!this._isDocReady) {
+ Common.NotificationCenter.trigger('app:face', me.appOptions);
+
me.hidePreloader();
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
}
@@ -1128,6 +1137,8 @@ define([
this.updateWindowTitle();
+ this.api.isDocumentModified() && appHeader.setSaveStatus('changed');
+
var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar');
if (toolbarView) {
var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
@@ -1358,12 +1369,8 @@ define([
return;
var me = this,
- shapegrouparray = [],
- shapeStore = this.getCollection('ShapeGroups');
+ shapegrouparray = [];
- shapeStore.reset();
-
- var groupscount = groupNames.length;
_.each(groupNames, function(groupName, index){
var store = new Backbone.Collection([], {
model: PE.Models.ShapeModel
@@ -1391,11 +1398,7 @@ define([
});
});
- shapeStore.add(shapegrouparray);
-
- setTimeout(function(){
- me.getApplication().getController('Toolbar').fillAutoShapes();
- }, 50);
+ this.getCollection('ShapeGroups').reset(shapegrouparray);
},
fillLayoutsStore: function(layouts){
@@ -1440,10 +1443,6 @@ define([
});
artStore.reset(arr);
- setTimeout(function(){
- me.getApplication().getController('Toolbar').fillTextArt();
- }, 50);
-
setTimeout(function(){
me.getApplication().getController('RightMenu').fillTextArt();
}, 50);
@@ -1503,11 +1502,11 @@ define([
},
onMeta: function(meta) {
- var app = this.getApplication(),
- filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file');
appHeader.setDocumentCaption(meta.title);
this.updateWindowTitle(true);
this.document.title = meta.title;
+
+ var filemenu = this.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file');
filemenu.loadDocument({doc:this.document});
filemenu.panels['info'].updateInfo(this.document);
Common.Gateway.metaChange(meta);
@@ -1760,8 +1759,6 @@ define([
criticalErrorExtText: 'Press "Ok" to to back to document list.',
openTitleText: 'Opening Document',
openTextText: 'Opening document...',
- saveTitleText: 'Saving Document',
- saveTextText: 'Saving document...',
loadFontsTitleText: 'Loading Data',
loadFontsTextText: 'Loading data...',
loadImagesTitleText: 'Loading Images',
@@ -1888,7 +1885,6 @@ define([
errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.',
- textChangesSaved: 'All changes saved',
errorBadImageUrl: 'Image url is incorrect'
}
})(), PE.Controllers.Main || {}))
diff --git a/apps/presentationeditor/main/app/controller/Statusbar.js b/apps/presentationeditor/main/app/controller/Statusbar.js
index ae5e6480a..b6d92e1da 100644
--- a/apps/presentationeditor/main/app/controller/Statusbar.js
+++ b/apps/presentationeditor/main/app/controller/Statusbar.js
@@ -72,9 +72,7 @@ define([
},
onLaunch: function() {
- this.statusbar = this.createView('Statusbar', {
- storeUsers: this.getApplication().getCollection('Common.Collections.Users')
- }).render();
+ this.statusbar = this.createView('Statusbar', {}).render();
this.statusbar.$el.css('z-index', 1);
this.bindViewEvents(this.statusbar, this.events);
diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js
index 44cb29368..e8e2bc085 100644
--- a/apps/presentationeditor/main/app/controller/Toolbar.js
+++ b/apps/presentationeditor/main/app/controller/Toolbar.js
@@ -114,7 +114,16 @@ define([
this.addListeners({
'Toolbar': {
- 'changecompact' : this.onChangeCompactView
+ 'view:compact' : this.onChangeCompactView,
+ 'insert:image' : this.onInsertImageClick.bind(this),
+ 'insert:text' : this.onInsertText.bind(this),
+ 'insert:textart' : this.onInsertTextart.bind(this),
+ 'insert:shape' : this.onInsertShape.bind(this)
+ },
+ 'FileMenu': {
+ 'filemenu:hide': function () {
+ this.toolbar.setTab('');
+ }.bind(this)
}
});
@@ -128,15 +137,17 @@ define([
btn_id = cmp.closest('.btn-group').attr('id');
if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) {
- if ( me.toolbar.btnInsertText.pressed && btn_id != me.toolbar.btnInsertText.id ||
- me.toolbar.btnInsertShape.pressed && btn_id != me.toolbar.btnInsertShape.id ) {
+ if ( me.toolbar.btnsInsertText.pressed && !me.toolbar.btnsInsertText.contains(btn_id) ||
+ me.toolbar.btnsInsertShape.pressed && !me.toolbar.btnsInsertShape.contains(btn_id) )
+ {
me._isAddingShape = false;
me._addAutoshape(false);
- me.toolbar.btnInsertShape.toggle(false, true);
- me.toolbar.btnInsertText.toggle(false, true);
+ me.toolbar.btnsInsertShape.toggle(false, true);
+ me.toolbar.btnsInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
- } else if ( me.toolbar.btnInsertShape.pressed && btn_id == me.toolbar.btnInsertShape.id) {
+ } else
+ if ( me.toolbar.btnsInsertShape.pressed && me.toolbar.btnsInsertShape.contains(btn_id) ) {
_.defer(function(){
me.api.StartAddShape('', false);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@@ -148,11 +159,11 @@ define([
this.onApiEndAddShape = function() {
this.toolbar.fireEvent('insertshape', this.toolbar);
- if (this.toolbar.btnInsertShape.pressed)
- this.toolbar.btnInsertShape.toggle(false, true);
+ if ( this.toolbar.btnsInsertShape.pressed )
+ this.toolbar.btnsInsertShape.toggle(false, true);
- if (this.toolbar.btnInsertText.pressed)
- this.toolbar.btnInsertText.toggle(false, true);
+ if ( this.toolbar.btnsInsertText.pressed )
+ this.toolbar.btnsInsertText.toggle(false, true);
$(document.body).off('mouseup', checkInsertAutoshape);
};
@@ -175,6 +186,18 @@ define([
this.toolbar = this.createView('Toolbar');
// this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this));
+
+ var me = this;
+ Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me));
+ Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me));
+
+ PE.getCollection('Common.Collections.TextArt').bind({
+ reset: me.onResetTextArt.bind(this)
+ });
+
+ PE.getCollection('ShapeGroups').bind({
+ reset: me.onResetAutoshapes.bind(this)
+ });
},
onToolbarAfterRender: function(toolbar) {
@@ -182,8 +205,6 @@ define([
* UI Events
*/
- toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this));
- toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this));
toolbar.btnAddSlide.on('click', _.bind(this.onBtnAddSlide, this));
toolbar.mnuAddSlidePicker.on('item:click', _.bind(this.onAddSlide, this));
if (toolbar.mnuChangeSlidePicker)
@@ -231,10 +252,6 @@ define([
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlinkClick, this));
toolbar.mnuTablePicker.on('select', _.bind(this.onTablePickerSelect, this));
toolbar.btnInsertTable.menu.on('item:click', _.bind(this.onInsertTableClick, this));
- toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageClick, this));
- toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
- toolbar.btnInsertText.menu.on('item:click', _.bind(this.onInsertTextClick, this));
- toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnClearStyle.on('click', _.bind(this.onClearStyleClick, this));
toolbar.btnCopyStyle.on('toggle', _.bind(this.onCopyStyleToggle, this));
toolbar.btnAdvSettings.on('click', _.bind(this.onAdvSettingsClick, this));
@@ -299,13 +316,9 @@ define([
},
onChangeCompactView: function(view, compact) {
- Common.localStorage.setItem('pe-compact-toolbar', compact ? 1 : 0);
-
- if (!compact && !this._state.changeslide_inited) {
- this.toolbar.mnuChangeSlidePicker.on('item:click', _.bind(this.onChangeSlide, this));
- }
- this._state.changeslide_inited = true;
+ this.toolbar.setFolded(compact);
+ Common.localStorage.setBool('pe-compact-toolbar', compact);
Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
@@ -552,10 +565,12 @@ define([
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: [
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnCopy, this.toolbar.btnPaste,
- this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertImage, this.toolbar.btnInsertChart,
- this.toolbar.btnInsertText, this.toolbar.btnInsertShape, this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign,
+ 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.lockToolbar(PE.enumLock.noSlides, this._state.no_slides,
+ { array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape) });
}
},
@@ -1312,19 +1327,16 @@ define([
}
},
- onInsertImageClick: function(menu, item, e) {
- if (item.value === 'file') {
- this.toolbar.fireEvent('insertimage', this.toolbar);
+ onInsertImageClick: function(opts, e) {
+ var me = this;
+ if (opts === 'file') {
+ me.toolbar.fireEvent('insertimage', this.toolbar);
- if (this.api)
- this.api.asc_addImage();
+ me.api.asc_addImage();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
-
Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else {
- var me = this;
-
(new Common.Views.ImageFromUrlDialog({
handler: function(result, value) {
if (result == 'ok') {
@@ -1349,38 +1361,54 @@ define([
}
},
- onBtnInsertTextClick: function(btn, e) {
- if (this.api)
- this._addAutoshape(btn.pressed, 'textRect');
+ onInsertText: function(status) {
+ if ( status == 'begin' ) {
+ this._addAutoshape(true, 'textRect');
- if (this.toolbar.btnInsertShape.pressed)
- this.toolbar.btnInsertShape.toggle(false, true);
+ if ( !this.toolbar.btnsInsertText.pressed )
+ this.toolbar.btnsInsertText.toggle(true, true);
+ } else
+ this._addAutoshape(false, 'textRect');
- Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
+ if ( this.toolbar.btnsInsertShape.pressed )
+ this.toolbar.btnsInsertShape.toggle(false, true);
+
+ Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
},
- onInsertTextClick: function(menu, item, e) {
- if (item.value === 'text') {
- if (this.api)
- this._addAutoshape(true, 'textRect');
- this.toolbar.btnInsertText.toggle(true, true);
+ onInsertShape: function (type) {
+ var me = this;
+ if ( type == 'menu:hide' ) {
+ if ( me.toolbar.btnsInsertShape.pressed && !me._isAddingShape ) {
+ me.toolbar.btnsInsertShape.toggle(false, true);
+ }
+ me._isAddingShape = false;
- if (this.toolbar.btnInsertShape.pressed)
- this.toolbar.btnInsertShape.toggle(false, true);
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ } else {
+ me._addAutoshape(true, type);
+ me._isAddingShape = true;
- Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
- Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
+ if ( me.toolbar.btnsInsertText.pressed )
+ me.toolbar.btnsInsertText.toggle(false, true);
+
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ Common.component.Analytics.trackEvent('ToolBar', 'Add Shape');
}
},
-
- onInsertShapeHide: function(btn, e) {
- if (this.toolbar.btnInsertShape.pressed && !this._isAddingShape) {
- this.toolbar.btnInsertShape.toggle(false, true);
- }
- this._isAddingShape = false;
- Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
+ onInsertTextart: function (data) {
+ var me = this;
+
+ me.toolbar.fireEvent('inserttextart', me.toolbar);
+ me.api.AddTextArt(data);
+
+ if ( me.toolbar.btnsInsertShape.pressed )
+ me.toolbar.btnsInsertShape.toggle(false, true);
+
+ Common.NotificationCenter.trigger('edit:complete', me.toolbar);
+ Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
},
onClearStyleClick: function(btn, e) {
@@ -1654,88 +1682,18 @@ define([
this._state.clrtext_asccolor = color;
},
- fillAutoShapes: function() {
- var me = this,
- shapesStore = this.getApplication().getCollection('ShapeGroups');
-
- for (var i = 0; i < shapesStore.length; i++) {
- var shapeGroup = shapesStore.at(i);
-
- var menuItem = new Common.UI.MenuItem({
- caption: shapeGroup.get('groupName'),
- menu: new Common.UI.Menu({
- menuAlign: 'tl-tr',
- items: [
- { template: _.template('