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 $ # -------------------------------------------------------- ?> @@ -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 @@ - + - + - + + +
/> + - + - + - + @@ -215,13 +270,23 @@ - + + + - + - + - - + + - - - + + + - - + /> + - + - - - - - + - + - - + + + + + + + + + + + + +
+ : + + "; + print_month_option_list( $t_filter['start_month'] ); + print "\n"; + } + if ( strcasecmp( $t_char, "D" ) == 0 ) { + print "\n"; + } + if ( strcasecmp( $t_char, "Y" ) == 0 ) { + print "\n"; + } + } + ?> +
+ : + + "; + print_month_option_list( $t_filter['end_month'] ); + print "\n"; + } + if ( strcasecmp( $t_char, "D" ) == 0 ) { + print "\n"; + } + if ( strcasecmp( $t_char, "Y" ) == 0 ) { + print "\n"; + } + } + ?> +
+ + + + + + '; - 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 ''; } else { echo ' '; } 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 @@ ?>
-
- + + '; @@ -837,27 +830,33 @@ > - : + : - : + : - : + : - : + : - : + : - : + : + + $t_filter_cols ) { + echo ' '; + } + ?> - + - - - + - - - + - - - + - - - + - - - + - - + $t_filter_cols ) { + echo ' '; + } + ?> > - : + : - : + : - : + : - : + : - : + : - : - + : + - + - - - - + + - - - + - - - + - - - + - - - - - - '; - } 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; - } - } - ?> - + + '; + } 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; + } + } + ?> + > - : + : - : + : - : + : - : + : - - : + + : + + $t_filter_cols ) { + echo ' '; + } + ?> - + - - + - - - - - + - + - - - - - - - - + + + + + + + + + $t_filter_cols ) { + echo ' '; + } + ?> '; - $t_fields .= ''; + $t_fields .= ''; $t_fields .= string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) ); $t_fields .= ' '; } $t_output = ''; $t_any_found = false; - $t_values .= ' ' ; + $t_values .= ' ' ; 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 .= ''; } if ( true == $t_any_found ) { @@ -1511,29 +1485,17 @@ ?> - + : + ?>:
- - - $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; - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /> - - - - - - - /> - - - - - - - - - - - - - - -
- : - - "; - print_month_option_list( $t_filter['start_month'] ); - print "\n"; - } - if ( strcasecmp( $t_char, "D" ) == 0 ) { - print "\n"; - } - if ( strcasecmp( $t_char, "Y" ) == 0 ) { - print "\n"; - } - } - ?> -
- : - - "; - print_month_option_list( $t_filter['end_month'] ); - print "\n"; - } - if ( strcasecmp( $t_char, "D" ) == 0 ) { - print "\n"; - } - if ( strcasecmp( $t_char, "Y" ) == 0 ) { - print "\n"; - } - } - ?> -
- - - unknown custom filter (custom ) - - '; - echo ''; - # 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 ''; - } - foreach( $t_accessible_custom_fields_values[$j] as $t_item ) { - if ( ( strtolower( $t_item ) != "[any]" ) && ( strtolower( $t_item ) != "[none]" ) && ( trim( $t_item ) != "" ) ) { - echo '' . "\n"; - } - } - echo ''; - } - - } - ?> 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( ' (%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) { +?> +