Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/view_filters_page.php

f2e824
f2e824
# Mantis - a php based bugtracking system
f2e824
f2e824
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
f2e824
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
f2e824
f2e824
# Mantis is free software: you can redistribute it and/or modify
f2e824
# it under the terms of the GNU General Public License as published by
f2e824
# the Free Software Foundation, either version 2 of the License, or
f2e824
# (at your option) any later version.
f2e824
#
f2e824
# Mantis is distributed in the hope that it will be useful,
f2e824
# but WITHOUT ANY WARRANTY; without even the implied warranty of
f2e824
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f2e824
# GNU General Public License for more details.
f2e824
#
f2e824
# You should have received a copy of the GNU General Public License
f2e824
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
f2e824
f2e824
	#------------------------------
f2e824
	#   $Revision: 2643 $
f2e824
	#     $Author: al $    
f2e824
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $  
f2e824
	#------------------------------
f2e824
?>
f2e824
f2e824
	require_once( 'core.php' );
f2e824
	$t_core_path = config_get( 'core_path' );
f2e824
f2e824
	require_once( $t_core_path.'compress_api.php' );
f2e824
	require_once( $t_core_path.'filter_api.php' );
f2e824
	require_once( $t_core_path.'relationship_api.php' );
f2e824
	require_once( $t_core_path.'current_user_api.php' );
f2e824
	require_once( $t_core_path.'bug_api.php' );
f2e824
	require_once( $t_core_path.'string_api.php' );
f2e824
	require_once( $t_core_path.'date_api.php' );
f2e824
	require_once( $t_core_path.'tag_api.php' );
f2e824
f2e824
	auth_ensure_user_authenticated();
f2e824
f2e824
	compress_enable();
f2e824
f2e824
	html_page_top1();
f2e824
	html_page_top2();
f2e824
f2e824
	$t_target_field = gpc_get_string( 'target_field', '' );
f2e824
f2e824
	if ( ON == config_get( 'use_javascript' ) ) {
f2e824
		?>
f2e824
		<body onload="SetInitialFocus();">
f2e824
f2e824
		<script type="text/javascript" language="JavaScript">
f2e824
		
f2e824
		function SetInitialFocus() {
f2e824
			
f2e824
			global $t_target_field;
f2e824
			if ( $t_target_field ) {
f2e824
				$f_view_type = gpc_get_string( 'view_type', '' );
f2e824
				if ( ( 'hide_status[]' == $t_target_field ) && ( 'advanced' == $f_view_type ) ) {
f2e824
					print "field_to_focus = \"show_status[]\";";
f2e824
				} else {
f2e824
					print "field_to_focus = \"$t_target_field\";";
f2e824
				}
f2e824
			} else {
f2e824
				print "field_to_focus = null;";
f2e824
			}
f2e824
			?>
f2e824
			if ( field_to_focus ) {
f2e824
				eval( "document.filters['" + field_to_focus + "'].focus()" );
f2e824
			}
f2e824
f2e824
			SwitchDateFields();
f2e824
		}
f2e824
f2e824
		function SwitchDateFields() {
f2e824
		    // All fields need to be enabled to go back to the script
f2e824
			document.filters.start_month.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
			document.filters.start_day.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
			document.filters.start_year.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
			document.filters.end_month.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
			document.filters.end_day.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
			document.filters.end_year.disabled = ! document.filters.do_filter_by_date.checked;
f2e824
f2e824
		    return true;
f2e824
		}
f2e824
		// -->
f2e824
		</script>
f2e824
f2e824
		
f2e824
	}
f2e824
f2e824
	# @@@ thraxisp - could this be replaced by a call to filter_draw_selection_area2
f2e824
f2e824
	$t_filter = current_user_get_bug_filter();
f2e824
	$t_filter = filter_ensure_valid_filter( $t_filter );
f2e824
	$t_project_id = helper_get_current_project();
f2e824
f2e824
	$t_current_user_access_level = current_user_get_access_level();
f2e824
	$t_accessible_custom_fields_ids = array();
f2e824
	$t_accessible_custom_fields_names = array();
f2e824
	$t_accessible_custom_fields_type = array() ;
f2e824
	$t_accessible_custom_fields_values = array();
f2e824
	$t_filter_cols = config_get( 'filter_custom_fields_per_row' );
f2e824
	$t_custom_cols = 1;
f2e824
	$t_custom_rows = 0;
f2e824
f2e824
	#get valid target fields
f2e824
	$t_fields = helper_get_columns_to_view();
f2e824
	$t_n_fields = count( $t_fields );
