View Issue Details

IDProjectCategoryView StatusLast Update
0004853mantisbtfilterspublic2005-04-18 10:27
Reporterdmandell Assigned Tothraxisp  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version1.0.0a1 
Summary0004853: Add the ability to filter by relationship
Description

I think it would be useful to add a relationship filter on the view issues page. The filter would allow you to only display those issues that were a parent of, children of, duplicates of, or related in any way to an issue id#.

I like the idea of creating a parent ID for a version (the way you guys do it now... as in http://www.mantisbt.org/mantis/view.php?id=4818), the problem is that the user can only view this list if they take a look at the issue you've created, and then you can't filter out closed/resolved bugs. Adding this filter would make relationships used in this fashion more useful.

TagsNo tags attached.
Attached Files
mantisbt-filter-relationsship.patch (87,485 bytes)   
Index: view_all_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_set.php,v
retrieving revision 1.42
diff -u -r1.42 view_all_set.php
--- view_all_set.php	12 Jan 2005 23:23:12 -0000	1.42
+++ view_all_set.php	13 Jan 2005 15:34:11 -0000
@@ -6,7 +6,7 @@
 	# See the README and LICENSE files for details
 
 	# --------------------------------------------------------
-	# $Id: view_all_set.php,v 1.42 2005/01/12 23:23:12 thraxisp Exp $
+	# $Id: view_all_set.php,v 1.38 2004/10/28 00:31:05 thraxisp Exp $
 	# --------------------------------------------------------
 ?>
 <?php require_once( 'core.php' ) ?>
@@ -21,25 +21,25 @@
 	# these are all possibly multiple selections for advanced filtering
 	$f_show_category = array();
 	if ( is_array( gpc_get( 'show_category', null ) ) ) {
-		$f_show_category = gpc_get_string_array( 'show_category', '[any]' );
+		$f_show_category = gpc_get_string_array( 'show_category', 'any' );
 	} else {
-		$f_show_category = gpc_get_string( 'show_category', '[any]' );
+		$f_show_category = gpc_get_string( 'show_category', 'any' );
 		$f_show_category = array( $f_show_category );
 	}
 
 	$f_show_severity = array();
 	if ( is_array( gpc_get( 'show_severity', null ) ) ) {
-		$f_show_severity = gpc_get_string_array( 'show_severity', '[any]' );
+		$f_show_severity = gpc_get_string_array( 'show_severity', 'any' );
 	} else {
-		$f_show_severity = gpc_get_string( 'show_severity', '[any]' );
+		$f_show_severity = gpc_get_string( 'show_severity', 'any' );
 		$f_show_severity = array( $f_show_severity );
 	}
 
 	$f_show_status = array();
 	if ( is_array( gpc_get( 'show_status', null ) ) ) {
-		$f_show_status = gpc_get_string_array( 'show_status', '[any]' );
+		$f_show_status = gpc_get_string_array( 'show_status', 'any' );
 	} else {
-		$f_show_status = gpc_get_string( 'show_status', '[any]' );
+		$f_show_status = gpc_get_string( 'show_status', 'any' );
 		$f_show_status = array( $f_show_status );
 	}
 
@@ -53,72 +53,72 @@
 
 	$f_reporter_id = array();
 	if ( is_array( gpc_get( 'reporter_id', null ) ) ) {
-		$f_reporter_id = gpc_get_string_array( 'reporter_id', '[any]' );
+		$f_reporter_id = gpc_get_string_array( 'reporter_id', 'any' );
 	} else {
-		$f_reporter_id = gpc_get_string( 'reporter_id', '[any]' );
+		$f_reporter_id = gpc_get_string( 'reporter_id', 'any' );
 		$f_reporter_id = array( $f_reporter_id );
 	}
 
 	$f_handler_id = array();
 	if ( is_array( gpc_get( 'handler_id', null ) ) ) {
-		$f_handler_id = gpc_get_string_array( 'handler_id', '[any]' );
+		$f_handler_id = gpc_get_string_array( 'handler_id', 'any' );
 	} else {
-		$f_handler_id = gpc_get_string( 'handler_id', '[any]' );
+		$f_handler_id = gpc_get_string( 'handler_id', 'any' );
 		$f_handler_id = array( $f_handler_id );
 	}
 
 	$f_show_resolution = array();
 	if ( is_array( gpc_get( 'show_resolution', null ) ) ) {
-		$f_show_resolution = gpc_get_string_array( 'show_resolution', '[any]' );
+		$f_show_resolution = gpc_get_string_array( 'show_resolution', 'any' );
 	} else {
-		$f_show_resolution = gpc_get_string( 'show_resolution', '[any]' );
+		$f_show_resolution = gpc_get_string( 'show_resolution', 'any' );
 		$f_show_resolution = array( $f_show_resolution );
 	}
 
 	$f_show_build = array();
 	if ( is_array( gpc_get( 'show_build', null ) ) ) {
-		$f_show_build = gpc_get_string_array( 'show_build', '[any]' );
+		$f_show_build = gpc_get_string_array( 'show_build', 'any' );
 	} else {
-		$f_show_build = gpc_get_string( 'show_build', '[any]' );
+		$f_show_build = gpc_get_string( 'show_build', 'any' );
 		$f_show_build = array( $f_show_build );
 	}
 
 	$f_show_version = array();
 	if ( is_array( gpc_get( 'show_version', null ) ) ) {
-		$f_show_version = gpc_get_string_array( 'show_version', '[any]' );
+		$f_show_version = gpc_get_string_array( 'show_version', 'any' );
 	} else {
-		$f_show_version = gpc_get_string( 'show_version', '[any]' );
+		$f_show_version = gpc_get_string( 'show_version', 'any' );
 		$f_show_version = array( $f_show_version );
 	}
 
 	$f_fixed_in_version = array();
 	if ( is_array( gpc_get( 'fixed_in_version', null ) ) ) {
-		$f_fixed_in_version = gpc_get_string_array( 'fixed_in_version', '[any]' );
+		$f_fixed_in_version = gpc_get_string_array( 'fixed_in_version', 'any' );
 	} else {
-		$f_fixed_in_version = gpc_get_string( 'fixed_in_version', '[any]' );
+		$f_fixed_in_version = gpc_get_string( 'fixed_in_version', 'any' );
 		$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 );
-	}
+        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]' );
+		$f_user_monitor = gpc_get_string_array( 'user_monitor', 'any' );
 	} else {
-		$f_user_monitor = gpc_get_string( 'user_monitor', '[any]' );
+		$f_user_monitor = gpc_get_string( 'user_monitor', 'any' );
 		$f_user_monitor = array( $f_user_monitor );
 	}
 
 	# these are only single values, even when doing advanced filtering
 	$f_per_page				= gpc_get_int( 'per_page', -1 );
 	$f_highlight_changed	= gpc_get_string( 'highlight_changed', config_get( 'default_show_changed' ) );
-	$f_sticky_issues		= gpc_get_bool( 'sticky_issues' );
 	# sort direction
 	$f_sort					= gpc_get_string( 'sort', 'last_updated' );
 	$f_dir					= gpc_get_string( 'dir', 'DESC' );
@@ -132,20 +132,23 @@
 	$f_search				= gpc_get_string( 'search', '' );
 	$f_and_not_assigned		= gpc_get_bool( 'and_not_assigned' );
 	$f_do_filter_by_date	= gpc_get_bool( 'do_filter_by_date' );
-	$f_view_state			= gpc_get_string( 'view_state', '[any]' );
+	$f_view_state			= gpc_get_string( 'view_state', 'any' );
 
 	$t_custom_fields 		= custom_field_get_ids();
 	$f_custom_fields_data 	= array();
 	if ( is_array( $t_custom_fields ) && ( sizeof( $t_custom_fields ) > 0 ) ) {
 		foreach( $t_custom_fields as $t_cfid ) {
 			if ( is_array( gpc_get( 'custom_field_' . $t_cfid, null ) ) ) {
-				$f_custom_fields_data[$t_cfid] = gpc_get_string_array( 'custom_field_' . $t_cfid, '[any]' );
+				$f_custom_fields_data[$t_cfid] = gpc_get_string_array( 'custom_field_' . $t_cfid, 'any' );
 			} else {
-				$f_custom_fields_data[$t_cfid] = gpc_get_string( 'custom_field_' . $t_cfid, '[any]' );
+				$f_custom_fields_data[$t_cfid] = gpc_get_string( 'custom_field_' . $t_cfid, 'any' );
 				$f_custom_fields_data[$t_cfid] = array( $f_custom_fields_data[$t_cfid] );
 			}
 		}
 	}
+	
+	$f_relationship_type = gpc_get_string( 'relationship_type', 'any' );
+	$f_relationship_bug = gpc_get_string( 'relationship_bug', 0 );
 
 	if ( $f_temp_filter ) {
 		$f_type = 1;
@@ -158,10 +161,6 @@
 	if ( $f_do_filter_by_date ) {
 		$f_do_filter_by_date = 'on';
 	}
-	
-	if ( $f_sticky_issues ) {
-		$f_sticky_issues = 'on';
-	}
 
 	if ( $f_type < 0 ) {
 		print_header_redirect( 'view_all_bug_page.php' );
@@ -206,18 +205,23 @@
 	22: $f_show_version
 	23: $f_do_filter_by_date
 	24: $f_custom_field
+	25: $f_relationship_type
+	26: $f_relationship_bug
+	
 */
 	# Set new filter values.  These are stored in a cookie
 	$t_view_all_cookie_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
 	$t_view_all_cookie = filter_db_get_filter( $t_view_all_cookie_id );
 	$t_old_setting_arr	= explode( '#', $t_view_all_cookie, 2 );
-
+	
 	$t_setting_arr = array();
 	
 	# If we're not going to reset the cookie, make sure it's valid
 	if ( $f_type != 0 ) {
-		$t_cookie_vers = (int) substr( $t_old_setting_arr[0], 1 );
-		if ( substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) { # if the version is old, update it
+		if ( ( $t_old_setting_arr[0] == 'v1' ) ||
+			 ( $t_old_setting_arr[0] == 'v2' ) || 
+			 ( $t_old_setting_arr[0] == 'v3' ) || 
+			 ( $t_old_setting_arr[0] == 'v4' ) ) {
 			gpc_clear_cookie( 'view_all_cookie' );
 			print_header_redirect( 'view_all_set.php?type=0' );
 		}
@@ -272,7 +276,8 @@
 				$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;
-				$t_setting_arr['sticky_issues'] = $f_sticky_issues;
+				$t_setting_arr['relationship_type'] = $f_relationship_type;
+				$t_setting_arr['relationship_bug'] = $f_relationship_bug;
 
 				break;
 		# Set the sort order and direction
@@ -297,20 +302,23 @@
 			}
 		# Generalise the filter
 		case '4':
-				$t_setting_arr['show_category']	= array( '[any]' );
-				$t_setting_arr['reporter_id'] 	= array( '[any]' );
-				$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]' );
+				$t_setting_arr['show_category']	= array( "any" );
+				$t_setting_arr['reporter_id'] 	= array( "any" );
+				$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" );
+				$t_setting_arr['relationship_type'] = "any";
+				$t_setting_arr['relationship_bug'] = 0;
+				
 
 				$t_custom_fields 		= custom_field_get_ids();
 				$t_custom_fields_data 	= array();
 				if ( is_array( $t_custom_fields ) && ( sizeof( $t_custom_fields ) > 0 ) ) {
 					foreach( $t_custom_fields as $t_cfid ) {
-						$t_custom_fields_data[$t_cfid] =  array( '[any]' );
+						$t_custom_fields_data[$t_cfid] =  array( "any" );
 					}
 				}
 				$t_setting_arr['custom_fields'] = $t_custom_fields_data;
@@ -326,9 +334,9 @@
 				break;
 	}
 
-	$tc_setting_arr = filter_ensure_valid_filter( $t_setting_arr );
+	$t_setting_arr = filter_ensure_valid_filter( $t_setting_arr );
 
-	$t_settings_serialized = serialize( $tc_setting_arr );
+	$t_settings_serialized = serialize( $t_setting_arr );
 	$t_settings_string = $t_cookie_version . '#' . $t_settings_serialized;
 
 	# If only using a temporary filter, don't store it in the database
@@ -350,8 +358,10 @@
 	}
 
 	if ( $f_temp_filter ) {
-		$t_token_id = token_add( $t_settings_serialized, TOKEN_FILTER);
-		$t_redirect_url = $t_redirect_url . '?filter=' . $t_token_id;
+		$t_redirect_url = $t_redirect_url . '?filter=' . $t_settings_serialized;
+		# @@@ jlatour: Why this translation, instead of using urlencode?
+		$t_trans = array( '"' => '%22', ';' => '%3B', '%' => '%25', ' ' => '%20' );
+		$t_redirect_url = strtr( $t_redirect_url, $t_trans );
 		html_meta_redirect( $t_redirect_url, 0 );
 	} else {
 		print_header_redirect( $t_redirect_url );
Index: view_filters_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_filters_page.php,v
retrieving revision 1.26
diff -u -r1.26 view_filters_page.php
--- view_filters_page.php	23 Dec 2004 16:40:54 -0000	1.26
+++ view_filters_page.php	13 Jan 2005 15:03:15 -0000
@@ -11,6 +11,7 @@
 	
 	require_once( $t_core_path.'compress_api.php' );
 	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'relationship_api.php' );
 	require_once( $t_core_path.'current_user_api.php' );
 	require_once( $t_core_path.'bug_api.php' );
 	require_once( $t_core_path.'string_api.php' );
