Commit 13539f39 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

request an account link is visible in info tab

parent 6fcabdf1
<component name="ProjectDictionaryState">
<dictionary name="piotr.gawron">
<words>
<w>mailto</w>
</words>
</dictionary>
</component>
\ No newline at end of file
......@@ -21,8 +21,8 @@ function ProjectInfoPanel(params) {
self._createUserDataTab();
var logoutButton = self.getControlElement(PanelControlElementType.USER_TAB_LOGOUT_BUTTON);
logoutButton.onclick = function() {
return ServerConnector.logout().then(function() {
logoutButton.onclick = function () {
return ServerConnector.logout().then(function () {
window.location.reload(false);
}).then(null, GuiConnector.alert);
};
......@@ -32,191 +32,191 @@ function ProjectInfoPanel(params) {
ProjectInfoPanel.prototype = Object.create(Panel.prototype);
ProjectInfoPanel.prototype.constructor = ProjectInfoPanel;
ProjectInfoPanel.prototype._createInfoPanelGui = function() {
ProjectInfoPanel.prototype._createInfoPanelGui = function () {
var self = this;
var guiUtils = self.getGuiUtils();
var projectId = self.getMap().getProject().getProjectId();
var infoDiv = Functions.createElement({
type : "div",
name : "infoDiv",
className : "searchPanel"
type: "div",
name: "infoDiv",
className: "searchPanel"
});
this.getElement().appendChild(infoDiv);
this.setControlElement(PanelControlElementType.INFO_DIV, infoDiv);
var infoTitle = Functions.createElement({
type : "h4",
content : "PROJECT INFO:"
type: "h4",
content: "PROJECT INFO:"
});
infoDiv.appendChild(infoTitle);
var dataTab = Functions.createElement({
type : "div",
style : "width:100%;display: table;border-spacing: 10px;"
type: "div",
style: "width:100%;display: table;border-spacing: 10px;"
});
infoDiv.appendChild(dataTab);
var projectNameLabel = Functions.createElement({
type : "div",
content : "Name:"
type: "div",
content: "Name:"
});
var projectNameText = Functions.createElement({
type : "div",
style : "width:100%",
name : "projectNameText"
type: "div",
style: "width:100%",
name: "projectNameText"
});
this.setControlElement(PanelControlElementType.INFO_PROJECT_NAME_TEXT, projectNameText);
dataTab.appendChild(guiUtils.createTableRow([ projectNameLabel, projectNameText ]));
dataTab.appendChild(guiUtils.createTableRow([projectNameLabel, projectNameText]));
var projectVersionLabel = Functions.createElement({
type : "div",
content : "Version:"
type: "div",
content: "Version:"
});
var projectVersionText = Functions.createElement({
type : "div",
style : "width:100%",
name : "projectVersionText"
type: "div",
style: "width:100%",
name: "projectVersionText"
});
this.setControlElement(PanelControlElementType.INFO_PROJECT_VERSION_TEXT, projectVersionText);
dataTab.appendChild(guiUtils.createTableRow([ projectVersionLabel, projectVersionText ]));
dataTab.appendChild(guiUtils.createTableRow([projectVersionLabel, projectVersionText]));
var projectDescriptionLabel = Functions.createElement({
type : "div",
content : "Description:"
type: "div",
content: "Description:"
});
var projectDescriptionText = Functions.createElement({
type : "div",
style : "width:100%",
name : "projectDescriptionText"
type: "div",
style: "width:100%",
name: "projectDescriptionText"
});
this.setControlElement(PanelControlElementType.INFO_PROJECT_DESCRIOPTION_TEXT, projectDescriptionText);
dataTab.appendChild(guiUtils.createTableRow([ projectDescriptionLabel, projectDescriptionText ]));
dataTab.appendChild(guiUtils.createTableRow([projectDescriptionLabel, projectDescriptionText]));
infoTitle = Functions.createElement({
type : "h4",
content : "Data:"
type: "h4",
content: "Data:"
});
infoDiv.appendChild(infoTitle);
var dialogDiv = Functions.createElement({
type : "div",
type: "div",
});
this.publicationListDialog = new PublicationListDialog({
customMap : self.getMap(),
element : dialogDiv,
customMap: self.getMap(),
element: dialogDiv,
});
dataTab = Functions.createElement({
type : "ul",
type: "ul",
});
infoDiv.appendChild(dataTab);
var projectPublicationsText = Functions.createElement({
type : "span",
name : "projectPublicationsText",
style : "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
type: "span",
name: "projectPublicationsText",
style: "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
});
this.setControlElement(PanelControlElementType.INFO_PROJECT_PUBLICATIONS_TEXT, projectPublicationsText);
var projectPublicationsButton = Functions.createElement({
type : "a",
name : "projectPublicationsButton",
type: "a",
name: "projectPublicationsButton",
});
projectPublicationsButton.appendChild(Functions.createElement({
type : "span",
content : "<i class='fa fa-list'>&nbsp;",
type: "span",
content: "<i class='fa fa-list'>&nbsp;",
}));
projectPublicationsButton.appendChild(projectPublicationsText);
projectPublicationsButton.appendChild(Functions.createElement({
type : "span",
style : "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
content : "&nbsp;publication(s)",
type: "span",
style: "font-family:FontAwesome; font-weight: normal;font-style: normal;cursor: pointer",
content: "&nbsp;publication(s)",
}));
this.setControlElement(PanelControlElementType.INFO_PROJECT_SHOW_PUBLICATIONS_BUTTON, projectPublicationsButton);
var liElement = Functions.createElement({
type : "li",
style : "line-height: 30px;",
type: "li",
style: "line-height: 30px;",
});
liElement.appendChild(projectPublicationsButton);
dataTab.appendChild(liElement);
var projectOriginalFileButton = Functions.createElement({
type : "a",
name : "projectOriginalFileButton",
href : "#",
content : "<i class='fa fa-files-o'>&nbsp;source file",
type: "a",
name: "projectOriginalFileButton",
href: "#",
content: "<i class='fa fa-files-o'>&nbsp;source file",
});
this.setControlElement(PanelControlElementType.INFO_PROJECT_GET_ORIGINAL_FILE_BUTTON, projectOriginalFileButton);
liElement = Functions.createElement({
type : "li",
style : "line-height: 30px",
type: "li",
style: "line-height: 30px",
});
liElement.appendChild(projectOriginalFileButton);
dataTab.appendChild(liElement);
var exportButton = Functions.createElement({
type : "a",
href : ServerConnector.getServerBaseUrl() + "/export.xhtml?id=" + projectId,
content : '<i class="fa fa-mail-forward">&nbsp;EXPORT',
type: "a",
href: ServerConnector.getServerBaseUrl() + "/export.xhtml?id=" + projectId,
content: '<i class="fa fa-mail-forward">&nbsp;EXPORT',
});
liElement = Functions.createElement({
type : "li",
style : "line-height: 30px",
type: "li",
style: "line-height: 30px",
});
liElement.appendChild(exportButton);
dataTab.appendChild(liElement);
var manualButton = Functions.createElement({
type : "a",
name : "manualLink",
content : '<i class="fa fa-file">&nbsp;MANUAL',
type: "a",
name: "manualLink",
content: '<i class="fa fa-file">&nbsp;MANUAL',
});
manualButton.href = "#";
manualButton.onclick = function() {
return ServerConnector.getConfigurationParam(ConfigurationType.USER_MANUAL_FILE).then(function(manualFileUrl) {
manualButton.onclick = function () {
return ServerConnector.getConfigurationParam(ConfigurationType.USER_MANUAL_FILE).then(function (manualFileUrl) {
var win = window.open(manualFileUrl, '_user_manual_');
win.focus();
});
};
liElement = Functions.createElement({
type : "li",
style : "line-height: 30px",
type: "li",
style: "line-height: 30px",
});
liElement.appendChild(manualButton);
dataTab.appendChild(liElement);
};
ProjectInfoPanel.prototype._createInfoPanelLogic = function() {
ProjectInfoPanel.prototype._createInfoPanelLogic = function () {
var self = this;
var downloadSourceButton = self.getControlElement(PanelControlElementType.INFO_PROJECT_GET_ORIGINAL_FILE_BUTTON);
var showPublicationsButton = self.getControlElement(PanelControlElementType.INFO_PROJECT_SHOW_PUBLICATIONS_BUTTON);
downloadSourceButton.onclick = function() {
downloadSourceButton.onclick = function () {
return self.downloadSourceFile();
};
showPublicationsButton.onclick = function() {
showPublicationsButton.onclick = function () {
return self.showPublicationListDialog();
};
};
ProjectInfoPanel.prototype.downloadSourceFile = function() {
ProjectInfoPanel.prototype.downloadSourceFile = function () {
var self = this;
return ServerConnector.getProjectSourceDownloadUrl().then(function(url) {
return ServerConnector.getProjectSourceDownloadUrl().then(function (url) {
return self.downloadFile(url);
}).then(null, GuiConnector.alert);
};
ProjectInfoPanel.prototype.showPublicationListDialog = function() {
ProjectInfoPanel.prototype.showPublicationListDialog = function () {
return this.publicationListDialog.show();
};
ProjectInfoPanel.prototype.refresh = function() {
ProjectInfoPanel.prototype.refresh = function () {
var self = this;
var projectNameText = self.getControlElement(PanelControlElementType.INFO_PROJECT_NAME_TEXT);
......@@ -224,123 +224,124 @@ ProjectInfoPanel.prototype.refresh = function() {
var projectDescriptionText = self.getControlElement(PanelControlElementType.INFO_PROJECT_DESCRIOPTION_TEXT);
var projectPublicationsText = self.getControlElement(PanelControlElementType.INFO_PROJECT_PUBLICATIONS_TEXT);
return ServerConnector.getProject().then(function(project) {
return ServerConnector.getProject().then(function (project) {
projectNameText.innerHTML = project.getName();
projectVersionText.innerHTML = project.getVersion();
projectDescriptionText.innerHTML = project.getDescription();
return ServerConnector.getProjectStatistics();
}).then(function(statistics) {
}).then(function (statistics) {
projectPublicationsText.innerHTML = statistics.getPublicationCount();
return ServerConnector.getLoggedUser();
}).then(function(user) {
}).then(function (user) {
self.showUserProfilePage(user);
});
};
ProjectInfoPanel.prototype._createUserDataTab = function() {
ProjectInfoPanel.prototype._createUserDataTab = function () {
var self = this;
var guiUtils = self.getGuiUtils();
var userDataDiv = Functions.createElement({
type : "div",
name : "userDataTab",
className : "searchPanel",
style : "display:none"
type: "div",
name: "userDataTab",
className: "searchPanel",
style: "display:none"
});
this.getElement().appendChild(userDataDiv);
this.setControlElement(PanelControlElementType.USER_TAB_USER_DIV, userDataDiv);
var userDataTitle = Functions.createElement({
type : "h3",
content : '<img src="./resources/images/profile.png" border="0" align="left"/><br/>User data<br/>'
type: "h3",
content: '<img src="./resources/images/profile.png" border="0" align="left"/><br/>User data<br/>'
});
userDataDiv.appendChild(userDataTitle);
var userDataFormTab = Functions.createElement({
type : "div",
style : "width:100%;display: table;border-spacing: 10px;"
type: "div",
style: "width:100%;display: table;border-spacing: 10px;"
});
userDataDiv.appendChild(userDataFormTab);
var loginLabel = Functions.createElement({
type : "span",
content : "LOGIN:",
style : "color:#999999"
type: "span",
content: "LOGIN:",
style: "color:#999999"
});
var loginText = Functions.createElement({
type : "span",
name : "loginValue"
type: "span",
name: "loginValue"
});
this.setControlElement(PanelControlElementType.USER_TAB_LOGIN_TEXT, loginText);
userDataDiv.appendChild(guiUtils.createTableRow([ loginLabel, loginText ]));
userDataDiv.appendChild(guiUtils.createTableRow([loginLabel, loginText]));
var nameLabel = Functions.createElement({
type : "span",
content : "NAME:",
style : "color:#999999"
type: "span",
content: "NAME:",
style: "color:#999999"
});
var nameText = Functions.createElement({
type : "span",
name : "nameValue"
type: "span",
name: "nameValue"
});
this.setControlElement(PanelControlElementType.USER_TAB_NAME_TEXT, nameText);
userDataDiv.appendChild(guiUtils.createTableRow([ nameLabel, nameText ]));
userDataDiv.appendChild(guiUtils.createTableRow([nameLabel, nameText]));
var surnameLabel = Functions.createElement({
type : "span",
content : "SURNAME:",
style : "color:#999999"
type: "span",
content: "SURNAME:",
style: "color:#999999"
});
var surnameText = Functions.createElement({
type : "span",
name : "surnameValue"
type: "span",
name: "surnameValue"
});
this.setControlElement(PanelControlElementType.USER_TAB_SURNAME_TEXT, surnameText);
userDataDiv.appendChild(guiUtils.createTableRow([ surnameLabel, surnameText ]));
userDataDiv.appendChild(guiUtils.createTableRow([surnameLabel, surnameText]));
var emailLabel = Functions.createElement({
type : "span",
content : "EMAIL:",
style : "color:#999999"
type: "span",
content: "EMAIL:",
style: "color:#999999"
});
var emailText = Functions.createElement({
type : "span",
name : "emailValue"
type: "span",
name: "emailValue"
});
self.setControlElement(PanelControlElementType.USER_TAB_EMAIL_TEXT, emailText);
userDataDiv.appendChild(guiUtils.createTableRow([ emailLabel, emailText ]));
userDataDiv.appendChild(guiUtils.createTableRow([emailLabel, emailText]));
var centerTag = Functions.createElement({
type : "center"
type: "center"
});
userDataDiv.appendChild(centerTag);
var logoutButton = Functions.createElement({
type : "button",
name : "logoutButton",
content : "LOGOUT"
type: "button",
name: "logoutButton",
content: "LOGOUT"
});
centerTag.appendChild(logoutButton);
self.setControlElement(PanelControlElementType.USER_TAB_LOGOUT_BUTTON, logoutButton);
self.setControlElement(PanelControlElementType.USER_TAB_USER_DIV, userDataDiv);
var loginTabDiv = Functions.createElement({
type : "div",
name : "userLoginTab",
className : "searchPanel",
style : "display:none",
content : '<h3><img src="./resources/images/profile.png" border="0" align="left"/>'
+ '<br/>User data</h3><br/>YOU ARE NOT LOGGED IN.<br/>' + '<center><button>LOGIN</button></center>',
});
$(loginTabDiv).find("button")[0].onclick = function() {
type: "div",
name: "userLoginTab",
className: "searchPanel",
style: "display:none",
content: '<h3><img src="./resources/images/profile.png" border="0" align="left"/>'
+ '<br/>User data</h3><br/>YOU ARE NOT LOGGED IN.<br/>' + '<center><button>LOGIN</button></center>' +
'<br/><a hreg="#" name="requestAccount">Request an account</a>',
});
$(loginTabDiv).find("button")[0].onclick = function () {
return self.getParent().getLoginDialog().open();
};
self.getElement().appendChild(loginTabDiv);
self.setControlElement(PanelControlElementType.USER_TAB_LOGIN_DIV, loginTabDiv);
};
ProjectInfoPanel.prototype.showUserProfilePage = function(user) {
ProjectInfoPanel.prototype.showUserProfilePage = function (user) {
var self = this;
var userDataTabDiv = self.getControlElement(PanelControlElementType.USER_TAB_USER_DIV);
......@@ -365,8 +366,13 @@ ProjectInfoPanel.prototype.showUserProfilePage = function(user) {
}
};
ProjectInfoPanel.prototype.init = function() {
return this.refresh();
ProjectInfoPanel.prototype.init = function () {
var self = this;
return ServerConnector.getConfigurationParam(ConfigurationType.REQUEST_ACCOUNT_EMAIL).then(function (value) {
var link = $("[name=requestAccount]", self.getElement());
link.attr("href", "mailto:" + value + "?subject=MINERVA account request");
return self.refresh();
});
};
module.exports = ProjectInfoPanel;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment