From 73d27355c54785877d8adadbd954494c738e4fc2 Mon Sep 17 00:00:00 2001 From: Renaud Michaelis Date: Tue, 17 Jan 2023 09:52:37 +0100 Subject: [PATCH] Show cyclomedia link to MinTour role --- .../static-ngeo/js/UserManager.js | 8 +++++ .../js/locationinfo/LocationinfoController.js | 31 +++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/geoportal/geoportailv3_geoportal/static-ngeo/js/UserManager.js b/geoportal/geoportailv3_geoportal/static-ngeo/js/UserManager.js index 19724ffac..277d2783f 100644 --- a/geoportal/geoportailv3_geoportal/static-ngeo/js/UserManager.js +++ b/geoportal/geoportailv3_geoportal/static-ngeo/js/UserManager.js @@ -301,6 +301,14 @@ exports.prototype.getUserType = function() { return this.typeUtilisateur; }; +/** + * @return {string|undefined} The Role. + */ +exports.prototype.getRole = function() { + return this.role; +}; + + /** * @return {?number} The Role Id. */ diff --git a/geoportal/geoportailv3_geoportal/static-ngeo/js/locationinfo/LocationinfoController.js b/geoportal/geoportailv3_geoportal/static-ngeo/js/locationinfo/LocationinfoController.js index ee86e3a03..a90b317b5 100644 --- a/geoportal/geoportailv3_geoportal/static-ngeo/js/locationinfo/LocationinfoController.js +++ b/geoportal/geoportailv3_geoportal/static-ngeo/js/locationinfo/LocationinfoController.js @@ -324,18 +324,22 @@ const exports = function( if (x !== undefined && y !== undefined) { - var coordinate = version === 3 ? - /** @type {ol.Coordinate} */ (transform([parseFloat(x), parseFloat(y)], srs, - this['map'].getView().getProjection())) : - /** @type {ol.Coordinate} */ (transform([parseFloat(y), parseFloat(x)], srs, - this['map'].getView().getProjection())); - this.setClickCordinate_(coordinate); - this.loadInfoPane_(); - if (!this.appGetDevice_.testEnv('xs')) { - this['open'] = true; - this['hiddenContent'] = false; - } else { - this['hiddenContent'] = true; + try { + var coordinate = version === 3 ? + /** @type {ol.Coordinate} */ (transform([parseFloat(x), parseFloat(y)], srs, + this['map'].getView().getProjection())) : + /** @type {ol.Coordinate} */ (transform([parseFloat(y), parseFloat(x)], srs, + this['map'].getView().getProjection())); + this.setClickCordinate_(coordinate); + this.loadInfoPane_(); + if (!this.appGetDevice_.testEnv('xs')) { + this['open'] = true; + this['hiddenContent'] = false; + } else { + this['hiddenContent'] = true; + } + } catch(exception) { + console.error(exception); } } } @@ -557,7 +561,8 @@ exports.prototype.getLidarUrl = function() { */ exports.prototype.isCyclomediaAvailable = function() { if (this.appUserManager_.getUserType() == 'etat' || - this.appUserManager_.getUserType() == 'commune') { + this.appUserManager_.getUserType() == 'commune' || + this.appUserManager_.getRole() == 'MinTour') { return true; } return false;