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

@@ -339,8 +339,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 () {
@@ -349,11 +348,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)) {
@@ -390,13 +384,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);
}
@@ -408,6 +395,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"
},
PE.Views.FileMenuPanels.DocumentInfo || {}));
PE.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);
},
@@ -416,34 +468,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"
},
PE.Views.FileMenuPanels.DocumentInfo || {}));
PE.Views.FileMenuPanels.DocumentRights || {}));
PE.Views.FileMenuPanels.Help = Common.UI.BaseView.extend({
el: "#panel-help",
menu: undefined,