From 4fdb67308b0e095aa76e36581cc4e94357d61f6a Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 11 Sep 2008 00:07:01 +0000 Subject: Bug 216557: Be able to specify the order of the columns in a bug list - Patch by Pascal Held r=LpSolit r=pyrzak a=LpSolit --- colchange.cgi | 8 +- js/change-columns.js | 145 ++++++++++++++++++++++ skins/standard/global.css | 26 ++++ skins/standard/global/down.png | Bin 0 -> 335 bytes skins/standard/global/left.png | Bin 0 -> 339 bytes skins/standard/global/right.png | Bin 0 -> 339 bytes skins/standard/global/up.png | Bin 0 -> 318 bytes skins/standard/show_bug.css | 4 - template/en/default/filterexceptions.pl | 4 - template/en/default/list/change-columns.html.tmpl | 61 +++++++-- 10 files changed, 227 insertions(+), 21 deletions(-) create mode 100644 js/change-columns.js create mode 100644 skins/standard/global/down.png create mode 100644 skins/standard/global/left.png create mode 100644 skins/standard/global/right.png create mode 100644 skins/standard/global/up.png diff --git a/colchange.cgi b/colchange.cgi index cb43b34e3..5c44df3ed 100755 --- a/colchange.cgi +++ b/colchange.cgi @@ -21,6 +21,7 @@ # Contributor(s): Terry Weissman # Gervase Markham # Max Kanat-Alexander +# Pascal Held use strict; @@ -94,10 +95,9 @@ if (defined $cgi->param('rememberedquery')) { if (defined $cgi->param('resetit')) { @collist = DEFAULT_COLUMN_LIST; } else { - foreach my $i (@masterlist) { - if (defined $cgi->param("column_$i")) { - push @collist, $i; - } + if (defined $cgi->param("selected_columns")) { + my %legal_list = map { $_ => 1 } @masterlist; + @collist = grep { exists $legal_list{$_} } $cgi->param("selected_columns"); } if (defined $cgi->param('splitheader')) { $splitheader = $cgi->param('splitheader')? 1: 0; diff --git a/js/change-columns.js b/js/change-columns.js new file mode 100644 index 000000000..5fd5c1085 --- /dev/null +++ b/js/change-columns.js @@ -0,0 +1,145 @@ +/*# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Pascal Held. + # + # Contributor(s): Pascal Held + # +*/ + +function initChangeColumns() { + window.onunload = unload; + var av_select = document.getElementById("available_columns"); + var sel_select = document.getElementById("selected_columns"); + document.getElementById("avail_header").style.display = "inline"; + document.getElementById("available_columns").style.display = "inline"; + document.getElementById("select_button").style.display = "inline"; + document.getElementById("deselect_button").style.display = "inline"; + document.getElementById("up_button").style.display = "inline"; + document.getElementById("down_button").style.display = "inline"; + switch_options(sel_select, av_select, false); + sel_select.selectedIndex = -1; + updateView(); +} + +function switch_options(from_box, to_box, selected) { + for (var i = 0; i= 0; i--) { + var opt = sel_select.options[i]; + if (opt.selected) { + sel_select.options[i] = dummy; + sel_select.options[i + 1] = opt; + sel_select.options[i] = last; + } + else{ + last = opt; + } + } + updateView(); +} + +function updateView() { + var select_button = document.getElementById("select_button"); + var deselect_button = document.getElementById("deselect_button"); + var up_button = document.getElementById("up_button"); + var down_button = document.getElementById("down_button"); + select_button.disabled = true; + deselect_button.disabled = true; + up_button.disabled = true; + down_button.disabled = true; + var av_select = document.getElementById("available_columns"); + var sel_select = document.getElementById("selected_columns"); + for (var i = 0; i < av_select.options.length; i++) { + if (av_select.options[i].selected) { + select_button.disabled = false; + break; + } + } + for (var i = 0; i < sel_select.options.length; i++) { + if (sel_select.options[i].selected) { + deselect_button.disabled = false; + up_button.disabled = false; + down_button.disabled = false; + break; + } + } + if (sel_select.options.length > 0) { + if (sel_select.options[0].selected) { + up_button.disabled = true; + } + if (sel_select.options[sel_select.options.length - 1].selected) { + down_button.disabled = true; + } + } +} + +function change_submit() { + var sel_select = document.getElementById("selected_columns"); + for (var i = 0; i < sel_select.options.length; i++) { + sel_select.options[i].selected = true; + } + return false; +} + +function unload() { + var sel_select = document.getElementById("selected_columns"); + for (var i = 0; i < sel_select.options.length; i++) { + sel_select.options[i].selected = true; + } +} diff --git a/skins/standard/global.css b/skins/standard/global.css index 938575eb5..f3dd2ffbe 100644 --- a/skins/standard/global.css +++ b/skins/standard/global.css @@ -20,6 +20,7 @@ * Vitaly Harisov * Svetlana Harisova * Marc Schumann + * Pascal Held */ /* global (begin) */ @@ -271,6 +272,10 @@ div#docslinks { padding: 1em 0; } +.bz_default_hidden { + display: none; +} + span.quote { color: #65379c; /* Make quoted text not wrap. */ @@ -439,4 +444,25 @@ form#Create .comment { background: white; } +.image_button { + background-repeat: no-repeat; + background-position: center center; + width: 30px; + display: none; +} + +#select_button { + background-image: url(global/right.png); +} + +#deselect_button { + background-image: url(global/left.png); +} + +#up_button { + background-image: url(global/up.png); +} +#down_button { + background-image: url(global/down.png); +} \ No newline at end of file diff --git a/skins/standard/global/down.png b/skins/standard/global/down.png new file mode 100644 index 000000000..78a9e631a Binary files /dev/null and b/skins/standard/global/down.png differ diff --git a/skins/standard/global/left.png b/skins/standard/global/left.png new file mode 100644 index 000000000..f8cb2b2dd Binary files /dev/null and b/skins/standard/global/left.png differ diff --git a/skins/standard/global/right.png b/skins/standard/global/right.png new file mode 100644 index 000000000..d02b707a6 Binary files /dev/null and b/skins/standard/global/right.png differ diff --git a/skins/standard/global/up.png b/skins/standard/global/up.png new file mode 100644 index 000000000..240d483df Binary files /dev/null and b/skins/standard/global/up.png differ diff --git a/skins/standard/show_bug.css b/skins/standard/show_bug.css index 3851315da..80c4513d6 100644 --- a/skins/standard/show_bug.css +++ b/skins/standard/show_bug.css @@ -11,10 +11,6 @@ width: 2em; } -.bz_default_hidden { - display: none; -} - .related_actions { font-size: 0.85em; float: right; diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index 361a1f469..9ac1b4339 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -177,10 +177,6 @@ 'default.series_id', ], -'list/change-columns.html.tmpl' => [ - 'column', -], - 'list/edit-multiple.html.tmpl' => [ 'group.id', 'menuname', diff --git a/template/en/default/list/change-columns.html.tmpl b/template/en/default/list/change-columns.html.tmpl index 88ae47818..53d0493ef 100644 --- a/template/en/default/list/change-columns.html.tmpl +++ b/template/en/default/list/change-columns.html.tmpl @@ -16,12 +16,15 @@ # Rights Reserved. # # Contributor(s): Dave Lawrence + # Pascal Held #%] [% PROCESS global/variables.none.tmpl %] [% PROCESS global/header.html.tmpl title = "Change Columns" + javascript_urls = "js/change-columns.js" + onload = "initChangeColumns()" %]

@@ -36,16 +39,56 @@ [% field_descs.reporter_realname = "Reporter Realname" %] [% field_descs.qa_contact_realname = "QA Contact Realname" %] -

+ - [% FOREACH column = masterlist %] - - -
- [% END %] + + + + + + + + + + + + + +
Available Columns
Selected Columns
+ + + +

+ +
+ + + +

+ +
+