View Issue Details

IDProjectCategoryView StatusLast Update
0003771mantisbtbugtrackerpublic2004-08-29 02:08
Reporterpermutations Assigned Tothraxisp  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionwon't fix 
Summary0003771: Status pulldown on Update pages should not always show full list
Description

Problem description and fix:

The Status pulldown menu on the Update pages uses the full status list, and this is a problem for me.

I want "Resolved" off the list because the "Resolved" option is better handled with the "Resolve Bug"

button, which brings up a page that prompts for relevant fields (easily forgotten otherwise).

I want "Closed" off the list because the threshold for "Closed" is Manager on my installation, and

the threshold for updates is "Updater".

#

To fix this, I created a new global variable, $g_status_pulldown_enum_string, for the elements in the

Status pulldown. This uses the same enum values and labels as $g_status_pulldown_enum_string (found

in config_defaults_inc.php), but omits the items I don't want to be displayed as choices.

#

Three small changes in the source code are necessary to make this work. In the files bug_update_page.php

and bug_update_advanced_page.php, the line that creates the pulldown is:

#

print_enum_string_option_list( 'status', $t_bug->status )

#

I replaced the first parameter, 'status', with 'status_pulldown'. Then in strings_english.txt, I created

a new variable called $s_status_pulldown_enum_string with the exact same values as $s_status_enum_string

(just copied the line and added 'pulldown' to the variable name.

$g_status_pulldown_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned';

TagsNo tags attached.
Attached Files
update_status_patch.diff (2,889 bytes)   
diff -Naurb epia_old/bug_update_advanced_page.php epia/bug_update_advanced_page.php
--- epia_old/bug_update_advanced_page.php	2004-06-26 16:05:42.000000000 +0200
+++ epia/bug_update_advanced_page.php	2004-07-12 11:44:56.000000000 +0200
@@ -221,7 +221,7 @@
 	</td>
 	<td bgcolor="<?php echo get_status_color( $t_bug->status ) ?>">
 		<select name="status">
-			<?php print_enum_string_option_list( 'status', $t_bug->status ) ?>
+			<?php print_enum_string_option_list( 'status', $t_bug->status, config_get( 'update_status_minimum' ), config_get( 'update_status_maximum' ) ) ?>
 		</select>
 	</td>
 
diff -Naurb epia_old/bug_update_page.php epia/bug_update_page.php
--- epia_old/bug_update_page.php	2004-06-26 16:05:42.000000000 +0200
+++ epia/bug_update_page.php	2004-07-12 11:43:32.000000000 +0200
@@ -219,7 +219,7 @@
 	</td>
 	<td bgcolor="<?php echo get_status_color( $t_bug->status ) ?>">
 		<select name="status">
-			<?php print_enum_string_option_list( 'status', $t_bug->status ) ?>
+			<?php print_enum_string_option_list( 'status', $t_bug->status, config_get( 'update_status_minimum' ), config_get( 'update_status_maximum' ) ) ?>
 		</select>
 	</td>
 
diff -Naurb epia_old/config_defaults_inc.php epia/config_defaults_inc.php
--- epia_old/config_defaults_inc.php	2004-07-12 11:19:46.000000000 +0200
+++ epia/config_defaults_inc.php	2004-07-12 11:48:35.000000000 +0200
@@ -618,6 +618,12 @@
 	# the bug is in progress, rather than just put in a person's queue.
 	$g_auto_set_status_to_assigned	= ON;
 
+	# Status threshold on update page
+	# Only status from $g_update_status_minimum to $g_update_status_maximum are shown.
+	# If threshold set to 0, it is disabled.
+	$g_update_status_minimum = FEEDBACK;
+	$g_update_status_maximum = ASSIGNED;
+
 	############################
 	# Bug Attachments Settings
 	############################
diff -Naurb epia_old/core/print_api.php epia/core/print_api.php
--- epia_old/core/print_api.php	2004-06-26 14:30:38.000000000 +0200
+++ epia/core/print_api.php	2004-07-12 11:39:48.000000000 +0200
@@ -571,7 +571,7 @@
 	# --------------------
 	# select the proper enum values based on the input parameter
 	# we use variable variables in order to achieve this
-	function print_enum_string_option_list( $p_enum_name, $p_val=0 ) {
+	function print_enum_string_option_list( $p_enum_name, $p_val=0, $p_min=0, $p_max=0 ) {
 		$g_var = 'g_'.$p_enum_name.'_enum_string';
 		global $$g_var;
 
@@ -580,9 +580,12 @@
 		for ($i=0;$i<$enum_count;$i++) {
 			$t_elem  = explode_enum_arr( $t_arr[$i] );
 			$t_elem2 = get_enum_element( $p_enum_name, $t_elem[0] );
+			if ( (($p_min == 0) || ($p_min <= $t_elem[0])) &&
+                             (($p_max == 0) || ($t_elem[0] <= $p_max))) {
 			PRINT "<option value=\"$t_elem[0]\"";
 			check_selected( $p_val, $t_elem[0] );
 			PRINT ">$t_elem2</option>";
+			}
 		} # end for
 	}
 	# --------------------
update_status_patch.diff (2,889 bytes)   
status_mask.diff (2,569 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.175
diff -u -r1.175 config_defaults_inc.php
--- config_defaults_inc.php	13 Jul 2004 12:16:10 -0000	1.175
+++ config_defaults_inc.php	14 Jul 2004 02:57:57 -0000
@@ -1013,6 +1017,9 @@
 	$g_severity_enum_string				= '10:feature,20:trivial,30:text,40:tweak,50:minor,60:major,70:crash,80:block';
 	$g_reproducibility_enum_string		= '10:always,30:sometimes,50:random,70:have not tried,90:unable to duplicate,100:N/A';
 	$g_status_enum_string				= '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed';
+	# The status pulldown is a mask that allows the items listed to show up in the menu on the 
+	#  bug update page.
+	$g_status_pulldown_enum_string = $g_status_enum_string;
 	$g_resolution_enum_string			= '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix';
 	$g_projection_enum_string			= '10:none,30:tweak,50:minor fix,70:major rework,90:redesign';
 	$g_eta_enum_string					= '10:none,20:< 1 day,30:2-3 days,40:< 1 week,50:< 1 month,60:> 1 month';
Index: core/print_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v
retrieving revision 1.91
diff -u -r1.91 print_api.php
--- core/print_api.php	13 Jul 2004 12:16:11 -0000	1.91
+++ core/print_api.php	14 Jul 2004 02:57:58 -0000
@@ -590,6 +590,7 @@
 		$t_config_var_name = $p_enum_name . '_enum_string';
 		$t_config_var_value = config_get( $t_config_var_name );
 		$t_enum_workflow = config_get( $p_enum_name . '_enum_workflow' );
+		$t_mask_arr = explode_enum_string( config_get( 'status_pulldown_enum_string' ) );
 
 		if ( count( $t_enum_workflow ) < 1 ) {
 			# workflow not defined, use default enum
@@ -602,11 +603,13 @@
 		$t_enum_count = count( $t_arr );
 
 		for ( $i = 0; $i < $t_enum_count; $i++ ) {
-			$t_elem  = explode_enum_arr( $t_arr[$i] );
-			$t_elem2 = get_enum_element( $p_enum_name, $t_elem[0] );
-			echo "<option value=\"$t_elem[0]\"";
-			check_selected( $t_elem[0], $p_val );
-			echo ">$t_elem2</option>";
+			if ( in_array($t_arr[$i], $t_mask_arr) ) {
+				$t_elem  = explode_enum_arr( $t_arr[$i] );
+				$t_elem2 = get_enum_element( $p_enum_name, $t_elem[0] );
+				echo "<option value=\"$t_elem[0]\"";
+				check_selected( $t_elem[0], $p_val );
+				echo ">$t_elem2</option>";
+			}
 		} # end for
 	}
 	# --------------------
status_mask.diff (2,569 bytes)   
status_mask.tar.gz (22,369 bytes)

Relationships

related to 0003772 closedthraxisp Status updating should be different from bug updating 
related to 0004131 closedthraxisp Closing bugs when you're not allowed to. 

Activities

permutations

permutations

2004-04-24 12:45

reporter   ~0005432

If it's not clear, the above global variable was added to config_inc.php.

grangeway

grangeway

2004-06-30 13:09

reporter   ~0005846

With new custom fields stuff, probably even more of a reason to look at this.

thraxisp

thraxisp

2004-07-05 18:48

reporter   ~0005884

Last edited: 2004-07-05 18:52

Is this resolved by the solution to bug 0003984?

edited on: 07-05-04 18:48

edited on: 07-05-04 18:52

RJelinek

RJelinek

2004-07-12 04:52

reporter   ~0006005

I have added my solution, as I use it in 0.19.0a1.

Now you have two new config-variables called

$g_update_status_minimum
$g_update_status_maximum

With them you can define, which status are shown in update-pages.

My configuration is
$g_update_status_minimum = FEEDBACK;
$g_update_status_maximum = ASSIGNED;

vboctor

vboctor

2004-07-13 09:30

manager   ~0006017

thraxisp, 0003984 does not fix this issue. However, we should extend the solution for 0003984 to cover this one as well.

I like the $g_status_pulldown_enum_string option since it allows selecting an subset of the enum, not just a range. Also using this option will require less code changes compared to range.

RJelinek

RJelinek

2004-07-13 10:10

reporter   ~0006021

I also think, that a enum is better than a range, but there is a problem with it. I think I will give an example...

Your enum is "feedback,acknowledged,assigned".
You have left out "confirmed".
So how can you set an entry to "confirmed"? The update page will not show this (as not defined in the enum-string) and another way does not exist (ok - you can manipulate it directly in the database ... ;) ).

thraxisp

thraxisp

2004-07-13 10:20

reporter   ~0006023

thraxisp, 0003984 does not fix this issue. However, we should extend the solution for 0003984 to cover this one as well.


What would you like to extend? The implementation currently has a list of allowable new states (enum) depending on the current state. How would you like to extend this?

vboctor

vboctor

2004-07-13 17:14

manager   ~0006028

I think what needs to be extended is to be able to make a "valid" next state not appear in the pull down combo of the update page, however, it is possible to move to such state via buttons on the view page, like Resolve and Close.

thraxisp

thraxisp

2004-07-13 21:59

reporter   ~0006031

I understand now. The patch is attached.

The string $g_status_pulldown_enum_string is used as a mask. Only items in this list will show up in the pulldown. It defaults to all of the possible status values.

thraxisp

thraxisp

2004-08-04 08:11

reporter   ~0006622

This was replaced by a fix to enforce permissions and a single button to change status. See 0003772.