Module: check_mk
Branch: master
Commit: 3598bb9e3b7c3ffd964ad61c2aaa01cdfe24cb06
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3598bb9e3b7c3f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Sep 6 18:05:09 2011 +0200
row selection nearly complete
---
web/htdocs/js/check_mk.js | 26 +++++++++++++++++++++-----
web/plugins/views/layouts.py | 3 ++-
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js
index a994865..4a050ac 100644
--- a/web/htdocs/js/check_mk.js
+++ b/web/htdocs/js/check_mk.js
@@ -1089,10 +1089,12 @@ function toggle_row(e, elem) {
// Yes: Unselect it
checkbox.checked = false;
g_selected_rows.splice(row_pos, 1);
+ alert('x');
} else {
// No: Select it
checkbox.checked = true;
g_selected_rows.push(checkbox.name);
+ alert('x');
}
if(e.stopPropagation)
@@ -1178,19 +1180,33 @@ function table_init_rowselect(oTable) {
if(childs[i].type != 'checkbox')
continue;
+ // Perform initial selections
+ if(g_selected_rows.indexOf(childs[i].name) > -1)
+ childs[i].checked = true;
+ else
+ childs[i].checked = false;
+
+ childs[i].onclick = function(e) {
+ return toggle_row(e, this);
+ };
+
iter_cells(childs[i], function(elem) {
elem.onmouseover = function() {
- highlight_row(this, true);
+ return highlight_row(this, true);
};
elem.onmouseout = function() {
- highlight_row(this, false);
+ return highlight_row(this, false);
};
elem.onclick = function(e) {
- toggle_row(e, this);
+ return toggle_row(e, this);
};
// Disable selections in IE and then in mozilla
- elem.onselectstart = function(e) {disable_selection(e);}
- elem.onmousedown = function(e) {disable_selection(e);}
+ elem.onselectstart = function(e) {
+ return disable_selection(e);
+ };
+ elem.onmousedown = function(e) {
+ return disable_selection(e);
+ };
elem = null;
});
}
diff --git a/web/plugins/views/layouts.py b/web/plugins/views/layouts.py
index d9c4989..db0fdef 100644
--- a/web/plugins/views/layouts.py
+++ b/web/plugins/views/layouts.py
@@ -33,7 +33,8 @@ def init_rowselect():
def render_checkbox(view, row, num_tds):
# value contains the number of columns of this datarow. This is
# needed for hiliting the correct number of TDs
- html.write("<input type=checkbox name=\"%s\" value=%d />" %
(row_id(view, row), num_tds))
+ html.write("<input type=checkbox name=\"%s\" value=%d />"
%
+ (row_id(view, row), num_tds + 1))
def render_checkbox_td(view, row, num_tds):
html.write("<td class=checkbox>")