@@ -172,27 +173,81 @@
 <tr class="row-1">
 	<!-- Reporter -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_reporter_id(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="reporter_id[]">
+			<option value="any" <?php check_selected( $t_filter['reporter_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php
+				if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { 
+					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
+					check_selected( $t_filter['reporter_id'], META_FILTER_MYSELF );
+					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
+				} 
+			?>
+			<?php print_reporter_option_list( $t_filter['reporter_id'] ) ?>
+		</select>
 	</td>
 	<!-- Monitored by -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_user_monitor(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="user_monitor[]">
+			<option value="any" <?php check_selected( $t_filter['user_monitor'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php
+				if ( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) {
+					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
+					check_selected( $t_filter['user_monitor'], META_FILTER_MYSELF );
+					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
+				}
+			?>
+			<?php print_reporter_option_list( $t_filter['user_monitor'] ) ?>
+		</select>
 	</td>
 	<!-- Handler -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_handler_id(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="handler_id[]">
+			<option value="any" <?php check_selected( $t_filter['handler_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="none" <?php check_selected( $t_filter['handler_id'], 'none' ); ?>><?php echo lang_get( 'none' ) ?></option>
+			<option value="any"></option>
+			<?php
+				if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { 
+					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
+					check_selected( $t_filter['handler_id'], META_FILTER_MYSELF );
+					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
+				} 
+			?>
+			<?php print_assign_to_option_list( $t_filter['handler_id'] ) ?>
+		</select>
+		<?php
+			if ( 'simple' == $f_view_type ) {
+			?>
+        		<br /><input type="checkbox" name="and_not_assigned" <?php check_checked( $t_filter['and_not_assigned'], 'on' ); ?> /> <?php echo lang_get( 'or_unassigned' ) ?>
+        	<?php
+        	}
+        ?>
 	</td>
 	<!-- Category -->
 	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
-		<?php print_filter_show_category(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="show_category[]">
+			<option value="any" <?php check_selected( $t_filter['show_category'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php # This shows orphaned categories as well as selectable categories ?>
+			<?php print_category_complete_option_list( $t_filter['show_category'] ) ?>
+		</select>
 	</td>
     <!-- Severity -->
     <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_show_severity(); ?>
+        <select <?php PRINT $t_select_modifier;?> name="show_severity[]">
+			<option value="any" <?php check_selected( $t_filter['show_severity'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+            <option value="any"></option>
+            <?php print_enum_string_option_list( 'severity', $t_filter['show_severity'] ) ?>
+        </select>
     </td>
 	<!-- Resolution -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_show_resolution(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="show_resolution[]">
+			<option value="any" <?php check_selected( $t_filter['show_resolution'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php print_enum_string_option_list( 'resolution', $t_filter['show_resolution'] ) ?>
+		</select>
 	</td>
 </tr>
 
@@ -215,13 +270,23 @@
 <tr class="row-1">
 	<!-- Status -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_show_status(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="show_status[]">
+			<option value="any" <?php check_selected( $t_filter['show_status'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php print_enum_string_option_list( 'status', $t_filter['show_status'] ) ?>
+		</select>
 	</td>
 	<!-- Hide Status -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 	<?php
 	if ( 'simple' == $f_view_type ) {
-		print_filter_hide_status();
+	?>
+		<select <?php PRINT $t_select_modifier;?> name="hide_status[]">
+			<option value="none"><?php echo lang_get( 'none' ) ?></option>
+			<option value="none"></option>
+			<?php print_enum_string_option_list( 'status', $t_filter['hide_status'] ) ?>
+		</select>
+	<?php
 	} else {
 		echo '&nbsp;';
 	}
@@ -229,55 +294,148 @@
 	</td>
 	<!-- Build -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
- 		<?php print_filter_show_build(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="show_build[]">
+			<option value="any" <?php check_selected( $t_filter['show_build'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php print_build_option_list( $t_filter['show_build'] ) ?>
+		</select>
 	</td>
 	<!-- Version -->
 	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
- 		<?php print_filter_show_version(); ?>
+		<select <?php PRINT $t_select_modifier;?> name="show_version[]">
+			<option value="any" <?php check_selected( $t_filter['show_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option>
+			<option value="any"></option>
+			<?php print_version_option_list( $t_filter['show_version'], null, VERSION_RELEASED ) ?>
+		</select>
 	</td>
 	<!-- Fixed in Version -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
- 		<?php print_filter_show_fixed_in_version(); ?>
- 	</td>
+		<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 ); ?>">
- 		<?php print_filter_show_priority(); ?>
-   </td>
+        <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">
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'show' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'view_status' ) ?></td>
-	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'sticky' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
-	<td class="small-caption" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<input type="checkbox" name="do_filter_by_date" <?php 
 			check_checked( $t_filter['do_filter_by_date'], 'on' ); 
 			if ( ON == config_get( 'use_javascript' ) ) { 
 				print "onclick=\"SwitchDateFields();\""; } ?> />
 		<?php echo lang_get( 'use_date_filters' ) ?>
 	</td>
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'bug_relationships' ) ?></td>
 </tr>
 <tr class="row-2">
 	<!-- Number of bugs per page -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_per_page(); ?>
+		<input type="text" name="per_page" size="3" maxlength="7" value="<?php echo $t_filter['per_page'] ?>" />
 	</td>
 	<!-- View Status -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_view_state(); ?>
-	</td>
-	<!-- Show Sticky bugs -->
-	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_sticky_issues(); ?>
+		<select name="view_state">
+			<?php
+			PRINT '<option value="any" ';
+			check_selected( $t_filter['view_state'], 'any' );
+			PRINT '>' . lang_get( 'any' ) . '</option>';
+			PRINT '<option value="any"></option>';
+			PRINT '<option value="' . VS_PUBLIC . '" ';
+			check_selected( $t_filter['view_state'], VS_PUBLIC );
+			PRINT '>' . lang_get( 'public' ) . '</option>';
+			PRINT '<option value="' . VS_PRIVATE . '" ';
+			check_selected( $t_filter['view_state'], VS_PRIVATE );
+			PRINT '>' . lang_get( 'private' ) . '</option>';
+			?>
+		</select>
 	</td>
 	<!-- Highlight changed bugs -->
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
-		<?php print_filter_highlight_changed(); ?>
+		<input type="text" name="highlight_changed" size="3" maxlength="7" value="<?php echo $t_filter['highlight_changed'] ?>" />
 	</td>
-	<td valign="top" class="left" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
-		<?php print_filter_do_filter_by_date( true ); # hide checkbox as it's already been shown ?>
+	<td valign="top" class="left" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
+	<table cellspacing="0" cellpadding="0">
+	<!-- Start date -->
+	<tr>
+		<td>
+		<?php echo lang_get( 'start_date' ) ?>:
+		</td>
+		<td>
+		<?php
+		$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
+		foreach( $t_chars as $t_char ) {
+			if ( strcasecmp( $t_char, "M" ) == 0 ) {
+				print "<select name=\"start_month\">";
+				print_month_option_list( $t_filter['start_month'] );
+				print "</select>\n";
+			}
+			if ( strcasecmp( $t_char, "D" ) == 0 ) {
+				print "<select name=\"start_day\">";
+				print_day_option_list( $t_filter['start_day'] );
+				print "</select>\n";
+			}
+			if ( strcasecmp( $t_char, "Y" ) == 0 ) {
+				print "<select name=\"start_year\">";
+				print_year_option_list( $t_filter['start_year'] );
+				print "</select>\n";
+			}
+		}
+		?>
+		</td>
+	</tr>
+	<!-- End date -->
+	<tr>
+		<td>
+		<?php echo lang_get( 'end_date' ) ?>:
+		</td>
+		<td>
+		<?php
+		$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
+		foreach( $t_chars as $t_char ) {
+			if ( strcasecmp( $t_char, "M" ) == 0 ) {
+				print "<select name=\"end_month\">";
+				print_month_option_list( $t_filter['end_month'] );
+				print "</select>\n";
+			}
+			if ( strcasecmp( $t_char, "D" ) == 0 ) {
+				print "<select name=\"end_day\">";
+				print_day_option_list( $t_filter['end_day'] );
+				print "</select>\n";
+			}
+			if ( strcasecmp( $t_char, "Y" ) == 0 ) {
+				print "<select name=\"end_year\">";
+				print_year_option_list( $t_filter['end_year'] );
+				print "</select>\n";
+			}
+		}
+		?>
+		</td>
+	</tr>
+	</table>
 	</td>
+	<!-- Relationship -->
+	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
+        <?php 
+            $c_reltype_value = $t_filter['relationship_type'];
+            if (!$c_reltype_value) {
+                $c_reltype_value = "any";
+            }
+            relationship_list_box ($c_reltype_value, "relationship_type", true) ?>
+        <input type="text" name="relationship_bug" size="5" maxlength="10" value="<?php echo $t_filter['relationship_bug'] ?>" />        
+	</td>
+	
 </tr>
 
 <?php
@@ -309,8 +467,22 @@
 			<?php
 			for ( $j = 0; $j < $t_per_row; $j++ ) {
 				echo '<td colspan="' . ( 1 * $t_filter_cols ) . '">';
-				if ( isset( $t_accessible_custom_fields_ids[$t_base + $j] ) ) {
-					print_filter_custom_field($t_accessible_custom_fields_ids[$t_base + $j]);
+				if ( isset( $t_accessible_custom_fields_names[$t_base + $j] ) ) {
+					echo '<select ' . $t_select_modifier . ' name="custom_field_' . $t_accessible_custom_fields_ids[$t_base + $j] .'[]">';
+					echo '<option value="any" ';
+					check_selected( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ], 'any' );
+					echo '>' . lang_get( 'any' ) .'</option>';
+					echo '<option value=""></option>';
+					foreach( $t_accessible_custom_fields_values[$t_base + $j] as $t_item ) {
+						if ( ( strtolower( $t_item ) != "any" ) && ( trim( $t_item ) != "" ) ) {
+							echo '<option value="' .  htmlentities( $t_item )  . '" ';
+							if ( isset( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ] ) ) {
+								check_selected( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ], $t_item );
+							}
+							echo '>' . $t_item  . '</option>' . "\n";
+						}
+					}
+					echo '</select>';
 				} else {
 					echo '&nbsp;';
 				}
Index: core/filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.71
diff -u -r1.71 filter_api.php
--- core/filter_api.php	12 Jan 2005 23:23:12 -0000	1.71
+++ core/filter_api.php	13 Jan 2005 15:16:42 -0000
@@ -6,7 +6,7 @@
 	# See the README and LICENSE files for details
 
 	# --------------------------------------------------------
-	# $Id: filter_api.php,v 1.71 2005/01/12 23:23:12 thraxisp Exp $
+	# $Id: filter_api.php,v 1.64 2004/11/19 13:06:29 vboctor Exp $
 	# --------------------------------------------------------
 
 	$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
@@ -15,6 +15,7 @@
 	require_once( $t_core_dir . 'user_api.php' );
 	require_once( $t_core_dir . 'bug_api.php' );
 	require_once( $t_core_dir . 'collapse_api.php' );
+	require_once( $t_core_dir . 'relationship_api.php' );
 
 	###########################################################################
 	# Filter API
@@ -44,17 +45,16 @@
 	#   - project id to use in filtering.
 	# $p_user_id
 	#   - user id to use as current user when filtering.
-	# $p_show_sticky
-	#	- get sticky issues only.
-	function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $custom_filter = null, $p_project_id = null, $p_user_id = null, $p_show_sticky = null ) {
-		$t_bug_table			= config_get( 'mantis_bug_table' );
-		$t_bug_text_table		= config_get( 'mantis_bug_text_table' );
-		$t_bugnote_table		= config_get( 'mantis_bugnote_table' );
-		$t_custom_field_string_table	= config_get( 'mantis_custom_field_string_table' );
-		$t_bugnote_text_table	= config_get( 'mantis_bugnote_text_table' );
-		$t_project_table		= config_get( 'mantis_project_table' );
-		$t_bug_monitor_table	= config_get( 'mantis_bug_monitor_table' );
-		$t_limit_reporters		= config_get( 'limit_reporters' );
+	function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $custom_filter = null, $p_project_id = null, $p_user_id = null ) {
+	    $t_bug_table			    = config_get( 'mantis_bug_table' );
+		$t_bug_text_table		    = config_get( 'mantis_bug_text_table' );
+		$t_bugnote_table		    = config_get( 'mantis_bugnote_table' );
+		$t_custom_field_string_table= config_get( 'mantis_custom_field_string_table' );
+		$t_bugnote_text_table	    = config_get( 'mantis_bugnote_text_table' );
+		$t_project_table		    = config_get( 'mantis_project_table' );
+		$t_bug_monitor_table	    = config_get( 'mantis_bug_monitor_table' );
+		$t_bug_relationship_table	= config_get( 'mantis_bug_relationship_table' );
+		$t_limit_reporters		    = config_get( 'limit_reporters' );
 		$t_report_bug_threshold		= config_get( 'report_bug_threshold' );
 
 		$t_current_user_id = auth_get_current_user_id();
@@ -126,7 +126,7 @@
 			array_push( $t_where_clauses, "($t_bug_table.view_state='$t_public' OR $t_bug_table.reporter_id='$t_user_id')" );
 		} else {
 			$t_view_state = db_prepare_int( $t_filter['view_state'] );
-			if ( ( $t_view_state != '[any]' ) && ( !is_blank( $t_view_state ) ) ) {
+			if ( ( $t_view_state != 'any' ) && ( !is_blank( $t_view_state ) ) ) {
 				array_push( $t_where_clauses, "($t_bug_table.view_state='$t_view_state')" );
 			}
 		}
@@ -135,7 +135,7 @@
 		$t_any_found = false;
 
 		foreach( $t_filter['reporter_id'] as $t_filter_member ) {
-			if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -146,18 +146,14 @@
 			$t_clauses = array();
 
 			foreach( $t_filter['reporter_id'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
-					array_push( $t_clauses, "($t_bug_table.reporter_id=0)" );
-				} else {
-					$c_reporter_id = db_prepare_int( $t_filter_member );
-					if ( META_FILTER_MYSELF == $c_reporter_id ) {
-						if ( access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_user_id ) ) {
-							$c_reporter_id = $c_user_id;
-							array_push( $t_clauses, "($t_bug_table.reporter_id='$c_reporter_id')" );
-						}
-					} else {
+				$c_reporter_id = db_prepare_int( $t_filter_member );
+				if ( META_FILTER_MYSELF == $c_reporter_id ) {
+					if ( access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_user_id ) ) {
+						$c_reporter_id = $c_user_id;
 						array_push( $t_clauses, "($t_bug_table.reporter_id='$c_reporter_id')" );
 					}
+				} else {
+					array_push( $t_clauses, "($t_bug_table.reporter_id='$c_reporter_id')" );
 				}
 			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
@@ -173,7 +169,7 @@
 		$t_any_found = false;
 
 		foreach( $t_filter['handler_id'] as $t_filter_member ) {
-			if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -182,19 +178,30 @@
 		}
 		if ( !$t_any_found ) {
 			$t_clauses = array();
+			if ( !isset( $t_filter['and_not_assigned'] ) ) {
+				$t_filter['and_not_assigned'] = '';
+			}
 
 			foreach( $t_filter['handler_id'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
+				if ( 'none' == $t_filter_member ) {
 					array_push( $t_clauses, "$t_bug_table.handler_id=0" );
 				} else {
 					$c_handler_id = db_prepare_int( $t_filter_member );
 					if ( META_FILTER_MYSELF == $c_handler_id ) {
 						if ( access_has_project_level( config_get( 'handle_bug_threshold' ), $t_project_id, $t_user_id ) ) {
 							$c_handler_id = $c_user_id;
-							array_push( $t_clauses, "($t_bug_table.handler_id='$c_handler_id')" );
+							if ( 'on' != $t_filter['and_not_assigned'] ) {
+								array_push( $t_clauses, "($t_bug_table.handler_id='$c_handler_id')" );
+							} else {
+								array_push( $t_clauses, "(($t_bug_table.handler_id='$c_handler_id') OR ($t_bug_table.handler_id=0))" );
+							}
 						}
 					} else {
-						array_push( $t_clauses, "($t_bug_table.handler_id='$c_handler_id')" );
+						if ( 'on' != $t_filter['and_not_assigned'] ) {
+							array_push( $t_clauses, "($t_bug_table.handler_id='$c_handler_id')" );
+						} else {
+							array_push( $t_clauses, "(($t_bug_table.handler_id='$c_handler_id') OR ($t_bug_table.handler_id=0))" );
+						}
 					}
 				}
 			}
@@ -205,7 +212,7 @@
 		$t_any_found = false;
 
 		foreach( $t_filter['show_category'] as $t_filter_member ) {
-			if ( '[any]' == $t_filter_member ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -216,12 +223,8 @@
 			$t_clauses = array();
 
 			foreach( $t_filter['show_category'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
-					array_push( $t_clauses, "$t_bug_table.category=''" );
-				} else {
-					$c_show_category = db_prepare_string( $t_filter_member );
-					array_push( $t_clauses, "($t_bug_table.category='$c_show_category')" );
-				}
+				$c_show_category = db_prepare_string( $t_filter_member );
+				array_push( $t_clauses, "($t_bug_table.category='$c_show_category')" );
 			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
@@ -229,7 +232,7 @@
 		# severity
 		$t_any_found = false;
 		foreach( $t_filter['show_severity'] as $t_filter_member ) {
-			if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -263,7 +266,7 @@
 			$t_this_status = $t_filter['show_status'][0];
 			$t_this_hide_status = $t_filter['hide_status'][0];
 
-			if ( ( '[any]' == $t_this_status ) || ( is_blank( $t_this_status ) ) || ( 0 == $t_this_status ) ) {
+			if ( ( 'any' == $t_this_status ) || ( is_blank( $t_this_status ) ) ) {
 				$t_any_found = true;
 			}
 			if ( $t_any_found ) {
@@ -280,7 +283,7 @@
 			$t_any_found = false;
 			foreach( $t_filter['show_status'] as $t_this_status ) {
 				$t_desired_statuses[] = $t_this_status;
-				if ( ( '[any]' == $t_this_status ) || ( is_blank( $t_this_status ) ) || ( 0 == $t_this_status ) ) {
+				if ( ( 'any' == $t_this_status ) || ( is_blank( $t_this_status ) ) ) {
 					$t_any_found = true;
 				}
 			}
@@ -302,7 +305,7 @@
 		# resolution
 		$t_any_found = false;
 		foreach( $t_filter['show_resolution'] as $t_filter_member ) {
-			if ( '[any]' == $t_filter_member ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -322,8 +325,8 @@
 		# priority 
 		$t_any_found = false;
 		foreach( $t_filter['show_priority'] as $t_filter_member ) {
-				if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
-					$t_any_found = true;
+				if ( 'any' == $t_filter_member ) {
+						$t_any_found = true;
 				}
 		}
 		if ( count( $t_filter['show_priority'] ) == 0 ) {
@@ -343,7 +346,7 @@
 		# product build
 		$t_any_found = false;
 		foreach( $t_filter['show_build'] as $t_filter_member ) {
-				if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -354,12 +357,8 @@
 			$t_clauses = array();
 
 			foreach( $t_filter['show_build'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
-					array_push( $t_clauses, "($t_bug_table.build='')" );
-				} else {
-					$c_show_build = db_prepare_string( $t_filter_member );
-					array_push( $t_clauses, "($t_bug_table.build='$c_show_build')" );
-				}
+				$c_show_build = db_prepare_string( $t_filter_member );
+				array_push( $t_clauses, "($t_bug_table.build='$c_show_build')" );
 			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
@@ -367,7 +366,7 @@
 		# product version
 		$t_any_found = false;
 		foreach( $t_filter['show_version'] as $t_filter_member ) {
-				if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -378,12 +377,8 @@
 			$t_clauses = array();
 
 			foreach( $t_filter['show_version'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
-					array_push( $t_clauses, "($t_bug_table.version='')" );
-				} else {
-					$c_show_version = db_prepare_string( $t_filter_member );
-					array_push( $t_clauses, "($t_bug_table.version='$c_show_version')" );
-				}
+				$c_show_version = db_prepare_string( $t_filter_member );
+				array_push( $t_clauses, "($t_bug_table.version='$c_show_version')" );
 			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
@@ -407,7 +402,7 @@
 		# fixed in version
 		$t_any_found = false;
 		foreach( $t_filter['fixed_in_version'] as $t_filter_member ) {
-			if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -418,12 +413,8 @@
 			$t_clauses = array();
 
 			foreach( $t_filter['fixed_in_version'] as $t_filter_member ) {
-				if ( '[none]' == $t_filter_member ) {
-					array_push( $t_clauses, "($t_bug_table.fixed_in_version='')" );
-				} else {
-					$c_fixed_in_version = db_prepare_string( $t_filter_member );
-					array_push( $t_clauses, "($t_bug_table.fixed_in_version='$c_fixed_in_version')" );
-				}
+				$c_fixed_in_version = db_prepare_string( $t_filter_member );
+				array_push( $t_clauses, "($t_bug_table.fixed_in_version='$c_fixed_in_version')" );
 			}
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
@@ -431,7 +422,7 @@
 		# users monitoring a bug
 		$t_any_found = false;
 		foreach( $t_filter['user_monitor'] as $t_filter_member ) {
-			if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+			if ( 'any' == $t_filter_member ) {
 				$t_any_found = true;
 			}
 		}
@@ -458,6 +449,25 @@
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
 
+		# bug relationship
+		$t_any_found = false;
+		$c_rel_type = $t_filter['relationship_type'];
+		$c_rel_bug = $t_filter['relationship_bug'];
+		if ( 'any' == $c_rel_type || '' == $c_rel_bug) {
+			$t_any_found = true;
+		}
+		if ( !$t_any_found ) {
+		    # use the complementary type
+		    $c_rel_type = relationship_get_complementary_type($c_rel_type);
+			$t_clauses = array();
+			$t_table_name = 'relationship';
+			array_push( $t_from_clauses, $t_bug_relationship_table );
+			array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" );
+			
+ 			array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
+			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
+		}
+
 		# custom field filters
 		if( ON == config_get( 'filter_by_custom_fields' ) ) {
 			# custom field filtering
@@ -469,7 +479,7 @@
 				# Ignore all custom filters that are not set, or that are set to '' or "any"
 				$t_any_found = false;
 				foreach( $t_filter['custom_fields'][$t_cfid] as $t_filter_member ) {
-				if ( ( '[any]' == $t_filter_member ) || ( 0 == $t_filter_member ) ) {
+					if ( 'any' == $t_filter_member ) {
 						$t_any_found = true;
 					}
 				}
@@ -482,14 +492,9 @@
 					array_push( $t_join_clauses, "LEFT JOIN $t_custom_field_string_table as $t_table_name ON $t_table_name.bug_id = $t_bug_table.id" );
 					foreach( $t_filter['custom_fields'][$t_cfid] as $t_filter_member ) {
 						if ( isset( $t_filter_member ) &&
-							( '[any]' != strtolower( $t_filter_member ) ) &&
+							( 'any' != strtolower( $t_filter_member ) ) &&
 							( !is_blank( trim( $t_filter_member ) ) ) ) {	# @@@ What if the user wants to filter on issues with an empty custom field??.. tricky!!!
 
-
-							if ( '[none]' == $t_filter_member ) { # coerce filter value if selecting 'none'
-								$t_filter_member = '';
-							}
-							
 							if( $t_first_time ) {
 								$t_first_time = false;
 								$t_custom_where_clause = '(';
@@ -554,18 +559,7 @@
 		} else {
 			$t_where	= '';
 		}
-		
-		if ( null === $p_show_sticky ) {
-			$t_where .= " AND $t_bug_table.sticky = 0";
-		}
-		else {
-			$t_where .= " AND $t_bug_table.sticky = 1";
-		}
-		
-		if ( false === $t_filter['sticky_issues'] && true === $p_show_sticky ) {
-			$t_where .= " AND 1 = 0";
-		}
-		
+
 		# Possibly do two passes. First time, grab the IDs of issues that match the filters. Second time, grab the IDs of issues that
 		# have bugnotes that match the text search if necessary.
 		$t_id_array = array();
@@ -602,7 +596,6 @@
 		} else {
 			$t_where = "WHERE 1 != 1";
 		}
-		
 		$t_from = 'FROM ' . $t_bug_table;
 
 		# Get the total number of bugs that meet the criteria.
@@ -650,7 +643,7 @@
 					$t_from
 					$t_join
 					$t_where";
-					
+
 		# Now add the rest of the criteria i.e. sorting, limit.
 		$c_sort = db_prepare_string( $t_filter['sort'] );
 
@@ -781,8 +774,8 @@
 ?> 
 
 		<br />
-		<form method="post" name="filters" id="filters_form" action="<?php PRINT $t_action; ?>">
-		<input type="hidden" name="type" value="1" />
+		<form method="post" name="filters" action="<?php PRINT $t_action; ?>">
+		<input type="hidden" name="type" value="5" />
 		<?php
 			if ( $p_for_screen == false ) {
 				PRINT '<input type="hidden" name="print" value="1" />';
@@ -837,27 +830,33 @@
 
 		<tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'reporter_id[]'; ?>" id="reporter_id_filter"><?php PRINT lang_get( 'reporter' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'reporter_id[]'; ?>"><?php PRINT lang_get( 'reporter' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'user_monitor[]'; ?>" id="user_monitor_filter"><?php PRINT lang_get( 'monitored_by' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'user_monitor[]'; ?>"><?php PRINT lang_get( 'monitored_by' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'handler_id[]'; ?>" id="handler_id_filter"><?php PRINT lang_get( 'assigned_to' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'handler_id[]'; ?>"><?php PRINT lang_get( 'assigned_to' ) ?>:</a>
 			</td>
 			<td colspan="2" class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_category[]'; ?>" id="show_category_filter"><?php PRINT lang_get( 'category' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_category[]'; ?>"><?php PRINT lang_get( 'category' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_severity[]'; ?>" id="show_severity_filter"><?php PRINT lang_get( 'severity' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_severity[]'; ?>"><?php PRINT lang_get( 'severity' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_resolution[]'; ?>" id="show_resolution_filter"><?php PRINT lang_get( 'resolution' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_resolution[]'; ?>"><?php PRINT lang_get( 'resolution' ) ?>:</a>
 			</td>
+
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 
 		<tr class="row-1">
-			<td class="small-caption" valign="top" id="reporter_id_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -867,10 +866,7 @@
 									$t_first_flag = true;
 									foreach( $t_filter['reporter_id'] as $t_current ) {
 										$t_this_name = '';
-										?>
-										<input type="hidden" name="reporter_id[]" value="<?php echo $t_current;?>" />
-										<?php
-										if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) || ( '[any]' == $t_current ) ) {
+										if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else if ( META_FILTER_MYSELF == $t_current ) {
 											if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) {
@@ -878,8 +874,6 @@
 											} else {
 												$t_any_found = true;
 											}
-										} else if ( '[none]' == $t_current ) {
-											$t_this_name = lang_get( 'none' );
 										} else {
 											$t_this_name = user_get_name( $t_current );
 										}
@@ -898,7 +892,7 @@
 								}
 							?>
 			</td>
-			<td class="small-caption" valign="top" id="user_monitor_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -907,11 +901,8 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['user_monitor'] as $t_current ) {
-										?>
-										<input type="hidden" name="user_monitor[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_name = '';
-										if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) || ( '[any]' == $t_current ) ) {
+										if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else if ( META_FILTER_MYSELF == $t_current ) {
 											if ( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) {
@@ -937,7 +928,7 @@
 								}
 							?>
 			</td>
-			<td class="small-caption" valign="top" id="handler_id_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -946,13 +937,10 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['handler_id'] as $t_current ) {
-										?>
-										<input type="hidden" name="handler_id[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_name = '';
-										if ( '[none]' == $t_current ) {
+										if ( 'none' == $t_current ) {
 											$t_this_name = lang_get( 'none' );
-										} else if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) || ( '[any]' == $t_current ) ) {
+										} else if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else if ( META_FILTER_MYSELF == $t_current ) {
 											if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) {
@@ -976,9 +964,12 @@
 										PRINT $t_output;
 									}
 								}
+								if ( 'on' == $t_filter['and_not_assigned'] ) {
+									PRINT ' (' . lang_get( 'or_unassigned' ) . ')';
+								}
 							?>
 			</td>
-			<td colspan="2" class="small-caption" valign="top" id="show_category_filter_target">
+			<td colspan="2" class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -987,14 +978,9 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_category'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_category[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
-										} else if ( '[none]' == $t_current ) {
-											$t_this_string = lang_get( 'none' );
 										} else {
 											$t_this_string = $t_current;
 										}
@@ -1013,7 +999,7 @@
 								}
 							?>
 			</td>
-			<td class="small-caption" valign="top" id="show_severity_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1022,11 +1008,8 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_severity'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_severity[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) || ( $t_current == 0 ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else {
 											$t_this_string = get_enum_element( 'severity', $t_current );
@@ -1046,7 +1029,7 @@
 								}
 							?>
 			</td>
-			<td class="small-caption" valign="top" id="show_resolution_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1055,11 +1038,8 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_resolution'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_resolution[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) || ( $t_current == 0 ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else {
 											$t_this_string = get_enum_element( 'resolution', $t_current );
@@ -1079,31 +1059,36 @@
 								}
 							?>
 			</td>
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 
 		<tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_status[]'; ?>" id="show_status_filter"><?php PRINT lang_get( 'status' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_status[]'; ?>"><?php PRINT lang_get( 'status' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>" id="hide_status_filter"><?php PRINT lang_get( 'hide_status' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>"><?php PRINT lang_get( 'hide_status' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_build[]'; ?>" id="show_build_filter"><?php PRINT lang_get( 'product_build' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_build[]'; ?>"><?php PRINT lang_get( 'product_build' ) ?>:</a>
 			</td>
 			<td colspan="2" class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'show_version[]'; ?>" id="show_version_filter"><?php PRINT lang_get( 'product_version' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'show_version[]'; ?>"><?php PRINT lang_get( 'product_version' ) ?>:</a>
 			</td>
 			<td colspan="1" class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'fixed_in_version[]'; ?>" id="show_fixed_in_version_filter"><?php PRINT lang_get( 'fixed_in_version' ) ?>:</a>
+				<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[]'; ?>" id="show_priority_filter"><?php PRINT lang_get( 'priority' ) ?>:</a>
-			</td>
+                                <a href="<?php PRINT $t_filters_url . 'show_priority[]'; ?>"><?php PRINT lang_get( 'priority' ) ?>:</a>
+                        </td>
 		</tr>
 
 		<tr class="row-1">
-			<td class="small-caption" valign="top" id="show_status_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1112,11 +1097,8 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_status'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_status[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) || ( $t_current == 0 ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
 										} else {
 											$t_this_string = get_enum_element( 'status', $t_current );
@@ -1135,8 +1117,8 @@
 									}
 								}
 							?>
-			</td>		
-			<td class="small-caption" valign="top" id="hide_status_filter_target">
+			</td>
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_none_found = false;
@@ -1145,9 +1127,6 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['hide_status'] as $t_current ) {
-										?>
-										<input type="hidden" name="hide_status[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
 										if ( ( $t_current == 'none' ) || ( is_blank( $t_current ) ) ) {
 											$t_none_found = true;
@@ -1173,7 +1152,7 @@
 								}
 							?>
 			</td>
-			<td class="small-caption" valign="top" id="show_build_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1182,14 +1161,9 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_build'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_build[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
-										} else if ( '[none]' == $t_current ) {
-											$t_this_string = lang_get( 'none' );
 										} else {
 											$t_this_string = $t_current;
 										}
@@ -1208,7 +1182,7 @@
 								}
 							?>
 			</td>
-			<td colspan="2" class="small-caption" valign="top" id="show_version_filter_target">
+			<td colspan="2" class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1217,14 +1191,9 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['show_version'] as $t_current ) {
-										?>
-										<input type="hidden" name="show_version[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
-										} else if ( '[none]' == $t_current ) {
-											$t_this_string = lang_get( 'none' );
 										} else {
 											$t_this_string = $t_current;
 										}
@@ -1243,7 +1212,7 @@
 								}
 							?>
 			</td>
-			<td colspan="1" class="small-caption" valign="top" id="show_fixed_in_version_filter_target">
+			<td colspan="1" class="small-caption" valign="top">
 							<?php
 								$t_output = '';
 								$t_any_found = false;
@@ -1252,14 +1221,9 @@
 								} else {
 									$t_first_flag = true;
 									foreach( $t_filter['fixed_in_version'] as $t_current ) {
-										?>
-										<input type="hidden" name="fixed_in_version[]" value="<?php echo $t_current;?>" />
-										<?php
 										$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) ) {
+										if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 											$t_any_found = true;
-										} else if ( '[none]' == $t_current ) {
-											$t_this_string = lang_get( 'none' );
 										} else {
 											$t_this_string = $t_current;
 										}
@@ -1278,64 +1242,66 @@
 								}
 							?>
 			</td>
-			<td colspan="1" class="small-caption" valign="top" id="show_priority_filter_target">
-              <?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 ) {
-										?>
-										<input type="hidden" name="show_priority[]" value="<?php echo $t_current;?>" />
-										<?php
-                  	$t_this_string = '';
-										if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) || ( $t_current == 0 ) ) {
-                  		$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>
+			<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 . "\""; ?>>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'per_page'; ?>" id="per_page_filter"><?php PRINT lang_get( 'show' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'per_page'; ?>"><?php PRINT lang_get( 'show' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'view_state'; ?>" id="view_state_filter"><?php PRINT lang_get( 'view_status' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'view_state'; ?>"><?php PRINT lang_get( 'view_status' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'sticky_issues'; ?>" id="sticky_issues_filter"><?php PRINT lang_get( 'sticky' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>"><?php PRINT lang_get( 'changed' ) ?>:</a>
 			</td>
 			<td class="small-caption" valign="top">
-				<a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>" id="highlight_changed_filter"><?php PRINT lang_get( 'changed' ) ?>:</a>
+				<a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a>
 			</td>
-			<td class="small-caption" valign="top" colspan="4">
-				<a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>" id="do_filter_by_date_filter"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a>
+			<td class="small-caption" valign="top" colspan="3">
+				<a href="<?php PRINT $t_filters_url . 'relationship_type'; ?>"><?php PRINT lang_get( 'bug_relationships' ) ?>:</a>
 			</td>
+
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 		<tr class="row-1">
-			<td class="small-caption" valign="top" id="per_page_filter_target">
+			<td class="small-caption" valign="top">
 				<?php PRINT $t_filter['per_page']; ?>
-				<input type="hidden" name="per_page" value="<?php echo $t_filter['per_page'];?>" />
 			</td>
-			<td class="small-caption" valign="top" id="view_state_filter_target">
+			<td class="small-caption" valign="top">
 				<?php
 				if ( VS_PUBLIC == $t_filter['view_state'] ) {
 					PRINT lang_get( 'public' );
@@ -1345,26 +1311,13 @@
 					PRINT lang_get( 'any' );
 				}
 				?>
-				<input type="hidden" name="view_state" value="<?php echo $t_filter['view_state'];?>" />
 			</td>
-			<td class="small-caption" valign="top" id="sticky_issues_filter_target">
-				<?php PRINT $t_filter['sticky_issues']; ?>
-			</td>
-			<td class="small-caption" valign="top" id="highlight_changed_filter_target">
+			<td class="small-caption" valign="top">
 				<?php PRINT $t_filter['highlight_changed']; ?>
 			</td>
-			<td class="small-caption" valign="top" colspan="4" id="do_filter_by_date_filter_target">
+			<td class="small-caption" valign="top">
 							<?php
 							if ( 'on' == $t_filter['do_filter_by_date'] ) {
-								?>
-								<input type="hidden" name="do_filter_by_date" value="<?php echo $t_filter['do_filter_by_date'];?>" />
-								<input type="hidden" name="start_month" value="<?php echo $t_filter['start_month'];?>" />
-								<input type="hidden" name="start_day" value="<?php echo $t_filter['start_day'];?>" />
-								<input type="hidden" name="start_year" value="<?php echo $t_filter['start_year'];?>" />
-								<input type="hidden" name="end_month" value="<?php echo $t_filter['end_month'];?>" />
-								<input type="hidden" name="end_day" value="<?php echo $t_filter['end_day'];?>" />
-								<input type="hidden" name="end_year" value="<?php echo $t_filter['end_year'];?>" />
-								<?php
 								$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
 								$t_time = mktime( 0, 0, 0, $t_filter['start_month'], $t_filter['start_day'], $t_filter['start_year'] );
 								foreach( $t_chars as $t_char ) {
@@ -1404,6 +1357,30 @@
 							}
 							?>
 			</td>
+
+			<td class="small-caption" valign="top" colspan="3">
+							<?php
+								$t_output = '';
+								$t_any_found = false;
+								$c_rel_type = $t_filter['relationship_type'];
+								$c_rel_bug = $t_filter['relationship_bug'];
+								if ( '' == $c_rel_type || 0 == $c_rel_bug ) {
+									PRINT lang_get( 'any' );
+								} else {
+								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
+								}
+
+							?>
+			</td>
+
+
+
+
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 		<?php
 
@@ -1428,24 +1405,22 @@
 
 					if ( isset( $t_accessible_custom_fields_names[ $i ] ) ) {
 						$t_fields .= '<td class="small-caption" valign="top"> ';
-						$t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_'. $t_accessible_custom_fields_ids[$i] .'_filter">';
+						$t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]">';
 						$t_fields .= string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) );
 						$t_fields .= '</a> </td> ';
 					}
 					$t_output = '';
 					$t_any_found = false;
 
-					$t_values .= '<td class="small-caption" valign="top" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> ' ; 
+					$t_values .= '<td class="small-caption" valign="top"> ' ; 
 					if ( !isset( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] ) ) {
 						$t_values .= lang_get( 'any' );
 					} else {
 						$t_first_flag = true;
 						foreach( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current ) {
 							$t_this_string = '';
-							if ( ( $t_current == '[any]' ) || ( is_blank( $t_current ) ) || ( $t_current == 0 ) ) {
+							if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) {
 								$t_any_found = true;
-							} else if ( '[none]' == $t_current ) {
-								$t_this_string = lang_get( 'none' );
 							} else {
 								$t_this_string = $t_current;
 							}
@@ -1457,7 +1432,6 @@
 							}
 
 							$t_output = $t_output . $t_this_string;
-							$t_values .= '<input type="hidden" name="custom_field_'.$t_accessible_custom_fields_ids[$i].'[]" value="'.$t_current.'" />';
 						}
 
 						if ( true == $t_any_found ) {
@@ -1511,29 +1485,17 @@
 		?>
 
 		<tr>
-			<td colspan="2">
+			<td colspan="3">
 				<?php
 					collapse_icon( 'filter' );
 					echo lang_get( 'search' );
-				?>:
+				?>: 
 				<input type="text" size="16" name="search" value="<?php PRINT htmlspecialchars( $t_filter['search'] ); ?>" />
 
 				<input type="submit" name="filter" class="button" value="<?php PRINT lang_get( 'search' ) ?>" />
 			</td>
 			</form>
-			<td class="center">
-				<?php
-					$f_switch_view_link = 'view_filters_page.php?view_type=';
 
-					if ( ( SIMPLE_ONLY != config_get( 'view_filters' ) ) && ( ADVANCED_ONLY != config_get( 'view_filters' ) ) ) {
-						if ( 'advanced' == $t_view_type ) {
-							print_bracket_link( $f_switch_view_link . 'simple', lang_get( 'simple_filters' ) );
-						} else {
-							print_bracket_link( $f_switch_view_link . 'advanced', lang_get( 'advanced_filters' ) );
-						}
-					}
-				?>
-			</td>
 			<td class="right" colspan="4">
 			<?php
 			$t_stored_queries_arr = array();
@@ -1861,10 +1823,6 @@
 		if ( !isset( $p_filter_arr['_version'] ) ) {
 			$p_filter_arr['_version'] = config_get( 'cookie_version' );
 		}
-		$t_cookie_vers = (int) substr( $p_filter_arr['_version'], 1 );
-		if ( substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) { # if the version is old, update it
-			$p_filter_arr['_version'] = config_get( 'cookie_version' );
-		}
 		if ( !isset( $p_filter_arr['_view_type'] ) ) {
 			$p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' );
 		}
@@ -1874,9 +1832,6 @@
 		if ( !isset( $p_filter_arr['highlight_changed'] ) ) {
 			$p_filter_arr['highlight_changed'] = config_get( 'default_show_changed' );
 		}
-		if ( !isset( $p_filter_arr['sticky_issues'] ) ) {
-			$p_filter_arr['sticky_issues'] = config_get( 'show_sticky_issues' );
-		}
 		if ( !isset( $p_filter_arr['sort'] ) ) {
 			$p_filter_arr['sort'] = "last_updated";
 		}
@@ -1919,9 +1874,9 @@
 		if ( is_array( $t_custom_fields ) && ( sizeof( $t_custom_fields ) > 0 ) ) {
 			foreach( $t_custom_fields as $t_cfid ) {
 				if ( is_array( gpc_get( 'custom_field_' . $t_cfid, null ) ) ) {
-					$f_custom_fields_data[$t_cfid] = gpc_get_string_array( 'custom_field_' . $t_cfid, '[any]' );
+					$f_custom_fields_data[$t_cfid] = gpc_get_string_array( 'custom_field_' . $t_cfid, 'any' );
 				} else {
-					$f_custom_fields_data[$t_cfid] = gpc_get_string( 'custom_field_' . $t_cfid, '[any]' );
+					$f_custom_fields_data[$t_cfid] = gpc_get_string( 'custom_field_' . $t_cfid, 'any' );
 					$f_custom_fields_data[$t_cfid] = array( $f_custom_fields_data[$t_cfid] );
 				}
 			}
@@ -1938,7 +1893,7 @@
 									  'show_version' => 'string',
 									  'hide_status' => 'int',
 									  'fixed_in_version' => 'string',
-									  'user_monitor' => 'int' );
+									  'user_monitor' => 'int');
 		foreach( $t_multi_select_list as $t_multi_field_name => $t_multi_field_type ) {
 			if ( !isset( $p_filter_arr[$t_multi_field_name] ) ) {
 				if ( 'hide_status' == $t_multi_field_name ) {
@@ -1946,7 +1901,7 @@
 				} else if ( 'custom_fields' == $t_multi_field_name ) {
 					$p_filter_arr[$t_multi_field_name] = array( $f_custom_fields_data );
 				} else {
-					$p_filter_arr[$t_multi_field_name] = array( "[any]" );
+					$p_filter_arr[$t_multi_field_name] = array( "any" );
 				}
 			} else {
 				if ( !is_array( $p_filter_arr[$t_multi_field_name] ) ) {
@@ -1954,9 +1909,6 @@
 				}
 				$t_checked_array = array();
 				foreach ( $p_filter_arr[$t_multi_field_name] as $t_filter_value ) {
-					if ( ( 5 == $t_cookie_vers ) && ( $t_filter_value == 'any' ) ) {
-						$t_filter_value = '[any]';
-					}
 					if ( 'string' == $t_multi_field_type ) {
 						$t_checked_array[] = db_prepare_string( $t_filter_value );
 					} else if ( 'int' == $t_multi_field_type ) {
@@ -1972,16 +1924,13 @@
 		if ( is_array( $t_custom_fields ) && ( sizeof( $t_custom_fields ) > 0 ) ) {
 			foreach( $t_custom_fields as $t_cfid ) {
 				if ( !isset( $p_filter_arr['custom_fields'][$t_cfid] ) ) {
-					$p_filter_arr['custom_fields'][$t_cfid] = array( "[any]" );
+					$p_filter_arr['custom_fields'][$t_cfid] = array( "any" );
 				} else {
 					if ( !is_array( $p_filter_arr['custom_fields'][$t_cfid] ) ) {
 						$p_filter_arr['custom_fields'][$t_cfid] = array( $p_filter_arr['custom_fields'][$t_cfid] );
 					}
 					$t_checked_array = array();
 					foreach ( $p_filter_arr['custom_fields'][$t_cfid] as $t_filter_value ) {
-						if ( ( 5 == $t_cookie_vers ) && ( $t_filter_value == 'any' ) ) {
-							$t_filter_value = '[any]';
-						}
 						$t_checked_array[] = db_prepare_string( $t_filter_value );
 					}
 					$p_filter_arr['custom_fields'][$t_cfid] = $t_checked_array;
@@ -1989,331 +1938,6 @@
 			}
 		}
 		# all of our filter values are now guaranteed to be there, and correct.
-
 		return $p_filter_arr;
 	}
-
-	
-	/**
-	 * The following functions each print out an individual filter field.
-	 * They are derived from view_filters_page.php
-	 *
-	 * The functions follow a strict naming convention:
-	 *
-	 *   print_filter_[filter_name]
-	 *
-	 * Where [filter_name] is the same as the "name" of the form element for
-	 * that filter. This naming convention is depended upon by the controller 
-	 * at the end of the script.
-	 */
-	/**
-	 * I expect that this code could be made simpler by refactoring into a 
-	 * class so as to avoid all those calls to global(which are pretty ugly)
-	 *
-	 * These functions could also be shared by view_filters_page.php
-	 *
-	 */
-	function print_filter_reporter_id(){
-		global $t_select_modifier, $t_filter;
-		?>
-		<select <?php PRINT $t_select_modifier;?> name="reporter_id[]">
-			<option value="[any]" <?php check_selected( $t_filter['reporter_id'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<?php
-				if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { 
-					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
-					check_selected( $t_filter['reporter_id'], META_FILTER_MYSELF );
-					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
-				} 
-			?>
-			<?php print_reporter_option_list( $t_filter['reporter_id'] ) ?>
-		</select>
-		<?php
-	}
-	
-	
-	function print_filter_user_monitor(){
-		global $t_select_modifier, $t_filter;
-		?>
-	<!-- Monitored by -->
-		<select <?php PRINT $t_select_modifier;?> name="user_monitor[]">
-			<option value="[any]" <?php check_selected( $t_filter['user_monitor'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<?php
-				if ( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) {
-					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
-					check_selected( $t_filter['user_monitor'], META_FILTER_MYSELF );
-					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
-				}
-			?>
-			<?php print_reporter_option_list( $t_filter['user_monitor'] ) ?>
-		</select>
-		<?php
-	}
-
-	function print_filter_handler_id(){
-		global $t_select_modifier, $t_filter, $f_view_type;
-		?>
-		<!-- Handler -->
-		<select <?php PRINT $t_select_modifier;?> name="handler_id[]">
-			<option value="[any]" <?php check_selected( $t_filter['handler_id'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<option value="[none]" <?php check_selected( $t_filter['handler_id'], '[none]' ); ?>>[<?php echo lang_get( 'none' ) ?>]</option>
-			<?php
-				if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { 
-					PRINT '<option value="' . META_FILTER_MYSELF . '" ';
-					check_selected( $t_filter['handler_id'], META_FILTER_MYSELF );
-					PRINT '>[' . lang_get( 'myself' ) . ']</option>';
-				} 
-			?>
-			<?php print_assign_to_option_list( $t_filter['handler_id'] ) ?>
-		</select>
-		<?php
-	}
-	
-	function print_filter_show_category(){
-		global $t_select_modifier, $t_filter;
-		?>
-		<!-- Category -->
-		<select <?php PRINT $t_select_modifier;?> name="show_category[]">
-			<option value="[any]" <?php check_selected( $t_filter['show_category'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<option value="[none]" <?php check_selected( $t_filter['show_category'], '[none]' ); ?>>[<?php echo lang_get( 'none' ) ?>]</option>
-			<?php # This shows orphaned categories as well as selectable categories ?>
-			<?php print_category_complete_option_list( $t_filter['show_category'] ) ?>
-		</select>
-		<?php
-	}
-	
-	function print_filter_show_severity(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Severity -->
-			<select <?php PRINT $t_select_modifier;?> name="show_severity[]">
-				<option value="[any]" <?php check_selected( $t_filter['show_severity'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-				<?php print_enum_string_option_list( 'severity', $t_filter['show_severity'] ) ?>
-			</select>
-		<?php
-	}
-	
-	function print_filter_show_resolution(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Resolution -->
-			<select <?php PRINT $t_select_modifier;?> name="show_resolution[]">
-				<option value="[any]" <?php check_selected( $t_filter['show_resolution'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-				<?php print_enum_string_option_list( 'resolution', $t_filter['show_resolution'] ) ?>
-			</select>
-		<?php
-	}
-	
-	function print_filter_show_status(){
-		global $t_select_modifier, $t_filter;
-		?>	<!-- Status -->
-			<select <?php PRINT $t_select_modifier;?> name="show_status[]">
-				<option value="[any]" <?php check_selected( $t_filter['show_status'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-				<?php print_enum_string_option_list( 'status', $t_filter['show_status'] ) ?>
-			</select>
-		<?php
-	}
-	
-	function print_filter_hide_status(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Hide Status -->
-			<select <?php PRINT $t_select_modifier;?> name="hide_status[]">
-				<option value="none">[<?php echo lang_get( 'none' ) ?>]</option>
-				<?php print_enum_string_option_list( 'status', $t_filter['hide_status'] ) ?>
-			</select>
-		<?php
-	}
-
-	function print_filter_show_build(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Build -->
-		<select <?php PRINT $t_select_modifier;?> name="show_build[]">
-			<option value="[any]" <?php check_selected( $t_filter['show_build'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<option value="[none]" <?php check_selected( $t_filter['show_build'], '[none]' ); ?>>[<?php echo lang_get( 'none' ) ?>]</option>
-			<?php print_build_option_list( $t_filter['show_build'] ) ?>
-		</select>
-		<?php
-	}
-
-	function print_filter_show_version(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Version -->
-		<select <?php PRINT $t_select_modifier;?> name="show_version[]">
-			<option value="[any]" <?php check_selected( $t_filter['show_version'], '[any]' ); ?>>[<?php echo lang_get( 'any' ) ?>]</option>
-			<option value="[none]" <?php check_selected( $t_filter['show_version'], '[none]' ); ?>>[<?php echo lang_get( 'none' ) ?>]</option>
-			<?php print_version_option_list( $t_filter['show_version'], null, VERSION_RELEASED ) ?>
-		</select>
-		<?php
-	}
-
-	function print_filter_show_fixed_in_version(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Fixed in Version -->
-		<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="[none]" <?php check_selected( $t_filter['fixed_in_version'], '[none]' ); ?>>[<?php echo lang_get( 'none' ) ?>]</option>
-			<?php print_version_option_list( $t_filter['fixed_in_version'], null, VERSION_ALL ) ?>
-		</select>
-		<?php
-	}
-
-	function print_filter_show_priority(){
-		global $t_select_modifier, $t_filter;
-		?><!-- Priority -->
-    <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>
-			<?php print_enum_string_option_list( 'priority', $t_filter['show_priority'] ) ?>
-    </select>
-		<?php
-	}
-
-	function print_filter_per_page(){
-		global $t_filter;
-		?><!-- Number of bugs per page -->
-		<input type="text" name="per_page" size="3" maxlength="7" value="<?php echo $t_filter['per_page'] ?>" />
-		<?php
-	}
-
-	function print_filter_view_state(){
-		global $t_select_modifier, $t_filter;
-		?><!-- View Status -->
-		<select name="view_state">
-			<?php
-			PRINT '<option value="[any]" ';
-			check_selected( $t_filter['view_state'], 'any' );
-			PRINT '>[' . lang_get( 'any' ) . ']</option>';
-			PRINT '<option value="' . VS_PUBLIC . '" ';
-			check_selected( $t_filter['view_state'], VS_PUBLIC );
-			PRINT '>' . lang_get( 'public' ) . '</option>';
-			PRINT '<option value="' . VS_PRIVATE . '" ';
-			check_selected( $t_filter['view_state'], VS_PRIVATE );
-			PRINT '>' . lang_get( 'private' ) . '</option>';
-			?>
-		</select>
-		<?php
-	}
-
-	function print_filter_sticky_issues(){
-		global $t_filter;
-		?><!-- Show or hide sticky bugs -->
-			<input type="checkbox" name="sticky_issues" <?php check_checked( $t_filter['sticky_issues'], 'on' ); ?> />
-		<?php
-	}
-
-	function print_filter_highlight_changed(){
-		global $t_filter;
-		?><!-- Highlight changed bugs -->
-			<input type="text" name="highlight_changed" size="3" maxlength="7" value="<?php echo $t_filter['highlight_changed'] ?>" />
-		<?php
-	}
-
-	function print_filter_do_filter_by_date( $p_hide_checkbox=false ){
-		global $t_filter;
-		?>
-		<table cellspacing="0" cellpadding="0">
-		<?php if ( ! $p_hide_checkbox ) {
-		?>
-		<tr>
-			<input type="checkbox" name="do_filter_by_date" <?php 
-				check_checked( $t_filter['do_filter_by_date'], 'on' ); 
-				if ( ON == config_get( 'use_javascript' ) ) { 
-					print "onclick=\"SwitchDateFields();\""; } ?> />
-			<?php echo lang_get( 'use_date_filters' ) ?>			
-		</tr>
-		<?php }
-		?>
-
-		<!-- Start date -->
-		<tr>
-			<td>
-			<?php echo lang_get( 'start_date' ) ?>:
-			</td>
-			<td nowrap="nowrap">
-			<?php
-			$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
-			foreach( $t_chars as $t_char ) {
-				if ( strcasecmp( $t_char, "M" ) == 0 ) {
-					print "<select name=\"start_month\">";
-					print_month_option_list( $t_filter['start_month'] );
-					print "</select>\n";
-				}
-				if ( strcasecmp( $t_char, "D" ) == 0 ) {
-					print "<select name=\"start_day\">";
-					print_day_option_list( $t_filter['start_day'] );
-					print "</select>\n";
-				}
-				if ( strcasecmp( $t_char, "Y" ) == 0 ) {
-					print "<select name=\"start_year\">";
-					print_year_option_list( $t_filter['start_year'] );
-					print "</select>\n";
-				}
-			}
-			?>
-			</td>
-		</tr>
-		<!-- End date -->
-		<tr>
-			<td>
-			<?php echo lang_get( 'end_date' ) ?>:
-			</td>
-			<td>
-			<?php
-			$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
-			foreach( $t_chars as $t_char ) {
-				if ( strcasecmp( $t_char, "M" ) == 0 ) {
-					print "<select name=\"end_month\">";
-					print_month_option_list( $t_filter['end_month'] );
-					print "</select>\n";
-				}
-				if ( strcasecmp( $t_char, "D" ) == 0 ) {
-					print "<select name=\"end_day\">";
-					print_day_option_list( $t_filter['end_day'] );
-					print "</select>\n";
-				}
-				if ( strcasecmp( $t_char, "Y" ) == 0 ) {
-					print "<select name=\"end_year\">";
-					print_year_option_list( $t_filter['end_year'] );
-					print "</select>\n";
-				}
-			}
-			?>
-			</td>
-		</tr>
-		</table>
-		<?php
-	}
-
-	function print_filter_custom_field($p_field_id){
-		global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier;
-
-		$j = array_search($p_field_id, $t_accessible_custom_fields_ids);
-		if($j === null || $j === false){ 
-			# Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE.
-			?>
-			<span style="color:red;weight:bold;">
-				unknown custom filter (custom <?php $p_field_id; ?>)
-			</span>
-			<?php
-		} elseif ( isset( $t_accessible_custom_fields_names[$j] ) ) {
-			echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id .'[]">';
-			echo '<option value="[any]" ';
-			check_selected( $t_filter['custom_fields'][ $p_field_id ], 'any' );
-			echo '>[' . lang_get( 'any' ) .']</option>';
-			# don't show '[none]' for enumerated types as it's not possible for them to be blank
-			if ( ! in_array( $t_accessible_custom_fields_types[$j], array( CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_CHECKBOX, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST ) ) ) {
-				echo '<option value="[none]" ';
-				check_selected( $t_filter['custom_fields'][ $p_field_id ], 'any' );
-				echo '>[' . lang_get( 'none' ) .']</option>';
-			}
-			foreach( $t_accessible_custom_fields_values[$j] as $t_item ) {
-				if ( ( strtolower( $t_item ) != "[any]" ) && ( strtolower( $t_item ) != "[none]" ) && ( trim( $t_item ) != "" ) ) {
-					echo '<option value="' .  htmlentities( $t_item )  . '" ';
-					if ( isset( $t_filter['custom_fields'][ $p_field_id ] ) ) {
-						check_selected( $t_filter['custom_fields'][ $p_field_id ], $t_item );
-					}
-					echo '>' . $t_item  . '</option>' . "\n";
-				}
-			}
-			echo '</select>';
-		}
-
-	}
-
 ?>
Index: core/relationship_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v
retrieving revision 1.29
diff -u -r1.29 relationship_api.php
--- core/relationship_api.php	18 Dec 2004 09:35:21 -0000	1.29
+++ core/relationship_api.php	13 Jan 2005 14:16:02 -0000
@@ -6,7 +6,7 @@
 	# See the README and LICENSE files for details
 
 	# --------------------------------------------------------
-	# $Id: relationship_api.php,v 1.29 2004/12/18 09:35:21 marcelloscata Exp $
+	# $Id: relationship_api.php,v 1.27 2004/11/30 12:17:04 vboctor Exp $
 	# --------------------------------------------------------
 
 	### Relationship API ###
@@ -501,7 +501,6 @@
 	# return formatted string with all the details on the requested relationship
 	function relationship_get_details( $p_bug_id, $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false ) {
 		$t_summary_wrap_at = strlen( config_get( 'email_separator2' ) ) - 28;
-		$t_icon_path = config_get( 'icon_path' );
 
 		$p_user_id = auth_get_current_user_id();
 
@@ -566,10 +565,7 @@
 		}
 
 		# add summary
-		$t_relationship_info_html .= $t_td . string_attribute( $t_bug->summary );
-		if ( VS_PRIVATE == $t_bug->view_state ) {
-			$t_relationship_info_html .= sprintf( ' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) );
-		}
+		$t_relationship_info_html .= $t_td . $t_bug->summary;
 		if( strlen( $t_bug->summary ) <= $t_summary_wrap_at ) {
 			$t_relationship_info_text .= $t_bug->summary;
 		}
@@ -682,9 +678,18 @@
 
  	# --------------------
  	# print HTML relationship listbox
-	function relationship_list_box( $p_default_rel_type = -1 ) {
+	function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false) {
+?>
+<select name="<?php echo $p_select_name?>">
+<?php if ($p_include_any) { ?>
+<option value="any" <?php echo ( $p_default_rel_type == "any" ? ' selected' : '' ) ?>><?php echo lang_get( 'any' ) ?></option>
+<option value="any"></option>
+<?php 
+    } 
+    if ($p_default_rel_type == "any") {
+        $p_default_rel_type = -100;
+    }
 ?>
-<select name="rel_type">
 <option value="<?php echo BUG_RELATED ?>"<?php echo ( $p_default_rel_type == BUG_RELATED ? ' selected' : '' ) ?>><?php echo lang_get( 'related_to' ) ?></option>
 <option value="<?php echo BUG_DEPENDANT ?>"<?php echo ( $p_default_rel_type == BUG_DEPENDANT ? ' selected' : '' ) ?>><?php echo lang_get( 'dependant_on' ) ?></option>
 <option value="<?php echo BUG_BLOCKS ?>" <?php echo ( $p_default_rel_type == BUG_BLOCKS ? ' selected' : '' ) ?>><?php echo lang_get( 'blocks' ) ?></option>
mantisbt-filter-relationsship-against_19_2.patch (11,571 bytes)   
Index: view_all_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_set.php,v
retrieving revision 1.38
diff -u -r1.38 view_all_set.php
--- view_all_set.php	28 Oct 2004 00:31:05 -0000	1.38
+++ view_all_set.php	13 Jan 2005 15:34:11 -0000
@@ -146,6 +146,9 @@
 			}
 		}
 	}
+	
+	$f_relationship_type = gpc_get_string( 'relationship_type', 'any' );
+	$f_relationship_bug = gpc_get_string( 'relationship_bug', 0 );
 
 	if ( $f_temp_filter ) {
 		$f_type = 1;
@@ -202,6 +205,9 @@
 	22: $f_show_version
 	23: $f_do_filter_by_date
 	24: $f_custom_field
+	25: $f_relationship_type
+	26: $f_relationship_bug
+	
 */
 	# Set new filter values.  These are stored in a cookie
 	$t_view_all_cookie_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
@@ -270,6 +276,8 @@
 				$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;
+				$t_setting_arr['relationship_type'] = $f_relationship_type;
+				$t_setting_arr['relationship_bug'] = $f_relationship_bug;
 
 				break;
 		# Set the sort order and direction
@@ -302,6 +310,9 @@
 				$t_setting_arr['show_priority']	= array( "any" );
 				$t_setting_arr['fixed_in_version']	= array( "any" );
 				$t_setting_arr['user_monitor'] 		= array( "any" );
+				$t_setting_arr['relationship_type'] = "any";
+				$t_setting_arr['relationship_bug'] = 0;
+				
 
 				$t_custom_fields 		= custom_field_get_ids();
 				$t_custom_fields_data 	= array();
Index: view_filters_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_filters_page.php,v
retrieving revision 1.22
diff -u -r1.22 view_filters_page.php
--- view_filters_page.php	28 Oct 2004 00:31:06 -0000	1.22
+++ view_filters_page.php	13 Jan 2005 15:03:15 -0000
@@ -11,6 +11,7 @@
 	
 	require_once( $t_core_path.'compress_api.php' );
 	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'relationship_api.php' );
 	require_once( $t_core_path.'current_user_api.php' );
 	require_once( $t_core_path.'bug_api.php' );
 	require_once( $t_core_path.'string_api.php' );
@@ -329,13 +330,14 @@
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'show' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'view_status' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
-	<td class="small-caption" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<input type="checkbox" name="do_filter_by_date" <?php 
 			check_checked( $t_filter['do_filter_by_date'], 'on' ); 
 			if ( ON == config_get( 'use_javascript' ) ) { 
 				print "onclick=\"SwitchDateFields();\""; } ?> />
 		<?php echo lang_get( 'use_date_filters' ) ?>
 	</td>
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'bug_relationships' ) ?></td>
 </tr>
 <tr class="row-2">
 	<!-- Number of bugs per page -->
@@ -363,7 +365,7 @@
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 		<input type="text" name="highlight_changed" size="3" maxlength="7" value="<?php echo $t_filter['highlight_changed'] ?>" />
 	</td>
-	<td valign="top" class="left" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td valign="top" class="left" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 	<table cellspacing="0" cellpadding="0">
 	<!-- Start date -->
 	<tr>
@@ -423,6 +425,17 @@
 	</tr>
 	</table>
 	</td>
+	<!-- Relationship -->
+	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
+        <?php 
+            $c_reltype_value = $t_filter['relationship_type'];
+            if (!$c_reltype_value) {
+                $c_reltype_value = "any";
+            }
+            relationship_list_box ($c_reltype_value, "relationship_type", true) ?>
+        <input type="text" name="relationship_bug" size="5" maxlength="10" value="<?php echo $t_filter['relationship_bug'] ?>" />        
+	</td>
+	
 </tr>
 
 <?php
Index: core/filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.64
diff -u -r1.64 filter_api.php
--- core/filter_api.php	19 Nov 2004 13:06:29 -0000	1.64
+++ core/filter_api.php	25 Jan 2005 21:07:49 -0000
@@ -15,6 +15,7 @@
 	require_once( $t_core_dir . 'user_api.php' );
 	require_once( $t_core_dir . 'bug_api.php' );
 	require_once( $t_core_dir . 'collapse_api.php' );
+	require_once( $t_core_dir . 'relationship_api.php' );
 
 	###########################################################################
 	# Filter API
@@ -45,14 +46,15 @@
 	# $p_user_id
 	#   - user id to use as current user when filtering.
 	function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $custom_filter = null, $p_project_id = null, $p_user_id = null ) {
-		$t_bug_table			= config_get( 'mantis_bug_table' );
-		$t_bug_text_table		= config_get( 'mantis_bug_text_table' );
-		$t_bugnote_table		= config_get( 'mantis_bugnote_table' );
-		$t_custom_field_string_table	= config_get( 'mantis_custom_field_string_table' );
-		$t_bugnote_text_table	= config_get( 'mantis_bugnote_text_table' );
-		$t_project_table		= config_get( 'mantis_project_table' );
-		$t_bug_monitor_table	= config_get( 'mantis_bug_monitor_table' );
-		$t_limit_reporters		= config_get( 'limit_reporters' );
+	    $t_bug_table			    = config_get( 'mantis_bug_table' );
+		$t_bug_text_table		    = config_get( 'mantis_bug_text_table' );
+		$t_bugnote_table		    = config_get( 'mantis_bugnote_table' );
+		$t_custom_field_string_table= config_get( 'mantis_custom_field_string_table' );
+		$t_bugnote_text_table	    = config_get( 'mantis_bugnote_text_table' );
+		$t_project_table		    = config_get( 'mantis_project_table' );
+		$t_bug_monitor_table	    = config_get( 'mantis_bug_monitor_table' );
+		$t_bug_relationship_table	= config_get( 'mantis_bug_relationship_table' );
+		$t_limit_reporters		    = config_get( 'limit_reporters' );
 		$t_report_bug_threshold		= config_get( 'report_bug_threshold' );
 
 		$t_current_user_id = auth_get_current_user_id();
@@ -447,6 +449,25 @@
 			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
 		}
 
+		# bug relationship
+		$t_any_found = false;
+		$c_rel_type = $t_filter['relationship_type'];
+		$c_rel_bug = $t_filter['relationship_bug'];
+		if ( 'any' == $c_rel_type || '' == $c_rel_bug) {
+			$t_any_found = true;
+		}
+		if ( !$t_any_found ) {
+		    # use the complementary type
+		    $c_rel_type = relationship_get_complementary_type($c_rel_type);
+			$t_clauses = array();
+			$t_table_name = 'relationship';
+			array_push( $t_from_clauses, $t_bug_relationship_table );
+			array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" );
+			
+ 			array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
+			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
+		}
+
 		# custom field filters
 		if( ON == config_get( 'filter_by_custom_fields' ) ) {
 			# custom field filtering
@@ -1263,9 +1284,13 @@
 			<td class="small-caption" valign="top">
 				<a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>"><?php PRINT lang_get( 'changed' ) ?>:</a>
 			</td>
-			<td class="small-caption" valign="top" colspan="4">
+			<td class="small-caption" valign="top" colspan="2">
 				<a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a>
 			</td>
+			<td class="small-caption" valign="top" colspan="2">
+				<a href="<?php PRINT $t_filters_url . 'relationship_type'; ?>"><?php PRINT lang_get( 'bug_relationships' ) ?>:</a>
+			</td>
+
 			<?php 
 				if ( $t_custom_cols > $t_filter_cols ) {
 					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
@@ -1290,7 +1315,7 @@
 			<td class="small-caption" valign="top">
 				<?php PRINT $t_filter['highlight_changed']; ?>
 			</td>
-			<td class="small-caption" valign="top" colspan="4">
+			<td class="small-caption" valign="top" colspan="2">
 							<?php
 							if ( 'on' == $t_filter['do_filter_by_date'] ) {
 								$t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY );
@@ -1332,6 +1357,25 @@
 							}
 							?>
 			</td>
+
+			<td class="small-caption" valign="top" colspan="2">
+							<?php
+								$t_output = '';
+								$t_any_found = false;
+								$c_rel_type = $t_filter['relationship_type'];
+								$c_rel_bug = $t_filter['relationship_bug'];
+								if ( '' == $c_rel_type || 0 == $c_rel_bug ) {
+									PRINT lang_get( 'any' );
+								} else {
+								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
+								}
+
+							?>
+			</td>
+
+
+
+
 			<?php 
 				if ( $t_custom_cols > $t_filter_cols ) {
 					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
@@ -1849,7 +1893,7 @@
 									  'show_version' => 'string',
 									  'hide_status' => 'int',
 									  'fixed_in_version' => 'string',
-									  'user_monitor' => 'int' );
+									  'user_monitor' => 'int');
 		foreach( $t_multi_select_list as $t_multi_field_name => $t_multi_field_type ) {
 			if ( !isset( $p_filter_arr[$t_multi_field_name] ) ) {
 				if ( 'hide_status' == $t_multi_field_name ) {
@@ -1894,7 +1938,6 @@
 			}
 		}
 		# all of our filter values are now guaranteed to be there, and correct.
-
 		return $p_filter_arr;
 	}
 ?>
Index: core/relationship_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v
retrieving revision 1.27
diff -u -r1.27 relationship_api.php
--- core/relationship_api.php	30 Nov 2004 12:17:04 -0000	1.27
+++ core/relationship_api.php	13 Jan 2005 14:16:02 -0000
@@ -678,9 +678,18 @@
 
  	# --------------------
  	# print HTML relationship listbox
-	function relationship_list_box( $p_default_rel_type = -1 ) {
+	function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false) {
+?>
+<select name="<?php echo $p_select_name?>">
+<?php if ($p_include_any) { ?>
+<option value="any" <?php echo ( $p_default_rel_type == "any" ? ' selected' : '' ) ?>><?php echo lang_get( 'any' ) ?></option>
+<option value="any"></option>
+<?php 
+    } 
+    if ($p_default_rel_type == "any") {
+        $p_default_rel_type = -100;
+    }
 ?>
-<select name="rel_type">
 <option value="<?php echo BUG_RELATED ?>"<?php echo ( $p_default_rel_type == BUG_RELATED ? ' selected' : '' ) ?>><?php echo lang_get( 'related_to' ) ?></option>
 <option value="<?php echo BUG_DEPENDANT ?>"<?php echo ( $p_default_rel_type == BUG_DEPENDANT ? ' selected' : '' ) ?>><?php echo lang_get( 'dependant_on' ) ?></option>
 <option value="<?php echo BUG_BLOCKS ?>" <?php echo ( $p_default_rel_type == BUG_BLOCKS ? ' selected' : '' ) ?>><?php echo lang_get( 'blocks' ) ?></option>
filter_by_relation_cvs_head_02142005.patch (9,999 bytes)   
? config_inc_old.php
? error.log
? core/filter_api.phpx
Index: view_all_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_set.php,v
retrieving revision 1.44
diff -u -r1.44 view_all_set.php
--- view_all_set.php	8 Feb 2005 16:11:19 -0000	1.44
+++ view_all_set.php	14 Feb 2005 19:04:37 -0000
@@ -151,6 +151,9 @@
 			}
 		}
 	}
+	
+	$f_relationship_type = gpc_get_string( 'relationship_type', 'any' );
+	$f_relationship_bug = gpc_get_string( 'relationship_bug', 0 );
 
 	if ( $f_temp_filter ) {
 		$f_type = 1;
@@ -218,6 +221,9 @@
 	22: $f_show_version
 	23: $f_do_filter_by_date
 	24: $f_custom_field
+	25: $f_relationship_type
+	26: $f_relationship_bug
+	
 */
 	# Set new filter values.  These are stored in a cookie
 	$t_view_all_cookie_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
@@ -285,6 +291,8 @@
 				$t_setting_arr['view_state'] = $f_view_state;
 				$t_setting_arr['custom_fields'] = $f_custom_fields_data;
 				$t_setting_arr['sticky_issues'] = $f_sticky_issues;
+				$t_setting_arr['relationship_type'] = $f_relationship_type;
+				$t_setting_arr['relationship_bug'] = $f_relationship_bug;
 
 				break;
 		# Set the sort order and direction
@@ -317,6 +325,8 @@
 				$t_setting_arr['show_priority']	= array( '[any]' );
 				$t_setting_arr['fixed_in_version']	= array( '[any]' );
 				$t_setting_arr['user_monitor'] 		= array( '[any]' );
+				$t_setting_arr['relationship_type'] = "any";
+				$t_setting_arr['relationship_bug'] = 0;
 
 				$t_custom_fields 		= custom_field_get_ids();
 				$t_custom_fields_data 	= array();
Index: view_filters_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_filters_page.php,v
retrieving revision 1.27
diff -u -r1.27 view_filters_page.php
--- view_filters_page.php	7 Feb 2005 22:04:10 -0000	1.27
+++ view_filters_page.php	14 Feb 2005 19:27:20 -0000
@@ -11,6 +11,7 @@
 	
 	require_once( $t_core_path.'compress_api.php' );
 	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'relationship_api.php' );
 	require_once( $t_core_path.'current_user_api.php' );
 	require_once( $t_core_path.'bug_api.php' );
 	require_once( $t_core_path.'string_api.php' );
@@ -248,13 +249,14 @@
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'view_status' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'sticky' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
-	<td class="small-caption" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<input type="checkbox" name="do_filter_by_date" <?php 
 			check_checked( $t_filter['do_filter_by_date'], 'on' ); 
 			if ( ON == config_get( 'use_javascript' ) ) { 
 				print "onclick=\"SwitchDateFields();\""; } ?> />
 		<?php echo lang_get( 'use_date_filters' ) ?>
 	</td>
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'bug_relationships' ) ?></td>
 </tr>
 <tr class="row-2">
 	<!-- Number of bugs per page -->
@@ -273,9 +275,18 @@
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 		<?php print_filter_highlight_changed(); ?>
 	</td>
-	<td valign="top" class="left" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td valign="top" class="left" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<?php print_filter_do_filter_by_date( true ); # hide checkbox as it's already been shown ?>
 	</td>
+	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
+        <?php 
+            $c_reltype_value = $t_filter['relationship_type'];
+            if (!$c_reltype_value) {
+                $c_reltype_value = "any";
+            }
+            relationship_list_box ($c_reltype_value, "relationship_type", true) ?>
+        <input type="text" name="relationship_bug" size="5" maxlength="10" value="<?php echo $t_filter['relationship_bug'] ?>" />        
+	</td>
 </tr>
 
 <?php
Index: core/filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.81
diff -u -r1.81 filter_api.php
--- core/filter_api.php	8 Feb 2005 16:11:23 -0000	1.81
+++ core/filter_api.php	14 Feb 2005 20:16:01 -0000
@@ -15,6 +15,7 @@
 	require_once( $t_core_dir . 'user_api.php' );
 	require_once( $t_core_dir . 'bug_api.php' );
 	require_once( $t_core_dir . 'collapse_api.php' );
+	require_once( $t_core_dir . 'relationship_api.php' );
 
 	###########################################################################
 	# Filter API
@@ -55,6 +56,7 @@
 		$t_project_table		= config_get( 'mantis_project_table' );
 		$t_bug_monitor_table	= config_get( 'mantis_bug_monitor_table' );
 		$t_limit_reporters		= config_get( 'limit_reporters' );
+		$t_bug_relationship_table	= config_get( 'mantis_bug_relationship_table' );
 		$t_report_bug_threshold		= config_get( 'report_bug_threshold' );
 
 		$t_current_user_id = auth_get_current_user_id();
@@ -492,6 +494,28 @@
 				array_push( $t_where_clauses, "( $t_table_name.user_id=$t_clauses[0] )" );
 			}
 		}
+		# bug relationship
+		$t_any_found = false;
+		$c_rel_type = $t_filter['relationship_type'];
+		$c_rel_bug = $t_filter['relationship_bug'];
+		if ( 'any' == $c_rel_type || '' == $c_rel_bug) {
+			$t_any_found = true;
+		}
+		echo ("relation type $c_rel_type");
+		if ( !$t_any_found ) {
+		    # use the complementary type
+		    $c_rel_type = relationship_get_complementary_type($c_rel_type);
+			$t_clauses = array();
+			$t_table_name = 'relationship';
+			array_push( $t_from_clauses, $t_bug_relationship_table );
+			array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" );
+			// get reverse relationships
+			if ( $c_rel_type == 1 ) array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name"."2 ON $t_table_name"."2.source_bug_id = $t_bug_table.id" );
+ 			array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
+ 			// get reverse relationships
+			if ( $c_rel_type == 1 ) array_push( $t_clauses, "($t_table_name"."2.relationship_type='$c_rel_type' AND $t_table_name"."2.destination_bug_id='$c_rel_bug')" );
+			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
+		}
 
 		# custom field filters
 		if( ON == config_get( 'filter_by_custom_fields' ) ) {
@@ -1375,9 +1399,12 @@
 			<td class="small-caption" valign="top">
 				<a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>" id="highlight_changed_filter"><?php PRINT lang_get( 'changed' ) ?>:</a>
 			</td>
-			<td class="small-caption" valign="top" colspan="4">
+			<td class="small-caption" valign="top" colspan="2">
 				<a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>" id="do_filter_by_date_filter"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a>
 			</td>
+			<td class="small-caption" valign="top" colspan="2">
+				<a href="<?php PRINT $t_filters_url . 'relationship_type'; ?>"><?php PRINT lang_get( 'bug_relationships' ) ?>:</a>
+			</td>
 		</tr>
 		<tr class="row-1">
 			<td class="small-caption" valign="top" id="per_page_filter_target">
@@ -1404,7 +1431,7 @@
 				<?php PRINT $t_filter['highlight_changed']; ?>
 				<input type="hidden" name="highlight_changed" value="<?php echo $t_filter['highlight_changed'];?>" />
 			</td>
-			<td class="small-caption" valign="top" colspan="4" id="do_filter_by_date_filter_target">
+			<td class="small-caption" valign="top" colspan="2" id="do_filter_by_date_filter_target">
 							<?php
 							if ( 'on' == $t_filter['do_filter_by_date'] ) {
 								?>
@@ -1455,6 +1482,30 @@
 							}
 							?>
 			</td>
+
+			<td class="small-caption" valign="top" colspan="2">
+							<?php
+								$t_output = '';
+								$t_any_found = false;
+								$c_rel_type = $t_filter['relationship_type'];
+								$c_rel_bug = $t_filter['relationship_bug'];
+								if ( '' == $c_rel_type || 0 == $c_rel_bug ) {
+									PRINT lang_get( 'any' );
+								} else {
+								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
+								}
+
+							?>
+			</td>
+
+
+
+
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 		<?php
 
Index: core/relationship_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v
retrieving revision 1.29
diff -u -r1.29 relationship_api.php
--- core/relationship_api.php	18 Dec 2004 09:35:21 -0000	1.29
+++ core/relationship_api.php	14 Feb 2005 19:05:33 -0000
@@ -682,7 +682,17 @@
 
  	# --------------------
  	# print HTML relationship listbox
-	function relationship_list_box( $p_default_rel_type = -1 ) {
+	function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false) {
+?>
+<select name="<?php echo $p_select_name?>">
+<?php if ($p_include_any) { ?>
+<option value="any" <?php echo ( $p_default_rel_type == "any" ? ' selected' : '' ) ?>><?php echo lang_get( 'any' ) ?></option>
+<option value="any"></option>
+<?php 
+    } 
+    if ($p_default_rel_type == "any") {
+        $p_default_rel_type = -100;
+    }
 ?>
 <select name="rel_type">
 <option value="<?php echo BUG_RELATED ?>"<?php echo ( $p_default_rel_type == BUG_RELATED ? ' selected' : '' ) ?>><?php echo lang_get( 'related_to' ) ?></option>
filter_by_relation_cvs_head_02152005.patch (10,401 bytes)   
? config_inc_old.php
? error.log
? core/filter_api.phpx
Index: view_all_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_set.php,v
retrieving revision 1.45
diff -u -r1.45 view_all_set.php
--- view_all_set.php	12 Feb 2005 20:01:08 -0000	1.45
+++ view_all_set.php	15 Feb 2005 15:29:28 -0000
@@ -151,6 +151,9 @@
 			}
 		}
 	}
+	
+	$f_relationship_type = gpc_get_string( 'relationship_type', 'any' );
+	$f_relationship_bug = gpc_get_string( 'relationship_bug', 0 );
 
 	if ( $f_temp_filter ) {
 		$f_type = 1;
@@ -218,6 +221,9 @@
 	22: $f_show_version
 	23: $f_do_filter_by_date
 	24: $f_custom_field
+	25: $f_relationship_type
+	26: $f_relationship_bug
+	
 */
 	# Set new filter values.  These are stored in a cookie
 	$t_view_all_cookie_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
@@ -285,6 +291,8 @@
 				$t_setting_arr['view_state'] = $f_view_state;
 				$t_setting_arr['custom_fields'] = $f_custom_fields_data;
 				$t_setting_arr['sticky_issues'] = $f_sticky_issues;
+				$t_setting_arr['relationship_type'] = $f_relationship_type;
+				$t_setting_arr['relationship_bug'] = $f_relationship_bug;
 
 				break;
 		# Set the sort order and direction
@@ -317,6 +325,8 @@
 				$t_setting_arr['show_priority']	= array( '[any]' );
 				$t_setting_arr['fixed_in_version']	= array( '[any]' );
 				$t_setting_arr['user_monitor'] 		= array( '[any]' );
+				$t_setting_arr['relationship_type'] = "any";
+				$t_setting_arr['relationship_bug'] = 0;
 
 				$t_custom_fields 		= custom_field_get_ids();
 				$t_custom_fields_data 	= array();
Index: view_filters_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_filters_page.php,v
retrieving revision 1.28
diff -u -r1.28 view_filters_page.php
--- view_filters_page.php	12 Feb 2005 20:01:08 -0000	1.28
+++ view_filters_page.php	15 Feb 2005 17:13:27 -0000
@@ -11,6 +11,7 @@
 
 	require_once( $t_core_path.'compress_api.php' );
 	require_once( $t_core_path.'filter_api.php' );
+	require_once( $t_core_path.'relationship_api.php' );
 	require_once( $t_core_path.'current_user_api.php' );
 	require_once( $t_core_path.'bug_api.php' );
 	require_once( $t_core_path.'string_api.php' );
@@ -248,13 +249,14 @@
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'view_status' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'sticky' ) ?></td>
 	<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
-	<td class="small-caption" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<input type="checkbox" name="do_filter_by_date" <?php
 			check_checked( $t_filter['do_filter_by_date'], 'on' );
 			if ( ON == config_get( 'use_javascript' ) ) {
 				print "onclick=\"SwitchDateFields();\""; } ?> />
 		<?php echo lang_get( 'use_date_filters' ) ?>
 	</td>
+	<td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'bug_relationships' ) ?></td>
 </tr>
 <tr class="row-2">
 	<!-- Number of bugs per page -->
@@ -273,9 +275,12 @@
 	<td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 		<?php print_filter_highlight_changed(); ?>
 	</td>
-	<td valign="top" class="left" colspan="<?php echo ( 4 * $t_custom_cols ); ?>">
+	<td valign="top" class="left" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 		<?php print_filter_do_filter_by_date( true ); # hide checkbox as it's already been shown ?>
 	</td>
+	<td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
+        <?php print_filter_relationship_type(); ?>
+	</td>
 </tr>
 
 <?php
Index: core/filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.84
diff -u -r1.84 filter_api.php
--- core/filter_api.php	13 Feb 2005 21:36:37 -0000	1.84
+++ core/filter_api.php	15 Feb 2005 17:13:19 -0000
@@ -15,6 +15,7 @@
 	require_once( $t_core_dir . 'user_api.php' );
 	require_once( $t_core_dir . 'bug_api.php' );
 	require_once( $t_core_dir . 'collapse_api.php' );
+	require_once( $t_core_dir . 'relationship_api.php' );
 
 	###########################################################################
 	# Filter API
@@ -55,6 +56,7 @@
 		$t_project_table		= config_get( 'mantis_project_table' );
 		$t_bug_monitor_table	= config_get( 'mantis_bug_monitor_table' );
 		$t_limit_reporters		= config_get( 'limit_reporters' );
+		$t_bug_relationship_table	= config_get( 'mantis_bug_relationship_table' );
 		$t_report_bug_threshold		= config_get( 'report_bug_threshold' );
 
 		$t_current_user_id = auth_get_current_user_id();
@@ -507,6 +509,28 @@
 				array_push( $t_where_clauses, "( $t_table_name.user_id=$t_clauses[0] )" );
 			}
 		}
+		# bug relationship
+		$t_any_found = false;
+		$c_rel_type = $t_filter['relationship_type'];
+		$c_rel_bug = $t_filter['relationship_bug'];
+		if ( 'any' == $c_rel_type || '' == $c_rel_bug) {
+			$t_any_found = true;
+		}
+		echo ("relation type $c_rel_type");
+		if ( !$t_any_found ) {
+		    # use the complementary type
+		    $c_rel_type = relationship_get_complementary_type($c_rel_type);
+			$t_clauses = array();
+			$t_table_name = 'relationship';
+			array_push( $t_from_clauses, $t_bug_relationship_table );
+			array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" );
+			// get reverse relationships
+			if ( $c_rel_type == 1 ) array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table as $t_table_name"."2 ON $t_table_name"."2.source_bug_id = $t_bug_table.id" );
+ 			array_push( $t_clauses, "($t_table_name.relationship_type='$c_rel_type' AND $t_table_name.source_bug_id='$c_rel_bug')" );
+ 			// get reverse relationships
+			if ( $c_rel_type == 1 ) array_push( $t_clauses, "($t_table_name"."2.relationship_type='$c_rel_type' AND $t_table_name"."2.destination_bug_id='$c_rel_bug')" );
+			array_push( $t_where_clauses, '('. implode( ' OR ', $t_clauses ) .')' );
+		}
 
 		# custom field filters
 		if( ON == config_get( 'filter_by_custom_fields' ) ) {
@@ -1389,9 +1413,12 @@
 			<td class="small-caption" valign="top">
 				<a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>" id="highlight_changed_filter"><?php PRINT lang_get( 'changed' ) ?>:</a>
 			</td>
-			<td class="small-caption" valign="top" colspan="4">
+			<td class="small-caption" valign="top" colspan="2">
 				<a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>" id="do_filter_by_date_filter"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a>
 			</td>
+			<td class="small-caption" valign="top" colspan="2">
+				<a href="<?php PRINT $t_filters_url . 'relationship_type'; ?>" id="relationship_type_filter"><?php PRINT lang_get( 'bug_relationships' ) ?>:</a>
+			</td>
 		</tr>
 		<tr class="row-1">
 			<td class="small-caption" valign="top" id="per_page_filter_target">
@@ -1418,7 +1445,7 @@
 				<?php PRINT $t_filter['highlight_changed']; ?>
 				<input type="hidden" name="highlight_changed" value="<?php echo $t_filter['highlight_changed'];?>" />
 			</td>
-			<td class="small-caption" valign="top" colspan="4" id="do_filter_by_date_filter_target">
+			<td class="small-caption" valign="top" colspan="2" id="do_filter_by_date_filter_target">
 							<?php
 							if ( 'on' == $t_filter['do_filter_by_date'] ) {
 								?>
@@ -1469,6 +1496,30 @@
 							}
 							?>
 			</td>
+
+			<td class="small-caption" valign="top" colspan="2" id="relationship_type_filter_target">
+							<?php
+								$t_output = '';
+								$t_any_found = false;
+								$c_rel_type = $t_filter['relationship_type'];
+								$c_rel_bug = $t_filter['relationship_bug'];
+								if ( '' == $c_rel_type || 0 == $c_rel_bug ) {
+									PRINT lang_get( 'any' );
+								} else {
+								    PRINT relationship_get_description_for_history ($c_rel_type) . ' ' . $c_rel_bug;
+								}
+
+							?>
+			</td>
+
+
+
+
+			<?php 
+				if ( $t_custom_cols > $t_filter_cols ) {
+					echo '<td colspan="' . ($t_custom_cols - $t_filter_cols) . '">&nbsp;</td>';
+				}
+			?>
 		</tr>
 		<?php
 
@@ -2385,6 +2436,18 @@
 		<?php
 	}
 
+	function print_filter_relationship_type(){
+		global $t_filter;
+		$c_reltype_value = $t_filter['relationship_type'];
+		if (!$c_reltype_value) {
+			$c_reltype_value = "any";
+		}
+		relationship_list_box ($c_reltype_value, "relationship_type", true); ?>
+		<input type="text" name="relationship_bug" size="5" maxlength="10" value="<?php echo $t_filter['relationship_bug']?>" />
+		<?php
+
+	}
+
 	function print_filter_custom_field($p_field_id){
 		global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier;
 
Index: core/relationship_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v
retrieving revision 1.29
diff -u -r1.29 relationship_api.php
--- core/relationship_api.php	18 Dec 2004 09:35:21 -0000	1.29
+++ core/relationship_api.php	14 Feb 2005 19:05:33 -0000
@@ -682,7 +682,17 @@
 
  	# --------------------
  	# print HTML relationship listbox
-	function relationship_list_box( $p_default_rel_type = -1 ) {
+	function relationship_list_box( $p_default_rel_type = -1, $p_select_name = "rel_type", $p_include_any = false) {
+?>
+<select name="<?php echo $p_select_name?>">
+<?php if ($p_include_any) { ?>
+<option value="any" <?php echo ( $p_default_rel_type == "any" ? ' selected' : '' ) ?>><?php echo lang_get( 'any' ) ?></option>
+<option value="any"></option>
+<?php 
+    } 
+    if ($p_default_rel_type == "any") {
+        $p_default_rel_type = -100;
+    }
 ?>
 <select name="rel_type">
 <option value="<?php echo BUG_RELATED ?>"<?php echo ( $p_default_rel_type == BUG_RELATED ? ' selected' : '' ) ?>><?php echo lang_get( 'related_to' ) ?></option>

Relationships

child of 0004937 closedvboctor Mantis 1.0.0a1 Release 

Activities

johnwebbcole

johnwebbcole

2005-01-11 14:46

reporter   ~0008939

This would be a very nice feature. This would let us export issues related to a 'release' issue.

ralfiii

ralfiii

2005-01-11 16:29

reporter   ~0008947

This could also solve issue 0004617

pero

pero

2005-01-13 10:31

reporter   ~0009003

I attached a patch that implements this feature.

It was really hard to find all the places I had to make changes. So I am not 100% sure that I did not introduce some side-effects.
IMHO the source-base rellay needs some major refactoring...

Anyway, some implementation details:

  • i18n: I reused the $s_bug_relationships entry, becaus I was too lazy to introduce a new one that reads "Relationship" (w/o "s") ;)
  • from the source I guess that in the backend nearly every filter may occur multiple times; my implementation can only handle one relationship; fixing this should be easy though
  • this patch does not handle '$g_enable_relationship' properly; it is assumed to be true all the time

The patch is against the current HEAD. If there are any questions - ask them anytime!

johnwebbcole

johnwebbcole

2005-01-25 15:51

reporter   ~0009102

Has anyone taken a look at the patch to see if it can be added to the HEAD? This would really be a powerful feature to add, as it would provide a way to search for and organize issues by relationships.

It would also allow you to export a list of related issues to excel for PHB's

pero

pero

2005-01-25 16:14

reporter   ~0009103

I fixed a small display bug in IE and attached a patch against the branch RELEASE_0_19_2_20041211. The first patch is not correct, since it contains files of the 19.2-branch... Sorry for that. The new one works (against 19.2)

We have this patch "in production" here ever since and had no surprises ;)

Let me know if I can help out in any way (porting to HEAD or fixing issues with it)

johnwebbcole

johnwebbcole

2005-02-03 10:52

reporter   ~0009188

Has this been ported to CVS HEAD?

pero

pero

2005-02-03 11:29

reporter   ~0009190

I don't think so. Currently I don't have the time to do so. We are running 0.19.2 with the patch applied. No problems until now.

I might have the time to port it in say about 2 weeks, but don't count on that. I haven't had a look into the current head yet - I think there are lots of changes making the porting of patch not that easy.

johnwebbcole

johnwebbcole

2005-02-14 15:22

reporter   ~0009309

I've ported the patch from 19.2 to todays CVS head. I also modified the query so that forward and reverse relationships are shown for 'related to' (type 1) relationships. It seems that our database has them both ways, yet the bug view shows the correctly.

I'm not sure if I did this correctly, but it seems to work :-)

Also, the DHTML filter view doesn't work for the relationships, it goes to the Advanced Filters page, but it works.

johnwebbcole

johnwebbcole

2005-02-15 12:36

reporter   ~0009325

I've gotten the relationship filter to work with the DHTML filters. However, it will not remember the relationship filter if you select another filter, so you have to apply it last. I haven't figured out how the others are doing that yet.

Also, note that there was a schema change between yesterday and today, so if you upgrade to the CVS head, you'll need to run the admin upgrade to keep everything working.

I've added the patch against the current CVS head filter_by_relation_cvs_head_02152005.patch

thraxisp

thraxisp

2005-02-18 12:58

reporter   ~0009337

Fixed in CVS.