Module: check_mk
Branch: master
Commit: 07b04e6f7a3a12bc27634a8b5473bffaba67a16b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=07b04e6f7a3a12…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 25 09:58:35 2011 +0200
The heder time is now updated again when present
---
web/htdocs/htmllib.py | 2 +-
web/htdocs/js/check_mk.js | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 4183ae6..9efc3e0 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -552,7 +552,7 @@ class html:
else:
login_text = "not logged in"
self.write("<table class=header><tr><td
class=left>%s</td><td class=right>"
- "%s <b class=headertime>%s</b>
<a href=\"http://mathias-kettner.de\"><img
src=\"images/mk_logo_small.gif\"/></a></td></tr></table>"
%
+ "%s <b id=headertime>%s</b>
<a href=\"http://mathias-kettner.de\"><img
src=\"images/mk_logo_small.gif\"/></a></td></tr></table>"
%
(title, login_text, time.strftime("%H:%M")))
self.write("<hr class=header>\n")
diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js
index 9da51f5..21ead5b 100644
--- a/web/htdocs/js/check_mk.js
+++ b/web/htdocs/js/check_mk.js
@@ -597,6 +597,29 @@ function startReloadTimer(url) {
gReloadTimer = setTimeout("handleReload('" + url + "')",
Math.ceil(parseFloat(gReloadTime) * 1000));
}
+function updateHeaderTime() {
+ var oTime = document.getElementById('headertime');
+ if(!oTime)
+ return;
+
+ var t = new Date();
+
+ var hours = t.getHours();
+ if(hours < 10)
+ hours = "0" + hours;
+
+ var min = t.getMinutes();
+ if(min < 10)
+ min = "0" + min;
+
+ oTime.innerHTML = hours + ':' + min
+
+ min = null;
+ hours = null;
+ t = null;
+ oTime = null;
+}
+
function handleContentReload(_unused, code) {
var o = document.getElementById('data_container');
o.innerHTML = code;
@@ -618,6 +641,9 @@ function handleContentReload(_unused, code) {
}
}
+ // Update the header time
+ updateHeaderTime();
+
aScripts = null;
o = null;
startReloadTimer('');