From e3ffcbc1fe64371ae95598176d03f74783ddefe1 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Tue, 2 Oct 2018 17:19:14 +0200
Subject: [PATCH] logo location moved outside of resoucre/images folder

---
 frontend-js/src/main/js/ServerConnector.js                 | 4 ----
 frontend-js/src/main/js/map/CustomMap.js                   | 7 +------
 frontend-js/src/main/js/minerva.js                         | 2 +-
 .../12.2.0~alpha.0/V12.2.0.20181002__logo_location.sql     | 2 ++
 4 files changed, 4 insertions(+), 11 deletions(-)
 create mode 100644 persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181002__logo_location.sql

diff --git a/frontend-js/src/main/js/ServerConnector.js b/frontend-js/src/main/js/ServerConnector.js
index e47b11cbda..ae6de2653f 100644
--- a/frontend-js/src/main/js/ServerConnector.js
+++ b/frontend-js/src/main/js/ServerConnector.js
@@ -1592,10 +1592,6 @@ ServerConnector.getProjectId = function (projectId) {
   }
 };
 
-ServerConnector.getLogoImg = function () {
-  return this.getConfigurationParam(ConfigurationType.LOGO_IMG);
-};
-
 ServerConnector.getLogoLink = function () {
   return this.getConfigurationParam(ConfigurationType.LOGO_LINK);
 };
diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js
index def66cc57d..d58857135f 100644
--- a/frontend-js/src/main/js/map/CustomMap.js
+++ b/frontend-js/src/main/js/map/CustomMap.js
@@ -133,13 +133,8 @@ CustomMap.prototype.init = function () {
       }
     });
   }).then(function () {
-    return self.getServerConnector().getLogoImg();
-  }).then(function (url) {
     var logo2 = self.getControl(ControlType.LOGO_2_IMG);
-    if (!/^(f|ht)tps?:\/\//i.test(url)) {
-      url = GuiConnector.getImgPrefix() + url;
-    }
-    logo2.src = url;
+    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());
   });
diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js
index 6cdf12cd52..72213c4088 100644
--- a/frontend-js/src/main/js/minerva.js
+++ b/frontend-js/src/main/js/minerva.js
@@ -502,7 +502,7 @@ function createFooter() {
       content: '<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
       '<tr>' +
       '<td align="left"><a href="' + logoLink + '" title="' + logoText + '" target="_blank">' +
-      '<img src="' + GuiConnector.getImgPrefix() + logoImg + '" width="80" height="80" border="0" alt="' + logoText + '"/>' +
+      '<img src="' + logoImg + '" width="80" height="80" border="0" alt="' + logoText + '"/>' +
       '</a></td>' +
       '<td align="center" class="minerva-footer-text">MiNERVA version ' + configuration.getVersion() + ';<br/>' +
       'build ' + configuration.getBuildDate() + ';<br/>' +
diff --git a/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181002__logo_location.sql b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181002__logo_location.sql
new file mode 100644
index 0000000000..4a9b5e8292
--- /dev/null
+++ b/persist/src/main/resources/db/migration/12.2.0~alpha.0/V12.2.0.20181002__logo_location.sql
@@ -0,0 +1,2 @@
+--logo location should be moved outside of minerva resources page
+update configuration_table set value=concat('resources/images/', value) where type='LOGO_IMG' and not (value like 'http:%' or value like 'https:%');
-- 
GitLab