bug fix
This commit is contained in:
@@ -92,10 +92,13 @@
|
||||
this.api.asc_registerCallback("asc_onReplaceAll", _.bind(this.onApiTextReplaced, 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));
|
||||
}
|
||||
this.leftMenu.getMenu("file").setApi(api);
|
||||
if (this.mode.canUseHistory) {
|
||||
this.getApplication().getController("Common.Controllers.History").setApi(this.api);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
@@ -106,14 +109,21 @@
|
||||
},
|
||||
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();
|
||||
}
|
||||
if (this.mode.canUseHistory) {
|
||||
this.leftMenu.setOptionsPanel("history", this.getApplication().getController("Common.Controllers.History").getView("Common.Views.History"));
|
||||
}
|
||||
Common.util.Shortcuts.resumeEvents();
|
||||
return this;
|
||||
},
|
||||
@@ -142,6 +152,30 @@
|
||||
this.onCreateNew(undefined, "blank");
|
||||
}
|
||||
break;
|
||||
case "history":
|
||||
if (this.api.isDocumentModified()) {
|
||||
var me = this;
|
||||
this.api.asc_stopSaving();
|
||||
Common.UI.warning({
|
||||
closable: false,
|
||||
title: this.notcriticalErrorTitle,
|
||||
msg: this.leavePageText,
|
||||
buttons: ["ok", "cancel"],
|
||||
primary: "ok",
|
||||
callback: _.bind(function (btn) {
|
||||
if (btn == "ok") {
|
||||
me.api.asc_undoAllChanges();
|
||||
me.showHistory();
|
||||
} else {
|
||||
me.api.asc_continueSaving();
|
||||
}
|
||||
},
|
||||
this)
|
||||
});
|
||||
} else {
|
||||
this.showHistory();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
close_menu = false;
|
||||
}
|
||||
@@ -231,7 +265,7 @@
|
||||
}
|
||||
},
|
||||
clickStatusbarUsers: function () {
|
||||
if (this.mode.canCoAuthoring) {
|
||||
if (this.mode.canCoAuthoring && this.mode.canChat) {
|
||||
if (this.leftMenu.btnChat.pressed) {
|
||||
this.leftMenu.close();
|
||||
} else {
|
||||
@@ -333,6 +367,14 @@
|
||||
this.dlgSearch["hide"]();
|
||||
}
|
||||
},
|
||||
SetDisabled: function (disable) {
|
||||
this.mode.isEdit = !disable;
|
||||
if (disable) {
|
||||
this.leftMenu.close();
|
||||
}
|
||||
this.leftMenu.btnComments.setDisabled(disable);
|
||||
this.leftMenu.btnChat.setDisabled(disable);
|
||||
},
|
||||
onApiChatMessage: function () {
|
||||
this.leftMenu.markCoauthOptions();
|
||||
},
|
||||
@@ -405,13 +447,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();
|
||||
@@ -419,11 +461,25 @@
|
||||
return false;
|
||||
}
|
||||
},
|
||||
showHistory: function () {
|
||||
var maincontroller = DE.getController("Main");
|
||||
if (!maincontroller.loadMask) {
|
||||
maincontroller.loadMask = new Common.UI.LoadMask({
|
||||
owner: $("#viewport")
|
||||
});
|
||||
}
|
||||
maincontroller.loadMask.setTitle(this.textLoadHistory);
|
||||
maincontroller.loadMask.show();
|
||||
Common.Gateway.requestHistory();
|
||||
},
|
||||
textNoTextFound: "Text not found",
|
||||
newDocumentTitle: "Unnamed document",
|
||||
requestEditRightsText: "Requesting editing rights...",
|
||||
textReplaceSuccess: "Search has been done. {0} occurrences have been replaced",
|
||||
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped."
|
||||
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped.",
|
||||
textLoadHistory: "Loading versions history...",
|
||||
notcriticalErrorTitle: "Warning",
|
||||
leavePageText: "All unsaved changes in this document will be lost.<br> Click 'Cancel' then 'Save' to save them. Click 'OK' to discard all the unsaved changes."
|
||||
},
|
||||
DE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
@@ -33,9 +33,14 @@
|
||||
DE.Controllers.Main = Backbone.Controller.extend(_.extend((function () {
|
||||
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", "EquationGroups"],
|
||||
collections: ["ShapeGroups", "EquationGroups", "Common.Collections.HistoryUsers"],
|
||||
views: [],
|
||||
initialize: function () {},
|
||||
onLaunch: function () {
|
||||
@@ -49,7 +54,9 @@
|
||||
return obj1.type === obj2.type;
|
||||
}
|
||||
});
|
||||
this._state = {};
|
||||
this._state = {
|
||||
isDisconnected: false
|
||||
};
|
||||
if (!Common.Utils.isBrowserSupported()) {
|
||||
Common.Utils.showBrowserRestriction();
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
@@ -161,8 +168,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;
|
||||
@@ -190,7 +198,6 @@
|
||||
docInfo.put_UserId(this.editorConfig.user.id);
|
||||
docInfo.put_UserName(this.editorConfig.user.name);
|
||||
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
|
||||
docInfo.put_OfflineApp(this.editorConfig.nativeApp === true);
|
||||
}
|
||||
this.api.asc_registerCallback("asc_onGetEditorPermissions", _.bind(this.onEditorPermissions, this));
|
||||
this.api.asc_setDocInfo(docInfo);
|
||||
@@ -211,7 +218,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
|
||||
@@ -227,6 +234,144 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
onRefreshHistory: function (opts) {
|
||||
this.loadMask && this.loadMask.hide();
|
||||
if (opts.data.error) {
|
||||
var config = {
|
||||
closable: false,
|
||||
title: this.notcriticalErrorTitle,
|
||||
msg: opts.data.error,
|
||||
iconCls: "warn",
|
||||
buttons: ["ok"],
|
||||
callback: _.bind(function (btn) {
|
||||
this.onEditComplete();
|
||||
},
|
||||
this)
|
||||
};
|
||||
Common.UI.alert(config);
|
||||
} else {
|
||||
this.api.asc_coAuthoringDisconnect();
|
||||
this.getApplication().getController("LeftMenu").getView("LeftMenu").showHistory();
|
||||
this.disableEditing(true);
|
||||
var versions = opts.data.history,
|
||||
historyStore = this.getApplication().getCollection("Common.Collections.HistoryVersions"),
|
||||
currentVersion = null;
|
||||
if (historyStore) {
|
||||
var arrVersions = [],
|
||||
ver,
|
||||
version,
|
||||
group = -1,
|
||||
prev_ver = -1,
|
||||
arrColors = [],
|
||||
docIdPrev = "",
|
||||
usersStore = this.getApplication().getCollection("Common.Collections.HistoryUsers"),
|
||||
user = null,
|
||||
usersCnt = 0;
|
||||
for (ver = versions.length - 1; ver >= 0; ver--) {
|
||||
version = versions[ver];
|
||||
if (version && version.user) {
|
||||
docIdPrev = (ver > 0 && versions[ver - 1]) ? versions[ver - 1].key : version.key + "0";
|
||||
user = usersStore.findUser(version.user.id);
|
||||
if (!user) {
|
||||
user = new Common.Models.User({
|
||||
id: version.user.id,
|
||||
username: version.user.name,
|
||||
colorval: c_oAscArrUserColors[usersCnt],
|
||||
color: this.generateUserColor(c_oAscArrUserColors[usersCnt++])
|
||||
});
|
||||
usersStore.add(user);
|
||||
}
|
||||
arrVersions.push(new Common.Models.HistoryVersion({
|
||||
version: version.version_group,
|
||||
revision: version.version,
|
||||
userid: version.user.id,
|
||||
username: version.user.name,
|
||||
usercolor: user.get("color"),
|
||||
created: version.created,
|
||||
docId: version.key,
|
||||
markedAsVersion: (group !== version.version_group),
|
||||
selected: (opts.data.currentVersion == version.version)
|
||||
}));
|
||||
if (opts.data.currentVersion == version.version) {
|
||||
currentVersion = arrVersions[arrVersions.length - 1];
|
||||
}
|
||||
group = version.version_group;
|
||||
if (prev_ver !== version.version) {
|
||||
prev_ver = version.version;
|
||||
arrColors.reverse();
|
||||
for (i = 0; i < arrColors.length; i++) {
|
||||
arrVersions[arrVersions.length - i - 2].set("arrColors", arrColors);
|
||||
}
|
||||
arrColors = [];
|
||||
}
|
||||
arrColors.push(user.get("colorval"));
|
||||
var changes = version.changes,
|
||||
change, i;
|
||||
if (changes) {
|
||||
if (changes.length > 0) {
|
||||
arrVersions[arrVersions.length - 1].set("changeid", changes.length - 1);
|
||||
arrVersions[arrVersions.length - 1].set("docIdPrev", docIdPrev);
|
||||
}
|
||||
for (i = changes.length - 2; i >= 0; i--) {
|
||||
change = changes[i];
|
||||
user = usersStore.findUser(change.user.id);
|
||||
if (!user) {
|
||||
user = new Common.Models.User({
|
||||
id: change.user.id,
|
||||
username: change.user.name,
|
||||
colorval: c_oAscArrUserColors[usersCnt],
|
||||
color: this.generateUserColor(c_oAscArrUserColors[usersCnt++])
|
||||
});
|
||||
usersStore.add(user);
|
||||
}
|
||||
arrVersions.push(new Common.Models.HistoryVersion({
|
||||
version: version.version_group,
|
||||
revision: version.version,
|
||||
changeid: i,
|
||||
userid: change.user.id,
|
||||
username: change.user.name,
|
||||
usercolor: user.get("color"),
|
||||
created: change.created,
|
||||
docId: version.key,
|
||||
docIdPrev: docIdPrev,
|
||||
selected: false
|
||||
}));
|
||||
arrColors.push(user.get("colorval"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arrColors.length > 0) {
|
||||
arrColors.reverse();
|
||||
for (i = 0; i < arrColors.length; i++) {
|
||||
arrVersions[arrVersions.length - i - 1].set("arrColors", arrColors);
|
||||
}
|
||||
arrColors = [];
|
||||
}
|
||||
historyStore[historyStore.size() > 0 ? "add" : "reset"](arrVersions);
|
||||
if (currentVersion) {
|
||||
this.getApplication().getController("Common.Controllers.History").onSelectRevision(null, null, currentVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
generateUserColor: function (color) {
|
||||
return "#" + ("000000" + color.toString(16)).substr(-6);
|
||||
},
|
||||
disableEditing: function (disable) {
|
||||
var app = this.getApplication();
|
||||
if (this.appOptions.isEdit) {
|
||||
app.getController("Toolbar").DisableToolbar(disable, disable);
|
||||
app.getController("RightMenu").SetDisabled(disable, false);
|
||||
app.getController("Statusbar").getView("Statusbar").btnLanguage.setDisabled(disable);
|
||||
app.getController("Statusbar").getView("Statusbar").btnDocLanguage.setDisabled(disable);
|
||||
var tooltip = app.getController("Toolbar").getView("Toolbar").synchTooltip;
|
||||
if (tooltip) {
|
||||
tooltip.hide();
|
||||
}
|
||||
}
|
||||
app.getController("LeftMenu").SetDisabled(disable);
|
||||
},
|
||||
goBack: function () {
|
||||
Common.Gateway.goBack();
|
||||
},
|
||||
@@ -429,9 +574,11 @@
|
||||
value = window.localStorage.getItem("de-settings-spellcheck");
|
||||
me.api.asc_setSpellCheck(value === null || parseInt(value) == 1);
|
||||
window.localStorage.setItem("de-settings-showsnaplines", me.api.get_ShowSnapLines() ? 1 : 0);
|
||||
Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); ! Common.Utils.isGecko && (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 && (Math.abs(me.getBrowseZoomLevel() - 1) > 0.1) && tips.push(Common.Utils.String.platformKey(me.warnBrowserZoom, "{0}"));
|
||||
if (tips.length) {
|
||||
me.showTips(tips);
|
||||
}
|
||||
}
|
||||
me.api.asc_registerCallback("asc_onStartAction", _.bind(me.onLongActionBegin, me));
|
||||
me.api.asc_registerCallback("asc_onEndAction", _.bind(me.onLongActionEnd, me));
|
||||
@@ -463,7 +610,7 @@
|
||||
statusbarController.createDelayedElements();
|
||||
leftmenuController.getView("LeftMenu").disableMenu("all", false);
|
||||
if (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.getView("DocumentHolder").setApi(me.api).on("editcomplete", _.bind(me.onEditComplete, me));
|
||||
if (me.appOptions.isEdit) {
|
||||
@@ -500,26 +647,33 @@
|
||||
}
|
||||
me.api.asc_setAutoSaveGap(value);
|
||||
if (this.appOptions.canAnalytics) {
|
||||
Common.Gateway.on("applyeditrights", _.bind(me.onApplyEditRights, me));
|
||||
Common.component.Analytics.initialize("UA-12442749-13", "Document 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));
|
||||
Common.Gateway.on("refreshhistory", _.bind(me.onRefreshHistory, me));
|
||||
$(document).on("contextmenu", _.bind(me.onContextMenu, me));
|
||||
},
|
||||
onOpenDocument: function () {},
|
||||
onEditorPermissions: function (params) {
|
||||
this.permissions.edit !== false && (this.permissions.edit = params.asc_getCanEdit());
|
||||
this.permissions.download !== false && (this.permissions.download = params.asc_getCanDownload());
|
||||
this.appOptions.canCoAuthoring = params.asc_getCanCoAuthoring();
|
||||
this.appOptions.canCoAuthoring = true;
|
||||
this.appOptions.canEdit = this.permissions.edit === true;
|
||||
this.appOptions.isEdit = this.appOptions.canEdit && this.editorConfig.mode !== "view";
|
||||
this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download;
|
||||
this.appOptions.canAutosave = this.editorConfig.canAutosave !== false && params.asc_getIsAutosaveEnable();
|
||||
this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable();
|
||||
this.appOptions.canBranding = params.asc_getCanBranding() && (typeof(this.editorConfig.branding) == "object");
|
||||
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.customization = this.editorConfig.customization;
|
||||
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canEdit && this.appOptions.canCoAuthoring;
|
||||
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.branding);
|
||||
this.getApplication().getController("Viewport").getView("Common.Views.Header").setBranding(this.editorConfig.customization);
|
||||
}
|
||||
this.applyModeCommonElements();
|
||||
this.applyModeEditorElements();
|
||||
@@ -541,7 +695,7 @@
|
||||
documentHolder = app.getController("DocumentHolder").getView("DocumentHolder");
|
||||
if (headerView) {
|
||||
headerView.setHeaderCaption(this.appOptions.isEdit ? "Document Editor" : "Document Viewer");
|
||||
headerView.setVisible(!this.appOptions.nativeApp && !value);
|
||||
headerView.setVisible(!this.appOptions.nativeApp && !value && !this.appOptions.isDesktopApp);
|
||||
}
|
||||
if (this.appOptions.nativeApp) {
|
||||
$("body").removeClass("safari");
|
||||
@@ -817,6 +971,10 @@
|
||||
}
|
||||
},
|
||||
hidePreloader: function () {
|
||||
if ( !! this.appOptions.customization && !this.appOptions.customization.done) {
|
||||
this.appOptions.customization.done = true;
|
||||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements);
|
||||
}
|
||||
Common.NotificationCenter.trigger("layout:changed", "main");
|
||||
$("#loading-mask").hide().remove();
|
||||
},
|
||||
|
||||
@@ -209,12 +209,7 @@
|
||||
this._settings[c_oAscTypeSelectElement.Shape].needShow = false;
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
if (this.rightmenu) {
|
||||
this.rightmenu.SetDisabled("", true, true);
|
||||
}
|
||||
this.setMode({
|
||||
isEdit: false
|
||||
});
|
||||
this.SetDisabled(true, false);
|
||||
},
|
||||
onInsertTable: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Table].needShow = true;
|
||||
@@ -274,6 +269,32 @@
|
||||
this.rightmenu.SetActivePane(type, true);
|
||||
this._settings[type].panel.ChangeSettings.call(this._settings[type].panel, this._settings[type].props);
|
||||
}
|
||||
},
|
||||
SetDisabled: function (disabled, allowMerge) {
|
||||
if (this.rightmenu) {
|
||||
this.rightmenu.paragraphSettings.disableControls(disabled);
|
||||
this.rightmenu.shapeSettings.disableControls(disabled);
|
||||
this.rightmenu.headerSettings.disableControls(disabled);
|
||||
this.rightmenu.tableSettings.disableControls(disabled);
|
||||
this.rightmenu.imageSettings.disableControls(disabled);
|
||||
this.rightmenu.chartSettings.disableControls(disabled);
|
||||
if (disabled) {
|
||||
this.rightmenu.btnText.setDisabled(disabled);
|
||||
this.rightmenu.btnTable.setDisabled(disabled);
|
||||
this.rightmenu.btnImage.setDisabled(disabled);
|
||||
this.rightmenu.btnHeaderFooter.setDisabled(disabled);
|
||||
this.rightmenu.btnShape.setDisabled(disabled);
|
||||
this.rightmenu.btnChart.setDisabled(disabled);
|
||||
} else {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements.length > 0) {
|
||||
this.onFocusObject(selectedElements);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setMode({
|
||||
isEdit: !disabled
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -756,20 +756,24 @@
|
||||
onCopyPaste: function (copy, e) {
|
||||
var me = this;
|
||||
if (me.api) {
|
||||
var value = window.localStorage.getItem("de-hide-copywarning");
|
||||
if (! (value && parseInt(value) == 1) && this._state.show_copywarning) {
|
||||
(new Common.Views.CopyWarningDialog({
|
||||
handler: function (dontshow) {
|
||||
copy ? me.api.Copy() : me.api.Paste();
|
||||
if (dontshow) {
|
||||
window.localStorage.setItem("de-hide-copywarning", 1);
|
||||
}
|
||||
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
if (typeof window["AscDesktopEditor"] === "object") {
|
||||
copy ? me.api.Copy() : me.api.Paste();
|
||||
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
|
||||
} else {
|
||||
var value = window.localStorage.getItem("de-hide-copywarning");
|
||||
if (! (value && parseInt(value) == 1) && this._state.show_copywarning) {
|
||||
(new Common.Views.CopyWarningDialog({
|
||||
handler: function (dontshow) {
|
||||
copy ? me.api.Copy() : me.api.Paste();
|
||||
if (dontshow) {
|
||||
window.localStorage.setItem("de-hide-copywarning", 1);
|
||||
}
|
||||
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
copy ? me.api.Copy() : me.api.Paste();
|
||||
Common.NotificationCenter.trigger("edit:complete", me.toolbar);
|
||||
}
|
||||
}
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Copy Warning");
|
||||
} else {
|
||||
@@ -2302,7 +2306,11 @@
|
||||
});
|
||||
this.editMode = false;
|
||||
},
|
||||
DisableToolbar: function (disable) {
|
||||
DisableToolbar: function (disable, viewMode) {
|
||||
if (viewMode !== undefined) {
|
||||
this.editMode = !viewMode;
|
||||
}
|
||||
disable = disable || !this.editMode;
|
||||
var mask = $(".toolbar-mask");
|
||||
if (disable && mask.length > 0 || !disable && mask.length == 0) {
|
||||
return;
|
||||
|
||||
@@ -45,8 +45,11 @@
|
||||
}).render();
|
||||
Common.NotificationCenter.on("layout:changed", _.bind(this.onLayoutChanged, this));
|
||||
$(window).on("resize", _.bind(this.onWindowResize, this));
|
||||
var leftPanel = $("#left-menu"),
|
||||
histPanel = $("#left-panel-history");
|
||||
this.viewport.hlayout.on("layout:resizedrag", function () {
|
||||
this.api.Resize();
|
||||
localStorage.setItem("de-mainmenu-width", histPanel.is(":visible") ? (histPanel.width() + SCALE_MIN) : leftPanel.width());
|
||||
},
|
||||
this);
|
||||
this.boxSdk = $("#editor_sdk");
|
||||
@@ -59,6 +62,14 @@
|
||||
case "rightmenu":
|
||||
this.viewport.hlayout.doLayout();
|
||||
break;
|
||||
case "history":
|
||||
var panel = this.viewport.hlayout.items[1];
|
||||
if (panel.resize.el) {
|
||||
this.boxSdk.css("border-left", "");
|
||||
panel.resize.el.show();
|
||||
}
|
||||
this.viewport.hlayout.doLayout();
|
||||
break;
|
||||
case "leftmenu":
|
||||
var panel = this.viewport.hlayout.items[0];
|
||||
if (panel.resize.el) {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
<li id="fm-btn-create" class="fm-btn" />
|
||||
<li class="devider" />
|
||||
<li id="fm-btn-info" class="fm-btn" />
|
||||
<li id="fm-btn-rights" class="fm-btn" />
|
||||
<li id="fm-btn-history" class="fm-btn" />
|
||||
<li class="devider" class="fm-btn" />
|
||||
<li id="fm-btn-settings" class="fm-btn" />
|
||||
<li class="devider" />
|
||||
@@ -23,6 +25,7 @@
|
||||
<div id="panel-recentfiles" class="content-box" />
|
||||
<div id="panel-createnew" class="content-box" />
|
||||
<div id="panel-info" class="content-box" />
|
||||
<div id="panel-rights" class="content-box" />
|
||||
<div id="panel-settings" class="content-box" />
|
||||
<div id="panel-help" class="content-box" />
|
||||
</div>
|
||||
@@ -9,6 +9,7 @@
|
||||
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
|
||||
<div id="editor_sdk" class="layout-item"></div>
|
||||
<div id="right-menu" class="layout-item"></div>
|
||||
<div id="left-panel-history" class="layout-item" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="statusbar" class="layout-item"></div>
|
||||
|
||||
@@ -649,7 +649,7 @@
|
||||
this.api.asc_registerCallback("asc_doubleClickOnChart", onDoubleClickOnChart);
|
||||
this.api.asc_registerCallback("asc_onSpellCheckVariantsFound", _.bind(onSpellCheckVariantsFound, this));
|
||||
}
|
||||
this.mode = m; ! (this.mode.canCoAuthoring && this.mode.isEdit) ? Common.util.Shortcuts.suspendEvents(hkComments) : Common.util.Shortcuts.resumeEvents(hkComments);
|
||||
this.mode = m; ! (this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) ? Common.util.Shortcuts.suspendEvents(hkComments) : Common.util.Shortcuts.resumeEvents(hkComments);
|
||||
this.editorConfig = {
|
||||
user: m.user
|
||||
};
|
||||
@@ -797,7 +797,7 @@
|
||||
}
|
||||
},
|
||||
addComment: function (item, e, eOpt) {
|
||||
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit) {
|
||||
if (this.api && this.mode.canCoAuthoring && this.mode.isEdit && this.mode.canComments) {
|
||||
this.suppressEditComplete = true;
|
||||
this.api.asc_enableKeyEvents(false);
|
||||
var controller = DE.getController("Common.Controllers.Comments");
|
||||
@@ -840,20 +840,24 @@
|
||||
onCutCopyPaste: function (item, e) {
|
||||
var me = this;
|
||||
if (me.api) {
|
||||
var value = window.localStorage.getItem("de-hide-copywarning");
|
||||
if (! (value && parseInt(value) == 1) && me.show_copywarning) {
|
||||
(new Common.Views.CopyWarningDialog({
|
||||
handler: function (dontshow) {
|
||||
(item.value == "cut") ? me.api.Cut() : ((item.value == "copy") ? me.api.Copy() : me.api.Paste());
|
||||
if (dontshow) {
|
||||
window.localStorage.setItem("de-hide-copywarning", 1);
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
if (typeof window["AscDesktopEditor"] === "object") {
|
||||
(item.value == "cut") ? me.api.Cut() : ((item.value == "copy") ? me.api.Copy() : me.api.Paste());
|
||||
me.fireEvent("editcomplete", me);
|
||||
} else {
|
||||
var value = window.localStorage.getItem("de-hide-copywarning");
|
||||
if (! (value && parseInt(value) == 1) && me.show_copywarning) {
|
||||
(new Common.Views.CopyWarningDialog({
|
||||
handler: function (dontshow) {
|
||||
(item.value == "cut") ? me.api.Cut() : ((item.value == "copy") ? me.api.Copy() : me.api.Paste());
|
||||
if (dontshow) {
|
||||
window.localStorage.setItem("de-hide-copywarning", 1);
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
(item.value == "cut") ? me.api.Cut() : ((item.value == "copy") ? me.api.Copy() : me.api.Paste());
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
me.fireEvent("editcomplete", me);
|
||||
@@ -1548,7 +1552,7 @@
|
||||
menuAddHyperlinkTable.hyperProps.value = new CHyperlinkProperty();
|
||||
menuAddHyperlinkTable.hyperProps.value.put_Text(text);
|
||||
}
|
||||
menuAddCommentTable.setVisible(me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring);
|
||||
menuAddCommentTable.setVisible(me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
|
||||
menuAddCommentTable.setDisabled(value.paraProps !== undefined && value.paraProps.locked === true);
|
||||
menuParagraphTable.setVisible(value.paraProps !== undefined);
|
||||
if (value.paraProps) {
|
||||
@@ -1836,8 +1840,8 @@
|
||||
if (me.api) {
|
||||
text = me.api.can_AddHyperlink();
|
||||
}
|
||||
menuCommentSeparatorPara.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring);
|
||||
menuAddCommentPara.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring);
|
||||
menuCommentSeparatorPara.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
|
||||
menuAddCommentPara.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
|
||||
menuAddCommentPara.setDisabled(value.paraProps && value.paraProps.locked === true);
|
||||
me.menuSpellPara.setVisible(value.spellProps !== undefined && value.spellProps.value.get_Checked() === false);
|
||||
menuSpellcheckParaSeparator.setVisible(value.spellProps !== undefined && value.spellProps.value.get_Checked() === false);
|
||||
|
||||
@@ -102,6 +102,16 @@
|
||||
action: "info",
|
||||
caption: this.btnInfoCaption,
|
||||
canFocused: false
|
||||
}), new Common.UI.MenuItem({
|
||||
el: $("#fm-btn-rights", this.el),
|
||||
action: "rights",
|
||||
caption: this.btnRightsCaption,
|
||||
canFocused: false
|
||||
}), new Common.UI.MenuItem({
|
||||
el: $("#fm-btn-history", this.el),
|
||||
action: "history",
|
||||
caption: this.btnHistoryCaption,
|
||||
canFocused: false
|
||||
}), new Common.UI.MenuItem({
|
||||
el: $("#fm-btn-settings", this.el),
|
||||
action: "opts",
|
||||
@@ -131,6 +141,9 @@
|
||||
"info": (new DE.Views.FileMenuPanels.DocumentInfo({
|
||||
menu: me
|
||||
})).render(),
|
||||
"rights": (new DE.Views.FileMenuPanels.DocumentRights({
|
||||
menu: me
|
||||
})).render(),
|
||||
"help": (new DE.Views.FileMenuPanels.Help({
|
||||
menu: me
|
||||
})).render()
|
||||
@@ -162,16 +175,17 @@
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
applyMode: function () {
|
||||
this.items[0][this.mode.canBack ? "show" : "hide"]();
|
||||
this.items[0].$el.find("+.devider")[this.mode.canBack ? "show" : "hide"]();
|
||||
this.items[5][this.mode.canOpenRecent ? "show" : "hide"]();
|
||||
this.items[6][this.mode.canCreateNew ? "show" : "hide"]();
|
||||
this.items[6].$el.find("+.devider")[this.mode.canCreateNew ? "show" : "hide"]();
|
||||
this.items[3][this.mode.canDownload ? "show" : "hide"]();
|
||||
this.items[1][this.mode.isEdit ? "show" : "hide"]();
|
||||
this.items[2][!this.mode.isEdit && this.mode.canEdit ? "show" : "hide"]();
|
||||
this.mode.canBack ? this.$el.find("#fm-btn-back").show().prev().show() : this.$el.find("#fm-btn-back").hide().prev().hide();
|
||||
this.items[8][(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.panels["opts"].setMode(this.mode);
|
||||
this.panels["info"].setMode(this.mode).updateInfo(this.document);
|
||||
this.panels["rights"].setMode(this.mode).updateInfo(this.document);
|
||||
if (this.mode.canCreateNew) {
|
||||
if (this.mode.templates && this.mode.templates.length) {
|
||||
$("a", this.items[6].$el).text(this.btnCreateNewCaption + "...");
|
||||
@@ -189,12 +203,16 @@
|
||||
})).render();
|
||||
}
|
||||
}
|
||||
if (this.mode.isDesktopApp) {}
|
||||
this.panels["help"].setLangConfig(this.mode.lang);
|
||||
this.items[9][this.mode.canUseHistory ? "show" : "hide"]();
|
||||
this.items[9].setDisabled(this.mode.isDisconnected);
|
||||
},
|
||||
setMode: function (mode, delay) {
|
||||
if (mode.isDisconnected) {
|
||||
this.mode.canEdit = this.mode.isEdit = false;
|
||||
this.mode.canOpenRecent = this.mode.canCreateNew = false;
|
||||
this.mode.isDisconnected = mode.isDisconnected;
|
||||
} else {
|
||||
this.mode = mode;
|
||||
}
|
||||
@@ -230,6 +248,7 @@
|
||||
btnSaveCaption: "Save",
|
||||
btnDownloadCaption: "Download as...",
|
||||
btnInfoCaption: "Document Info...",
|
||||
btnRightsCaption: "Access Rights...",
|
||||
btnCreateNewCaption: "Create New",
|
||||
btnRecentFilesCaption: "Open Recent...",
|
||||
btnPrintCaption: "Print",
|
||||
@@ -237,7 +256,8 @@
|
||||
btnReturnCaption: "Back to Document",
|
||||
btnToEditCaption: "Edit Document",
|
||||
btnBackCaption: "Go to Documents",
|
||||
btnSettingsCaption: "Advanced Settings..."
|
||||
btnSettingsCaption: "Advanced Settings...",
|
||||
btnHistoryCaption: "Versions History"
|
||||
},
|
||||
DE.Views.FileMenu || {}));
|
||||
});
|
||||
@@ -398,8 +398,7 @@
|
||||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, arguments);
|
||||
this.rendered = false;
|
||||
this.template = _.template(['<table class="main">', "<tr>", '<td class="left"><label>' + this.txtTitle + "</label></td>", '<td class="right"><label id="id-info-title">-</label></td>', "</tr>", '<tr class="author">', '<td class="left"><label>' + this.txtAuthor + "</label></td>", '<td class="right"><span class="userLink" id="id-info-author">-</span></td>', "</tr>", '<tr class="placement">', '<td class="left"><label>' + this.txtPlacement + "</label></td>", '<td class="right"><label id="id-info-placement">-</label></td>', "</tr>", '<tr class="date">', '<td class="left"><label>' + this.txtDate + "</label></td>", '<td class="right"><label id="id-info-date">-</label></td>', "</tr>", '<tr class="divider date"></tr>', '<tr class="rights">', '<td class="left" style="vertical-align: top;"><label>' + this.txtRights + "</label></td>", '<td class="right"><div id="id-info-rights"></div></td>', "</tr>", '<tr class="edit-rights">', '<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary" style="margin-right: 10px;width: auto;">' + this.txtBtnAccessRights + "</button></td>", "</tr>", '<tr class="divider rights"></tr>', "<tr>", '<td class="left" style="vertical-align: top;"><label>' + this.txtStatistics + "</label></td>", '<td class="right" style="vertical-align: top;"><div id="id-info-statistic">', "<table>", "<tr>", "<td><label>" + this.txtPages + "</label></td>", '<td><label id="id-info-pages"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtParagraphs + "</label></td>", '<td><label id="id-info-paragraphs"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtWords + "</label></td>", '<td><label id="id-info-words"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSymbols + "</label></td>", '<td><label id="id-info-symbols"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSpaces + "</label></td>", '<td><label id="id-info-spaces"></label></td>', "</tr>", "</table>", "</div></td>", "</tr>", "</table>"].join(""));
|
||||
this.templateRights = _.template(["<table>", "<% _.each(users, function(item) { %>", "<tr>", '<td><span class="userLink"><%= Common.Utils.String.htmlEncode(item.user) %></span></td>', "<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>", "</tr>", "<% }); %>", "</table>"].join(""));
|
||||
this.template = _.template(['<table class="main">', "<tr>", '<td class="left"><label>' + this.txtTitle + "</label></td>", '<td class="right"><label id="id-info-title">-</label></td>', "</tr>", '<tr class="author">', '<td class="left"><label>' + this.txtAuthor + "</label></td>", '<td class="right"><span class="userLink" id="id-info-author">-</span></td>', "</tr>", '<tr class="placement">', '<td class="left"><label>' + this.txtPlacement + "</label></td>", '<td class="right"><label id="id-info-placement">-</label></td>', "</tr>", '<tr class="date">', '<td class="left"><label>' + this.txtDate + "</label></td>", '<td class="right"><label id="id-info-date">-</label></td>', "</tr>", '<tr class="divider date"></tr>', "<tr>", '<td class="left" style="vertical-align: top;"><label>' + this.txtStatistics + "</label></td>", '<td class="right" style="vertical-align: top;"><div id="id-info-statistic">', "<table>", "<tr>", "<td><label>" + this.txtPages + "</label></td>", '<td><label id="id-info-pages"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtParagraphs + "</label></td>", '<td><label id="id-info-paragraphs"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtWords + "</label></td>", '<td><label id="id-info-words"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSymbols + "</label></td>", '<td><label id="id-info-symbols"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSpaces + "</label></td>", '<td><label id="id-info-spaces"></label></td>', "</tr>", "</table>", "</div></td>", "</tr>", "</table>"].join(""));
|
||||
this.infoObj = {
|
||||
PageCount: 0,
|
||||
WordsCount: 0,
|
||||
@@ -421,11 +420,6 @@
|
||||
this.lblStatParagraphs = $("#id-info-paragraphs");
|
||||
this.lblStatSymbols = $("#id-info-symbols");
|
||||
this.lblStatSpaces = $("#id-info-spaces");
|
||||
this.cntRights = $("#id-info-rights");
|
||||
this.btnEditRights = new Common.UI.Button({
|
||||
el: "#id-info-btn-edit"
|
||||
});
|
||||
this.btnEditRights.on("click", _.bind(this.changeAccessRights, this));
|
||||
this.rendered = true;
|
||||
this.updateInfo(this.doc);
|
||||
if (_.isUndefined(this.scroller)) {
|
||||
@@ -464,13 +458,6 @@
|
||||
this.lblPlacement.text(doc.info.folder);
|
||||
}
|
||||
this._ShowHideInfoItem("placement", doc.info.folder !== undefined && doc.info.folder !== null);
|
||||
if (doc.info.sharingSettings) {
|
||||
this.cntRights.html(this.templateRights({
|
||||
users: doc.info.sharingSettings
|
||||
}));
|
||||
}
|
||||
this._ShowHideInfoItem("rights", doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
|
||||
this._ShowHideInfoItem("edit-rights", !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
|
||||
} else {
|
||||
this._ShowHideDocInfo(false);
|
||||
}
|
||||
@@ -482,8 +469,6 @@
|
||||
this._ShowHideInfoItem("date", visible);
|
||||
this._ShowHideInfoItem("placement", visible);
|
||||
this._ShowHideInfoItem("author", visible);
|
||||
this._ShowHideInfoItem("rights", visible);
|
||||
this._ShowHideInfoItem("edit-rights", visible);
|
||||
},
|
||||
updateStatisticInfo: function () {
|
||||
if (this.api && this.doc) {
|
||||
@@ -504,7 +489,6 @@
|
||||
return this;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
||||
return this;
|
||||
},
|
||||
_onGetDocInfoStart: function () {
|
||||
@@ -556,6 +540,85 @@
|
||||
this.lblStatSymbols.text(this.infoObj.SymbolsCount);
|
||||
this.lblStatSpaces.text(this.infoObj.SymbolsWSCount);
|
||||
},
|
||||
txtTitle: "Document Title",
|
||||
txtAuthor: "Author",
|
||||
txtPlacement: "Placement",
|
||||
txtDate: "Creation Date",
|
||||
txtStatistics: "Statistics",
|
||||
txtPages: "Pages",
|
||||
txtWords: "Words",
|
||||
txtParagraphs: "Paragraphs",
|
||||
txtSymbols: "Symbols",
|
||||
txtSpaces: "Symbols with spaces",
|
||||
txtLoading: "Loading..."
|
||||
},
|
||||
DE.Views.FileMenuPanels.DocumentInfo || {}));
|
||||
DE.Views.FileMenuPanels.DocumentRights = Common.UI.BaseView.extend(_.extend({
|
||||
el: "#panel-rights",
|
||||
menu: undefined,
|
||||
initialize: function (options) {
|
||||
Common.UI.BaseView.prototype.initialize.call(this, arguments);
|
||||
this.rendered = false;
|
||||
this.template = _.template(['<table class="main">', '<tr class="rights">', '<td class="left" style="vertical-align: top;"><label>' + this.txtRights + "</label></td>", '<td class="right"><div id="id-info-rights"></div></td>', "</tr>", '<tr class="edit-rights">', '<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary" style="margin-right: 10px;width: auto;">' + this.txtBtnAccessRights + "</button></td>", "</tr>", "</table>"].join(""));
|
||||
this.templateRights = _.template(["<table>", "<% _.each(users, function(item) { %>", "<tr>", '<td><span class="userLink"><%= Common.Utils.String.htmlEncode(item.user) %></span></td>', "<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>", "</tr>", "<% }); %>", "</table>"].join(""));
|
||||
this.menu = options.menu;
|
||||
},
|
||||
render: function () {
|
||||
$(this.el).html(this.template());
|
||||
this.cntRights = $("#id-info-rights");
|
||||
this.btnEditRights = new Common.UI.Button({
|
||||
el: "#id-info-btn-edit"
|
||||
});
|
||||
this.btnEditRights.on("click", _.bind(this.changeAccessRights, this));
|
||||
this.rendered = true;
|
||||
this.updateInfo(this.doc);
|
||||
if (_.isUndefined(this.scroller)) {
|
||||
this.scroller = new Common.UI.Scroller({
|
||||
el: $(this.el),
|
||||
suppressScrollX: true
|
||||
});
|
||||
}
|
||||
return this;
|
||||
},
|
||||
show: function () {
|
||||
Common.UI.BaseView.prototype.show.call(this, arguments);
|
||||
},
|
||||
hide: function () {
|
||||
Common.UI.BaseView.prototype.hide.call(this, arguments);
|
||||
},
|
||||
updateInfo: function (doc) {
|
||||
this.doc = doc;
|
||||
if (!this.rendered) {
|
||||
return;
|
||||
}
|
||||
doc = doc || {};
|
||||
if (doc.info) {
|
||||
if (doc.info.sharingSettings) {
|
||||
this.cntRights.html(this.templateRights({
|
||||
users: doc.info.sharingSettings
|
||||
}));
|
||||
}
|
||||
this._ShowHideInfoItem("rights", doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && doc.info.sharingSettings.length > 0);
|
||||
this._ShowHideInfoItem("edit-rights", !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
|
||||
} else {
|
||||
this._ShowHideDocInfo(false);
|
||||
}
|
||||
},
|
||||
_ShowHideInfoItem: function (cls, visible) {
|
||||
$("tr." + cls, this.el)[visible ? "show" : "hide"]();
|
||||
},
|
||||
_ShowHideDocInfo: function (visible) {
|
||||
this._ShowHideInfoItem("rights", visible);
|
||||
this._ShowHideInfoItem("edit-rights", visible);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
return this;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.sharingSettingsUrl = mode.sharingSettingsUrl;
|
||||
return this;
|
||||
},
|
||||
changeAccessRights: function (btn, event, opts) {
|
||||
var me = this;
|
||||
var win = new Common.Views.DocumentAccessDialog({
|
||||
@@ -563,6 +626,7 @@
|
||||
});
|
||||
win.on("accessrights", function (obj, rights) {
|
||||
me.doc.info.sharingSettings = rights;
|
||||
me._ShowHideInfoItem("rights", me.doc.info.sharingSettings !== undefined && me.doc.info.sharingSettings !== null && me.doc.info.sharingSettings.length > 0);
|
||||
me.cntRights.html(me.templateRights({
|
||||
users: me.doc.info.sharingSettings
|
||||
}));
|
||||
@@ -574,24 +638,12 @@
|
||||
if (!this.rendered) {
|
||||
return;
|
||||
}
|
||||
this._ShowHideInfoItem("rights", false);
|
||||
this._ShowHideInfoItem("edit-rights", false);
|
||||
},
|
||||
txtTitle: "Document Title",
|
||||
txtAuthor: "Author",
|
||||
txtPlacement: "Placement",
|
||||
txtDate: "Creation Date",
|
||||
txtRights: "Persons who have rights",
|
||||
txtStatistics: "Statistics",
|
||||
txtPages: "Pages",
|
||||
txtWords: "Words",
|
||||
txtParagraphs: "Paragraphs",
|
||||
txtSymbols: "Symbols",
|
||||
txtSpaces: "Symbols with spaces",
|
||||
txtLoading: "Loading...",
|
||||
txtBtnAccessRights: "Change access rights"
|
||||
},
|
||||
DE.Views.FileMenuPanels.DocumentInfo || {}));
|
||||
DE.Views.FileMenuPanels.DocumentRights || {}));
|
||||
DE.Views.FileMenuPanels.Help = Common.UI.BaseView.extend({
|
||||
el: "#panel-help",
|
||||
menu: undefined,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
define(["text!documenteditor/main/app/template/LeftMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/view/About", "common/main/lib/view/Comments", "common/main/lib/view/Chat", "common/main/lib/view/About", "common/main/lib/view/SearchDialog", "documenteditor/main/app/view/FileMenu"], function (menuTemplate, $, _, Backbone) {
|
||||
define(["text!documenteditor/main/app/template/LeftMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/view/About", "common/main/lib/view/Comments", "common/main/lib/view/Chat", "common/main/lib/view/History", "common/main/lib/view/About", "common/main/lib/view/SearchDialog", "documenteditor/main/app/view/FileMenu"], function (menuTemplate, $, _, Backbone) {
|
||||
var SCALE_MIN = 40;
|
||||
var MENU_SCALE_PART = 300;
|
||||
DE.Views.LeftMenu = Backbone.View.extend(_.extend({
|
||||
@@ -140,7 +140,7 @@
|
||||
if (btn.options.action == "search") {} else {
|
||||
if (btn.pressed) {
|
||||
if (! (this.$el.width() > SCALE_MIN)) {
|
||||
this.$el.width(localStorage.getItem("de-mainmenu-width") || MENU_SCALE_PART);
|
||||
this.$el.width(parseInt(localStorage.getItem("de-mainmenu-width")) || MENU_SCALE_PART);
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem("de-mainmenu-width", this.$el.width());
|
||||
@@ -152,25 +152,20 @@
|
||||
},
|
||||
onCoauthOptions: function (e) {
|
||||
if (this.mode.canCoAuthoring) {
|
||||
this.panelComments[this.btnComments.pressed ? "show" : "hide"]();
|
||||
this.fireEvent((this.btnComments.pressed) ? "comments:show": "comments:hide", this);
|
||||
if (this.btnChat.pressed) {
|
||||
if (this.btnChat.$el.hasClass("notify")) {
|
||||
this.btnChat.$el.removeClass("notify");
|
||||
}
|
||||
this.panelChat.show();
|
||||
this.panelChat.focus();
|
||||
} else {
|
||||
this.panelChat["hide"]();
|
||||
if (this.mode.canComments) {
|
||||
this.panelComments[this.btnComments.pressed ? "show" : "hide"]();
|
||||
this.fireEvent((this.btnComments.pressed) ? "comments:show": "comments:hide", this);
|
||||
}
|
||||
}
|
||||
},
|
||||
setOptionsPanel: function (name, panel) {
|
||||
if (name == "chat") {
|
||||
this.panelChat = panel.render("#left-panel-chat");
|
||||
} else {
|
||||
if (name == "comment") {
|
||||
this.panelComments = panel;
|
||||
if (this.mode.canChat) {
|
||||
if (this.btnChat.pressed) {
|
||||
if (this.btnChat.$el.hasClass("notify")) {
|
||||
this.btnChat.$el.removeClass("notify");
|
||||
}
|
||||
this.panelChat.show();
|
||||
this.panelChat.focus();
|
||||
} else {
|
||||
this.panelChat["hide"]();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -179,18 +174,35 @@
|
||||
this.btnChat.$el.addClass("notify");
|
||||
}
|
||||
},
|
||||
setOptionsPanel: function (name, panel) {
|
||||
if (name == "chat") {
|
||||
this.panelChat = panel.render("#left-panel-chat");
|
||||
} else {
|
||||
if (name == "comment") {
|
||||
this.panelComments = panel;
|
||||
} else {
|
||||
if (name == "history") {
|
||||
this.panelHistory = panel.render("#left-panel-history");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
close: function (menu) {
|
||||
this.btnFile.toggle(false);
|
||||
this.btnAbout.toggle(false);
|
||||
this.$el.width(SCALE_MIN);
|
||||
if (this.mode.canCoAuthoring) {
|
||||
this.panelComments["hide"]();
|
||||
this.panelChat["hide"]();
|
||||
if (this.btnComments.pressed) {
|
||||
this.fireEvent("comments:hide", this);
|
||||
if (this.mode.canComments) {
|
||||
this.panelComments["hide"]();
|
||||
if (this.btnComments.pressed) {
|
||||
this.fireEvent("comments:hide", this);
|
||||
}
|
||||
this.btnComments.toggle(false, true);
|
||||
}
|
||||
if (this.mode.canChat) {
|
||||
this.panelChat["hide"]();
|
||||
this.btnChat.toggle(false, true);
|
||||
}
|
||||
this.btnComments.toggle(false, true);
|
||||
this.btnChat.toggle(false, true);
|
||||
}
|
||||
},
|
||||
isOpened: function () {
|
||||
@@ -245,6 +257,12 @@
|
||||
this.mode = mode;
|
||||
return this;
|
||||
},
|
||||
showHistory: function () {
|
||||
this.panelHistory.show();
|
||||
this.panelHistory.$el.width((parseInt(localStorage.getItem("de-mainmenu-width")) || MENU_SCALE_PART) - SCALE_MIN);
|
||||
this.btnFile.panel.items[9].hide();
|
||||
Common.NotificationCenter.trigger("layout:changed", "history");
|
||||
},
|
||||
tipComments: "Comments",
|
||||
tipChat: "Chat",
|
||||
tipAbout: "About",
|
||||
|
||||
@@ -123,19 +123,24 @@ define([
|
||||
hint: this.tipSetLang,
|
||||
hintAnchor: 'top-left'
|
||||
});
|
||||
this.btnLanguage.cmpEl.on('show.bs.dropdown', function () {
|
||||
this.btnLanguage.cmpEl.on({
|
||||
'show.bs.dropdown': function () {
|
||||
_.defer(function(){
|
||||
me.api.asc_enableKeyEvents(false);
|
||||
me.btnLanguage.cmpEl.find('ul').focus();
|
||||
}, 100);
|
||||
}
|
||||
);
|
||||
this.btnLanguage.cmpEl.on('hide.bs.dropdown', function () {
|
||||
},
|
||||
'hide.bs.dropdown': function () {
|
||||
_.defer(function(){
|
||||
me.api.asc_enableKeyEvents(true);
|
||||
}, 100);
|
||||
},
|
||||
'click': function (e) {
|
||||
if (me.btnLanguage.isDisabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
this.langMenu.render(panelLang);
|
||||
this.langMenu.cmpEl.attr({tabindex: -1});
|
||||
|
||||
@@ -2040,6 +2040,10 @@
|
||||
nativeBtnGroup.hide();
|
||||
}
|
||||
}
|
||||
if (mode.isDesktopApp) {
|
||||
$(".toolbar-group-native").hide();
|
||||
this.mnuitemHideTitleBar.hide();
|
||||
}
|
||||
},
|
||||
changeViewMode: function (item, compact) {
|
||||
var me = this,
|
||||
|
||||
@@ -84,6 +84,16 @@
|
||||
max: 600
|
||||
}
|
||||
},
|
||||
{
|
||||
el: items[3],
|
||||
rely: true,
|
||||
resize: {
|
||||
hidden: true,
|
||||
autohide: false,
|
||||
min: 300,
|
||||
max: 600
|
||||
}
|
||||
},
|
||||
{
|
||||
el: items[1],
|
||||
stretch: true
|
||||
|
||||
Reference in New Issue
Block a user