From cb0d7389a091eb807d8a54e91d9487470ac362b3 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 25 Jun 2009 01:01:18 +0000 Subject: Bug 304267: Large lists in admin pages fail to display (they take too much time) - Patch by Michael Thomas r/a=LpSolit --- .../en/default/admin/components/list.html.tmpl | 16 ++- .../en/default/admin/custom_fields/list.html.tmpl | 26 +++-- .../en/default/admin/fieldvalues/list.html.tmpl | 22 ++-- template/en/default/admin/groups/list.html.tmpl | 116 ++++++++++----------- .../en/default/admin/milestones/list.html.tmpl | 9 +- template/en/default/admin/table.html.tmpl | 74 +++++++------ template/en/default/admin/users/list.html.tmpl | 39 ++++--- 7 files changed, 145 insertions(+), 157 deletions(-) (limited to 'template') diff --git a/template/en/default/admin/components/list.html.tmpl b/template/en/default/admin/components/list.html.tmpl index 990b07997..d4bf11748 100644 --- a/template/en/default/admin/components/list.html.tmpl +++ b/template/en/default/admin/components/list.html.tmpl @@ -86,23 +86,19 @@ }) %] [%# Overrides the initialowner and the initialqacontact with right values %] -[% overrides.initialowner = [] %] -[% overrides.initialqacontact = [] %] +[% overrides.initialowner = {} %] +[% overrides.initialqacontact = {} %] [% FOREACH component = product.components %] - [% overrides.initialowner.push({ - match_value => component.name - match_field => 'name' + [% overrides.initialowner.name.${component.name} = { override_content => 1 content => component.default_assignee.login - }) + } %] - [% overrides.initialqacontact.push({ - match_value => component.name - match_field => 'name' + [% overrides.initialqacontact.name.${component.name} = { override_content => 1 content => component.default_qa_contact.login - }) + } %] [% END %] diff --git a/template/en/default/admin/custom_fields/list.html.tmpl b/template/en/default/admin/custom_fields/list.html.tmpl index 6f2e68be7..dd266c759 100644 --- a/template/en/default/admin/custom_fields/list.html.tmpl +++ b/template/en/default/admin/custom_fields/list.html.tmpl @@ -68,27 +68,25 @@ [% custom_fields = Bugzilla.get_fields({ custom => 1 }) %] [%# We want to display the type name of fields, not their type ID. %] -[% overrides.type = [] %] +[% overrides.type = {} %] [% FOREACH field_type = field_types.keys %] - [% overrides.type.push({ - match_value => field_type - match_field => 'type' + [% overrides.type.type.$field_type = { override_content => 1 - content => field_types.${field_type} - }) + content => field_types.$field_type + } %] [% END %] -[% overrides.action = [ { - match_value => 1 - match_field => 'obsolete' - override_content => 1 - content => "Delete" - override_contentlink => 1 - contentlink => delete_contentlink - } ] +[% overrides.action.obsolete = { + "1" => { + override_content => 1 + content => "Delete" + override_contentlink => 1 + contentlink => delete_contentlink + } + } %] [% PROCESS admin/table.html.tmpl diff --git a/template/en/default/admin/fieldvalues/list.html.tmpl b/template/en/default/admin/fieldvalues/list.html.tmpl index 976b58ae7..fdc22d912 100644 --- a/template/en/default/admin/fieldvalues/list.html.tmpl +++ b/template/en/default/admin/fieldvalues/list.html.tmpl @@ -59,27 +59,23 @@ %] -[% SET overrides.action = [] %] +[% SET overrides.action = {} %] [% FOREACH check_value = values %] - [% IF check_value.is_static %] - [% overrides.action.push({ - match_value => check_value.name - match_field => 'name' + [% overrides.action.name.${check_value.name} = { override_content => 1 content => "(Non-deletable value)" override_contentlink => 1 contentlink => undef - }) + } %] [% ELSIF check_value.is_default %] - [% overrides.action.push({ - match_value => check_value.name - match_field => 'name' - override_content => 1 - content => "(Default value)" - override_contentlink => 1 - contentlink => undef }) + [% overrides.action.name.${check_value.name} = { + override_content => 1 + content => "(Default value)" + override_contentlink => 1 + contentlink => undef + } %] [% END %] diff --git a/template/en/default/admin/groups/list.html.tmpl b/template/en/default/admin/groups/list.html.tmpl index 029e5f0b4..1d137dc5f 100644 --- a/template/en/default/admin/groups/list.html.tmpl +++ b/template/en/default/admin/groups/list.html.tmpl @@ -66,68 +66,60 @@ ] %] -[% overrides.is_active_bug_group = [ { - match_value => "0" - match_field => 'is_active_bug_group' - override_content => 1 - content => " " - }, - { - match_value => "1" - match_field => 'is_active_bug_group' - override_content => 1 - content => "X" - }] - overrides.userregexp = [ { - match_value => "" - match_field => 'userregexp' - override_content => 1 - content => " " - }] - overrides.action = [ { - match_value => Param("chartgroup") - match_field => 'name' - override_content => 1 - content => "(used as the 'chartgroup')" - }, - { - match_value => Param("insidergroup") - match_field => 'name' - override_content => 1 - content => "(used as the 'insidergroup')" - }, - { - match_value => Param("timetrackinggroup") - match_field => 'name' - override_content => 1 - content => "(used as the 'timetrackinggroup')" - }, - { - match_value => Param("querysharegroup") - match_field => 'name' - override_content => 1 - content => "(used as the 'querysharegroup')" - }, - { - match_value => "1" - match_field => 'isbuggroup' - override_content => 1 - content => "Delete" - override_contentlink => 1 - contentlink => del_contentlink - }] - overrides.type = [ { - match_value => "0" - match_field => 'isbuggroup' - override_content => 1 - content => "system" - }, - { - match_value => "1" - match_field => 'isbuggroup' - override_content => 1 - content => "user" - }] +[% overrides.is_active_bug_group = { + 'is_active_bug_group' => { + "0" => { + override_content => 1 + content => " " + } + "1" => { + override_content => 1 + content => "X" + } + } + } + + overrides.userregexp = { + 'userregexp' => { + "" => { + override_content => 1 + content => " " + } + } + } +%] + +[% FOREACH group IN ["chartgroup", "insidergroup", "timetrackinggroup", "querysharegroup"] %] + [% special_group = Param(group) %] + + [% IF special_group %] + [% overrides.action.name.$special_group = { + override_content => 1 + content => "(used as the '$group')" + } + %] + [% END %] +[% END %] + +[% overrides.action.isbuggroup = { + "1" => { + override_content => 1 + content => "Delete" + override_contentlink => 1 + contentlink => del_contentlink + } + } + + overrides.type.isbuggroup = { + "0" => { + override_content => 1 + content => "system" + } + "1" => { + override_content => 1 + content => "user" + } + } %] [% PROCESS admin/table.html.tmpl diff --git a/template/en/default/admin/milestones/list.html.tmpl b/template/en/default/admin/milestones/list.html.tmpl index 00e5bd922..e1463603c 100644 --- a/template/en/default/admin/milestones/list.html.tmpl +++ b/template/en/default/admin/milestones/list.html.tmpl @@ -77,16 +77,13 @@ }) %] -[%# We want to override the usual 'Delete' link for the default - milestone %] -[% overrides.action = [ { - match_value => product.default_milestone - match_field => 'name' +[%# We want to override the usual 'Delete' link for the default milestone %] +[% overrides.action.name.${product.default_milestone} = { override_content => 1 content => "(Default milestone)" override_contentlink => 1 contentlink => undef - } ] + } %] [% PROCESS admin/table.html.tmpl diff --git a/template/en/default/admin/table.html.tmpl b/template/en/default/admin/table.html.tmpl index 303aba798..ce5e985cb 100644 --- a/template/en/default/admin/table.html.tmpl +++ b/template/en/default/admin/table.html.tmpl @@ -50,14 +50,26 @@ # keys are column names from columns subhashes name field. # # overrides: - # Provides a method for overriding individual table cells. This is - # a hash, whose key is the column name, so the column must be - # named for one of it's cells to be overwritten. The hash value is - # an array. Each item in this array is a hash specifying - # row-matching criteria, and any overridden values. The - # row-matching criteria consist of keys: - # match_field: The name of the row value we want to match - # match_value: The value to match against + # Example: + # overrides { # first hash + # column_name_to_be_overwriten => { # second hash + # name_of_row_to_match_against => { # third hash + # value_to_match_against => { # fourth hash + # content => "some contents" + # override_content => 1 + # } + # } + # } + # } + # + # Provides a method for overriding individual table cells. This is a hash + # (1), whose key is the column name, so the column must be named for + # one of it's cells to be overwritten. The hash value is another hash + # (2). The keys of that second hash are the name of the row to match + # against. The second hash then again points to another hash. Within this + # third hash (3), the keys represent values to match against. The item + # contains a fourth hash (4) specifying overridden values. + # # Each column value mentioned in the 'columns' documentation above # can be overwritten (apart from name and heading). To override a # table-cell value 'xxx', specify a new 'xxx' value, and specify a @@ -98,30 +110,30 @@ yesno_field = c.yesno_field %] - [%# Are there any specific overrides for this column? %] - [% FOREACH override = overrides.${c.name} %] - - [%# Is the override for this row? %] - [% IF override.match_value == row.${override.match_field} %] - - [% SET contentlink = override.contentlink - IF override.override_contentlink %] - [% SET content = override.content - IF override.override_content %] - [% SET content_use_field = override.content_use_field - IF override.override_content_use_field %] - [% SET align = override.align - IF override.override_align %] - [% SET class = override.class - IF override.override_class %] - [% SET allow_html_content = override.allow_html_content - IF override.override_allow_html_content %] - [% SET yesno_field = override.yesno_field - IF override.override_yesno_field %] - - [% LAST %] + [%# Get any specific "important" overrides for this c.name and row.name ? %] + [% SET important = overrides.${c.name}.name.${row.name} %] - [% END %] + [% IF important %] + + [% FOREACH key IN important.keys %] + [% SET ${key} = important.${key} %] + [% END %] + + [% ELSE %] + + [%# Are there any specific overrides for this column? %] + [% FOREACH match_field = overrides.${c.name}.keys %] + + [% override = overrides.${c.name}.${match_field}.${row.$match_field} %] + [% NEXT UNLESS override %] + + [% FOREACH key IN override.keys %] + [% SET ${key} = override.${key} %] + [% END %] + + [% LAST %] + + [% END %] [% END %] "$thisuser.login_name" - match_field => 'login_name' - content => "missing" - override_content => 1 - class => "$classes" - override_class => 1 }) + [% overrides.realname.login_name.${thisuser.login_name} = { + content => "missing" + override_content => 1 + class => "$classes" + override_class => 1 + } + %] + [% ELSIF thisuser.disabledtext %] + [% overrides.realname.login_name.${thisuser.login_name} = { + class => "bz_inactive" + override_class => 1 + } %] [% END %] [% IF thisuser.disabledtext %] - [% overrides.login_name.push({ - match_value => "$thisuser.login_name" - match_field => 'login_name' - class => "bz_inactive" - override_class => 1 }) - %] - - [% overrides.realname.push({ - match_value => "$thisuser.login_name" - match_field => 'login_name' - class => "bz_inactive" - override_class => 1 }) + [% overrides.login_name.login_name.${thisuser.login_name} = { + class => "bz_inactive" + override_class => 1 + } %] [% END %] [% END %] -- cgit v1.2.3-24-g4f1b