Commit 894a6342 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

logo link is obtained via API

parent 22f7ae61
......@@ -3,6 +3,7 @@
var ConfigurationType = {
DEFAULT_MAP : "DEFAULT_MAP",
LOGO_IMG : "LOGO_IMG",
LOGO_LINK : "LOGO_LINK",
};
module.exports = ConfigurationType;
......@@ -49,14 +49,6 @@ ServerConnector.lastActualization = 0;
ServerConnector._customMap = null;
/**
* Get link to the website that should be accessed when clicking on
* {@link ServerConnector.getLogoImg}.
*/
ServerConnector.getLogoLink = function() {
return document.getElementById('logoLink').value;
};
/**
* Get zoom level of the {@link CustomMap} at which it was last browsed.
*/
......@@ -915,7 +907,7 @@ ServerConnector.getConfigurationParam = function(paramId) {
return new Promise(function(resolve, reject) {
if (paramId === undefined) {
reject("Invalid param identifier");
} else if (self._configurationParam[paramId] !== undefined) {
} else if (self._configurationParam[paramId] !== undefined) {
resolve(self._configurationParam[paramId]);
} else {
return self.getToken().then(function(token) {
......@@ -1038,6 +1030,10 @@ ServerConnector.getLogoImg = function() {
return this.getConfigurationParam(ConfigurationType.LOGO_IMG);
};
ServerConnector.getLogoLink = function() {
return this.getConfigurationParam(ConfigurationType.LOGO_LINK);
};
ServerConnector.getOverlayById = function(layoutId, projectId) {
var self = this;
return new Promise(function(resolve, reject) {
......
......@@ -2,6 +2,8 @@
var ControlType = {
COMMENT_CHECKBOX : "COMMENT_CHECKBOX",
LOGO_IMG : "LOGO_IMG",
LOGO_2_IMG: "LOGO_2_IMG",
};
module.exports = ControlType;
......@@ -103,7 +103,6 @@ CustomMap.prototype.createSubmaps = function() {
};
CustomMap.prototype.createLogo = function() {
var logoControlDiv2 = document.createElement('DIV');
var logo2 = document.createElement('IMG');
ServerConnector.getLogoImg().then(function(url){
......@@ -114,10 +113,15 @@ CustomMap.prototype.createLogo = function() {
});
logo2.style.cursor = 'pointer';
logo2.style.width = "80px";
logo2.id = ControlType.LOGO_2_IMG;
this.addControl(logo2);
logoControlDiv2.appendChild(logo2);
google.maps.event.addDomListener(logo2, 'click', function() {
var win = window.open(ServerConnector.getLogoLink(), '_blank');
win.focus();
return ServerConnector.getLogoLink().then(function(url){
var win = window.open(url, '_blank');
win.focus();
}).catch(GuiConnector.alert);
});
logoControlDiv2.index = 0; // used for ordering
this.getGoogleMap().controls[google.maps.ControlPosition.LEFT_BOTTOM].push(logoControlDiv2);
......@@ -128,6 +132,9 @@ CustomMap.prototype.createLogo = function() {
var logo = document.createElement('IMG');
logo.src = GuiConnector.getImgPrefix() + GuiConnector.getLcsbLogoImg(this.bigButtons);
logo.style.cursor = 'pointer';
logo.id = ControlType.LOGO_IMG;
this.addControl(logo);
logoControlDiv.appendChild(logo);
google.maps.event.addDomListener(logo, 'click', function() {
var win = window.open('http://wwwen.uni.lu/lcsb/', '_blank');
......
......@@ -11,7 +11,8 @@ var google = {
fun : fun
});
},
addDomListener : function() {
addDomListener : function(object, type, fun) {
object.addEventListener(type, fun);
},
trigger : function(object, type, param) {
for (var i = 0; i < google.maps.event._data.length; i++) {
......
......@@ -623,7 +623,7 @@ describe('CustomMap', function() {
assert.ok(details[0][0] instanceof Comment);
});
});
it("getOverlayDataForIdentifiedElement", function() {
var map = helper.createCustomMap();
var commentOverlay = helper.createCommentDbOverlay(map);
......@@ -637,9 +637,8 @@ describe('CustomMap', function() {
return map.getOverlayDataForIdentifiedElement(ie, {
comment : true
}).then(function(details) {
logger.debug(details);
assert.equal(details.length,1);
assert.equal(details.length, 1);
var overlayData = details[0];
assert.equal(overlayData.overlay, commentOverlay);
assert.ok(overlayData.data);
......@@ -647,7 +646,5 @@ describe('CustomMap', function() {
assert.ok(overlayData.data[0] instanceof Comment);
});
});
});
......@@ -37,8 +37,6 @@
<h:inputHidden id="exportModelId" value="#{exportMB.selectedModelId}"/>
<h:inputHidden id="selectedDrugPolygon" value="#{drugMB.polygon}"/>
<input type="hidden" id="logoLink" value="#{configurationMB.logoLink}" readonly="true"/>
<p:remoteCommand name="_actualizeParams" actionListener="#{mapMB.actualizeParams}"/>
<h:inputHidden id="centerCoordinateX" value="#{mapMB.topModelMapData.centerCoordinateX}"/>
<h:inputHidden id="centerCoordinateY" value="#{mapMB.topModelMapData.centerCoordinateY}"/>
......
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