Skip to content

Commit

Permalink
fix for 0004497: Add filter for priority (DGtlRift)
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@3088 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
thraxisp committed Oct 28, 2004
1 parent eb09d04 commit 4e53d84
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 10 deletions.
68 changes: 62 additions & 6 deletions core/filter_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: filter_api.php,v 1.61 2004-10-25 19:55:29 marcelloscata Exp $
# $Id: filter_api.php,v 1.62 2004-10-28 00:31:04 thraxisp Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -293,6 +293,27 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
}

# priority
$t_any_found = false;
foreach( $t_filter['show_priority'] as $t_filter_member ) {
if ( 'any' == $t_filter_member ) {
$t_any_found = true;
}
}
if ( count( $t_filter['show_priority'] ) == 0 ) {
$t_any_found = true;
}
if ( !$t_any_found ) {
$t_clauses = array();

foreach( $t_filter['show_priority'] as $t_filter_member ) {
$c_show_priority = db_prepare_int( $t_filter_member );
array_push( $t_clauses, "($t_bug_table.priority='$c_show_priority')" );
}
array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
}


# product build
$t_any_found = false;
foreach( $t_filter['show_build'] as $t_filter_member ) {
Expand Down Expand Up @@ -696,13 +717,14 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
$t_tdclass = 'small-caption';
$t_trclass = 'row-category2';
$t_action = 'view_all_set.php?f=3';

if ( $p_for_screen == false ) {
$t_tdclass = 'print';
$t_trclass = '';
$t_action = 'view_all_set.php';
}
?>
?>

<br />
<form method="post" name="filters" action="<?php PRINT $t_action; ?>">
<input type="hidden" name="type" value="5" />
Expand All @@ -717,7 +739,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<input type="hidden" name="page_number" value="<?php PRINT $p_page_number ?>" />
<input type="hidden" name="view_type" value="<?php PRINT $t_view_type ?>" />
<table class="width100" cellspacing="1">

<?php
if ( $p_expanded ) {
$t_filter_cols = 7;
Expand Down Expand Up @@ -1009,9 +1031,12 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<td colspan="2" class="small-caption" valign="top">
<a href="<?php PRINT $t_filters_url . 'show_version[]'; ?>"><?php PRINT lang_get( 'product_version' ) ?>:</a>
</td>
<td colspan="2" class="small-caption" valign="top">
<td colspan="1" class="small-caption" valign="top">
<a href="<?php PRINT $t_filters_url . 'fixed_in_version[]'; ?>"><?php PRINT lang_get( 'fixed_in_version' ) ?>:</a>
</td>
<td colspan="1" class="small-caption" valign="top">
<a href="<?php PRINT $t_filters_url . 'show_priority[]'; ?>"><?php PRINT lang_get( 'priority' ) ?>:</a>
</td>
</tr>

<tr class="row-1">
Expand Down Expand Up @@ -1139,7 +1164,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
}
?>
</td>
<td colspan="2" class="small-caption" valign="top">
<td colspan="1" class="small-caption" valign="top">
<?php
$t_output = '';
$t_any_found = false;
Expand Down Expand Up @@ -1169,6 +1194,36 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
}
?>
</td>
<td colspan="1" class="small-caption" valign="top">
<?php
$t_output = '';
$t_any_found = false;
if ( count( $t_filter['show_priority'] ) == 0 ) {
PRINT lang_get( 'any' );
} else {
$t_first_flag = true;
foreach( $t_filter['show_priority'] as $t_current ) {
$t_this_string = '';
if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
$t_any_found = true;
} else {
$t_this_string = get_enum_element( 'priority', $t_current );
}
if ( $t_first_flag != true ) {
$t_output = $t_output . '<br>';
} else {
$t_first_flag = false;
}
$t_output = $t_output . $t_this_string;
}
if ( true == $t_any_found ) {
PRINT lang_get( 'any' );
} else {
PRINT $t_output;
}
}
?>
</td>
</tr>

<tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>>
Expand Down Expand Up @@ -1751,6 +1806,7 @@ function filter_ensure_valid_filter( $p_filter_arr ) {
'reporter_id' => 'int',
'handler_id' => 'string',
'show_resolution' => 'int',
'show_priority' => 'int',
'show_build' => 'string',
'show_version' => 'string',
'hide_status' => 'int',
Expand Down
15 changes: 13 additions & 2 deletions view_all_set.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: view_all_set.php,v 1.37 2004-08-06 15:38:38 jlatour Exp $
# $Id: view_all_set.php,v 1.38 2004-10-28 00:31:05 thraxisp Exp $
# --------------------------------------------------------
?>
<?php require_once( 'core.php' ) ?>
Expand Down Expand Up @@ -99,6 +99,15 @@
$f_fixed_in_version = array( $f_fixed_in_version );
}

$f_show_priority = array();
if ( is_array( gpc_get( 'show_priority', null ) ) ) {
$f_show_priority = gpc_get_string_array( 'show_priority', 'any' );
} else {
$f_show_priority = gpc_get_string( 'show_priority', 'any' );
$f_show_priority = array( $f_show_priority );
}


$f_user_monitor = array();
if ( is_array( gpc_get( 'user_monitor', null ) ) ) {
$f_user_monitor = gpc_get_string_array( 'user_monitor', 'any' );
Expand Down Expand Up @@ -257,6 +266,7 @@
$t_setting_arr['show_version'] = $f_show_version;
$t_setting_arr['do_filter_by_date'] = $f_do_filter_by_date;
$t_setting_arr['fixed_in_version'] = $f_fixed_in_version;
$t_setting_arr['show_priority'] = $f_show_priority;
$t_setting_arr['user_monitor'] = $f_user_monitor;
$t_setting_arr['view_state'] = $f_view_state;
$t_setting_arr['custom_fields'] = $f_custom_fields_data;
Expand Down Expand Up @@ -289,6 +299,7 @@
$t_setting_arr['handler_id'] = array( "any" );
$t_setting_arr['show_build'] = array( "any" );
$t_setting_arr['show_version'] = array( "any" );
$t_setting_arr['show_priority'] = array( "any" );
$t_setting_arr['fixed_in_version'] = array( "any" );
$t_setting_arr['user_monitor'] = array( "any" );

Expand Down Expand Up @@ -344,4 +355,4 @@
} else {
print_header_redirect( $t_redirect_url );
}
?>
?>
13 changes: 11 additions & 2 deletions view_filters_page.php
Expand Up @@ -263,7 +263,8 @@ function SwitchDateFields() {
</td>
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'product_build' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'product_version' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'fixed_in_version' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'fixed_in_version' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'priority' ) ?></td>
</tr>
<tr class="row-1">
<!-- Status -->
Expand Down Expand Up @@ -307,13 +308,21 @@ function SwitchDateFields() {
</select>
</td>
<!-- Fixed in Version -->
<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
<select <?php PRINT $t_select_modifier;?> name="fixed_in_version[]">
<option value="any" <?php check_selected( $t_filter['fixed_in_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
<option value="any"></option>
<?php print_version_option_list( $t_filter['fixed_in_version'], null, VERSION_ALL ) ?>
</select>
</td>
<!-- Priority -->
<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
<select <?php PRINT $t_select_modifier;?> name="show_priority[]">
<option value="any" <?php check_selected( $t_filter['show_priority'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
<option value="any"></option>
<?php print_enum_string_option_list( 'priority', $t_filter['show_priority'] ) ?>
</select>
</td>
</tr>

<tr class="row-category2">
Expand Down

0 comments on commit 4e53d84

Please sign in to comment.