Blame Extras/Mantis/1.1.2-1.fc9/print_all_bug_page_word.php

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

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

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

';
4c79b5
		} # end in_array
4c79b5
}  # end main loop
4c79b5
?>