33
44namespace Icinga \Web \Widget \Dashboard ;
55
6+ use Icinga \Web \Session ;
67use Icinga \Web \Url ;
78use Icinga \Data \ConfigObject ;
8- use Icinga \Exception \IcingaException ;
99
1010/**
1111 * A dashboard pane dashlet
@@ -57,18 +57,15 @@ class Dashlet extends UserWidget
5757 */
5858 private $ template =<<<'EOD'
5959
60- <div class="container" data-icinga-url="{URL}">
61- <h1><a href="{FULL_URL}" aria-label="{TOOLTIP}" title="{TOOLTIP}" data-base-target="col1">{TITLE}</a></h1>
60+ <div class="container" data-icinga-url="{URL}" data-url-hash="{URL_HASH}">
61+ <h1><a
62+ href="{FULL_URL}"
63+ aria-label="{TOOLTIP}"
64+ title="{TOOLTIP}"
65+ data-url-hash="{FULL_URL_HASH}"
66+ data-base-target="col1"
67+ >{TITLE}</a></h1>
6268 <p class="progress-label">{PROGRESS_LABEL}<span>.</span><span>.</span><span>.</span></p>
63- <noscript>
64- <div class="iframe-container">
65- <iframe
66- src="{IFRAME_URL}"
67- frameborder="no"
68- title="{TITLE_PREFIX}{TITLE}">
69- </iframe>
70- </div>
71- </noscript>
7269 </div>
7370EOD;
7471
@@ -250,13 +247,22 @@ public function render()
250247
251248 $ url = $ this ->getUrl ();
252249 $ url ->setParam ('showCompact ' , true );
253- $ iframeUrl = clone $ url ;
254- $ iframeUrl ->setParam ('isIframe ' );
250+ $ fullUrl = $ url ->getUrlWithout (['showCompact ' , 'limit ' , 'view ' ]);
251+
252+ $ urlHash = '' ;
253+ $ fullUrlHash = '' ;
254+ if ($ url ->getPath () === 'iframe ' ) {
255+ $ urlHash = hash ('sha256 ' , Url::fromPath ($ url ->getParam ('url ' ))->getAbsoluteUrl ()
256+ . Session::getSession ()->getId ());
257+ $ fullUrlHash = hash ('sha256 ' , Url::fromPath ($ fullUrl ->getParam ('url ' ))->getAbsoluteUrl ()
258+ . Session::getSession ()->getId ());
259+ }
255260
256261 $ searchTokens = array (
257262 '{URL} ' ,
258- '{IFRAME_URL } ' ,
263+ '{URL_HASH } ' ,
259264 '{FULL_URL} ' ,
265+ '{FULL_URL_HASH} ' ,
260266 '{TOOLTIP} ' ,
261267 '{TITLE} ' ,
262268 '{TITLE_PREFIX} ' ,
@@ -265,8 +271,9 @@ public function render()
265271
266272 $ replaceTokens = array (
267273 $ url ,
268- $ iframeUrl ,
269- $ url ->getUrlWithout (['showCompact ' , 'limit ' , 'view ' ]),
274+ $ urlHash ,
275+ $ fullUrl ,
276+ $ fullUrlHash ,
270277 sprintf ($ view ->translate ('Show %s ' , 'dashboard.dashlet.tooltip ' ), $ view ->escape ($ this ->getTitle ())),
271278 $ view ->escape ($ this ->getTitle ()),
272279 $ view ->translate ('Dashlet ' ) . ': ' ,
0 commit comments