Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/bugnote_view_inc.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
	#   $Revision: 2643 $
ef5584
	#     $Author: al $    
ef5584
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $  
ef5584
	#------------------------------
ef5584
	# This include file prints out the list of bugnotes attached to the bug
ef5584
	# $f_bug_id must be set and be set to the bug id
ef5584
ef5584
	$t_core_path = config_get( 'core_path' );
ef5584
ef5584
	require_once( $t_core_path.'current_user_api.php' );
ef5584
ef5584
	# grab the user id currently logged in
ef5584
	$t_user_id = auth_get_current_user_id();
ef5584
ef5584
	if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) {
ef5584
		$t_restriction = 'AND ( view_state=' . VS_PUBLIC . ' OR reporter_id = ' . $t_user_id . ')';
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
	# get the bugnote data
ef5584
	$query = "SELECT *
ef5584
			FROM $t_bugnote_table
ef5584
			WHERE bug_id='$f_bug_id' $t_restriction
ef5584
			ORDER BY date_submitted $t_bugnote_order, id $t_bugnote_order";
ef5584
	$result = db_query( $query );
ef5584
	$num_notes = db_num_rows( $result );
ef5584
?>
ef5584
ef5584
ef5584

ef5584
ef5584
ef5584
	collapse_open( 'bugnotes' );
ef5584
?>
ef5584
ef5584
ef5584
	# no bugnotes
ef5584
	if ( 0 == $num_notes ) {
ef5584
?>
ef5584
ef5584
	
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
ef5584
	
ef5584
ef5584
		collapse_icon( 'bugnotes' ); ?>
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
	$t_normal_date_format = config_get( 'normal_date_format' );
ef5584
	$t_total_time = 0;
ef5584
ef5584
	for ( $i=0; $i < $num_notes; $i++ ) {
ef5584
		# prefix all bugnote data with v3_
ef5584
		$row = db_fetch_array( $result );
ef5584
		extract( $row, EXTR_PREFIX_ALL, 'v3' );
ef5584
		if ( db_unixtimestamp( $v3_date_submitted ) != db_unixtimestamp( $v3_last_modified ) )
ef5584
			$t_bugnote_modified = true;
ef5584
		else
ef5584
			$t_bugnote_modified = false;
ef5584
ef5584
		$v3_date_submitted = date( $t_normal_date_format, ( db_unixtimestamp( $v3_date_submitted ) ) );
ef5584
		$v3_last_modified = date( $t_normal_date_format, ( db_unixtimestamp( $v3_last_modified ) ) );
ef5584
ef5584
		# grab the bugnote text and id and prefix with v3_
ef5584
		$query = "SELECT note
ef5584
				FROM $t_bugnote_text_table
ef5584
				WHERE id='$v3_bugnote_text_id'";
ef5584
		$result2 = db_query( $query );
ef5584
		$row = db_fetch_array( $result2 );
ef5584
ef5584
		$v3_note = $row['note'];
ef5584
		$v3_note = string_display_links( $v3_note );
ef5584
		$t_bugnote_id_formatted = bugnote_format_id( $v3_id );
ef5584
ef5584
		if ( 0 != $v3_time_tracking ) {
ef5584
			$v3_time_tracking_hhmm = db_minutes_to_hhmm( $v3_time_tracking );
ef5584
			$v3_note_type = TIME_TRACKING;   // for older entries that didn't set the type
ef5584
			$t_total_time += $v3_time_tracking;
ef5584
		} else {
ef5584
			$v3_time_tracking_hhmm = '';
ef5584
		}
ef5584
ef5584
		if ( VS_PRIVATE == $v3_view_state ) {
ef5584
			$t_bugnote_css		= 'bugnote-private';
ef5584
			$t_bugnote_note_css	= 'bugnote-note-private';
ef5584
		} else {
ef5584
			$t_bugnote_css		= 'bugnote-public';
ef5584
			$t_bugnote_note_css	= 'bugnote-note-public';
ef5584
		}
ef5584
?>
ef5584
ef5584
        
ef5584
		
ef5584
		()
ef5584
		
ef5584
			echo print_user( $v3_reporter_id );
ef5584
		?>
ef5584
		
ef5584
			if ( user_exists( $v3_reporter_id ) ) {
ef5584
				$t_access_level = access_get_project_level( null, $v3_reporter_id );
ef5584
				echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
ef5584
			} 
ef5584
		?>
ef5584
		
ef5584
		[  ]
ef5584
		
ef5584
		
ef5584
		
ef5584
		
ef5584
		if ( $t_bugnote_modified ) {
ef5584
			echo ''.lang_get( 'edited_on').' '.$v3_last_modified.'
';
ef5584
		}
ef5584
		?>
ef5584
		
ef5584
		
ef5584
			# bug must be open to be editable
ef5584
			if ( !bug_is_readonly( $f_bug_id ) ) {
ef5584
				$t_can_edit_note = false;
ef5584
				$t_can_delete_note = false;
ef5584
ef5584
				# admins and the bugnote creator can edit/delete this bugnote
ef5584
				if ( ( access_has_bug_level( config_get( 'manage_project_threshold' ), $f_bug_id ) ) ||
ef5584
					( ( $v3_reporter_id == $t_user_id ) && ( ON == config_get( 'bugnote_allow_user_edit_delete' ) ) ) ) {
ef5584
					$t_can_edit_note = true;
ef5584
					$t_can_delete_note = true;
ef5584
				}
ef5584
ef5584
				# users above update_bugnote_threshold should be able to edit this bugnote
ef5584
				if ( $t_can_edit_note || access_has_bug_level( config_get( 'update_bugnote_threshold' ), $f_bug_id ) ) {
ef5584
					print_button( 'bugnote_edit_page.php?bugnote_id='.$v3_id, lang_get( 'bugnote_edit_link' ) );
ef5584
				}
ef5584
ef5584
				# users above delete_bugnote_threshold should be able to delete this bugnote
ef5584
				if ( $t_can_delete_note || access_has_bug_level( config_get( 'delete_bugnote_threshold' ), $f_bug_id ) ) {
ef5584
					echo " ";
ef5584
					print_button( 'bugnote_delete.php?bugnote_id='.$v3_id, lang_get( 'delete_link' ) );
ef5584
				}
ef5584
ef5584
				if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) &&
ef5584
					access_has_bug_level( config_get( 'change_view_status_threshold' ), $f_bug_id ) ) {
ef5584
					if ( VS_PRIVATE == $v3_view_state ) {
ef5584
						echo " ";
ef5584
						print_button('bugnote_set_view_state.php?private=0&bugnote_id='.$v3_id, lang_get( 'make_public' ));
ef5584
					} else {
ef5584
						echo " ";
ef5584
						print_button('bugnote_set_view_state.php?private=1&bugnote_id='.$v3_id, lang_get( 'make_private' ));
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
				case TIME_TRACKING:
ef5584
					if ( access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) {
ef5584
						echo '<big>', $v3_time_tracking_hhmm, '</big>

';
ef5584
					}
ef5584
					break;
ef5584
			}
ef5584
ef5584
			echo $v3_note;
ef5584
		?>
ef5584
	
ef5584
ef5584
ef5584
	
ef5584
ef5584
ef5584
		} # end for loop
ef5584
ef5584
		if ( $t_total_time > 0 && access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) {
ef5584
			echo '', sprintf ( lang_get( 'total_time_for_issue' ), db_minutes_to_hhmm( $t_total_time ) ), '';
ef5584
		}
ef5584
	} # end else
ef5584
?>
ef5584
ef5584
ef5584
ef5584
	collapse_closed( 'bugnotes' );
ef5584
?>
ef5584
ef5584
ef5584
ef5584
	
ef5584
		
ef5584
		
ef5584
	
ef5584
ef5584
ef5584
ef5584
	collapse_end( 'bugnotes' );
ef5584
?>
ef5584
ef5584