[checkmk-commits] Check_MK Git: check_mk: URL dashlets: Added option to enable /

Lars Michelsen lm at mathias-kettner.de
Mon Aug 25 11:04:58 CEST 2014


  disable displaying URLs in iframe
Message-ID: <53fafc3a./Arj54FZBVgPKTft%lm at mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Module: check_mk
Branch: master
Commit: d9e723b6df34de6c475886f6986db5f6d87d67e7
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d9e723b6df34de6c475886f6986db5f6d87d67e7

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Mon Aug 25 11:04:50 2014 +0200

URL dashlets: Added option to enable / disable displaying URLs in iframe

---

 web/htdocs/dashboard.py           |    4 +++-
 web/plugins/dashboard/dashlets.py |    8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 3da590b..deb2311 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -482,7 +482,9 @@ def render_dashlet(name, board, nr, dashlet, wato_folder, add_url_vars):
 
     # Optional way to render a dynamic iframe URL
     if "iframe_urlfunc" in dashlet_type:
-        dashlet["iframe"] = dashlet_type["iframe_urlfunc"](dashlet)
+        url = dashlet_type["iframe_urlfunc"](dashlet)
+        if url != None:
+            dashlet["iframe"] = url
 
     elif "iframe_render" in dashlet_type:
         dashlet["iframe"] = html.makeuri_contextless([
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 8e19a94..5038bb1 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -567,7 +567,8 @@ dashlet_types["view"] = {
 #   '----------------------------------------------------------------------'
 
 def dashlet_url(params):
-    return params['url']
+    if params.get('show_in_iframe', True):
+        return params['url']
 
 dashlet_types["url"] = {
     "title"          : _("Custom URL"),
@@ -585,6 +586,11 @@ dashlet_types["url"] = {
             title = _('Dynamic URL rendering function'),
             size = 50,
         )),
+        ("show_in_iframe", Checkbox(
+            title = _('Render in iframe'),
+            label = _('Render URL contents in own frame'),
+            default_value = True,
+        )),
     ],
     "opt_params": ['url', 'urlfunc'],
 }



More information about the checkmk-commits mailing list