Module: check_mk
Branch: master
Commit: 33ec31040ad9ade07a8a136e459ccae4bd04eed2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=33ec31040ad9ad…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 15 10:19:00 2015 +0200
Not trying time graphs for IE<9
---
web/htdocs/htmllib.py | 3 +++
web/htdocs/index.py | 2 +-
web/plugins/views/painters.py | 26 +++++++++++++++++---------
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index a853f1a..7117e43 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -128,6 +128,9 @@ class html:
BACKSPACE = 8
F1 = 112
+ def get_user_agent(self):
+ return self.req.headers_in.get('User-Agent', '')
+
def set_page_context(self, c):
self.page_context = c
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 26604f1..c8fe615 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -141,7 +141,7 @@ def handler(req, fields = None, profiling = True):
if html.has_var("mobile"):
html.mobile = not not html.var("mobile")
else:
- user_agent = html.req.headers_in.get('User-Agent', '')
+ user_agent = html.get_user_agent()
html.mobile = mobile.is_mobile(user_agent)
# Redirect to mobile GUI if we are a mobile device and
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index bf30b9b..95242ac 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -798,15 +798,23 @@ multisite_painters["svc_group_memberlist"] = {
}
def paint_graph(row):
- # For hosts graphs always use PNP
- try:
- css, htmlcode = paint_time_graph(row)
- if htmlcode:
- return css, htmlcode
- except NameError:
- if config.debug:
- raise
- pass
+ # Filter some clients which do not support our graphing, for example IE < 8
+ try_time_graph = True
+
+ user_agent = html.get_user_agent()
+ if 'MSIE' in user_agent:
+ matches = regex('MSIE ([0-9]{1,}[\.0-9]{0,})').search(user_agent)
+ try_time_graph = not matches or float(matches.group(1)) >= 9.0
+
+ if try_time_graph:
+ try:
+ css, htmlcode = paint_time_graph(row)
+ if htmlcode:
+ return css, htmlcode
+ except NameError:
+ if config.debug:
+ raise
+ pass
sitename = row["site"]
host = row["host_name"]