This commit is contained in:
Alexander Trofimov
2015-06-25 11:27:08 +03:00
parent dbf21ee32f
commit a10605c91f
174 changed files with 24121 additions and 8908 deletions

View File

@@ -167,7 +167,7 @@
this.editorConfig = data.config;
},
setMode: function (permissions) {
this.permissions = permissions; ! (this.permissions.canCoAuthoring && this.permissions.isEdit) ? Common.util.Shortcuts.suspendEvents(this.hkComments) : Common.util.Shortcuts.resumeEvents(this.hkComments);
this.permissions = permissions; ! (this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) ? Common.util.Shortcuts.suspendEvents(this.hkComments) : Common.util.Shortcuts.resumeEvents(this.hkComments);
},
setApi: function (api) {
this.api = api;
@@ -187,22 +187,26 @@
onCopyPaste: function (item) {
var me = this;
if (me.api) {
var value = window.localStorage.getItem("sse-hide-copywarning");
if (! (value && parseInt(value) == 1) && me.show_copywarning) {
(new Common.Views.CopyWarningDialog({
handler: function (dontshow) {
(item.value == "cut") ? me.api.asc_Cut() : ((item.value == "copy") ? me.api.asc_Copy() : me.api.asc_Paste());
if (dontshow) {
window.localStorage.setItem("sse-hide-copywarning", 1);
}
Common.NotificationCenter.trigger("edit:complete", me.documentHolder);
}
})).show();
} else {
if (typeof window["AscDesktopEditor"] === "object") {
(item.value == "cut") ? me.api.asc_Cut() : ((item.value == "copy") ? me.api.asc_Copy() : me.api.asc_Paste());
Common.NotificationCenter.trigger("edit:complete", me.documentHolder);
} else {
var value = window.localStorage.getItem("sse-hide-copywarning");
if (! (value && parseInt(value) == 1) && me.show_copywarning) {
(new Common.Views.CopyWarningDialog({
handler: function (dontshow) {
(item.value == "cut") ? me.api.asc_Cut() : ((item.value == "copy") ? me.api.asc_Copy() : me.api.asc_Paste());
if (dontshow) {
window.localStorage.setItem("sse-hide-copywarning", 1);
}
Common.NotificationCenter.trigger("edit:complete", me.documentHolder);
}
})).show();
} else {
(item.value == "cut") ? me.api.asc_Cut() : ((item.value == "copy") ? me.api.asc_Copy() : me.api.asc_Paste());
Common.NotificationCenter.trigger("edit:complete", me.documentHolder);
}
Common.component.Analytics.trackEvent("ToolBar", "Copy Warning");
}
Common.component.Analytics.trackEvent("ToolBar", "Copy Warning");
}
},
onInsertEntire: function (item) {
@@ -342,7 +346,7 @@
}
},
onAddComment: function (item) {
if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit) {
if (this.api && this.permissions.canCoAuthoring && this.permissions.isEdit && this.permissions.canComments) {
this.api.asc_enableKeyEvents(false);
var controller = SSE.getController("Common.Controllers.Comments"),
cellinfo = this.api.asc_getCellInfo();
@@ -910,8 +914,8 @@
documentHolder.pmiColumnWidth.setVisible(iscolmenu || isallmenu);
documentHolder.pmiEntireHide.setVisible(iscolmenu || isrowmenu);
documentHolder.pmiEntireShow.setVisible(iscolmenu || isrowmenu);
documentHolder.ssMenu.items[10].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring);
documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring);
documentHolder.ssMenu.items[10].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments);
documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments);
documentHolder.pmiCellMenuSeparator.setVisible(iscellmenu || isrowmenu || iscolmenu || isallmenu || insfunc);
documentHolder.pmiEntireHide.isrowmenu = isrowmenu;
documentHolder.pmiEntireShow.isrowmenu = isrowmenu;

View File

