Module: check_mk
Branch: master
Commit: 7e9928a32046f3e742333c30cd33c24abdba9ea7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e9928a32046f3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue May 15 11:52:42 2012 +0200
Snapin Custom Links allows to specify HTTP link target
---
ChangeLog | 1 +
multisite.mk | 18 +++++++++---------
web/htdocs/sidebar.py | 14 +++++++-------
web/plugins/sidebar/shipped.py | 5 +++--
4 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 193a0b1..26286c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* FIX: Logwatch handles logs with only OK lines in it correctly in logfile list
views
* FIX: Fixed syntax error in "Single-Host Problems" view definition
* New help button at top right of each page now toggles help texts
+ * Snapin Custom Links allows to specify HTTP link target
Mobile GUI:
* FIX: commands can be executed again
diff --git a/multisite.mk b/multisite.mk
index 0222aed..dd2f289 100644
--- a/multisite.mk
+++ b/multisite.mk
@@ -53,13 +53,13 @@ custom_links['guest'] = [
# but some in addition
custom_links['user'] = custom_links['guest'] + [
( "Open Source Components", False, [
- ( "Multisite",
"http://mathias-kettner.de/checkmk_multisite.html" ),
- ( "MK Livestatus",
"http://mathias-kettner.de/checkmk_livestatus.html" ),
- ( "Check_MK", "http://mathias-kettner.de/check_mk.html"
),
- ( "Nagios", "http://www.nagios.org/" ),
- ( "PNP4Nagios", "http://pnp4nagios.org/" ),
- ( "NagVis", "http://nagvis.org/" ),
- ( "RRDTool", "http://oss.oetiker.ch/rrdtool/" ),
+ ( "Multisite",
"http://mathias-kettner.de/checkmk_multisite.html", None, "_blank"),
+ ( "MK Livestatus",
"http://mathias-kettner.de/checkmk_livestatus.html", None, "_blank"),
+ ( "Check_MK", "http://mathias-kettner.de/check_mk.html",
None, "_blank"),
+ ( "Nagios", "http://www.nagios.org/", None,
"_blank"),
+ ( "PNP4Nagios", "http://pnp4nagios.org/", None,
"_blank"),
+ ( "NagVis", "http://nagvis.org/", None,
"_blank"),
+ ( "RRDTool", "http://oss.oetiker.ch/rrdtool/", None,
"_blank"),
])
]
@@ -68,8 +68,8 @@ custom_links['admin'] = custom_links['user'] + [
( "Support", False, [
( "Mathias Kettner",
"http://mathias-kettner.de/" ),
( "Check_MK Mailinglists",
"http://mathias-kettner.de/check_mk_lists.html" ),
- ( "Check_MK Exchange (inofficial)",
"http://exchange.check-mk.org/" ),
- ( "Nagios Portal (German)",
"http://nagios-portal.org"),
+ ( "Check_MK Exchange (inofficial)",
"http://exchange.check-mk.org/", None, "_blank" ),
+ ( "Nagios Portal (German)", "http://nagios-portal.org",
None, "_blank"),
])
]
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 52015f3..3010413 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -55,7 +55,7 @@ def load_plugins():
snapin["allowed"])
# Helper functions to be used by snapins
-def link(text, target):
+def link(text, target, frame="main"):
# Convert relative links into absolute links. We have three kinds
# of possible links and we change only [3]
# [1] protocol://hostname/url/link.py
@@ -63,14 +63,14 @@ def link(text, target):
# [3] relative.py
if not (":" in target[:10]) and target[0] != '/':
target = defaults.url_prefix + "check_mk/" + target
- return '<a onfocus="if (this.blur) this.blur();"
target="main" ' \
- 'class=link href="%s">%s</a>' % (target,
htmllib.attrencode(text))
+ return '<a onfocus="if (this.blur) this.blur();"
target="%s" ' \
+ 'class=link href="%s">%s</a>' % (frame, target,
htmllib.attrencode(text))
-def simplelink(text, target):
- html.write(link(text, target) + "<br>\n")
+def simplelink(text, target, frame="main"):
+ html.write(link(text, target, frame) + "<br>\n")
-def bulletlink(text, target):
- html.write("<li class=sidebar>" + link(text, target) +
"</li>\n")
+def bulletlink(text, target, frame="main"):
+ html.write("<li class=sidebar>" + link(text, target, frame) +
"</li>\n")
def iconlink(text, target, icon):
linktext = '<img class=iconlink src="images/icon_%s.png">%s'
% \
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 96d577a..06ea8a9 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -1171,11 +1171,12 @@ def render_custom_links():
render_list(idss, entry[2])
html.write('</div>\n')
elif type(entry[1]) == str:
- if len(entry) > 2:
+ frame = len(entry) > 3 and entry[3] or "main"
+ if len(entry) > 2 and entry[2]:
html.write('<img src="images/%s">' %
entry[2])
else:
html.write('<img
src="images/link_link.gif">')
- simplelink(entry[0], entry[1])
+ simplelink(entry[0], entry[1], frame)
else:
html.write(_("Second part of tuple must be list or string, not
%s\n") % str(entry[1]))
except Exception, e: