Blame Identity/Webenv/Mantis/1.1.2-1.fc9/print_all_bug_page_word.php

ef5584
ef5584
# Mantis - a php based bugtracking system
ef5584
ef5584
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
ef5584
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
ef5584
ef5584
# Mantis is free software: you can redistribute it and/or modify
ef5584
# it under the terms of the GNU General Public License as published by
ef5584
# the Free Software Foundation, either version 2 of the License, or
ef5584
# (at your option) any later version.
ef5584
#
ef5584
# Mantis is distributed in the hope that it will be useful,
ef5584
# but WITHOUT ANY WARRANTY; without even the implied warranty of
ef5584
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ef5584
# GNU General Public License for more details.
ef5584
#
ef5584
# You should have received a copy of the GNU General Public License
ef5584
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
ef5584
ef5584
	# --------------------------------------------------------
ef5584
	# $Id: print_all_bug_page_word.php,v 1.65.2.1 2007-10-13 22:34:17 giallu Exp $
ef5584
	# --------------------------------------------------------
ef5584
?>
ef5584
ef5584
	# Word 2000 export page
ef5584
	# The bugs displayed in print_all_bug_page.php are saved in a .doc file
ef5584
	# The IE icon allows to see or directly print the same result
ef5584
?>
ef5584
ef5584
	require_once( 'core.php' );
ef5584
ef5584
	$t_core_path = config_get( 'core_path' );
ef5584
ef5584
	require_once( $t_core_path.'current_user_api.php' );
ef5584
	require_once( $t_core_path.'bug_api.php' );
ef5584
	require_once( $t_core_path.'custom_field_api.php' );
ef5584
	require_once( $t_core_path.'string_api.php' );
ef5584
	require_once( $t_core_path.'date_api.php' );
ef5584
?>
ef5584
ef5584
ef5584
	$f_type_page	= gpc_get_string( 'type_page', 'word' );
ef5584
	$f_search		= gpc_get_string( 'search', false ); # @@@ need a better default
ef5584
	$f_offset		= gpc_get_int( 'offset', 0 );
ef5584
	$f_export		= gpc_get_string( 'export' );
ef5584
	$f_show_flag	= gpc_get_bool( 'show_flag' );
ef5584
ef5584
	helper_begin_long_process();
ef5584
ef5584
	# word or html export
ef5584
	if ( $f_type_page != 'html' ) {
ef5584
		$t_export_title = helper_get_default_export_filename( '' );
ef5584
		$t_export_title = ereg_replace( '[\/:*?"<>|]', '', $t_export_title );
ef5584
ef5584
		# Make sure that IE can download the attachments under https.
ef5584
		header( 'Pragma: public' );
ef5584
ef5584
		header( 'Content-Type: application/msword' );
ef5584
ef5584
		if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
ef5584
                        header( 'Content-Disposition: attachment; filename="' . urlencode( $t_export_title ) . '.doc"' );
ef5584
                } else {
ef5584
                        header( 'Content-Disposition: attachment; filename="' . $t_export_title . '.doc"' );
ef5584
                }
ef5584
	}
ef5584
ef5584
	# This is where we used to do the entire actual filter ourselves
ef5584
	$t_page_number = gpc_get_int( 'page_number', 1 );
ef5584
	$t_per_page = -1;
ef5584
	$t_bug_count = null;
ef5584
	$t_page_count = null;
ef5584
ef5584
	$result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
ef5584
	$row_count = sizeof( $result );
ef5584
ef5584
?>
ef5584
ef5584
ef5584
ef5584
xmlns:w="urn:schemas-microsoft-com:office:word"
ef5584
xmlns="http://www.w3.org/TR/REC-html40">
ef5584
ef5584
ef5584
ef5584
ef5584
ef5584
ef5584
	//$t_bug_arr_sort[$row_count]=-1;
ef5584
	$f_bug_arr = explode_enum_string( $f_export );
