From: guy.pyrzak%gmail.com <> Date: Thu, 10 Apr 2008 21:33:15 +0000 (+0000) Subject: Bug 414236 Ð show_bug.cgi: Remove the knob in favor of normal boxes Patch By Guy Pyrzak r=mkanat, a=LpSolit. Removes knob from edit single and edit multiple bugs. --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index e523db6aef..0087b3b856 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -2560,7 +2560,7 @@ sub choices { } # Hack - this array contains "". See bug 106589. - my @res = grep ($_, @{settable_resolutions()}); + my @res = grep ($_, @{get_legal_field_values('resolution')}); $self->{'choices'} = { @@ -2579,22 +2579,6 @@ sub choices { return $self->{'choices'}; } -# List of resolutions that may be set directly by hand in the bug form. -# 'MOVED' and 'DUPLICATE' are excluded from the list because setting -# bugs to those resolutions requires a special process. -sub settable_resolutions { - my $resolutions = get_legal_field_values('resolution'); - my $pos = lsearch($resolutions, 'DUPLICATE'); - if ($pos >= 0) { - splice(@$resolutions, $pos, 1); - } - $pos = lsearch($resolutions, 'MOVED'); - if ($pos >= 0) { - splice(@$resolutions, $pos, 1); - } - return $resolutions; -} - sub votes { my ($self) = @_; return 0 if $self->{error}; @@ -2623,35 +2607,6 @@ sub bug_alias_to_id { "SELECT bug_id FROM bugs WHERE alias = ?", undef, $alias); } -##################################################################### -# Workflow Control routines -##################################################################### - -sub process_knob { - my ($self, $action, $to_resolution, $dupe_of) = @_; - my $dbh = Bugzilla->dbh; - - return if $action eq 'none'; - - my $dupe_move_status = Bugzilla->params->{'duplicate_or_move_bug_status'}; - if ($action eq 'duplicate') { - $self->set_status($dupe_move_status, - {resolution => 'DUPLICATE', dupe_of => $dupe_of}); - } - elsif ($action eq 'move') { - $self->set_status($dupe_move_status, {resolution => 'MOVED'}); - } - elsif ($action eq 'change_resolution') { - $self->set_resolution($to_resolution); - } - elsif ($action eq 'clearresolution') { - $self->clear_resolution(); - } - else { - $self->set_status($action, {resolution => $to_resolution}); - } -} - ##################################################################### # Subroutines ##################################################################### diff --git a/buglist.cgi b/buglist.cgi index 43d147b82d..c40e65aed3 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -1181,7 +1181,7 @@ if ($dotweak && scalar @bugs) { $vars->{'op_sys'} = get_legal_field_values('op_sys'); $vars->{'priorities'} = get_legal_field_values('priority'); $vars->{'severities'} = get_legal_field_values('bug_severity'); - $vars->{'resolutions'} = Bugzilla::Bug->settable_resolutions; + $vars->{'resolutions'} = get_legal_field_values('resolution'); $vars->{'unconfirmedstate'} = 'UNCONFIRMED'; diff --git a/js/field.js b/js/field.js index 6a8019dd57..044c9b6ac3 100644 --- a/js/field.js +++ b/js/field.js @@ -246,6 +246,56 @@ function initDefaultCheckbox(field_id){ 'set_default_' + field_id ); } +function showHideStatusItems(e, dupArrayInfo) { + var el = document.getElementById('bug_status'); + // finish doing stuff based on the selection. + if ( el ) { + showDuplicateItem(el); + YAHOO.util.Dom.setStyle('resolution_settings', 'display', 'none'); + if (document.getElementById('resolution_settings_warning')) { + YAHOO.util.Dom.setStyle('resolution_settings_warning', 'display', 'none'); + } + YAHOO.util.Dom.setStyle('duplicate_display', 'display', 'none'); + + if ( el.value == dupArrayInfo[1] && dupArrayInfo[0] == "is_duplicate" ) { + YAHOO.util.Dom.setStyle('resolution_settings', 'display', 'inline'); + YAHOO.util.Dom.setStyle('resolution_settings_warning', 'display', 'block'); + } + else if (close_status_array.indexOf(el.value) > -1) { + // hide duplicate and show resolution + YAHOO.util.Dom.setStyle('resolution_settings', 'display', 'inline'); + YAHOO.util.Dom.setStyle('resolution_settings_warning', 'display', 'block'); + } + } +} + +function showDuplicateItem(e) { + var resolution = document.getElementById('resolution'); + var bug_status = document.getElementById('bug_status'); + if (resolution) { + if (resolution.value == 'DUPLICATE' && close_status_array.indexOf(bug_status.value) > -1 ) { + // hide resolution show duplicate + YAHOO.util.Dom.setStyle('duplicate_settings', 'display', 'inline'); + YAHOO.util.Dom.setStyle('dup_id_discoverable', 'display', 'none'); + } + else { + YAHOO.util.Dom.setStyle('duplicate_settings', 'display', 'none'); + YAHOO.util.Dom.setStyle('dup_id_discoverable', 'display', 'block'); + } + } + YAHOO.util.Event.preventDefault(e); //prevents the hyperlink from going to the url in the href. +} + +function setResolutionToDuplicate(e, duplicate_or_move_bug_status) { + var status = document.getElementById('bug_status'); + var resolution = document.getElementById('resolution'); + YAHOO.util.Dom.setStyle('dup_id_discoverable', 'display', 'none'); + status.value = duplicate_or_move_bug_status; + resolution.value = "DUPLICATE"; + showHideStatusItems("", ["",""]); + YAHOO.util.Event.preventDefault(e); +} + function setDefaultCheckbox(e, field_id ) { var el = document.getElementById(field_id); var elLabel = document.getElementById(field_id + "_label"); diff --git a/process_bug.cgi b/process_bug.cgi index 97cd3098d3..cf24c96c91 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -495,23 +495,19 @@ if (!$cgi->param('id') && $cgi->param('dup_id')) { # down here, because the validity of status changes depends on other fields, # such as Target Milestone. foreach my $b (@bug_objects) { - if (should_set('knob')) { - # First, get the correct resolution + [% IF bug.user.canmove %] + + [% END %] + [% ELSE %]
Note @@ -357,9 +363,9 @@ : + [% PROCESS select selname => "component" %] @@ -404,14 +410,7 @@ Status: - - [% get_status(bug.bug_status) FILTER html %]   - [% get_resolution(bug.resolution) FILTER html %] - - [% IF bug.resolution == "DUPLICATE" %] - of [% terms.bug %] [%+ "${bug.dup_id}" FILTER bug_link(bug.dup_id) FILTER none %] - [% END %] - + [% PROCESS bug/knob.html.tmpl %] [%###############################################################%] @@ -422,24 +421,20 @@ : - - - [% PROCESS select selname => "priority" %] - [% PROCESS select selname = "bug_severity" %] - [% IF bug.use_votes %] - - [% END %] - -
- [% IF bug.votes %] - with - - [% bug.votes %] vote[%IF bug.votes > 1 %]s[% END %] - . - [% END %] - (vote) -
+ [% PROCESS select selname => "priority" no_td=>1 %] + [% PROCESS select selname = "bug_severity" no_td=>1 %] + [% IF bug.use_votes %] + + [% IF bug.votes %] + with + + [% bug.votes %] vote[%IF bug.votes > 1 %]s[% END %] + . + [% END %] + (vote) + + [% END %] diff --git a/template/en/default/bug/knob.html.tmpl b/template/en/default/bug/knob.html.tmpl index 432e9b3099..4cf6031e7e 100644 --- a/template/en/default/bug/knob.html.tmpl +++ b/template/en/default/bug/knob.html.tmpl @@ -18,15 +18,16 @@ # Contributor(s): Gervase Markham # Vaskin Kissoyan # Frédéric Buclin + # Guy Pyrzak #%] [% PROCESS global/variables.none.tmpl %] - -
-
-
+
[% initial_action_shown = 0 %] + [% show_resolution = 0 %] + [% bug_status_select_displayed = 0 %] + [% closed_status_array = [] %] [%# These actions are based on the current custom workflow. %] [% FOREACH bug_status = bug.status.can_change_to %] [% NEXT IF bug.isunconfirmed && bug_status.is_open && !bug.user.canconfirm %] @@ -36,85 +37,114 @@ # for compatibility with older versions. %] [% NEXT IF !bug.isopened && (bug.everconfirmed && bug_status.name == "UNCONFIRMED" || !bug.everconfirmed && bug_status.name == "REOPENED") %] + [% IF NOT bug_status_select_displayed %] + - - [% IF bug.isopened && !bug_status.is_open %] - and set the resolution to [% PROCESS select_resolution field = "knob_${bug_status.id}" %] + + [% IF !bug_status.is_open %] + [% show_resolution = 1 %] + [% filtered_status = bug_status.name FILTER js %] + [% closed_status_array.push( filtered_status ) %] [% END %] -
[% END %] [%# These actions are special and are independent of the workflow. %] [% IF bug.user.canedit || bug.user.isreporter %] + [% IF NOT bug_status_select_displayed %] + - -
[% END %] - [% ELSE %] - [% IF bug.resolution != "MOVED" || bug.user.canmove %] + [% ELSIF bug.resolution != "MOVED" || bug.user.canmove %] [% PROCESS initial_action %] - - - [% PROCESS select_resolution field = "knob_change_resolution" %] -
- [% END %] + [% show_resolution = 1 %] [% END %] - - [% PROCESS duplicate %] + [% END %] + [% IF bug_status_select_displayed %] + + [% ELSE %] + [% get_status(bug.bug_status) FILTER html %] + [% IF bug.resolution %] + [%+ get_resolution(bug.resolution) FILTER html %] + [% IF bug.dup_id %] + of + [% "${terms.bug} ${bug.dup_id}" FILTER bug_link(bug.dup_id) FILTER none %] + [% END %] + [% END %] [% END %] -
- -
- - [% IF bug.user.canmove %] - + [% IF bug.user.canedit || bug.user.isreporter %] + [% IF show_resolution %] + + [% PROCESS select_resolution %] [% END %] -
+ + + of + + [% "${terms.bug} ${bug.dup_id}" FILTER bug_link(bug.dup_id) FILTER none %] + (edit) + + + + [% END %]
+ [%# Common actions %] [% BLOCK initial_action %] - [%# Only show 'Leave as' action in combination with another knob %] [% IF !initial_action_shown %] - - -
+ + [% IF !bug.isopened %] + [% show_resolution = 1 %] + [% filtered_status = bug.bug_status FILTER js %] + [% closed_status_array.push(filtered_status) %] + [% END %] [% initial_action_shown = 1 %] [% END %] [% END %] [% BLOCK select_resolution %] - [% FOREACH r = bug.choices.resolution %] - + [% NEXT IF r == "MOVED" && bug.resolution != "MOVED" %] + [% END %] [% END %] - -[% BLOCK duplicate %] - - - -
-[% END %] diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 7e0e1cd70c..80645a8511 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -394,11 +394,7 @@ [% ELSIF error == "undefined_field" %] Form field [% field FILTER html %] was not defined. - [%# Useful message if browser did not select show_bug radio button %] - [% IF field == "knob" %] - Check that the "Leave as..." radio button was selected. - [% END %] - + [% ELSIF error == "unknown_action" %] [% IF action %] Unknown action [% action FILTER html %]! diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 5607371eb7..fef4c0c997 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -18,6 +18,7 @@ # Contributor(s): Myk Melez # Max Kanat-Alexander # Frédéric Buclin + # Guy Pyrzak #%] [% PROCESS global/variables.none.tmpl %] @@ -130,7 +131,11 @@ [% END %] - + + + + [% PROCESS status_section %] + [% IF user.in_group(Param("timetrackinggroup")) %] @@ -309,49 +314,6 @@ [% END %] [% END %] - -[% all_open_bugs = !current_bug_statuses.containsany(closedstates) %] -[% all_closed_bugs = !current_bug_statuses.containsany(openstates) %] -[% display_warning = 0 %] - - -
- -[% FOREACH bug_status = new_bug_statuses %] - - - [%# Closed bugs cannot have their resolution changed this way. %] - [% IF !bug_status.is_open && !all_closed_bugs %] - and set the resolution to [% PROCESS select_resolution id = bug_status.id %] - [%+ "(*)" UNLESS all_open_bugs %] - [% display_warning = 1 UNLESS all_open_bugs %] - [% END %] -
-[% END %] - -[%# If all the bugs being changed are open, allow the user to clear their resolution. %] -[% IF all_open_bugs %] - -
-[% END %] - -[%# If all the bugs being changed are closed, allow the user to change their resolution. %] -[% IF all_closed_bugs %] - - - [%+ PROCESS select_resolution id = "change_resolution" %]
-[% END %] - -[% IF display_warning %] -

- (*) Note that the resolution will only be applied to open [% terms.bugs %]. - Already closed [% terms.bugs %] will keep their resolution unchanged. -

-[% END %] - [% IF Param('move-enabled') && user.is_mover %] @@ -374,12 +336,50 @@ [% END %] -[% BLOCK select_resolution %] - + + + [% FOREACH bug_status = new_bug_statuses %] + + [% IF !bug_status.is_open %] + [% filtered_status = bug_status.name FILTER js %] + [% closed_status_array.push( filtered_status ) %] + [% END %] + [% END %] + + [%# If all the bugs being changed are closed, allow the user to change their resolution. %] + [% IF all_closed_bugs %] + [% filtered_status = dontchange FILTER js %] + [% closed_status_array.push( filtered_status ) %] + [% END %] + + + + + + + + [% END %]