diff -r 04bb28dd6964 core/bug_api.php --- a/core/bug_api.php Fri Sep 25 20:11:21 2009 +0200 +++ b/core/bug_api.php Mon Oct 12 10:49:02 2009 +0200 @@ -1286,11 +1286,11 @@ * return the timestamp for the most recent time at which a bugnote * associated with the bug was modified * @param int p_bug_id integer representing bug id - * @return bool|int false or timestamp in integer format representing newest bugnote timestamp + * @return bool|int false or timestamp in integer format representing last bugnote timestamp * @access public * @uses database_api.php */ -function bug_get_newest_bugnote_timestamp( $p_bug_id ) { +function bug_get_last_bugnote_timestamp( $p_bug_id ) { $c_bug_id = db_prepare_int( $p_bug_id ); $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); @@ -1299,13 +1299,29 @@ WHERE bug_id=" . db_param() . " ORDER BY last_modified DESC"; $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); - $row = db_result( $result ); + return db_result( $result ); +} - if( false === $row ) { - return false; - } else { - return $row; - } +/** + * return the reporter (user_id) for the most recent time at which a bugnote + * associated with the bug was modified + * @param int p_bug_id integer representing bug id + * @return bool|int false or user id in integer format representing last bugnote reporter + * @access public + * @uses database_api.php + */ +function bug_get_last_bugnote_reporter( $p_bug_id ) { + $c_bug_id = db_prepare_int( $p_bug_id ); + $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); + + $query = "SELECT MIN(reporter_id) + FROM $t_bugnote_table A + WHERE A.date_submitted = (SELECT MAX(X.date_submitted) + FROM $t_bugnote_table X + WHERE X.bug_id = A.bug_id) AND + A.bug_id=" . db_param(); + $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); + return db_result( $result ); } /** diff -r 04bb28dd6964 core/columns_api.php --- a/core/columns_api.php Fri Sep 25 20:11:21 2009 +0200 +++ b/core/columns_api.php Mon Oct 12 10:49:02 2009 +0200 @@ -74,6 +74,8 @@ $t_columns['selection'] = null; $t_columns['edit'] = null; + $t_columns['last_bugnote_reporter'] = null; + $t_columns['last_bugnote_timestamp'] = null; if( OFF == config_get( 'enable_profiles' ) ) { unset( $t_columns['os'] ); @@ -92,6 +94,13 @@ if( config_get( 'enable_product_build' ) == OFF ) { unset( $t_columns['build'] ); } + + if( config_get( 'enable_last_bugnote_reporter', ON) == OFF ) { + unset( $t_columns['last_bugnote_reporter'] ); + } + if( config_get( 'enable_last_bugnote_timestamp', OFF) == OFF ) { + unset( $t_columns['last_bugnote_timestamp'] ); + } # The following fields are used internally and don't make sense as columns unset( $t_columns['_stats'] ); @@ -802,6 +811,34 @@ /** * + * @param string sort + * @param string direction + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_title_last_bugnote_reporter( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + echo lang_get( 'last_bugnote_reporter' ); + echo ''; +} + +/** + * + * @param string sort + * @param string direction + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_title_last_bugnote_timestamp( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + echo lang_get( 'last_bugnote_timestamp' ); + echo ''; +} + +/** + * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php * @return null @@ -1271,3 +1308,41 @@ echo ''; } + +/** + * + * @param BugData $p_bug bug obect + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_last_bugnote_reporter( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + + $t_reporter_id = bug_get_last_bugnote_reporter( $p_bug->id ); + + if( $t_reporter_id > 0 ) { + echo prepare_user_name( $t_reporter_id ); + } + + echo ''; +} + +/** + * + * @param BugData $p_bug bug obect + * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + * @return null + * @access public + */ +function print_column_last_bugnote_timestamp( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + + $t_timestamp = bug_get_last_bugnote_timestamp( $p_bug->id ); + + if( $t_timestamp != null && $t_timestamp > 0 ) { + echo date( config_get( 'short_date_format' ), $t_timestamp ); + } + + echo ''; +} diff -r 04bb28dd6964 core/file_api.php --- a/core/file_api.php Fri Sep 25 20:11:21 2009 +0200 +++ b/core/file_api.php Mon Oct 12 10:49:02 2009 +0200 @@ -650,6 +650,11 @@ $c_bug_id = db_prepare_int( $p_bug_id ); $c_project_id = db_prepare_int( $t_project_id ); $c_file_type = db_prepare_string( $p_file['type'] ); + # GT: + if( $c_file_type == 'image/pjpeg') { + $c_file_type = 'image/jpeg'; + } + # :GT $c_title = db_prepare_string( $p_title ); $c_desc = db_prepare_string( $p_desc ); diff -r 04bb28dd6964 my_view_inc.php --- a/my_view_inc.php Fri Sep 25 20:11:21 2009 +0200 +++ b/my_view_inc.php Mon Oct 12 10:49:02 2009 +0200 @@ -442,6 +442,9 @@ $t_summary = string_display_line_links( $t_bug->summary ); $t_last_updated = date( config_get( 'normal_date_format' ), $t_bug->last_updated ); + $t_last_reporter_id = bug_get_last_bugnote_reporter( $t_bug->id ); + $t_last_reporter = $t_last_reporter_id ? user_get_name( $t_last_reporter_id ) : ''; + # choose color based on status $status_color = get_status_color( $t_bug->status ); @@ -506,9 +509,9 @@ echo string_display_line( category_full_name( $t_bug->category_id, true, $t_bug->project_id ) ); if( $t_bug->last_updated > strtotime( '-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] . ' hours' ) ) { - echo ' - ' . $t_last_updated . ''; + echo ' - ' . $t_last_updated . ' - ' . $t_last_reporter . ''; } else { - echo ' - ' . $t_last_updated; + echo ' - ' . $t_last_updated . ' - ' . $t_last_reporter; } ?>