ef5584
ef5584
	for( $j=0; $j < $row_count; $j++ ) {
ef5584
ef5584
		# prefix bug data with v_
ef5584
		extract( $result[$j], EXTR_PREFIX_ALL, 'v' );
ef5584
ef5584
		# display the available and selected bugs
ef5584
		if ( in_array( $v_id, $f_bug_arr ) || ( $f_show_flag==0 ) ) {
ef5584
ef5584
            $t_last_updated = date( $g_short_date_format, $v_last_updated );
ef5584
ef5584
            # grab the bugnote count
ef5584
            $bugnote_count = bug_get_bugnote_count( $v_id );
ef5584
ef5584
            # grab the project name
ef5584
            $t_project_name = project_get_field( $v_project_id, 'name' );
ef5584
ef5584
            # bug text infos
ef5584
            $t_bug_text_table = config_get( 'mantis_bug_text_table' );
ef5584
            $query3 = "SELECT *
ef5584
                FROM $t_bug_text_table
ef5584
                WHERE id='$v_bug_text_id'";
ef5584
            $result3 = db_query( $query3 );
ef5584
            $row = db_fetch_array( $result3 );
ef5584
            extract( $row, EXTR_PREFIX_ALL, 'v2' );
ef5584
ef5584
            $v_os 						= string_display( $v_os );
ef5584
            $v_os_build					= string_display( $v_os_build );
ef5584
            $v_platform					= string_display( $v_platform );
ef5584
            $v_version 					= string_display( $v_version );
ef5584
            $v_summary 					= string_display_links( $v_summary );
ef5584
            $v2_description 			= string_display_links( $v2_description );
ef5584
            $v2_steps_to_reproduce 		= string_display_links( $v2_steps_to_reproduce );
ef5584
            $v2_additional_information 	= string_display_links( $v2_additional_information );
ef5584
            ### note that dates are converted to unix format in filter_get_bug_rows
ef5584
?>
ef5584

ef5584
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
			if ( access_has_bug_level( config_get( 'view_handler_threshold' ), $v_id ) ) {
ef5584
				print_user_with_subject( $v_handler_id, $v_id ); 
ef5584
			}
ef5584
		?>
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
			if ( !config_get( 'enable_relationship' ) ) {
ef5584
				echo lang_get( 'duplicate_id' );
ef5584
			} # MASC RELATIONSHIP
ef5584
		?> 
ef5584
	
ef5584
	
ef5584
		
ef5584
			if ( !config_get( 'enable_relationship' ) ) {
ef5584
				print_duplicate_id( $v_duplicate_id );
ef5584
			} # MASC RELATIONSHIP
ef5584
		?> 
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
	 
ef5584
ef5584
ef5584
$t_related_custom_field_ids = custom_field_get_linked_ids( $v_project_id );
ef5584
foreach( $t_related_custom_field_ids as $t_id ) {
ef5584
	$t_def = custom_field_get_definition( $t_id );
ef5584
?>
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
}       // foreach
ef5584
?>
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	# account profile description
ef5584
	if ( $v_profile_id > 0 ) {
ef5584
	   $t_user_prof_table = config_get( 'mantis_user_profile_table' );
ef5584
		$query4 = "SELECT description
ef5584
				FROM $t_user_prof_table
ef5584
				WHERE id='$v_profile_id'";
ef5584
		$result4 = db_query( $query4 );
ef5584
		$t_profile_description = '';
ef5584
		if ( db_num_rows( $result4 ) > 0 ) {
ef5584
			$t_profile_description = db_result( $result4, 0 );
ef5584
		}
ef5584
		$t_profile_description = string_display( $t_profile_description );
ef5584
ef5584
?>
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	} # profile description
ef5584
?>
ef5584
ef5584
	
ef5584
		:
ef5584
	
ef5584
	
ef5584
		
ef5584
	        $t_bug_file_table = config_get( 'mantis_bug_file_table' );
ef5584
			$query5 = "SELECT filename, filesize, date_added
ef5584
					FROM $t_bug_file_table
ef5584
					WHERE bug_id='$v_id'";
ef5584
			$result5 = db_query( $query5 );
ef5584
			$num_files = db_num_rows( $result5 );
ef5584
			for ( $i=0;$i<$num_files;$i++ ) {
ef5584
				$row = db_fetch_array( $result5 );
ef5584
				extract( $row, EXTR_PREFIX_ALL, 'v2' );
ef5584
				$v2_filename = file_get_display_name( $v2_filename );
ef5584
				$v2_filesize = round( $v2_filesize / 1024 );
ef5584
				$v2_date_added = date( config_get( 'normal_date_format' ), db_unixtimestamp( $v2_date_added ) );
ef5584
ef5584
				switch ( $g_file_upload_method ) {
ef5584
					case DISK:	PRINT "$v2_filename ($v2_filesize KB) $v2_date_added";
ef5584
							break;
ef5584
					case DATABASE:	PRINT "$v2_filename ($v2_filesize KB) $v2_date_added";
ef5584
							break;
ef5584
				}
ef5584
ef5584
				if ( $i != ( $num_files - 1 ) ) {
ef5584
					PRINT '
';
ef5584
				}
ef5584
			}
ef5584
		?>
ef5584
	
ef5584
ef5584
ef5584
	# get the bugnote data
ef5584
 	if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_id ) ) {
ef5584
 		$t_restriction = 'AND view_state=' . VS_PUBLIC;
ef5584
 	} else {
ef5584
 		$t_restriction = '';
ef5584
 	}
