Commit 3eb619db authored by Julia Radzhabova's avatar Julia Radzhabova

Added "Rename" to the File menu.

parent 954f36ae
......@@ -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;
}
......
......@@ -971,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');
......@@ -984,7 +985,7 @@ define([
headerView.setBranding(this.editorConfig.customization);
params.asc_getTrial() && headerView.setDeveloperMode(true);
this.permissions.rename && headerView.setCanRename(true);
this.appOptions.canRename && headerView.setCanRename(true);
this.applyModeCommonElements();
this.applyModeEditorElements();
......@@ -1281,6 +1282,7 @@ 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;
},
......
......@@ -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" />
......
......@@ -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 || {}));
});
......@@ -875,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",
......
......@@ -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;
}
......
......@@ -739,6 +739,7 @@ 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';
......@@ -748,7 +749,7 @@ define([
headerView.setBranding(this.editorConfig.customization);
params.asc_getTrial() && headerView.setDeveloperMode(true);
this.permissions.rename && headerView.setCanRename(true);
this.appOptions.canRename && headerView.setCanRename(true);
this.applyModeCommonElements();
this.applyModeEditorElements();
......@@ -1034,6 +1035,7 @@ define([
// 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});
},
......
......@@ -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" />
......
......@@ -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 || {}));
});
......@@ -344,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",
......
......@@ -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;
}
......
......@@ -759,13 +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.permissions.rename && this.headerView.setCanRename(true);
this.appOptions.canRename && this.headerView.setCanRename(true);
}
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
......@@ -1186,6 +1187,7 @@ 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;
},
......
......@@ -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" />
......
......@@ -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 || {}));
});
......@@ -532,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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment