diff options
author | Henry Castro <hcastro@collabora.com> | 2021-10-12 15:43:19 -0400 |
---|---|---|
committer | Pedro Pinto Silva <pedro.silva@collabora.com> | 2022-01-26 13:31:41 +0100 |
commit | 1c1286974bb9b9c8cd8acef61fb22993736d2049 (patch) | |
tree | be68bc11d2b0436289d78a14db45f330f621e7b0 | |
parent | browser: add initial Map.Infobar handler (diff) | |
download | online-1c1286974bb9b9c8cd8acef61fb22993736d2049.tar.gz online-1c1286974bb9b9c8cd8acef61fb22993736d2049.zip |
browser: show infobar if user is admin
Change-Id: Ie1626752d2d0d05e20d6a68eaa55fefa1d22ca63
Signed-off-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | browser/src/map/handler/Map.Infobar.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/browser/src/map/handler/Map.Infobar.js b/browser/src/map/handler/Map.Infobar.js index 2e92001d6e..8bcfbfad8c 100644 --- a/browser/src/map/handler/Map.Infobar.js +++ b/browser/src/map/handler/Map.Infobar.js @@ -5,12 +5,31 @@ L.Map.Infobar = L.Handler.extend({ + initialize: function (map) { + L.Handler.prototype.initialize.call(this, map); + map.on('updateviewslist', this.onUpdateList, this); + }, + + onUpdateList: function () { + var docLayer = this._map._docLayer || {}; + var viewInfo = this._map._viewInfo[docLayer._viewId]; + + if (viewInfo && !this.enabled() && viewInfo.userextrainfo && + viewInfo.userextrainfo.is_admin) { + this.enable(); + } + }, + addHooks: function () { + this._map.off('updateviewslist', this.onUpdateList, this); L.DomEvent.on(window, 'message', this.onMessage, this); var url = window.feedbackLocation.replace(/feedback.html/g, 'updatecheck.html'); this.remove(); - this._iframeInfobar = L.iframeDialog(url); + + this._iframeInfobar = L.iframeDialog(url, null, + L.DomUtil.get('main-document-content'), + options); }, removeHooks: function () { |