ef5584
ef5584
	$t_bugnote_table		= config_get( 'mantis_bugnote_table' );
ef5584
	$t_bugnote_text_table	= config_get( 'mantis_bugnote_text_table' );
ef5584
	$t_bugnote_order = current_user_get_pref( 'bugnote_order' );
ef5584
ef5584
	$query6 = "SELECT *
ef5584
			FROM $t_bugnote_table
ef5584
			WHERE bug_id='$v_id' $t_restriction
ef5584
			ORDER BY date_submitted $t_bugnote_order";
ef5584
	$result6 = db_query( $query6 );
ef5584
	$num_notes = db_num_rows( $result6 );
ef5584
?>
ef5584
ef5584
ef5584

ef5584
ef5584
ef5584
	# no bugnotes
ef5584
	if ( 0 == $num_notes ) {
ef5584
	?>
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
	
ef5584
		else { # print bugnotes ?>
ef5584
ef5584
	
ef5584
			
ef5584
	
ef5584
ef5584
	
ef5584
		for ( $k=0; $k < $num_notes; $k++ ) {
ef5584
			# prefix all bugnote data with v3_
ef5584
			$row = db_fetch_array( $result6 );
ef5584
			extract( $row, EXTR_PREFIX_ALL, 'v3' );
ef5584
			$v3_date_submitted = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_date_submitted ) ) );
ef5584
			$v3_last_modified = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_last_modified ) ) );
ef5584
ef5584
			# grab the bugnote text and id and prefix with v3_
ef5584
			$query6 = "SELECT note, id
ef5584
					FROM $t_bugnote_text_table
ef5584
					WHERE id='$v3_bugnote_text_id'";
ef5584
			$result7 = db_query( $query6 );
ef5584
			$v3_note = db_result( $result7, 0, 0 );
ef5584
			$v3_bugnote_text_id = db_result( $result7, 0, 1 );
ef5584
ef5584
			$v3_note = string_display_links( $v3_note );
ef5584
	?>
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
		
ef5584
		
ef5584
			
ef5584
				()
ef5584
			
ef5584
		
ef5584
		
ef5584
			
ef5584
				   
ef5584
			
ef5584
		
ef5584
		
ef5584
			
ef5584
				   
ef5584
				
ef5584
					echo '
(' . lang_get( 'edited_on').' '. $v3_last_modified . ')';
ef5584
				} ?>
ef5584
			
ef5584
		
ef5584
		
ef5584
	
ef5584
	
ef5584
		
ef5584
		
ef5584
			
ef5584
				
ef5584
					switch ( $v3_note_type ) {
ef5584
						case REMINDER:
ef5584
							echo lang_get( 'reminder_sent_to' ) . ': ';
ef5584
							$v3_note_attr = substr( $v3_note_attr, 1, strlen( $v3_note_attr ) - 2 );
ef5584
							$t_to = array();
ef5584
							foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
ef5584
								$t_to[] = prepare_user_name( $t_recipient );
ef5584
							}
ef5584
							echo implode( ', ', $t_to ) . '
';
ef5584
						default:
ef5584
							echo $v3_note;
ef5584
					}
ef5584
				?>
ef5584
			
ef5584
		
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
		} # end for
ef5584
	} # end else
ef5584
?>
ef5584
ef5584
ef5584
ef5584
ef5584
ef5584
ef5584
ef5584
echo '

';
ef5584
		} # end in_array
ef5584
}  # end main loop
ef5584
?>