Module: check_mk
Branch: master
Commit: 98812b92c4ceb35eb59a6828a90b0855657f372c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=98812b92c4ceb3…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jun 26 16:56:32 2013 +0200
New global option: Display date in dashboard
---
ChangeLog | 4 ++--
web/htdocs/htmllib.py | 6 ++++--
web/htdocs/js/checkmk.js | 21 +++++++++++++++++----
web/plugins/config/builtin.py | 3 +++
web/plugins/wato/check_mk_configuration.py | 19 +++++++++++++++++++
5 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cbc7a7b..ed9938f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,8 +61,8 @@
* Sorter Host IP address: fixed sorting, no longer uses str compare on ip
* Views: New: Draw rule editor icon in multisite views (default off)
Can be activated in global settings
- * New global multisite option: Default downtime duration and comment
-
+ * New global multisite options: Default downtime duration and comment
+ Display current date in dashboard
WATO:
* Allow to configure check-/retry_interval in second precision
* FIX: do validation of check items in rule editor
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index bfae476..a7292f4 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -886,8 +886,10 @@ class html:
self.write('<a href="#" onfocus="if (this.blur)
this.blur();" '
'onclick="this.innerHTML=\'%s\';
document.location.reload();">%s</a></td>' %
(_("Reloading..."), title))
- self.write('<td style="min-width:240px" class=right><span
id=headinfo></span>%s <b id=headertime></b>' %
- login_text)
+ self.write('<td style="min-width:240px" class=right><span
id=headinfo></span>%s ' % login_text)
+ if config.display_date_in_dashboard.get("format"):
+ self.write(' <b id=headerdate
format="%s"></b>' %
config.display_date_in_dashboard["format"])
+ self.write(' <b id=headertime></b>')
self.write("<script language=\"javascript\"
type=\"text/javascript\">updateHeaderTime()</script>")
try:
self.help_visible = config.load_user_file("help", False) # cache
for later usage
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 61a2b19..98e010c 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -859,10 +859,23 @@ function updateHeaderTime() {
oTime.innerHTML = hours + ':' + min
- min = null;
- hours = null;
- t = null;
- oTime = null;
+ var oDate = document.getElementById('headerdate');
+ if (oDate) {
+ var day = ("0" + t.getDate()).slice(-2);
+ var month = ("0" + (t.getMonth() + 1)).slice(-2);
+ var year = t.getFullYear();
+ var date_format = oDate.getAttribute("format");
+ oDate.innerHTML = date_format.replace(/yyyy/, year).replace(/mm/,
month).replace(/dd/, day);
+ }
+ day = null;
+ month = null;
+ year = null;
+ format = null;
+ oDate = null;
+ min = null;
+ hours = null;
+ t = null;
+ oTime = null;
}
var g_reload_error = false;
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index 3f9b6db..51b8bb7 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -183,6 +183,9 @@ multisite_draw_ruleicon = False
# Default downtime configuration
default_downtime = {}
+# Display dashboard date
+display_date_in_dashboard = {}
+
# _ _ ____ ____
# | | | |___ ___ _ __| _ \| __ )
# | | | / __|/ _ \ '__| | | | _ \
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index c95790d..e68d97d 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -219,6 +219,25 @@ register_configvar(group,
domain = "multisite")
register_configvar(group,
+ "display_date_in_dashboard",
+ Dictionary(
+ title = _("Display date in dashboard"),
+ help = _("When enabled, the dashboard headline also displays "\
+ "the date in addition the time "),
+ label = _("Draw date"),
+ elements = [
+ ("format", DropdownChoice(
+ title = _("Display date in dashboard"),
+ label = _("Date format"),
+ choices = [
+ ('yyyy-mm-dd', _("YYYY-MM-DD")),
+ ('dd.mm.yyyy', _("DD.MM.YYYY")),
+ ],
+ default_value = 'yyyy-mm-dd'))
+ ]),
+ domain = "multisite")
+
+register_configvar(group,
"multisite_draw_ruleicon",
Checkbox(title = _("Draw WATO rule editor icon for services"),
label = _("Draw rule editor icon"),