f2e824
	for ( $i=0; $i < $t_n_fields; $i++ ) {
f2e824
		if ( in_array( $t_fields[$i], array( 'selection', 'edit', 'bugnotes_count', 'attachment' ) ) ) {
f2e824
			unset( $t_fields[$i] );
f2e824
		}
f2e824
	}
f2e824
f2e824
	if ( ON == config_get( 'filter_by_custom_fields' ) ) {
f2e824
		$t_custom_cols = $t_filter_cols;
f2e824
		$t_custom_fields = custom_field_get_linked_ids( $t_project_id );
f2e824
f2e824
		foreach ( $t_custom_fields as $t_cfid ) {
f2e824
			$t_field_info = custom_field_cache_row( $t_cfid, true );
f2e824
			if ( $t_field_info['access_level_r'] <= $t_current_user_access_level ) {
f2e824
				$t_accessible_custom_fields_ids[] = $t_cfid;
f2e824
				$t_accessible_custom_fields_names[] = $t_field_info['name'];
f2e824
				$t_accessible_custom_fields_types[] = $t_field_info['type'];
f2e824
				$t_accessible_custom_fields_values[] = custom_field_distinct_values( $t_cfid, $t_project_id );
f2e824
				$t_fields[] = "custom_" . $t_field_info['name'];
f2e824
			}
f2e824
		}
f2e824
f2e824
		if ( sizeof( $t_accessible_custom_fields_ids ) > 0 ) {
f2e824
			$t_per_row = config_get( 'filter_custom_fields_per_row' );
f2e824
			$t_custom_rows = ceil( sizeof( $t_accessible_custom_fields_ids ) / $t_per_row );
f2e824
		}
f2e824
	}
f2e824
f2e824
	if ( ! in_array( $t_target_field, $t_fields ) ) {
f2e824
		$t_target_field = '';
f2e824
	}
f2e824
	
f2e824
	$f_for_screen = gpc_get_bool( 'for_screen', true );
f2e824
f2e824
	$t_action  = "view_all_set.php?f=3";
f2e824
f2e824
	if ( $f_for_screen == false ) {
f2e824
		$t_action  = "view_all_set.php";
f2e824
	}
f2e824
f2e824
	$f_default_view_type = 'simple';
f2e824
	if ( ADVANCED_DEFAULT == config_get( 'view_filters' ) ) {
f2e824
		$f_default_view_type = 'advanced';
f2e824
	}
f2e824
f2e824
	$f_view_type = gpc_get_string( 'view_type', $f_default_view_type );
f2e824
	if ( ADVANCED_ONLY == config_get( 'view_filters' ) ) {
f2e824
		$f_view_type = 'advanced';
f2e824
	}
f2e824
	if ( SIMPLE_ONLY == config_get( 'view_filters' ) ) {
f2e824
		$f_view_type = 'simple';
f2e824
	}
f2e824
	if ( ! in_array( $f_view_type, array( 'simple', 'advanced' ) ) ) {
f2e824
		$f_view_type = $f_default_view_type;
f2e824
	}	
f2e824
f2e824
	$t_select_modifier = '';
f2e824
	if ( 'advanced' == $f_view_type ) {
f2e824
		$t_select_modifier = 'multiple="multiple" size="10" ';
f2e824
	}
f2e824
f2e824
	$t_show_version = ( ON == config_get( 'show_product_version' ) )
f2e824
			|| ( ( AUTO == config_get( 'show_product_version' ) )
f2e824
						&& ( count( version_get_all_rows_with_subs( $t_project_id ) ) > 0 ) );
f2e824
?>
f2e824

f2e824
<form method="post" name="filters" action="<?php echo $t_action; ?>">
f2e824
<input type="hidden" name="type" value="1" />
f2e824
<input type="hidden" name="view_type" value="<?php PRINT $f_view_type; ?>" />
f2e824
f2e824
	if ( $f_for_screen == false )
f2e824
	{
f2e824
		print "<input type=\"hidden\" name=\"print\" value=\"1\" />";
f2e824
		print "<input type=\"hidden\" name=\"offset\" value=\"0\" />";
f2e824
	}
f2e824
?>
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
		$f_switch_view_link = 'view_filters_page.php?target_field=' . $t_target_field . '&view_type=';
f2e824
f2e824
		if ( ( SIMPLE_ONLY != config_get( 'view_filters' ) ) && ( ADVANCED_ONLY != config_get( 'view_filters' ) ) ) {
f2e824
			if ( 'advanced' == $f_view_type ) {
f2e824
				print_bracket_link( $f_switch_view_link . 'simple', lang_get( 'simple_filters' ) );
f2e824
			} else {
f2e824
				print_bracket_link( $f_switch_view_link . 'advanced', lang_get( 'advanced_filters' ) );
f2e824
			}
f2e824
		}
f2e824
	?>
f2e824
	
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
    
f2e824
    
f2e824
		
f2e824
    
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
	
f2e824
	if ( 'simple' == $f_view_type ) {
f2e824
		echo lang_get( 'hide_status' );
f2e824
	} else {
f2e824
		echo ' ';
f2e824
	}
f2e824
	?>
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
		
f2e824
	
f2e824
		 
f2e824
		 
f2e824
	
f2e824
	
f2e824
	 
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	if ( 'simple' == $f_view_type ) {
f2e824
		print_filter_hide_status();
f2e824
	} else {
f2e824
		echo ' ';
f2e824
	}
f2e824
	?>
f2e824
	
f2e824
	
f2e824
	
f2e824
 		
f2e824
	
f2e824
	
f2e824
	
f2e824
 		
f2e824
 			print_filter_show_version();
f2e824
 		} else {
f2e824
 			echo " ";
f2e824
 		} ?>
f2e824
	
f2e824
	
f2e824
	
f2e824
 		
f2e824
 			print_filter_show_fixed_in_version();
f2e824
 		} else {
f2e824
 			echo " ";
f2e824
 		} ?>
f2e824
 	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	 
f2e824
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
	
f2e824
		<label title="<?php echo lang_get( 'use_date_filters' ); ?>">
f2e824
		
f2e824
			check_checked( $t_filter['do_filter_by_date'], 'on' );
f2e824
			if ( ON == config_get( 'use_javascript' ) ) {
f2e824
				print "onclick=\"SwitchDateFields();\""; } ?> />
f2e824
		
f2e824
		'; ?>
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
		
f2e824
	
f2e824
	
f2e824
        
f2e824
	
f2e824
	
f2e824
f2e824
f2e824
f2e824
if ( ON == config_get( 'filter_by_custom_fields' ) ) {
f2e824
?>
f2e824
	
f2e824
	
f2e824
	if ( sizeof( $t_accessible_custom_fields_ids ) > 0 ) {
f2e824
		$t_per_row = config_get( 'filter_custom_fields_per_row' );
f2e824
		$t_num_rows = ceil( sizeof( $t_accessible_custom_fields_ids ) / $t_per_row );
f2e824
		$t_base = 0;
f2e824
f2e824
		for ( $i = 0; $i < $t_num_rows; $i++ ) {
f2e824
			?>
f2e824
			
f2e824
			
f2e824
			for( $j = 0; $j < $t_per_row; $j++ ) {
f2e824
				echo '';
f2e824
				if ( isset( $t_accessible_custom_fields_names[$t_base + $j] ) ) {
f2e824
					echo string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$t_base + $j] ) );
f2e824
				} else {
f2e824
					echo ' ';
f2e824
				}
f2e824
				echo '';
f2e824
			}
f2e824
			?>
f2e824
			
f2e824
			
f2e824
			
f2e824
			for ( $j = 0; $j < $t_per_row; $j++ ) {
f2e824
				echo '';
f2e824
				if ( isset( $t_accessible_custom_fields_ids[$t_base + $j] ) ) {
f2e824
					print_filter_custom_field($t_accessible_custom_fields_ids[$t_base + $j]);
f2e824
				} else {
f2e824
					echo ' ';
f2e824
				}
f2e824
				echo '';
f2e824
			}
f2e824
f2e824
			?>
f2e824
			
f2e824
			
f2e824
			$t_base += $t_per_row;
f2e824
		}
f2e824
	}
f2e824
}
f2e824
f2e824
if ( 'simple' == $f_view_type ) {
f2e824
	$t_project_cols = 0;
f2e824
} else {
f2e824
	$t_project_cols = 3;
f2e824
}
f2e824
?>
f2e824
f2e824
f2e824
	
f2e824
		:
f2e824
	
f2e824
	
f2e824
		
f2e824
			print_filter_show_sort();
f2e824
		?>
f2e824
	
f2e824
	
f2e824
		if ( 'advanced' == $f_view_type ) {
f2e824
	?>
f2e824
			
f2e824
				:
f2e824
			
f2e824
			
f2e824
				
f2e824
					print_filter_project_id();
f2e824
				?>
f2e824
			
f2e824
	
f2e824
		}
f2e824
	?>
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
f2e824
	
f2e824
	
f2e824
		<input type="text" size="16" name="search" value="<?php echo string_html_specialchars( $t_filter['search'] ); ?>" />
f2e824
	
f2e824
f2e824
	
f2e824
f2e824
	
f2e824
	
f2e824
		<input type="submit" name="filter" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
f2e824
	
f2e824
f2e824
f2e824
</form>
f2e824
f2e824