@@ -103,7 +103,7 @@
this.api.asc_registerCallback("asc_onRenameCellTextEnd", _.bind(this.onRenameText, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiServerDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiServerDisconnect, this));
if (this.mode.canCoAuthoring) {
if (this.mode.canCoAuthoring && this.mode.canChat) {
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", _.bind(this.onApiChatMessage, this));
}
if (!this.mode.isEditDiagram) {
@@ -120,10 +120,14 @@
},
createDelayedElements: function () {
if (this.mode.canCoAuthoring) {
this.leftMenu.btnComments[this.mode.isEdit ? "show" : "hide"]();
this.leftMenu.btnChat.show();
this.leftMenu.setOptionsPanel("chat", this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"));
this.leftMenu.setOptionsPanel("comment", this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments"));
this.leftMenu.btnComments[this.mode.isEdit && this.mode.canComments ? "show" : "hide"]();
if (this.mode.canComments) {
this.leftMenu.setOptionsPanel("comment", this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments"));
}
this.leftMenu.btnChat[this.mode.canChat ? "show" : "hide"]();
if (this.mode.canChat) {
this.leftMenu.setOptionsPanel("chat", this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"));
}
} else {
this.leftMenu.btnChat.hide();
this.leftMenu.btnComments.hide();
@@ -236,7 +240,7 @@
}
},
clickStatusbarUsers: function () {
if (this.mode.canCoAuthoring) {
if (this.mode.canCoAuthoring && this.mode.canChat) {
if (this.leftMenu.btnChat.pressed) {
this.leftMenu.close();
} else {
@@ -523,13 +527,13 @@
}
break;
case "chat":
if (this.mode.canCoAuthoring) {
if (this.mode.canCoAuthoring && this.mode.canChat) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("chat");
}
return false;
case "comments":
if (this.mode.canCoAuthoring && this.mode.isEdit) {
if (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("comments");
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();

View File

@@ -34,6 +34,11 @@
var InitApplication = -254;
var ApplyEditRights = -255;
var LoadingDocument = -256;
var mapCustomizationElements = {
about: "button#left-btn-about",
feedback: "button#left-btn-support",
goback: "#fm-btn-back > a, #header-back > div"
};
return {
models: [],
collections: ["ShapeGroups", "TableTemplates"],
@@ -159,8 +164,9 @@
this.appOptions.user = this.editorConfig.user;
this.appOptions.canBack = this.editorConfig.nativeApp !== true && this.editorConfig.canBackToFolder === true;
this.appOptions.nativeApp = this.editorConfig.nativeApp === true;
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl);
this.appOptions.canOpenRecent = this.editorConfig.nativeApp !== true && this.editorConfig.recent !== undefined;
this.appOptions.isDesktopApp = this.editorConfig.targetApp == "desktop";
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp;
this.appOptions.canOpenRecent = this.editorConfig.nativeApp !== true && this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp;
this.appOptions.templates = this.editorConfig.templates;
this.appOptions.recent = this.editorConfig.recent;
this.appOptions.createUrl = this.editorConfig.createUrl;
@@ -169,6 +175,7 @@
this.appOptions.canAnalytics = false;
this.appOptions.sharingSettingsUrl = this.editorConfig.sharingSettingsUrl;
this.appOptions.isEditDiagram = this.editorConfig.mode == "editdiagram";
this.appOptions.customization = this.editorConfig.customization;
this.headerView = this.getApplication().getController("Viewport").getView("Common.Views.Header");
this.headerView.setCanBack(this.editorConfig.canBackToFolder === true);
if (this.editorConfig.lang) {
@@ -191,7 +198,6 @@
docInfo.VKey = data.doc.vkey;
docInfo.Origin = data.doc.origin;
docInfo.CallbackUrl = this.editorConfig.callbackUrl;
docInfo.OfflineApp = this.editorConfig.nativeApp === true;
this.headerView.setDocumentCaption(data.doc.title);
}
if (this.appOptions.isEditDiagram) {
@@ -214,7 +220,7 @@
onProcessRightsChange: function (data) {
if (data && data.enabled === false) {
this.api.asc_coAuthoringDisconnect();
this.getApplication().getController("LeftMenu").leftMenu.getMenu("file").panels["info"].onLostEditRights();
this.getApplication().getController("LeftMenu").leftMenu.getMenu("file").panels["rights"].onLostEditRights();
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: _.isEmpty(data.message) ? this.warnProcessRightsChange : data.message
@@ -417,7 +423,7 @@
leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api);
leftMenuView.disableMenu("all", false);
if (!me.appOptions.isEditDiagram && me.appOptions.canBranding) {
me.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(me.editorConfig.branding);
me.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(me.editorConfig.customization);
}
documentHolderController.setApi(me.api).loadConfig({
config: me.editorConfig
@@ -471,15 +477,18 @@
}
me.api.asc_setAutoSaveGap(value);
if (me.appOptions.canAnalytics) {
Common.Gateway.on("applyeditrights", _.bind(me.onApplyEditRights, me));
Common.component.Analytics.initialize("UA-12442749-13", "Spreadsheet Editor");
}
Common.Gateway.on("applyeditrights", _.bind(me.onApplyEditRights, me));
Common.Gateway.on("processsaveresult", _.bind(me.onProcessSaveResult, me));
Common.Gateway.on("processrightschange", _.bind(me.onProcessRightsChange, me));
Common.Gateway.on("processmouse", _.bind(me.onProcessMouse, me));
$(document).on("contextmenu", _.bind(me.onContextMenu, me));
Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); ! Common.Utils.isGecko && !me.appOptions.isEditDiagram && !me.appOptions.nativeApp && (Math.abs(me.getBrowseZoomLevel() - 1) > 0.1) && tips.push(Common.Utils.String.platformKey(me.warnBrowserZoom, "{0}"));
if (tips.length) {
me.showTips(tips);
if ( !! window["AscDesktopEditor"]) {
Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); ! Common.Utils.isGecko && !me.appOptions.isEditDiagram && !me.appOptions.nativeApp && (Math.abs(me.getBrowseZoomLevel() - 1) > 0.1) && tips.push(Common.Utils.String.platformKey(me.warnBrowserZoom, "{0}"));
if (tips.length) {
me.showTips(tips);
}
}
},
onOpenDocument: function (progress) {
@@ -494,10 +503,13 @@
this.permissions.download !== false && (this.permissions.download = params.asc_getCanDownload());
this.appOptions.canAutosave = this.editorConfig.canAutosave !== false && params.asc_getIsAutosaveEnable();
this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
this.appOptions.canCoAuthoring = params.asc_getCanCoAuthoring();
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof(this.editorConfig.branding) == "object");
this.appOptions.canCoAuthoring = true;
this.appOptions.canLicense = params.asc_getCanLicense ? params.asc_getCanLicense() : false;
this.appOptions.canComments = this.appOptions.canLicense && !((typeof(this.editorConfig.customization) == "object") && this.editorConfig.customization.comments === false);
this.appOptions.canChat = this.appOptions.canLicense && !((typeof(this.editorConfig.customization) == "object") && this.editorConfig.customization.chat === false);
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof(this.editorConfig.customization) == "object");
if (this.appOptions.canBranding) {
this.headerView.setBranding(this.editorConfig.branding);
this.headerView.setBranding(this.editorConfig.customization);
}
}
this.appOptions.canEdit = this.permissions.edit === true;
@@ -521,7 +533,7 @@
statusbarView = app.getController("Statusbar").getView("Statusbar");
if (this.headerView) {
this.headerView.setHeaderCaption(this.appOptions.isEdit ? "Spreadsheet Editor" : "Spreadsheet Viewer");
this.headerView.setVisible(!this.appOptions.nativeApp && !value && !this.appOptions.isEditDiagram);
this.headerView.setVisible(!this.appOptions.nativeApp && !value && !this.appOptions.isDesktopApp && !this.appOptions.isEditDiagram);
}
viewport && viewport.setMode(this.appOptions, true);
statusbarView && statusbarView.setMode(this.appOptions);
@@ -870,6 +882,10 @@
}
},
hidePreloader: function () {
if ( !! this.appOptions.customization && !this.appOptions.customization.done) {
this.appOptions.customization.done = true;
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements);
}
this.stackLongActions.pop({
id: InitApplication,
type: c_oAscAsyncActionType.BlockInteraction

View File

@@ -287,20 +287,25 @@
onCopyPaste: function (copy, e) {
var me = this;
if (me.api) {
var value = window.localStorage.getItem("sse-hide-copywarning");
if (! (value && parseInt(value) == 1) && this._state.show_copywarning) {
(new Common.Views.CopyWarningDialog({
handler: function (dontshow) {
copy ? me.api.asc_Copy() : me.api.asc_Paste();
if (dontshow) {
window.localStorage.setItem("sse-hide-copywarning", 1);
}
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
}
})).show();
} else {
if (typeof window["AscDesktopEditor"] === "object") {
copy ? me.api.asc_Copy() : me.api.asc_Paste();
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
} else {
var value = window.localStorage.getItem("sse-hide-copywarning");
if (! (value && parseInt(value) == 1) && this._state.show_copywarning) {
(new Common.Views.CopyWarningDialog({
handler: function (dontshow) {
copy ? me.api.asc_Copy() : me.api.asc_Paste();
if (dontshow) {
window.localStorage.setItem("sse-hide-copywarning", 1);
}
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
}
})).show();
} else {
copy ? me.api.asc_Copy() : me.api.asc_Paste();
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
}
}
Common.component.Analytics.trackEvent("ToolBar", "Copy Warning");
} else {