Module: check_mk
Branch: master
Commit: 1f87ef91cf688d101f834a2ca84a0d08f13a0c7c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f87ef91cf688d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 27 14:09:28 2012 +0200
Start implementing repeated column headers
---
web/htdocs/views.py | 6 +++++-
web/plugins/views/layouts.py | 7 +++++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index d4f48af..3b65753 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -712,7 +712,11 @@ function toggle_section(nr, oImg) {
if html.var("column_headers") == 'perpage':
html.set_var("column_headers", 'pergroup')
- html.select("column_headers", [ ("off", _("off")),
("pergroup", _("once per group")) ])
+ html.select("column_headers", [
+ ("off", _("off")),
+ ("pergroup", _("once per group"),
+ ("repeat", _("repeat every 20'th row")) ])
+
html.write("</td><tr>\n")
html.write("<tr><td>%s:</td><td>" % _('Sortable
by user'))
html.checkbox('user_sortable', True)
diff --git a/web/plugins/views/layouts.py b/web/plugins/views/layouts.py
index e19a364..d5d7acf 100644
--- a/web/plugins/views/layouts.py
+++ b/web/plugins/views/layouts.py
@@ -367,6 +367,7 @@ def render_grouped_list(rows, view, group_painters, painters,
num_columns, show_
index = 0
+ visible_row_number = 0
for row in rows:
register_events(row) # needed for playing sounds
# Show group header, if a new group begins. But only if grouping
@@ -386,6 +387,7 @@ def render_grouped_list(rows, view, group_painters, painters,
num_columns, show_
# paint group header
group_open = True
+ visible_row_number = 0
html.write("<tr class=groupheader>")
html.write("<td class=groupheader colspan=%d><table
class=groupheader><tr>" %
(num_painters * (num_columns + 2) + (num_columns - 1)))
@@ -424,6 +426,11 @@ def render_grouped_list(rows, view, group_painters, painters,
num_columns, show_
# At the beginning of the line? Beginn new line
if column == 1:
+ visible_row_number += 1
+ if view.get("column_headers") == "repeat":
+ if visible_row_number % 20 == 0:
+ show_header_line()
+
# In one-column layout we use the state of the service
# or host - if available - to color the complete line
if num_columns == 1: