Support rename for wopi
This commit is contained in:
parent
f221d2202e
commit
5c7350e28f
|
@ -67,6 +67,7 @@ div {
|
||||||
var startTime;
|
var startTime;
|
||||||
var documentChanged;
|
var documentChanged;
|
||||||
var sendNotificationTimer;
|
var sendNotificationTimer;
|
||||||
|
var sessionId;
|
||||||
|
|
||||||
var innerAlert = function (message) {
|
var innerAlert = function (message) {
|
||||||
if (console && console.log)
|
if (console && console.log)
|
||||||
|
@ -91,7 +92,7 @@ div {
|
||||||
if (window.parent && window.JSON) {
|
if (window.parent && window.JSON) {
|
||||||
msgData = msgData || {};
|
msgData = msgData || {};
|
||||||
msgData["ui-language"] = lang;
|
msgData["ui-language"] = lang;
|
||||||
msgData["wdUserSession"] = ""; // ???
|
msgData["wdUserSession"] = sessionId;
|
||||||
var msg = {
|
var msg = {
|
||||||
"MessageId": msgId,
|
"MessageId": msgId,
|
||||||
"SendTime": Date.now(),
|
"SendTime": Date.now(),
|
||||||
|
@ -232,6 +233,9 @@ div {
|
||||||
"coEditing": {
|
"coEditing": {
|
||||||
"mode": "fast",
|
"mode": "fast",
|
||||||
"change": false
|
"change": false
|
||||||
|
},
|
||||||
|
"wopi": {
|
||||||
|
"FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"events": {
|
"events": {
|
||||||
|
@ -249,6 +253,7 @@ div {
|
||||||
if (postMessageOrigin && (typeof postMessageOrigin === 'string') && postMessageOrigin.charAt(postMessageOrigin.length-1)=='/')
|
if (postMessageOrigin && (typeof postMessageOrigin === 'string') && postMessageOrigin.charAt(postMessageOrigin.length-1)=='/')
|
||||||
postMessageOrigin = postMessageOrigin.substring(0, postMessageOrigin.length - 1);
|
postMessageOrigin = postMessageOrigin.substring(0, postMessageOrigin.length - 1);
|
||||||
lang = config.editorConfig.lang;
|
lang = config.editorConfig.lang;
|
||||||
|
sessionId = userAuth.userSessionId;
|
||||||
|
|
||||||
startTime = Date.now();
|
startTime = Date.now();
|
||||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||||
|
|
|
@ -76,6 +76,7 @@ define([
|
||||||
el : $('#id-dlg-newname'),
|
el : $('#id-dlg-newname'),
|
||||||
style : 'width: 100%;',
|
style : 'width: 100%;',
|
||||||
validateOnBlur: false,
|
validateOnBlur: false,
|
||||||
|
maxLength: me.options.maxLength,
|
||||||
validation : function(value) {
|
validation : function(value) {
|
||||||
return (/[\t*\+:\"<>?|\\\\/]/gim.test(value)) ? me.txtInvalidName + "*+:\"<>?|\/" : true;
|
return (/[\t*\+:\"<>?|\\\\/]/gim.test(value)) ? me.txtInvalidName + "*+:\"<>?|\/" : true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,9 +276,10 @@ define([
|
||||||
documentCaption = me.api.asc_getDocumentName();
|
documentCaption = me.api.asc_getDocumentName();
|
||||||
(new Common.Views.RenameDialog({
|
(new Common.Views.RenameDialog({
|
||||||
filename: documentCaption,
|
filename: documentCaption,
|
||||||
|
maxLength: this.mode.wopi ? this.mode.wopi.FileNameMaxLength : undefined,
|
||||||
handler: function(result, value) {
|
handler: function(result, value) {
|
||||||
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
||||||
Common.Gateway.requestRename(value);
|
me.mode.wopi ? me.api.asc_wopi_renameFile(value) : Common.Gateway.requestRename(value);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,6 +413,8 @@ define([
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
Common.Utils.InternalSettings.set("de-macros-mode", value);
|
Common.Utils.InternalSettings.set("de-macros-mode", value);
|
||||||
|
|
||||||
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
|
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2328,6 +2330,11 @@ define([
|
||||||
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document);
|
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document);
|
||||||
this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document});
|
this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document});
|
||||||
Common.Gateway.metaChange(meta);
|
Common.Gateway.metaChange(meta);
|
||||||
|
|
||||||
|
if (this.appOptions.wopi) {
|
||||||
|
var idx = meta.title.lastIndexOf('.');
|
||||||
|
Common.Gateway.requestRename(idx>0 ? meta.title.substring(0, idx) : meta.title);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
|
|
|
@ -242,9 +242,10 @@ define([
|
||||||
documentCaption = me.api.asc_getDocumentName();
|
documentCaption = me.api.asc_getDocumentName();
|
||||||
(new Common.Views.RenameDialog({
|
(new Common.Views.RenameDialog({
|
||||||
filename: documentCaption,
|
filename: documentCaption,
|
||||||
|
maxLength: this.mode.wopi ? this.mode.wopi.FileNameMaxLength : undefined,
|
||||||
handler: function(result, value) {
|
handler: function(result, value) {
|
||||||
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
||||||
Common.Gateway.requestRename(value);
|
me.mode.wopi ? me.api.asc_wopi_renameFile(value) : Common.Gateway.requestRename(value);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,6 +373,8 @@ define([
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
Common.Utils.InternalSettings.set("pe-macros-mode", value);
|
Common.Utils.InternalSettings.set("pe-macros-mode", value);
|
||||||
|
|
||||||
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
|
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1982,6 +1984,11 @@ define([
|
||||||
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document);
|
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document);
|
||||||
this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document});
|
this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document});
|
||||||
Common.Gateway.metaChange(meta);
|
Common.Gateway.metaChange(meta);
|
||||||
|
|
||||||
|
if (this.appOptions.wopi) {
|
||||||
|
var idx = meta.title.lastIndexOf('.');
|
||||||
|
Common.Gateway.requestRename(idx>0 ? meta.title.substring(0, idx) : meta.title);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
|
|
|
@ -255,9 +255,10 @@ define([
|
||||||
documentCaption = me.api.asc_getDocumentName();
|
documentCaption = me.api.asc_getDocumentName();
|
||||||
(new Common.Views.RenameDialog({
|
(new Common.Views.RenameDialog({
|
||||||
filename: documentCaption,
|
filename: documentCaption,
|
||||||
|
maxLength: this.mode.wopi ? this.mode.wopi.FileNameMaxLength : undefined,
|
||||||
handler: function(result, value) {
|
handler: function(result, value) {
|
||||||
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
if (result == 'ok' && !_.isEmpty(value.trim()) && documentCaption !== value.trim()) {
|
||||||
Common.Gateway.requestRename(value);
|
me.mode.wopi ? me.api.asc_wopi_renameFile(value) : Common.Gateway.requestRename(value);
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,8 @@ define([
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
Common.Utils.InternalSettings.set("sse-macros-mode", value);
|
Common.Utils.InternalSettings.set("sse-macros-mode", value);
|
||||||
|
|
||||||
|
this.appOptions.wopi = this.editorConfig.wopi;
|
||||||
|
|
||||||
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
|
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
},
|
},
|
||||||
|
@ -2376,6 +2378,11 @@ define([
|
||||||
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet);
|
filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet);
|
||||||
app.getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.appOptions.spreadsheet});
|
app.getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.appOptions.spreadsheet});
|
||||||
Common.Gateway.metaChange(meta);
|
Common.Gateway.metaChange(meta);
|
||||||
|
|
||||||
|
if (this.appOptions.wopi) {
|
||||||
|
var idx = meta.title.lastIndexOf('.');
|
||||||
|
Common.Gateway.requestRename(idx>0 ? meta.title.substring(0, idx) : meta.title);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
|
|
Loading…
Reference in a new issue