Module: check_mk
Branch: master
Commit: b770fed117281438b6966f71568144a09e916aec
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b770fed1172814…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jul 3 16:49:28 2013 +0200
Fixed error in new tables when search disabled
---
web/htdocs/table.py | 37 ++++++++++++++--------------
web/htdocs/wato.py | 10 ++++----
web/plugins/wato/builtin_modules.py | 4 +--
web/plugins/wato/check_mk_configuration.py | 6 ++---
4 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/web/htdocs/table.py b/web/htdocs/table.py
index edea650..24c88cf 100644
--- a/web/htdocs/table.py
+++ b/web/htdocs/table.py
@@ -119,6 +119,7 @@ def end():
return
table_id = table['id']
+ rows = table["rows"]
# Controls wether or not actions are available for a table
actions_enabled = table["searchable"]
@@ -134,24 +135,22 @@ def end():
user_opts[table_id]['actions_visible'] = actions_visible
- rows = table["rows"]
-
- if html.var('_%s_reset' % table_id):
- html.del_var('_%s_search' % table_id)
- if 'search' in table_opts:
- del table_opts['search'] # persist
-
- search_term = html.var('_%s_search' % table_id,
table_opts.get('search'))
- if search_term:
- html.set_var('_%s_search' % table_id, search_term)
- table_opts['search'] = search_term # persist
- filtered_rows = []
- for row, css in rows:
- for cell_content, css_classes in row:
- if search_term in cell_content:
- filtered_rows.append((row, css))
- break # skip other cells when matched
- rows = filtered_rows
+ if html.var('_%s_reset' % table_id):
+ html.del_var('_%s_search' % table_id)
+ if 'search' in table_opts:
+ del table_opts['search'] # persist
+
+ search_term = html.var('_%s_search' % table_id,
table_opts.get('search'))
+ if search_term:
+ html.set_var('_%s_search' % table_id, search_term)
+ table_opts['search'] = search_term # persist
+ filtered_rows = []
+ for row, css in rows:
+ for cell_content, css_classes in row:
+ if search_term in cell_content:
+ filtered_rows.append((row, css))
+ break # skip other cells when matched
+ rows = filtered_rows
num_rows_unlimited = len(rows)
num_cols = len(table["headers"])
@@ -221,7 +220,7 @@ def end():
html.write("</td>\n")
html.write("</tr>\n")
- if search_term and not rows:
+ if actions_enabled and search_term and not rows:
html.write('<tr class="data odd0 no_match"><td
colspan=%d>%s</td></tr>' %
(num_cols, _('Found no matching rows. Please try another search
term.')))
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index bc7b512..61a232f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5794,7 +5794,7 @@ def mode_groups(phase, what):
for cg in cgs:
members.setdefault(cg, []).append((userid, user.get('alias',
userid)))
- table.begin(what + "groups", what_name.title())
+ table.begin(what + "groups")
for name, alias in sorted:
table.row()
@@ -5993,7 +5993,7 @@ def mode_timeperiods(phase):
return None
- table.begin("timeperiods", _("Time Periods"), empty_text =
_("There are no timeperiods defined yet."))
+ table.begin("timeperiods", empty_text = _("There are no timeperiods
defined yet."))
names = timeperiods.keys()
names.sort()
for name in names:
@@ -7909,7 +7909,7 @@ def load_notification_table():
def mode_users(phase):
if phase == "title":
- return _("Users & Contacts")
+ return _("Users")
elif phase == "buttons":
global_buttons()
@@ -8551,7 +8551,7 @@ def mode_roles(phase):
log_pending(False, None, "edit-roles", _("Created new role
'%s'" % newid))
return
- table.begin("roles", _("Roles"))
+ table.begin("roles")
# Show table of builtin and user defined roles
entries = roles.items()
@@ -13572,7 +13572,7 @@ def load_plugins():
config.declare_permission("wato.users",
_("User management"),
- _("This permission is needed for the modules <b>Users &
Contacts</b>, <b>Roles</b> and <b>Contact
Groups</b>"),
+ _("This permission is needed for the modules <b>Users</b>,
<b>Roles</b> and <b>Contact Groups</b>"),
[ "admin", ])
config.declare_permission("wato.snapshots",
diff --git a/web/plugins/wato/builtin_modules.py b/web/plugins/wato/builtin_modules.py
index 528aca0..ef5b0cf 100644
--- a/web/plugins/wato/builtin_modules.py
+++ b/web/plugins/wato/builtin_modules.py
@@ -49,8 +49,8 @@ modules = [
( "service_groups", _("Service Groups"),
"servicegroups", "groups",
_("Organize services in groups for a better overview in the status
display.") ),
- ( "users", _("Users & Contacts"),
"users", "users",
- _("Manage users of Multisite and contacts of the monitoring system.") ),
+ ( "users", _("Users"), "users",
"users",
+ _("Manage users of the monitoring system.") ),
( "roles", _("Roles & Permissions"),
"roles", "users",
_("User roles are configurable sets of permissions." ) ),
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 7b24322..967ba46 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -378,7 +378,7 @@ register_configvar(group,
"table_row_limit",
Integer(title = _("Limit the number of rows shown in tables"),
help = _("Several pages which use tables to show data in rows, like the
"
- "\"Users & Contacts\" configuration page, can be
configured to show "
+ "\"Users\" configuration page, can be configured to
show "
"only a limited number of rows when accessing the
pages."),
minvalue = 1,
default_value = 100,
@@ -418,13 +418,13 @@ register_configvar(group,
ListChoice(
title = _('Automatic User Synchronization'),
help = _('By default the users are synchronized automatically in several
situations. '
- 'The sync is started when opening the "Users &
Contacts" page in configuration and '
+ 'The sync is started when opening the "Users" page in
configuration and '
'during each page rendering. Each connector can then specify if it
wants to perform '
'any actions. For example the LDAP connector will start the sync
once the cached user '
'information are too old.'),
default_value = [ 'wato_users', 'page' ],
choices = [
- ('wato_users', 'When opening WATO Users & Contacts'),
+ ('wato_users', 'When opening the users configuration page'),
('page', 'During regular page processing'),
],
allow_empty = True,