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

@@ -102,6 +102,11 @@
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-settings", this.el),
action: "opts",
@@ -131,6 +136,9 @@
"info": (new SSE.Views.FileMenuPanels.DocumentInfo({
menu: me
})).render(),
"rights": (new SSE.Views.FileMenuPanels.DocumentRights({
menu: me
})).render(),
"help": (new SSE.Views.FileMenuPanels.Help({
menu: me
})).render()
@@ -161,18 +169,18 @@
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.items[8][this.mode.isEdit ? "show" : "hide"]();
this.items[8].$el.find("+.devider")[this.mode.isEdit ? "show" : "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.items[9][this.mode.isEdit ? "show" : "hide"]();
this.items[9].$el.find("+.devider")[this.mode.isEdit ? "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 + "...");
@@ -230,6 +238,7 @@
btnSaveCaption: "Save",
btnDownloadCaption: "Download as...",
btnInfoCaption: "Document Info...",
btnRightsCaption: "Access Rights...",
btnCreateNewCaption: "Create New",
btnRecentFilesCaption: "Open Recent...",
btnPrintCaption: "Print",

View File

@@ -117,7 +117,7 @@
panel: this.printSettings,
iconCls: "mnu-print"
}]),
itemTemplate: _.template(['<div id="<%= id %>" class="settings-item-wrap">', '<div><span class="settings-icon <%= iconCls %>"/><span class="caption"><%= name %></span></div>', "</div>"].join(""))
itemTemplate: _.template(['<div id="<%= id %>" class="settings-item-wrap">', '<div class="settings-icon <%= iconCls %>" style="display: inline-block;" >', "</div><%= name %>", "</div>"].join(""))
});
this.viewSettingsPicker.on("item:select", _.bind(function (dataview, itemview, record) {
var panel = record.get("panel");
@@ -594,8 +594,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>", "</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>', "</table>"].join(""));
this.menu = options.menu;
},
render: function () {
@@ -604,11 +603,6 @@
this.lblPlacement = $("#id-info-placement");
this.lblDate = $("#id-info-date");
this.lblAuthor = $("#id-info-author");
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)) {
@@ -645,13 +639,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);
}
@@ -663,6 +650,71 @@
this._ShowHideInfoItem("date", visible);
this._ShowHideInfoItem("placement", visible);
this._ShowHideInfoItem("author", visible);
},
setMode: function (mode) {
return this;
},
txtTitle: "Document Title",
txtAuthor: "Author",
txtPlacement: "Placement",
txtDate: "Creation Date"
},
SSE.Views.FileMenuPanels.DocumentInfo || {}));
SSE.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);
},
@@ -671,34 +723,35 @@
return this;
},
changeAccessRights: function (btn, event, opts) {
if (this._docAccessDlg) {
return;
}
var me = this;
var win = new Common.Views.DocumentAccessDialog({
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.sharingSettingsUrl
});
win.on("accessrights", function (obj, rights) {
me._docAccessDlg.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
}));
}).on("close", function (obj) {
me._docAccessDlg = undefined;
});
win.show();
me._docAccessDlg.show();
},
onLostEditRights: function () {
this._readonlyRights = true;
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",
txtBtnAccessRights: "Change access rights"
},
SSE.Views.FileMenuPanels.DocumentInfo || {}));
SSE.Views.FileMenuPanels.DocumentRights || {}));
SSE.Views.FileMenuPanels.Help = Common.UI.BaseView.extend({
el: "#panel-help",
menu: undefined,

View File

@@ -147,16 +147,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");
if (this.mode.canComments) {
this.panelComments[this.btnComments.pressed ? "show" : "hide"]();
this.fireEvent((this.btnComments.pressed) ? "comments:show": "comments:hide", this);
}
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"]();
}
this.panelChat.show();
this.panelChat.focus();
} else {
this.panelChat["hide"]();
}
}
},
@@ -179,13 +183,17 @@
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 () {

View File

@@ -909,7 +909,7 @@
iconCls: "mnu-icon-item mnu-border-width",
template: _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 11px; height: 11px; margin: 2px 7px 0 -9px; border-style: solid; border-width: 1px; border-color: #000;"></span><%= caption %></a>'),
menu: (function () {
var itemTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div style="width: 80px; height: 20px; margin-top: -3px; margin-bottom: -2px; background:url(\'resources/img/toolbar/BorderSize.png\') repeat-x scroll 0 -<%= options.offsety %>px;"></div></a>');
var itemTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div class="border-size-item" style="background-position: 0 -<%= options.offsety %>px;"></div></a>');
me.mnuBorderWidth = new Common.UI.Menu({
style: "min-width: 100px;",
menuAlign: "tl-tr",
@@ -1884,13 +1884,12 @@
checkable: true,
checked: me.isCompactView,
value: "compact"
}), {
}), me.mnuitemHideTitleBar = new Common.UI.MenuItem({
caption: me.textHideTBar,
checkable: true,
checked: !!options.title,
value: "title"
},
{
}), {
caption: me.textHideFBar,
checkable: true,
checked: !!options.formula,
@@ -2206,6 +2205,10 @@
nativeBtnGroup.hide();
}
}
if (mode.isDesktopApp) {
$(".toolbar-group-native").hide();
this.mnuitemHideTitleBar.hide();
}
}
},
onApiSendThemeColorSchemes: function (schemas) {