Commit 92cc6b26 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '731-make-lcsb-logo-configurable' into 'master'

Resolve "make lcsb logo configurable"

Closes #731

See merge request minerva/core!679
parents 41b1e932 0074da66
......@@ -3,6 +3,7 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
annotator (#617)
* Small improvement: added current username next to logout button in admin panel (#660)
* Small improvement: New comment dialog does not contain content of previous comment dialog (#680)
* Small improvement: Left logo is configurable (#731)
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: order of the overlays is defined explicitly also for general
......
......@@ -5,9 +5,9 @@ var ConfigurationType = {
MINERVANET_URL: "MINERVANET_URL",
GOOGLE_ANALYTICS_IDENTIFIER: "GOOGLE_ANALYTICS_IDENTIFIER",
GOOGLE_MAPS_API_KEY: "GOOGLE_MAPS_API_KEY",
LOGO_IMG: "LOGO_IMG",
LOGO_LINK: "LOGO_LINK",
LOGO_TEXT: "LOGO_TEXT",
LEFT_LOGO_IMG: "LEFT_LOGO_IMG",
LEFT_LOGO_LINK: "LEFT_LOGO_LINK",
LEFT_LOGO_TEXT: "LEFT_LOGO_TEXT",
LEGEND_FILES: "LEGEND_FILES",
MIN_COLOR_VAL: "MIN_COLOR_VAL",
MAX_COLOR_VAL: "MAX_COLOR_VAL",
......@@ -15,6 +15,9 @@ var ConfigurationType = {
OVERLAY_OPACITY: "OVERLAY_OPACITY",
REQUEST_ACCOUNT_EMAIL: "REQUEST_ACCOUNT_EMAIL",
REQUEST_ACCOUNT_DEFAULT_CONTENT: "REQUEST_ACCOUNT_DEFAULT_CONTENT",
RIGHT_LOGO_IMG: "RIGHT_LOGO_IMG",
RIGHT_LOGO_LINK: "RIGHT_LOGO_LINK",
RIGHT_LOGO_TEXT: "RIGHT_LOGO_TEXT",
SIMPLE_COLOR_VAL: "SIMPLE_COLOR_VAL",
SESSION_LENGTH: "SESSION_LENGTH",
SHOW_ELEMENT_ABBREVIATION: "SHOW_ELEMENT_ABBREVIATION",
......
......@@ -167,22 +167,6 @@ GuiConnector.prototype.removeWindowResizeEvent = function (handler) {
}
};
/**
* Returns name of the file with LCSB logo.
*
* @param bigLogo
* {@link Boolean} value determining if we want to have big logo or
* small one
* @returns {string}
*/
GuiConnector.prototype.getLcsbLogoImg = function (bigLogo) {
if (bigLogo) {
return 'lcsb_logo_mid.png';
} else {
return 'lcsb_logo.png';
}
};
/**
* Returns name of the file with image that should be presented when we are
* waiting for data to be loaded.
......
......@@ -1630,10 +1630,6 @@ ServerConnector.getProjectId = function (projectId) {
}
};
ServerConnector.getLogoLink = function () {
return this.getConfigurationParam(ConfigurationType.LOGO_LINK);
};
ServerConnector.getMaxSearchDistance = function () {
return this.getConfigurationParam(ConfigurationType.SEARCH_DISTANCE);
};
......
"use strict";
var ControlType = {
SUBMAP_DIALOGS : "SUBMAP_DIALOGS",
LOGO_IMG : "LOGO_IMG",
LOGO_2_IMG : "LOGO_2_IMG"
};
module.exports = ControlType;
......@@ -9,9 +9,7 @@ var AbstractCustomMap = require('./AbstractCustomMap');
var Alias = require('./data/Alias');
var CommentDialog = require('../gui/CommentDialog');
var ConfigurationType = require('../ConfigurationType');
var ControlType = require('./ControlType');
var CustomMapOptions = require('./CustomMapOptions');
var GuiConnector = require('../GuiConnector');
var IdentifiedElement = require('./data/IdentifiedElement');
var DataOverlay = require('./data/DataOverlay');
var Reaction = require('./data/Reaction');
......@@ -33,9 +31,6 @@ var Point = require('./canvas/Point');
* @extends AbstractCustomMap
*/
function CustomMap(options) {
//@type {HTMLElement[]}
this._controls = [];
if (!(options instanceof CustomMapOptions)) {
options = new CustomMapOptions(options);
}
......@@ -131,11 +126,6 @@ CustomMap.prototype.init = function () {
}
});
});
}).then(function () {
var logo2 = self.getControl(ControlType.LOGO_2_IMG);
logo2.src = self.getConfiguration().getOption(ConfigurationType.LOGO_IMG).getValue();
logo2.setAttribute('title', self.getConfiguration().getOption(ConfigurationType.LOGO_TEXT).getValue());
logo2.setAttribute('alt', self.getConfiguration().getOption(ConfigurationType.LOGO_TEXT).getValue());
});
};
......@@ -158,34 +148,28 @@ CustomMap.prototype.createLogo = function () {
var logo2 = Functions.createElement({
type: 'IMG',
className: "minerva-logo",
id: ControlType.LOGO_2_IMG,
title: self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue(),
src: self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_IMG).getValue(),
onclick: function () {
return self.getServerConnector().getLogoLink().then(function (url) {
var win = window.open(url, '_blank');
win.focus();
}).catch(GuiConnector.alert);
var win = window.open(self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_LINK).getValue(), '_blank');
win.focus();
}
});
this.addControl(logo2);
logoControlDiv2.appendChild(logo2);
this.getMapCanvas().addLeftBottomControl(logoControlDiv2);
var logoControlDiv = Functions.createElement({type: "div", style: "padding: 5px", index: 1});
var logoControlDiv = Functions.createElement({type: "div", index: 1});
var logo = Functions.createElement({
type: "IMG",
src: GuiConnector.getImgPrefix() + GuiConnector.getLcsbLogoImg(this.bigButtons),
style: "cursor: pointer",
id: ControlType.LOGO_IMG,
title: self.getConfiguration().getOption(ConfigurationType.RIGHT_LOGO_TEXT).getValue(),
src: self.getConfiguration().getOption(ConfigurationType.RIGHT_LOGO_IMG).getValue(),
className: "minerva-logo",
onclick: function () {
var win = window.open('http://wwwen.uni.lu/lcsb/', '_blank');
var win = window.open(self.getConfiguration().getOption(ConfigurationType.RIGHT_LOGO_LINK).getValue(), '_blank');
win.focus();
}
});
this.addControl(logo);
logoControlDiv.appendChild(logo);
this.getMapCanvas().addRightBottomControl(logoControlDiv);
};
......@@ -479,7 +463,7 @@ CustomMap.prototype.openSubmap = function (id) {
return self.refreshMarkers();
});
}
}).then(function (value) {
}).then(function () {
return self.callListeners("onSubmapOpen", {mapId: id});
});
} else {
......@@ -1042,32 +1026,6 @@ CustomMap.prototype.getTopMap = function () {
return this;
};
/**
*
* @param {HTMLElement} element
*/
CustomMap.prototype.addControl = function (element) {
if (this._controls[element.id] !== undefined) {
throw new Error("Element with id " + element.id + " already added to controls");
}
if (ControlType[element.id] === undefined) {
throw new Error("Unknown control type: " + element.id);
}
this._controls[element.id] = element;
};
/**
*
* @param {string} type
* @returns {HTMLElement}
*/
CustomMap.prototype.getControl = function (type) {
if (ControlType[type] === undefined) {
throw new Error("Unknown control type: " + type);
}
return this._controls[type];
};
/**
*
* @param {CommentDialog} commentDialog
......
......@@ -641,22 +641,29 @@ function create(params) {
*/
function createFooter() {
return ServerConnector.getConfiguration().then(function (configuration) {
var logoLink = configuration.getOption(ConfigurationType.LOGO_LINK).getValue();
var logoText = configuration.getOption(ConfigurationType.LOGO_TEXT).getValue();
var logoImg = configuration.getOption(ConfigurationType.LOGO_IMG).getValue();
var leftLogoLink = configuration.getOption(ConfigurationType.LEFT_LOGO_LINK).getValue();
var leftLogoText = configuration.getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue();
var leftLogoImg = configuration.getOption(ConfigurationType.LEFT_LOGO_IMG).getValue();
var rightLogoLink = configuration.getOption(ConfigurationType.RIGHT_LOGO_LINK).getValue();
var rightLogoText = configuration.getOption(ConfigurationType.RIGHT_LOGO_TEXT).getValue();
var rightLogoImg = configuration.getOption(ConfigurationType.RIGHT_LOGO_IMG).getValue();
return functions.createElement({
type: "div",
className: "minerva-footer-table",
content: '<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
'<tr>' +
'<td align="left"><a href="' + logoLink + '" title="' + logoText + '" target="_blank">' +
'<img src="' + logoImg + '" class="minerva-logo" alt="' + logoText + '"/>' +
'<td align="left"><a href="' + leftLogoLink + '" title="' + leftLogoText + '" target="_blank">' +
'<img src="' + leftLogoImg + '" class="minerva-logo" alt="' + leftLogoText + '"/>' +
'</a></td>' +
'<td align="center" class="minerva-footer-text">MiNERVA version ' + configuration.getVersion() + ';<br/>' +
'build ' + configuration.getBuildDate() + ';<br/>' +
'git: ' + configuration.getGitHash() + '</td>' +
'<td align="right"><a href="http://wwwen.uni.lu/lcsb/" title="LCSB - Luxembourg Centre for Systems Biomedicine" target="_blank">' +
'<img src="' + GuiConnector.getImgPrefix() + 'lcsb.png" width="80" height="80" border="0" alt="LCSB - Luxembourg Centre for Systems Biomedicine"/>' +
'<td align="right"><a href="' + rightLogoLink + '" title="' + rightLogoText + '" target="_blank">' +
'<img src="' + rightLogoImg + '" class="minerva-logo" alt="' + rightLogoText + '"/>' +
'</a></td>' +
'</tr>\n' +
'</table>', xss: false
......
......@@ -7,7 +7,6 @@ require("../mocha-config.js");
var AliasMarker = require('../../../main/js/map/marker/AliasMarker');
var AliasSurface = require('../../../main/js/map/surface/AliasSurface');
var Comment = require('../../../main/js/map/data/Comment');
var ControlType = require('../../../main/js/map/ControlType');
var CustomMap = require('../../../main/js/map/CustomMap');
var IdentifiedElement = require('../../../main/js/map/data/IdentifiedElement');
var MapContextMenu = require('../../../main/js/gui/MapContextMenu');
......@@ -1010,11 +1009,11 @@ describe('CustomMap', function () {
describe("logo link", function () {
it("left logo click", function () {
var map = helper.createCustomMap();
return map.getControl(ControlType.LOGO_2_IMG).onclick()
return $(".minerva-logo", map.getElement())[0].onclick()
});
it("right logo click", function () {
var map = helper.createCustomMap();
return map.getControl(ControlType.LOGO_IMG).onclick()
return $(".minerva-logo", map.getElement())[1].onclick()
});
});
describe("getDistance", function () {
......
......@@ -58,15 +58,39 @@ public enum ConfigurationElementType {
ConfigurationElementTypeGroup.SERVER_CONFIGURATION),
/**
* Logo presented in the system.
* Left logo presented in the system.
*/
LOGO_IMG("Logo icon", "resources/images/udl.png", ConfigurationElementEditType.URL, false,
LEFT_LOGO_IMG("Left logo icon", "resources/images/udl.png", ConfigurationElementEditType.URL, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Address connected to the logo.
* Address connected to the left logo.
*/
LOGO_LINK("Logo link (after click)", "http://wwwen.uni.lu/", ConfigurationElementEditType.URL, false,
LEFT_LOGO_LINK("Left logo link (after click)", "http://wwwen.uni.lu/", ConfigurationElementEditType.URL, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Description of the left logo presented in the system.
*/
LEFT_LOGO_TEXT("Left logo description", "University of Luxembourg", ConfigurationElementEditType.STRING, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Right logo presented in the system.
*/
RIGHT_LOGO_IMG("Right logo icon", "resources/images/lcsb.png", ConfigurationElementEditType.URL, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Address connected to the right logo.
*/
RIGHT_LOGO_LINK("Right logo link (after click)", "http://wwwen.uni.lu/lcsb/", ConfigurationElementEditType.URL, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Description of the right logo presented in the system.
*/
RIGHT_LOGO_TEXT("Right logo description", "LCSB - Luxembourg Centre for Systems Biomedicine", ConfigurationElementEditType.STRING, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
......@@ -98,12 +122,6 @@ public enum ConfigurationElementType {
GOOGLE_ANALYTICS_IDENTIFIER("Google Analytics tracking ID used for statistics", "",
ConfigurationElementEditType.STRING, false, ConfigurationElementTypeGroup.SERVER_CONFIGURATION),
/**
* Description of the logo presented in the system.
*/
LOGO_TEXT("Logo description", "University of Luxembourg", ConfigurationElementEditType.STRING, false,
ConfigurationElementTypeGroup.LEGEND_AND_LOGO),
/**
* Domain allowed to connect via x-frame technology.
*/
......
update configuration_option_table set type='LEFT_LOGO_LINK' where type='LOGO_LINK';
update configuration_option_table set type='LEFT_LOGO_TEXT' where type='LOGO_TEXT';
update configuration_option_table set type='LEFT_LOGO_IMG' where type='LOGO_IMG';
......@@ -35,17 +35,17 @@ public class ConfigurationDaoTest extends PersistTestFunctions {
assertNull(configurationDao.getValueByType(null));
// check data for something that is in database
String val = configurationDao.getValueByType(ConfigurationElementType.LOGO_TEXT);
String val = configurationDao.getValueByType(ConfigurationElementType.LEFT_LOGO_TEXT);
assertNotNull(val);
// remove data from database
ConfigurationOption obj = configurationDao.getByType(ConfigurationElementType.LOGO_TEXT);
ConfigurationOption obj = configurationDao.getByType(ConfigurationElementType.LEFT_LOGO_TEXT);
if (obj != null) {
configurationDao.delete(obj);
}
// and now check data for something that is not in database
assertNotNull(configurationDao.getValueByType(ConfigurationElementType.LOGO_TEXT));
assertNotNull(configurationDao.getValueByType(ConfigurationElementType.LEFT_LOGO_TEXT));
}
......
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