. /** * View Filters Page * * @package MantisBT * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org * * @uses core.php * @uses access_api.php * @uses authentication_api.php * @uses compress_api.php * @uses config_api.php * @uses constant_inc.php * @uses current_user_api.php * @uses custom_field_api.php * @uses filter_api.php * @uses filter_constants_inc.php * @uses gpc_api.php * @uses helper_api.php * @uses html_api.php * @uses lang_api.php * @uses print_api.php * @uses string_api.php * @uses version_api.php */ require_once( 'core.php' ); require_api( 'access_api.php' ); require_api( 'authentication_api.php' ); require_api( 'compress_api.php' ); require_api( 'config_api.php' ); require_api( 'constant_inc.php' ); require_api( 'current_user_api.php' ); require_api( 'custom_field_api.php' ); require_api( 'filter_api.php' ); require_api( 'filter_constants_inc.php' ); require_api( 'gpc_api.php' ); require_api( 'helper_api.php' ); require_api( 'html_api.php' ); require_api( 'lang_api.php' ); require_api( 'print_api.php' ); require_api( 'string_api.php' ); require_api( 'version_api.php' ); auth_ensure_user_authenticated(); compress_enable(); html_page_top(); $t_filter = current_user_get_bug_filter(); filter_init( $t_filter ); $t_target_field = rtrim( gpc_get_string( 'target_field', '' ), '[]' ); if( !isset( $t_filter[$t_target_field] ) ) { $t_target_field = ''; } # @todo thraxisp - could this be replaced by a call to filter_draw_selection_area2 $t_project_id = helper_get_current_project(); $t_current_user_access_level = current_user_get_access_level(); $t_accessible_custom_fields_ids = array(); $t_accessible_custom_fields_names = array(); $t_accessible_custom_fields_type = array() ; $t_accessible_custom_fields_values = array(); $t_filter_cols = config_get( 'filter_custom_fields_per_row' ); $t_custom_cols = 1; $t_custom_rows = 0; #get valid target fields $t_fields = helper_get_columns_to_view(); $t_n_fields = count( $t_fields ); for( $i=0; $i < $t_n_fields; $i++ ) { if( in_array( $t_fields[$i], array( 'selection', 'edit', 'bugnotes_count', 'attachment_count' ) ) ) { unset( $t_fields[$i] ); } } if( ON == config_get( 'filter_by_custom_fields' ) ) { $t_custom_cols = $t_filter_cols; $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); foreach ( $t_custom_fields as $t_cfid ) { $t_field_info = custom_field_cache_row( $t_cfid, true ); if( $t_field_info['access_level_r'] <= $t_current_user_access_level && $t_field_info['filter_by'] ) { $t_accessible_custom_fields_ids[] = $t_cfid; $t_accessible_custom_fields_names[] = $t_field_info['name']; $t_accessible_custom_fields_types[] = $t_field_info['type']; $t_accessible_custom_fields_values[] = custom_field_distinct_values( $t_field_info, $t_project_id ); $t_fields[] = 'custom_' . $t_field_info['name']; } } if( count( $t_accessible_custom_fields_ids ) > 0 ) { $t_per_row = config_get( 'filter_custom_fields_per_row' ); $t_custom_rows = ceil( count( $t_accessible_custom_fields_ids ) / $t_per_row ); } } if( !in_array( $t_target_field, $t_fields ) ) { $t_target_field = ''; } $f_for_screen = gpc_get_bool( 'for_screen', true ); $t_action = 'view_all_set.php?f=3'; if( $f_for_screen == false ) { $t_action = 'view_all_set.php'; } $f_default_view_type = 'simple'; if( ADVANCED_DEFAULT == config_get( 'view_filters' ) ) { $f_default_view_type = 'advanced'; } $f_view_type = gpc_get_string( 'view_type', $f_default_view_type ); if( ADVANCED_ONLY == config_get( 'view_filters' ) ) { $f_view_type = 'advanced'; } if( SIMPLE_ONLY == config_get( 'view_filters' ) ) { $f_view_type = 'simple'; } if( !in_array( $f_view_type, array( 'simple', 'advanced' ) ) ) { $f_view_type = $f_default_view_type; } $g_select_modifier = ''; if( 'advanced' == $f_view_type ) { $g_select_modifier = ' multiple="multiple" size="10"'; } $t_show_product_version = version_should_show_product_version( $t_project_id ); $t_show_build = $t_show_product_version && ( config_get( 'enable_product_build' ) == ON ); $t_show_tags = access_has_global_level( config_get( 'tag_view_threshold' ) ); ?>
'; print ''; } ?> 0 ) { $t_per_row = config_get( 'filter_custom_fields_per_row' ); $t_num_rows = ceil( count( $t_accessible_custom_fields_ids ) / $t_per_row ); $t_base = 0; for( $i = 0; $i < $t_num_rows; $i++ ) { ?> '; if( isset( $t_accessible_custom_fields_names[$t_base + $j] ) ) { echo string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$t_base + $j] ) ); } else { echo ' '; } echo ''; } ?> '; if( isset( $t_accessible_custom_fields_ids[$t_base + $j] ) ) { print_filter_custom_field( $t_accessible_custom_fields_ids[$t_base + $j] ); } else { echo ' '; } echo ''; } ?> $t_filter_object ) { $t_fields .= ''; $t_row_filters[] = $t_field_name; $t_column++; # wrap at the appropriate column if( $t_column >= $t_filter_cols ) { echo '', $t_fields, ''; echo ''; foreach( $t_row_filters as $t_row_field_name ) { echo ''; } echo ''; $t_fields = ''; $t_row_filters = array(); } } # output any remaining plugin filters if( $t_column > 0 ) { if( $t_column < $t_filter_cols ) { $t_fields .= ''; } echo '', $t_fields, ''; echo ''; foreach( $t_row_filters as $t_row_field_name ) { echo ''; } if( $t_column < $t_filter_cols ) { echo ''; } echo ''; } ?>
       
' . string_display_line( $t_filter_object->title ) . '
'; print_filter_plugin_field( $t_row_field_name, $t_plugin_filters[$t_row_field_name] ); echo '
 
'; print_filter_plugin_field( $t_row_field_name, $t_plugin_filters[$t_row_field_name] ); echo '