Merge branch 'develop' into feature/sparklines

This commit is contained in:
Julia Radzhabova 2016-09-27 15:13:05 +03:00
commit 5fe026ec86
23 changed files with 348 additions and 42 deletions

View file

@ -233,6 +233,14 @@ Common.Gateway = new(function() {
_postMessage({event: 'onCollaborativeChanges'});
},
requestRename: function(title) {
_postMessage({event: 'onRequestRename', data: title});
},
metaChange: function(meta) {
_postMessage({event: 'onMetaChange', data: meta});
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)

View file

@ -2,6 +2,6 @@
<div id="header-logo"></div>
<div id="header-caption"><div><%= headerCaption %></div></div>
<div id="header-developer" class="hidden"><div><%= headerDeveloper %></div></div>
<div id="header-documentcaption"><%= documentCaption %></div>
<div id="header-documentcaption"><span><%= documentCaption %></span></div>
<div id="header-back" style="display: <%= canBack ? 'table-cell' : 'none' %>;"><div><%= textBack %></div></div>
</div>

View file

@ -52,7 +52,7 @@ define([
initialize: function(options) {
Common.UI.BaseView.prototype.initialize.call(this,arguments);
this.txtVersionNum = '4.1';
this.txtVersionNum = '4.2';
this.txtAscMail = 'support@onlyoffice.com';
this.txtAscTelNum = '+371 660-16425';
this.txtAscUrl = 'www.onlyoffice.com';

View file

@ -46,7 +46,8 @@ Common.Views = Common.Views || {};
define([
'backbone',
'text!common/main/lib/template/Header.template',
'core'
'core',
'common/main/lib/view/RenameDialog'
], function (Backbone, headerTemplate) { 'use strict';
Common.Views.Header = Backbone.View.extend(_.extend({
@ -165,7 +166,7 @@ define([
if (!value)
value = '';
var dc = $('#header-documentcaption');
var dc = $('#header-documentcaption span');
if (dc)
dc.html(Common.Utils.String.htmlEncode(value));
@ -226,8 +227,36 @@ define([
$('#header-developer').toggleClass('hidden', !mode);
},
setCanRename: function(rename) {
var dc = $('#header-documentcaption span');
if (rename) {
var me = this;
dc.tooltip({title: me.txtRename, placement: 'cursor'});
dc.on('click', function(e) {
(new Common.Views.RenameDialog({
filename: me.documentCaption,
handler: function(result, value) {
if (result == 'ok' && !_.isEmpty(value.trim()) && me.documentCaption !== value.trim()) {
Common.Gateway.requestRename(value);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show(dc.position().left-1, 20);
});
} else {
var tip = dc.data('bs.tooltip');
if (tip) {
tip.options.title = '';
tip.setContent();
}
dc.off('click');
}
dc.css('cursor', rename ? 'pointer' : 'default');
},
textBack: 'Go to Documents',
openNewTabText: 'Open in New Tab',
txtHeaderDeveloper: 'DEVELOPER MODE'
txtHeaderDeveloper: 'DEVELOPER MODE',
txtRename: 'Rename'
}, Common.Views.Header || {}))
});

View file

@ -0,0 +1,134 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* 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. 125a-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
*
*/
/**
* RenameDialog.js
*
* Created by Julia Radzhabova on 9/23/16
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window'
], function () { 'use strict';
Common.Views.RenameDialog = Common.UI.Window.extend(_.extend({
options: {
width: 330,
header: false,
cls: 'modal-dlg',
filename: ''
},
initialize : function(options) {
_.extend(this.options, options || {});
this.template = [
'<div class="box">',
'<div class="input-row">',
'<label>' + this.textName + '</label>',
'</div>',
'<div id="id-dlg-newname" class="input-row"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + '</button>',
'</div>'
].join('');
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var me = this;
me.inputName = new Common.UI.InputField({
el : $('#id-dlg-newname'),
style : 'width: 100%;',
validateOnBlur: false,
validation : function(value) {
return (/[\t*\+:\"<>?|\\\\/]/gim.test(value)) ? me.txtInvalidName + "*+:\"<>?|\/" : true;
}
});
var $window = this.getChild();
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
me.inputNameEl = $window.find('input');
me.inputNameEl.on('keypress', _.bind(this.onKeyPress, this));
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
me.inputName.setValue(me.options.filename);
me.inputNameEl.focus().select();
},100);
},
onKeyPress: function(event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput('ok');
}
},
onBtnClick: function(event) {
this._handleInput(event.currentTarget.attributes['result'].value);
},
_handleInput: function(state) {
if (this.options.handler) {
if (state == 'ok') {
if (this.inputName.checkValidate() !== true) {
this.inputNameEl.focus();
return;
}
}
this.options.handler.call(this, state, this.inputName.getValue());
}
this.close();
},
textName : 'File name',
cancelButtonText: 'Cancel',
okButtonText : 'Ok',
txtInvalidName : 'The file name cannot contain any of the following characters: '
}, Common.Views.RenameDialog || {}));
});

View file

@ -235,6 +235,19 @@ define([
this.showHistory();
}
break;
case 'rename':
var me = this,
documentCaption = me.api.asc_getDocumentName();
(new Common.Views.RenameDialog({
filename: documentCaption,
handler: function(result, value) {
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
Common.Gateway.requestRename(value);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
break;
default: close_menu = false;
}

View file

@ -130,6 +130,7 @@ define([
this.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(this.onAdvancedOptions, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
@ -363,6 +364,7 @@ define([
});
} else {
this.api.asc_coAuthoringDisconnect();
this.getApplication().getController('Viewport').getView('Common.Views.Header').setCanRename(false);
this.getApplication().getController('LeftMenu').getView('LeftMenu').showHistory();
this.disableEditing(true);
var versions = opts.data.history,
@ -969,6 +971,7 @@ define([
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename;
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string');
@ -976,11 +979,13 @@ define([
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
var headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
this.getApplication().getController('Viewport').getView('Common.Views.Header').setBranding(this.editorConfig.customization);
headerView.setBranding(this.editorConfig.customization);
params.asc_getTrial() && this.getApplication().getController('Viewport').getView('Common.Views.Header').setDeveloperMode(true);
params.asc_getTrial() && headerView.setDeveloperMode(true);
this.appOptions.canRename && headerView.setCanRename(true);
this.applyModeCommonElements();
this.applyModeEditorElements();
@ -1276,6 +1281,8 @@ define([
onCoAuthoringDisconnect: function() {
this.getApplication().getController('Viewport').getView('Viewport').setMode({isDisconnected:true});
this.getApplication().getController('Viewport').getView('Common.Views.Header').setCanRename(false);
this.appOptions.canRename = false;
this._state.isDisconnected = true;
},
@ -1706,6 +1713,17 @@ define([
this.updateWindowTitle(true);
},
onMeta: function(meta) {
var app = this.getApplication(),
filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file');
app.getController('Viewport').getView('Common.Views.Header').setDocumentCaption(meta.title);
this.updateWindowTitle(true);
this.document.title = meta.title;
filemenu.loadDocument({doc:this.document});
filemenu.panels['info'].updateInfo(this.document);
Common.Gateway.metaChange(meta);
},
onPrint: function() {
if (!this.appOptions.canPrint) return;

View file

@ -7,6 +7,7 @@
<li id="fm-btn-download" class="fm-btn" />
<li id="fm-btn-save-desktop" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li id="fm-btn-rename" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />

View file

@ -121,6 +121,12 @@ define([
caption : this.btnPrintCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-rename',this.el),
action : 'rename',
caption : this.btnRenameCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -208,9 +214,10 @@ define([
applyMode: function() {
this.items[5][this.mode.canPrint?'show':'hide']();
this.items[6][this.mode.canOpenRecent?'show':'hide']();
this.items[7][this.mode.canCreateNew?'show':'hide']();
this.items[7].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.items[7][this.mode.canOpenRecent?'show':'hide']();
this.items[8][this.mode.canCreateNew?'show':'hide']();
this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[3][((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
this.items[4][((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
@ -219,7 +226,7 @@ define([
this.items[1][this.mode.isEdit?'show':'hide']();
this.items[2][!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.items[9][(!this.mode.isOffline && !this.mode.isReviewOnly && this.document&&this.document.info &&
this.items[10][(!this.mode.isOffline && !this.mode.isReviewOnly && this.document&&this.document.info &&
(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
@ -232,7 +239,7 @@ define([
if ( this.mode.canCreateNew ) {
if (this.mode.templates && this.mode.templates.length) {
$('a',this.items[7].$el).text(this.btnCreateNewCaption + '...');
$('a',this.items[8].$el).text(this.btnCreateNewCaption + '...');
this.panels['new'] = ((new DE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
}
}
@ -254,8 +261,8 @@ define([
this.panels['help'].setLangConfig(this.mode.lang);
this.items[10][this.mode.canUseHistory?'show':'hide']();
this.items[10].setDisabled(this.mode.isDisconnected);
this.items[11][this.mode.canUseHistory?'show':'hide']();
this.items[11].setDisabled(this.mode.isDisconnected);
},
setMode: function(mode, delay) {
@ -263,6 +270,7 @@ define([
this.mode.canEdit = this.mode.isEdit = false;
this.mode.canOpenRecent = this.mode.canCreateNew = false;
this.mode.isDisconnected = mode.isDisconnected;
this.mode.canRename = false;
} else {
this.mode = mode;
}
@ -303,6 +311,7 @@ define([
SetDisabled: function(disable) {
this.items[1][(disable || !this.mode.isEdit)?'hide':'show']();
this.items[6][(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
},
btnSaveCaption : 'Save',
@ -319,6 +328,7 @@ define([
btnSettingsCaption : 'Advanced Settings...',
btnHistoryCaption : 'Versions History',
btnSaveAsCaption : 'Save as',
textDownload : 'Download'
textDownload : 'Download',
btnRenameCaption : 'Rename...'
}, DE.Views.FileMenu || {}));
});

View file

@ -437,8 +437,8 @@ define([
textAutoRecover: 'Autorecover',
strAutoRecover: 'Turn on autorecover',
txtInch: 'Inch',
txtFitPage: 'Fit Page',
txtFitWidth: 'Fit Width'
txtFitPage: 'Fit to Page',
txtFitWidth: 'Fit to Width'
}, DE.Views.FileMenuPanels.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({

View file

@ -506,8 +506,8 @@ define([
tipUsers : 'Document is currently being edited by several users.',
tipMoreUsers : 'and %1 users.',
tipShowUsers : 'To see all users click the icon below.',
tipFitPage : 'Fit Page',
tipFitWidth : 'Fit Width',
tipFitPage : 'Fit to Page',
tipFitWidth : 'Fit to Width',
tipZoomIn : 'Zoom In',
tipZoomOut : 'Zoom Out',
tipZoomFactor : 'Magnification',

View file

@ -1834,8 +1834,8 @@ define([
textHideTitleBar: 'Hide Title Bar',
textHideStatusBar: 'Hide Status Bar',
textHideLines: 'Hide Rulers',
textFitPage: 'Fit Page',
textFitWidth: 'Fit Width',
textFitPage: 'Fit to Page',
textFitWidth: 'Fit to Width',
textZoom: 'Zoom',
mniEditDropCap: 'Drop Cap Settings',
textNone: 'None',

View file

@ -142,6 +142,7 @@
"Common.Views.Header.openNewTabText": "Open in New Tab",
"Common.Views.Header.textBack": "Go to Documents",
"Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"Common.Views.Header.txtRename": "Rename",
"Common.Views.History.textHistoryHeader": "Back to Document",
"Common.Views.History.textRestore": "Restore",
"Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel",
@ -167,6 +168,10 @@
"Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
"Common.Views.RenameDialog.cancelButtonText": "Cancel",
"Common.Views.RenameDialog.okButtonText": "Ok",
"Common.Views.RenameDialog.textName": "File name",
"Common.Views.RenameDialog.txtInvalidName": "The file name cannot contain any of the following characters: ",
"Common.Views.ReviewChanges.txtAccept": "Accept",
"Common.Views.ReviewChanges.txtAcceptAll": "Accept All Changes",
"Common.Views.ReviewChanges.txtAcceptCurrent": "Accept Current Change",
@ -870,6 +875,7 @@
"DE.Views.FileMenu.btnInfoCaption": "Document Info...",
"DE.Views.FileMenu.btnPrintCaption": "Print",
"DE.Views.FileMenu.btnRecentFilesCaption": "Open Recent...",
"DE.Views.FileMenu.btnRenameCaption": "Rename...",
"DE.Views.FileMenu.btnReturnCaption": "Back to Document",
"DE.Views.FileMenu.btnRightsCaption": "Access Rights...",
"DE.Views.FileMenu.btnSaveAsCaption": "Save as",
@ -936,8 +942,6 @@
"DE.Views.FileMenuPanels.Settings.txtPt": "Point",
"DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking",
"DE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
"DE.Views.FileMenuPanels.Settings.txtFitPage": "Fit Page",
"DE.Views.FileMenuPanels.Settings.txtFitWidth": "Fit Width",
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom Center",
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom Left",
"DE.Views.HeaderFooterSettings.textBottomRight": "Bottom Right",

View file

@ -196,6 +196,19 @@ define([
if ( isopts ) close_menu = false;
else this.onCreateNew(undefined, 'blank');
break;
case 'rename':
var me = this,
documentCaption = me.api.asc_getDocumentName();
(new Common.Views.RenameDialog({
filename: documentCaption,
handler: function(result, value) {
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
Common.Gateway.requestRename(value);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
break;
default: close_menu = false;
}

View file

@ -121,6 +121,7 @@ define([
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
@ -738,14 +739,17 @@ define([
this.appOptions.canComments = this.appOptions.canLicense && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canRename = !!this.permissions.rename;
this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
var headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
this.getApplication().getController('Viewport').getView('Common.Views.Header').setBranding(this.editorConfig.customization);
headerView.setBranding(this.editorConfig.customization);
params.asc_getTrial() && this.getApplication().getController('Viewport').getView('Common.Views.Header').setDeveloperMode(true);
params.asc_getTrial() && headerView.setDeveloperMode(true);
this.appOptions.canRename && headerView.setCanRename(true);
this.applyModeCommonElements();
this.applyModeEditorElements();
@ -1030,6 +1034,8 @@ define([
onCoAuthoringDisconnect: function() {
// TODO: Disable all except 'Download As' and 'Print'
this.getApplication().getController('Viewport').getView('Viewport').setMode({isDisconnected:true});
this.getApplication().getController('Viewport').getView('Common.Views.Header').setCanRename(false);
this.appOptions.canRename = false;
this._state.isDisconnected = true;
// this.getFileMenu().setMode({isDisconnected:true});
},
@ -1464,6 +1470,17 @@ define([
this.updateWindowTitle(true);
},
onMeta: function(meta) {
var app = this.getApplication(),
filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file');
app.getController('Viewport').getView('Common.Views.Header').setDocumentCaption(meta.title);
this.updateWindowTitle(true);
this.document.title = meta.title;
filemenu.loadDocument({doc:this.document});
filemenu.panels['info'].updateInfo(this.document);
Common.Gateway.metaChange(meta);
},
onPrint: function() {
if (!this.appOptions.canPrint) return;

View file

@ -7,6 +7,7 @@
<li id="fm-btn-download" class="fm-btn" />
<li id="fm-btn-save-desktop" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li id="fm-btn-rename" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />

View file

@ -124,6 +124,12 @@ define([
caption : this.btnPrintCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-rename',this.el),
action : 'rename',
caption : this.btnRenameCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -205,9 +211,10 @@ define([
applyMode: function() {
this.items[5][this.mode.canPrint?'show':'hide']();
this.items[6][this.mode.canOpenRecent?'show':'hide']();
this.items[7][this.mode.canCreateNew?'show':'hide']();
this.items[7].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.items[7][this.mode.canOpenRecent?'show':'hide']();
this.items[8][this.mode.canCreateNew?'show':'hide']();
this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[3][(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
this.items[4][(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
@ -217,7 +224,7 @@ define([
this.items[1][this.mode.isEdit?'show':'hide']();
this.items[2][!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.items[9][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.items[10][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
@ -229,7 +236,7 @@ define([
if ( this.mode.canCreateNew ) {
if (this.mode.templates && this.mode.templates.length) {
$('a',this.items[7].$el).text(this.btnCreateNewCaption + '...');
$('a',this.items[8].$el).text(this.btnCreateNewCaption + '...');
this.panels['new'] = ((new PE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
}
}
@ -251,6 +258,7 @@ define([
if (mode.isDisconnected) {
this.mode.canEdit = this.mode.isEdit = false;
this.mode.canOpenRecent = this.mode.canCreateNew = false;
this.mode.canRename = false;
} else {
this.mode = mode;
}
@ -315,6 +323,7 @@ define([
btnToEditCaption : 'Edit Document',
btnBackCaption : 'Go to Documents',
btnSettingsCaption : 'Advanced Settings...',
btnSaveAsCaption : 'Save as'
btnSaveAsCaption : 'Save as',
btnRenameCaption : 'Rename...'
}, PE.Views.FileMenu || {}));
});

View file

@ -81,6 +81,7 @@
"Common.Views.Header.openNewTabText": "Open in New Tab",
"Common.Views.Header.textBack": "Go to Documents",
"Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"Common.Views.Header.txtRename": "Rename",
"Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel",
"Common.Views.ImageFromUrlDialog.okButtonText": "OK",
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
@ -98,14 +99,16 @@
"Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
"Common.Views.RenameDialog.cancelButtonText": "Cancel",
"Common.Views.RenameDialog.okButtonText": "Ok",
"Common.Views.RenameDialog.textName": "File name",
"Common.Views.RenameDialog.txtInvalidName": "The file name cannot contain any of the following characters: ",
"PE.Controllers.LeftMenu.newDocumentTitle": "Unnamed presentation",
"PE.Controllers.LeftMenu.requestEditRightsText": "Requesting editing rights...",
"PE.Controllers.LeftMenu.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
"PE.Controllers.Main.applyChangesTextText": "Loading data...",
"PE.Controllers.Main.applyChangesTitleText": "Loading Data",
"del_PE.Controllers.Main.convertationErrorText": "Conversion failed.",
"PE.Controllers.Main.openErrorText": "An error has occurred while opening the file",
"PE.Controllers.Main.saveErrorText": "An error has occurred while saving the file",
"PE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",
"PE.Controllers.Main.criticalErrorExtText": "Press \"OK\" to return to document list.",
"PE.Controllers.Main.criticalErrorTitle": "Error",
@ -341,6 +344,7 @@
"PE.Views.FileMenu.btnInfoCaption": "Presentation Info...",
"PE.Views.FileMenu.btnPrintCaption": "Print",
"PE.Views.FileMenu.btnRecentFilesCaption": "Open Recent...",
"PE.Views.FileMenu.btnRenameCaption": "Rename...",
"PE.Views.FileMenu.btnReturnCaption": "Back to Presentation",
"PE.Views.FileMenu.btnRightsCaption": "Access Rights...",
"PE.Views.FileMenu.btnSaveAsCaption": "Save as",

View file

@ -205,6 +205,19 @@ define([
if ( isopts ) close_menu = false;
else this.onCreateNew(undefined, 'blank');
break;
case 'rename':
var me = this,
documentCaption = me.api.asc_getDocumentName();
(new Common.Views.RenameDialog({
filename: documentCaption,
handler: function(result, value) {
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
Common.Gateway.requestRename(value);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
break;
default: close_menu = false;
}

View file

@ -121,6 +121,7 @@ define([
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(this.onUpdateVersion, this));
this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onPrintUrl', _.bind(this.onPrintUrl, this));
this.api.asc_registerCallback('asc_onMeta', _.bind(this.onMeta, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
Common.NotificationCenter.on('namedrange:locked', _.bind(this.onNamedRangeLocked, this));
@ -758,12 +759,14 @@ define([
/** coauthoring end **/
this.appOptions.canComments = this.appOptions.canLicense && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false);
this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false);
this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
this.headerView.setBranding(this.editorConfig.customization);
params.asc_getTrial() && this.headerView.setDeveloperMode(true);
this.appOptions.canRename && this.headerView.setCanRename(true);
}
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
@ -1183,7 +1186,9 @@ define([
onCoAuthoringDisconnect: function() {
this.getApplication().getController('Viewport').getView('Viewport').setMode({isDisconnected:true});
this._state.isDisconnected = true;
this.getApplication().getController('Viewport').getView('Common.Views.Header').setCanRename(false);
this.appOptions.canRename = false;
this._state.isDisconnected = true;
},
showTips: function(strings) {
@ -1699,6 +1704,17 @@ define([
this.updateWindowTitle(this.api.asc_isDocumentModified(), true);
},
onMeta: function(meta) {
var app = this.getApplication(),
filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file');
app.getController('Viewport').getView('Common.Views.Header').setDocumentCaption(meta.title);
this.updateWindowTitle(true);
this.appOptions.spreadsheet.title = meta.title;
filemenu.loadDocument({doc:this.appOptions.spreadsheet});
filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet);
Common.Gateway.metaChange(meta);
},
onPrint: function() {
if (!this.appOptions.canPrint) return;
Common.NotificationCenter.trigger('print', this);

View file

@ -7,6 +7,7 @@
<li id="fm-btn-download" class="fm-btn" />
<li id="fm-btn-save-desktop" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li id="fm-btn-rename" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />

View file

@ -111,6 +111,12 @@ define([
caption : this.btnPrintCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-rename',this.el),
action : 'rename',
caption : this.btnRenameCaption,
canFocused: false
}),
new Common.UI.MenuItem({
el : $('#fm-btn-recent',this.el),
action : 'recent',
@ -191,9 +197,10 @@ define([
applyMode: function() {
this.items[5][this.mode.canPrint?'show':'hide']();
this.items[6][this.mode.canOpenRecent?'show':'hide']();
this.items[7][this.mode.canCreateNew?'show':'hide']();
this.items[7].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.items[7][this.mode.canOpenRecent?'show':'hide']();
this.items[8][this.mode.canCreateNew?'show':'hide']();
this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
this.items[3][(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
this.items[4][(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
@ -202,11 +209,11 @@ define([
this.items[1][this.mode.isEdit?'show':'hide']();
this.items[2][!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.items[9][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.items[10][(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide']();
this.items[10][this.mode.isEdit?'show':'hide']();
this.items[10].$el.find('+.devider')[this.mode.isEdit?'show':'hide']();
this.items[11][this.mode.isEdit?'show':'hide']();
this.items[11].$el.find('+.devider')[this.mode.isEdit?'show':'hide']();
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
this.$el.find('#fm-btn-back').hide().prev().hide();
@ -217,7 +224,7 @@ define([
if ( this.mode.canCreateNew ) {
if (this.mode.templates && this.mode.templates.length) {
$('a',this.items[7].$el).text(this.btnCreateNewCaption + '...');
$('a',this.items[8].$el).text(this.btnCreateNewCaption + '...');
this.panels['new'] = ((new SSE.Views.FileMenuPanels.CreateNew({menu: this, docs: this.mode.templates})).render());
}
}
@ -235,6 +242,7 @@ define([
if (mode.isDisconnected) {
this.mode.canEdit = this.mode.isEdit = false;
this.mode.canOpenRecent = this.mode.canCreateNew = false;
this.mode.canRename = false;
} else {
this.mode = mode;
}
@ -291,6 +299,7 @@ define([
btnToEditCaption : 'Edit Document',
btnBackCaption : 'Go to Documents',
btnSettingsCaption : 'Advanced Settings...',
btnSaveAsCaption : 'Save as'
btnSaveAsCaption : 'Save as',
btnRenameCaption : 'Rename...'
}, SSE.Views.FileMenu || {}));
});

View file

@ -75,6 +75,7 @@
"Common.Views.Header.openNewTabText": "Open in New Tab",
"Common.Views.Header.textBack": "Go to Documents",
"Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"Common.Views.Header.txtRename": "Rename",
"Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel",
"Common.Views.ImageFromUrlDialog.okButtonText": "OK",
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
@ -93,6 +94,10 @@
"Common.Views.Plugins.strPlugins": "Plugins",
"Common.Views.Plugins.textLoading": "Loading",
"Common.Views.Plugins.textStart": "Start",
"Common.Views.RenameDialog.cancelButtonText": "Cancel",
"Common.Views.RenameDialog.okButtonText": "Ok",
"Common.Views.RenameDialog.textName": "File name",
"Common.Views.RenameDialog.txtInvalidName": "The file name cannot contain any of the following characters: ",
"SSE.Controllers.DocumentHolder.errorInvalidLink": "The link reference does not exist. Please correct the link or delete it.",
"SSE.Controllers.DocumentHolder.guestText": "Guest",
"SSE.Controllers.DocumentHolder.notcriticalErrorTitle": "Warning",
@ -527,6 +532,7 @@
"SSE.Views.FileMenu.btnInfoCaption": "Spreadsheet Info...",
"SSE.Views.FileMenu.btnPrintCaption": "Print",
"SSE.Views.FileMenu.btnRecentFilesCaption": "Open Recent...",
"SSE.Views.FileMenu.btnRenameCaption": "Rename...",
"SSE.Views.FileMenu.btnReturnCaption": "Back to Spreadsheet",
"SSE.Views.FileMenu.btnRightsCaption": "Access Rights...",
"SSE.Views.FileMenu.btnSaveAsCaption": "Save as",