. /** * Print Bug Page * * @package MantisBT * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org * * @uses core.php * @uses access_api.php * @uses bug_api.php * @uses category_api.php * @uses columns_api.php * @uses compress_api.php * @uses config_api.php * @uses constant_inc.php * @uses custom_field_api.php * @uses date_api.php * @uses file_api.php * @uses gpc_api.php * @uses helper_api.php * @uses history_api.php * @uses html_api.php * @uses lang_api.php * @uses last_visited_api.php * @uses prepare_api.php * @uses print_api.php * @uses project_api.php * @uses relationship_api.php * @uses string_api.php * @uses tag_api.php * @uses utility_api.php * @uses version_api.php */ require_once( 'core.php' ); require_api( 'access_api.php' ); require_api( 'bug_api.php' ); require_api( 'category_api.php' ); require_api( 'columns_api.php' ); require_api( 'compress_api.php' ); require_api( 'config_api.php' ); require_api( 'constant_inc.php' ); require_api( 'custom_field_api.php' ); require_api( 'date_api.php' ); require_api( 'file_api.php' ); require_api( 'gpc_api.php' ); require_api( 'helper_api.php' ); require_api( 'history_api.php' ); require_api( 'html_api.php' ); require_api( 'lang_api.php' ); require_api( 'last_visited_api.php' ); require_api( 'prepare_api.php' ); require_api( 'print_api.php' ); require_api( 'project_api.php' ); require_api( 'relationship_api.php' ); require_api( 'string_api.php' ); require_api( 'tag_api.php' ); require_api( 'utility_api.php' ); require_api( 'version_api.php' ); $f_bug_id = gpc_get_int( 'bug_id' ); bug_ensure_exists( $f_bug_id ); $t_bug = bug_get( $f_bug_id, true ); $t_selected_project = helper_get_current_project(); if( $t_bug->project_id != $t_selected_project ) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; } access_ensure_bug_level( config_get( 'view_bug_threshold' ), $f_bug_id ); $t_fields = config_get( 'bug_print_page_fields' ); $t_fields = columns_filter_disabled( $t_fields ); compress_enable(); $t_show_id = in_array( 'id', $t_fields ); $t_show_project = in_array( 'project', $t_fields ); $t_show_category = in_array( 'category_id', $t_fields ); $t_show_date_submitted = in_array( 'date_submitted', $t_fields ); $t_show_last_updated = in_array( 'last_updated', $t_fields ); $t_show_view_state = in_array( 'view_state', $t_fields ); $t_show_reporter = in_array( 'reporter', $t_fields ); $t_show_handler = in_array( 'handler', $t_fields ) && access_has_bug_level( config_get( 'view_handler_threshold' ), $f_bug_id ); $t_show_due_date = in_array( 'due_date', $t_fields ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $f_bug_id ); $t_show_priority = in_array( 'priority', $t_fields ); $t_show_severity = in_array( 'severity', $t_fields ); $t_show_reproducibility = in_array( 'reproducibility', $t_fields ); $t_show_platform = in_array( 'platform', $t_fields ); $t_show_os = in_array( 'os', $t_fields ); $t_show_os_version = in_array( 'os_version', $t_fields ); $t_show_status = in_array( 'status', $t_fields ); $t_show_resolution = in_array( 'resolution', $t_fields ); $t_show_projection = in_array( 'projection', $t_fields ); $t_show_eta = in_array( 'eta', $t_fields ); $t_show_versions = version_should_show_product_version( $t_bug->project_id ); $t_show_product_version = $t_show_versions && in_array( 'product_version', $t_fields ); $t_show_product_build = $t_show_versions && in_array( 'product_build', $t_fields ) && config_get( 'enable_product_build' ); $t_show_fixed_in_version = $t_show_versions && in_array( 'fixed_in_version', $t_fields ); $t_show_target_version = $t_show_versions && in_array( 'target_version', $t_fields ) && access_has_bug_level( config_get( 'roadmap_view_threshold' ), $f_bug_id ); $t_show_summary = in_array( 'summary', $t_fields ); $t_show_description = in_array( 'description', $t_fields ); $t_show_steps_to_reproduce = !is_blank( $t_bug->steps_to_reproduce ) && in_array( 'steps_to_reproduce', $t_fields ); $t_show_additional_information = !is_blank( $t_bug->additional_information ) && in_array( 'additional_info', $t_fields ); $t_show_tags = in_array( 'tags', $t_fields ); $t_show_attachments = in_array( 'attachments', $t_fields ); $t_show_history = access_has_bug_level( config_get( 'view_history_threshold' ), $f_bug_id ); $t_window_title = string_display_line( config_get( 'window_title' ) ); $t_project_name = $t_show_project ? string_display_line( project_get_name( $t_bug->project_id ) ) : ''; $t_formatted_bug_id = $t_show_id ? bug_format_id( $f_bug_id ) : ''; $t_category_name = $t_show_category ? string_display_line( category_full_name( $t_bug->category_id ) ) : ''; $t_severity = string_display_line( get_enum_element( 'severity', $t_bug->severity ) ); $t_reproducibility = string_display_line( get_enum_element( 'reproducibility', $t_bug->reproducibility ) ); $t_date_submitted = $t_show_date_submitted ? string_display_line( date( config_get( 'normal_date_format' ), $t_bug->date_submitted ) ) : ''; $t_last_updated = $t_show_last_updated ? string_display_line( date( config_get( 'normal_date_format' ), $t_bug->last_updated ) ) : ''; $t_platform = string_display_line( $t_bug->platform ); $t_os = string_display_line( $t_bug->os ); $t_os_version = string_display_line( $t_bug->os_build ); $t_is = string_display_line( $t_bug->os ); $t_status = string_display_line( get_enum_element( 'status', $t_bug->status ) ); $t_priority = string_display_line( get_enum_element( 'priority', $t_bug->priority ) ); $t_resolution = string_display_line( get_enum_element( 'resolution', $t_bug->resolution ) ); $t_product_build = string_display_line( $t_bug->build ); $t_projection = string_display_line( get_enum_element( 'projection', $t_bug->projection ) ); $t_eta = string_display_line( get_enum_element( 'eta', $t_bug->eta ) ); $t_summary = string_display_line_links( bug_format_summary( $f_bug_id, SUMMARY_FIELD ) ); $t_description = string_display_links( $t_bug->description ); $t_steps_to_reproduce = string_display_links( $t_bug->steps_to_reproduce ); $t_additional_information = string_display_links( $t_bug->additional_information ); $t_view_state = $t_show_view_state ? get_enum_element( 'view_state', $t_bug->view_state ) : ''; if( $t_show_due_date ) { if( !date_is_null( $t_bug->due_date ) ) { $t_due_date = date( config_get( 'normal_date_format' ), $t_bug->due_date ); } else { $t_due_date = ''; } } $t_product_version = $t_show_product_version ? string_display_line( prepare_version_string( $t_bug->project_id, version_get_id( $t_bug->version, $t_bug->project_id ) ) ) : ''; $t_target_version = $t_show_target_version ? string_display_line( prepare_version_string( $t_bug->project_id, version_get_id( $t_bug->target_version, $t_bug->project_id ) ) ) : ''; $t_fixed_in_version = $t_show_fixed_in_version ? string_display_line( prepare_version_string( $t_bug->project_id, version_get_id( $t_bug->fixed_in_version, $t_bug->project_id ) ) ) : ''; html_page_top1( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); html_head_end(); html_body_begin(); echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if( $t_show_id || $t_show_project || $t_show_category || $t_show_view_state || $t_show_date_submitted || $t_show_last_updated ) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } # # Reporter # if( $t_show_reporter ) { echo ''; echo ''; echo ''; echo ''; echo ''; } # # Handler, Due Date # if( $t_show_handler || $t_show_due_date ) { $t_spacer = 2; echo ''; if( $t_show_handler ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_due_date ) { echo ''; echo ''; } else { $t_spacer += 2; } echo ''; echo ''; } # # Priority, Severity, Reproducibility # if( $t_show_priority || $t_show_severity || $t_show_reproducibility ) { echo ''; $t_spacer = 0; if( $t_show_priority ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_severity ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_reproducibility ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_spacer > 0 ) { echo ''; } echo ''; } # # Status, Resolution # if( $t_show_status || $t_show_resolution ) { echo ''; $t_spacer = 2; if( $t_show_status ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_resolution ) { echo ''; echo ''; } else { $t_spacer += 2; } echo ''; echo ''; } # # Projection, ETA # if( $t_show_projection || $t_show_eta ) { $t_spacer = 2; echo ''; if( $t_show_projection ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_eta ) { echo ''; echo ''; } else { $t_spacer += 2; } echo ''; echo ''; } # # Platform, OS, OS Version # if( $t_show_platform || $t_show_os || $t_show_os_version ) { echo ''; $t_spacer = 0; if( $t_show_platform ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_os ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_os_version ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_spacer > 0 ) { echo ''; } echo ''; } # # Product Version, Product Build # if( $t_show_product_version || $t_show_product_build ) { echo ''; $t_spacer = 2; if( $t_show_product_version ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_product_build ) { echo ''; echo ''; } else { $t_spacer += 2; } echo ''; echo ''; } # # Target Version, Fixed in Version # if( $t_show_target_version || $t_show_fixed_in_version ) { echo ''; $t_spacer = 2; if( $t_show_target_version ) { echo ''; echo ''; } else { $t_spacer += 2; } if( $t_show_fixed_in_version ) { echo ''; echo ''; } else { $t_spacer += 2; } echo ''; echo ''; } # # Custom Fields # $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug->project_id ); foreach( $t_related_custom_field_ids as $t_id ) { # Don't display the field if user does not have read access to it if( !custom_field_has_read_access_by_project_id( $t_id, $t_bug->project_id ) ) { continue; } $t_def = custom_field_get_definition( $t_id ); echo ''; echo ''; echo ''; echo ''; } # foreach echo ''; if( $t_show_summary ) { echo ''; echo ''; echo ''; echo ''; } if( $t_show_description ) { echo ''; echo ''; echo ''; echo ''; } if( $t_show_steps_to_reproduce ) { echo ''; echo ''; echo ''; echo ''; } if( $t_show_additional_information ) { echo ''; echo ''; echo ''; echo ''; } # Tagging if( $t_show_tags ) { echo ''; echo ''; echo ''; } echo ''; echo ''; echo ''; if( $t_show_attachments ) { echo ''; echo ''; echo ''; } echo '
'; echo '
', $t_window_title; if( !is_blank( $t_project_name ) ) { echo ' - ' . $t_project_name; } echo '
', lang_get( 'bug_view_title' ), '
', $t_formatted_bug_id, '', $t_project_name, '', $t_category_name, '', $t_view_state, '', $t_date_submitted, '', $t_last_updated, '
', lang_get( 'reporter' ), ''; print_user_with_subject( $t_bug->reporter_id, $f_bug_id ); echo ' 
', lang_get( 'assigned_to' ), ''; print_user_with_subject( $t_bug->handler_id, $f_bug_id ); echo '', lang_get( 'due_date' ), '', $t_due_date, ' 
', lang_get( 'priority' ), '', $t_priority, '', lang_get( 'severity' ), '', $t_severity, '', lang_get( 'reproducibility' ), '', $t_reproducibility, ' 
', lang_get( 'status' ), '', $t_status, '', lang_get( 'resolution' ), '', $t_resolution, ' 
', lang_get( 'projection' ), '', $t_projection, '', lang_get( 'eta' ), '', $t_eta, ' 
', lang_get( 'platform' ), '', $t_platform, '', lang_get( 'os' ), '', $t_os, '', lang_get( 'os_version' ), '', $t_os_version, ' 
', lang_get( 'product_version' ), '', $t_product_version, '', lang_get( 'product_build' ), '', $t_product_build, ' 
', lang_get( 'target_version' ), '', $t_target_version, '', lang_get( 'fixed_in_version' ), '', $t_fixed_in_version, ' 
', string_display_line( lang_get_defaulted( $t_def['name'] ) ), ''; print_custom_field_value( $t_def, $t_id, $f_bug_id ); echo '
', lang_get( 'summary' ), '', $t_summary, '
', lang_get( 'description' ), '', $t_description, '
', lang_get( 'steps_to_reproduce' ), '', $t_steps_to_reproduce, '
', lang_get( 'additional_information' ), '', $t_additional_information, '
', lang_get( 'tags' ), ''; tag_display_attached( $f_bug_id ); echo '
' . relationship_get_summary_html_preview( $f_bug_id ) . '
', lang_get( 'attached_files' ), ''; $t_attachments = file_get_visible_attachments( $f_bug_id ); $t_first_attachment = true; $t_path = config_get_global( 'path' ); foreach ( $t_attachments as $t_attachment ) { if( $t_first_attachment ) { $t_first_attachment = false; } else { echo '
'; } $c_filename = string_display_line( $t_attachment['display_name'] ); $c_download_url = $t_path . htmlspecialchars( $t_attachment['download_url'] ); $c_filesize = number_format( $t_attachment['size'] ); $c_date_added = date( config_get( 'normal_date_format' ), $t_attachment['date_added'] ); if( isset( $t_attachment['icon'] ) ) { echo '', $t_attachment['icon']['alt'], ' '; } echo $c_filename . ' (' .$c_filesize . ') ' . $c_date_added . '
' . $c_download_url; if( $t_attachment['preview'] && $t_attachment['type'] == 'image' ) { echo '
', $t_attachment['alt'], '
'; } } echo '
'; define( 'PRINT_BUGNOTE_INC_ALLOW', true ); include( dirname( __FILE__ ) . '/print_bugnote_inc.php' ) ; # # Issue History # if( $t_show_history ) { echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $t_history = history_get_events_array( $f_bug_id ); foreach ( $t_history as $t_item ) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
', lang_get( 'bug_history' ), '
', $t_item['date'], ''; print_user( $t_item['userid'] ); echo '', string_display( $t_item['note'] ), '', string_display_line_links( $t_item['change'] ), '
'; } last_visited_issue( $f_bug_id ); html_body_end(); html_end();