|
|
d6e8d8 |
|
|
|
d6e8d8 |
# Mantis - a php based bugtracking system
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
|
|
d6e8d8 |
# Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# Mantis is free software: you can redistribute it and/or modify
|
|
|
d6e8d8 |
# it under the terms of the GNU General Public License as published by
|
|
|
d6e8d8 |
# the Free Software Foundation, either version 2 of the License, or
|
|
|
d6e8d8 |
# (at your option) any later version.
|
|
|
d6e8d8 |
#
|
|
|
d6e8d8 |
# Mantis is distributed in the hope that it will be useful,
|
|
|
d6e8d8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d6e8d8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
d6e8d8 |
# GNU General Public License for more details.
|
|
|
d6e8d8 |
#
|
|
|
d6e8d8 |
# You should have received a copy of the GNU General Public License
|
|
|
d6e8d8 |
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
#------------------------------
|
|
|
d6e8d8 |
# $Revision: 2643 $
|
|
|
d6e8d8 |
# $Author: al $
|
|
|
d6e8d8 |
# $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $
|
|
|
d6e8d8 |
#------------------------------
|
|
|
d6e8d8 |
# This include file prints out the list of bugnotes attached to the bug
|
|
|
d6e8d8 |
# $f_bug_id must be set and be set to the bug id
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
$t_core_path = config_get( 'core_path' );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
require_once( $t_core_path.'current_user_api.php' );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# grab the user id currently logged in
|
|
|
d6e8d8 |
$t_user_id = auth_get_current_user_id();
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
$t_restriction = 'AND ( view_state=' . VS_PUBLIC . ' OR reporter_id = ' . $t_user_id . ')';
|
|
|
d6e8d8 |
} else {
|
|
|
d6e8d8 |
$t_restriction = '';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
$t_bugnote_table = config_get( 'mantis_bugnote_table' );
|
|
|
d6e8d8 |
$t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
|
|
|
d6e8d8 |
$t_bugnote_order = current_user_get_pref( 'bugnote_order' );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# get the bugnote data
|
|
|
d6e8d8 |
$query = "SELECT *
|
|
|
d6e8d8 |
FROM $t_bugnote_table
|
|
|
d6e8d8 |
WHERE bug_id='$f_bug_id' $t_restriction
|
|
|
d6e8d8 |
ORDER BY date_submitted $t_bugnote_order, id $t_bugnote_order";
|
|
|
d6e8d8 |
$result = db_query( $query );
|
|
|
d6e8d8 |
$num_notes = db_num_rows( $result );
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
collapse_open( 'bugnotes' );
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# no bugnotes
|
|
|
d6e8d8 |
if ( 0 == $num_notes ) {
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
collapse_icon( 'bugnotes' ); ?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
$t_normal_date_format = config_get( 'normal_date_format' );
|
|
|
d6e8d8 |
$t_total_time = 0;
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
for ( $i=0; $i < $num_notes; $i++ ) {
|
|
|
d6e8d8 |
# prefix all bugnote data with v3_
|
|
|
d6e8d8 |
$row = db_fetch_array( $result );
|
|
|
d6e8d8 |
extract( $row, EXTR_PREFIX_ALL, 'v3' );
|
|
|
d6e8d8 |
if ( db_unixtimestamp( $v3_date_submitted ) != db_unixtimestamp( $v3_last_modified ) )
|
|
|
d6e8d8 |
$t_bugnote_modified = true;
|
|
|
d6e8d8 |
else
|
|
|
d6e8d8 |
$t_bugnote_modified = false;
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
$v3_date_submitted = date( $t_normal_date_format, ( db_unixtimestamp( $v3_date_submitted ) ) );
|
|
|
d6e8d8 |
$v3_last_modified = date( $t_normal_date_format, ( db_unixtimestamp( $v3_last_modified ) ) );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# grab the bugnote text and id and prefix with v3_
|
|
|
d6e8d8 |
$query = "SELECT note
|
|
|
d6e8d8 |
FROM $t_bugnote_text_table
|
|
|
d6e8d8 |
WHERE id='$v3_bugnote_text_id'";
|
|
|
d6e8d8 |
$result2 = db_query( $query );
|
|
|
d6e8d8 |
$row = db_fetch_array( $result2 );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
$v3_note = $row['note'];
|
|
|
d6e8d8 |
$v3_note = string_display_links( $v3_note );
|
|
|
d6e8d8 |
$t_bugnote_id_formatted = bugnote_format_id( $v3_id );
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( 0 != $v3_time_tracking ) {
|
|
|
d6e8d8 |
$v3_time_tracking_hhmm = db_minutes_to_hhmm( $v3_time_tracking );
|
|
|
d6e8d8 |
$v3_note_type = TIME_TRACKING; // for older entries that didn't set the type
|
|
|
d6e8d8 |
$t_total_time += $v3_time_tracking;
|
|
|
d6e8d8 |
} else {
|
|
|
d6e8d8 |
$v3_time_tracking_hhmm = '';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( VS_PRIVATE == $v3_view_state ) {
|
|
|
d6e8d8 |
$t_bugnote_css = 'bugnote-private';
|
|
|
d6e8d8 |
$t_bugnote_note_css = 'bugnote-note-private';
|
|
|
d6e8d8 |
} else {
|
|
|
d6e8d8 |
$t_bugnote_css = 'bugnote-public';
|
|
|
d6e8d8 |
$t_bugnote_note_css = 'bugnote-note-public';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
()
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
echo print_user( $v3_reporter_id );
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( user_exists( $v3_reporter_id ) ) {
|
|
|
d6e8d8 |
$t_access_level = access_get_project_level( null, $v3_reporter_id );
|
|
|
d6e8d8 |
echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
[ ]
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( $t_bugnote_modified ) {
|
|
|
d6e8d8 |
echo ''.lang_get( 'edited_on').' '.$v3_last_modified.' ';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# bug must be open to be editable
|
|
|
d6e8d8 |
if ( !bug_is_readonly( $f_bug_id ) ) {
|
|
|
d6e8d8 |
$t_can_edit_note = false;
|
|
|
d6e8d8 |
$t_can_delete_note = false;
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# admins and the bugnote creator can edit/delete this bugnote
|
|
|
d6e8d8 |
if ( ( access_has_bug_level( config_get( 'manage_project_threshold' ), $f_bug_id ) ) ||
|
|
|
d6e8d8 |
( ( $v3_reporter_id == $t_user_id ) && ( ON == config_get( 'bugnote_allow_user_edit_delete' ) ) ) ) {
|
|
|
d6e8d8 |
$t_can_edit_note = true;
|
|
|
d6e8d8 |
$t_can_delete_note = true;
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# users above update_bugnote_threshold should be able to edit this bugnote
|
|
|
d6e8d8 |
if ( $t_can_edit_note || access_has_bug_level( config_get( 'update_bugnote_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
print_button( 'bugnote_edit_page.php?bugnote_id='.$v3_id, lang_get( 'bugnote_edit_link' ) );
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
# users above delete_bugnote_threshold should be able to delete this bugnote
|
|
|
d6e8d8 |
if ( $t_can_delete_note || access_has_bug_level( config_get( 'delete_bugnote_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
echo " ";
|
|
|
d6e8d8 |
print_button( 'bugnote_delete.php?bugnote_id='.$v3_id, lang_get( 'delete_link' ) );
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) &&
|
|
|
d6e8d8 |
access_has_bug_level( config_get( 'change_view_status_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
if ( VS_PRIVATE == $v3_view_state ) {
|
|
|
d6e8d8 |
echo " ";
|
|
|
d6e8d8 |
print_button('bugnote_set_view_state.php?private=0&bugnote_id='.$v3_id, lang_get( 'make_public' ));
|
|
|
d6e8d8 |
} else {
|
|
|
d6e8d8 |
echo " ";
|
|
|
d6e8d8 |
print_button('bugnote_set_view_state.php?private=1&bugnote_id='.$v3_id, lang_get( 'make_private' ));
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
switch ( $v3_note_type ) {
|
|
|
d6e8d8 |
case REMINDER:
|
|
|
d6e8d8 |
echo '' . lang_get( 'reminder_sent_to' ) . ': ';
|
|
|
d6e8d8 |
$v3_note_attr = substr( $v3_note_attr, 1, strlen( $v3_note_attr ) - 2 );
|
|
|
d6e8d8 |
$t_to = array();
|
|
|
d6e8d8 |
foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
|
|
|
d6e8d8 |
$t_to[] = prepare_user_name( $t_recipient );
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
echo implode( ', ', $t_to ) . '
';
|
|
|
d6e8d8 |
case TIME_TRACKING:
|
|
|
d6e8d8 |
if ( access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
echo '<big>', $v3_time_tracking_hhmm, '</big>
';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
break;
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
echo $v3_note;
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
} # end for loop
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
if ( $t_total_time > 0 && access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) {
|
|
|
d6e8d8 |
echo '', sprintf ( lang_get( 'total_time_for_issue' ), db_minutes_to_hhmm( $t_total_time ) ), '';
|
|
|
d6e8d8 |
}
|
|
|
d6e8d8 |
} # end else
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
collapse_closed( 'bugnotes' );
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
collapse_end( 'bugnotes' );
|
|
|
d6e8d8 |
?>
|
|
|
d6e8d8 |
|
|
|
d6e8d8 |
|