. #------------------------------ # $Revision: 2643 $ # $Author: al $ # $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $ #------------------------------ ########################################################################### # HTML API # # These functions control the display of each page # # This is the call order of these functions, should you need to figure out # which to modify or which to leave out. # # html_page_top1 # html_begin # html_head_begin # html_css # html_content_type # html_rss_link # (html_meta_redirect) # html_title # html_page_top2 # html_page_top2a # html_head_end # html_body_begin # html_header # html_top_banner # html_login_info # (print_project_menu_bar) # print_menu # # ...Page content here... # # html_page_bottom1 # (print_menu) # html_page_bottom1a # html_bottom_banner # html_footer # html_body_end # html_end # ########################################################################### $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; require_once( $t_core_dir . 'current_user_api.php' ); require_once( $t_core_dir . 'string_api.php' ); require_once( $t_core_dir . 'bug_api.php' ); require_once( $t_core_dir . 'project_api.php' ); require_once( $t_core_dir . 'helper_api.php' ); require_once( $t_core_dir . 'authentication_api.php' ); require_once( $t_core_dir . 'user_api.php' ); require_once( $t_core_dir . 'rss_api.php' ); require_once( $t_core_dir . 'wiki_api.php' ); $g_rss_feed_url = null; # flag for error handler to skip header menus $g_error_send_page_header = true; # Projax library disabled by default. It will be enabled if projax_api.php # is included. But it must be included after html_api.php $g_enable_projax = false; # -------------------- # Sets the url for the rss link associated with the current page. # null: means no feed (default). function html_set_rss_link( $p_rss_feed_url ) { if ( OFF != config_get( 'rss_enabled' ) ) { global $g_rss_feed_url; $g_rss_feed_url = $p_rss_feed_url; } } # -------------------- # Prints the link that allows auto-detection of the associated feed. function html_rss_link() { global $g_rss_feed_url; if ( $g_rss_feed_url !== null ) { echo ""; } } # -------------------- # Print the part of the page that comes before meta redirect tags should # be inserted function html_page_top1( $p_page_title = null ) { html_begin(); html_head_begin(); html_css(); html_content_type(); include( config_get( 'meta_include_file' ) ); html_rss_link(); echo ''; html_title( $p_page_title ); html_head_javascript(); } # -------------------- # Print the part of the page that comes after meta tags, but before the # actual page content function html_page_top2() { html_page_top2a(); if ( !db_is_connected() ) { return; } } # -------------------- # Print the part of the page that comes after meta tags and before the # actual page content, but without login info or menus. This is used # directly during the login process and other times when the user may # not be authenticated function html_page_top2a() { global $g_error_send_page_header; html_head_end(); html_body_begin(); $g_error_send_page_header = false; html_header(); html_top_banner(); } # -------------------- # Print the part of the page that comes below the page content # $p_file should always be the __FILE__ variable. This is passed to show source function html_page_bottom1( $p_file = null ) { if ( !db_is_connected() ) { return; } html_page_bottom1a( $p_file ); } # -------------------- # Print the part of the page that comes below the page content but leave off # the menu. This is used during the login process and other times when the # user may not be authenticated. function html_page_bottom1a( $p_file = null ) { if ( null === $p_file ) { $p_file = basename( $_SERVER['PHP_SELF'] ); } html_bottom_banner(); html_footer( $p_file ); html_body_end(); html_end(); } # -------------------- # (1) Print the document type and the opening tag function html_begin() { # @@@ NOTE make this a configurable global. #echo '', "\n"; #echo '', "\n"; echo '', "\n"; echo '', "\n"; } # -------------------- # (2) Begin the section function html_head_begin() { echo '', "\n"; } # -------------------- # (3) Print the content-type function html_content_type() { echo "\t", '', "\n"; } # -------------------- # (4) Print the window title function html_title( $p_page_title = null ) { $t_title = config_get( 'window_title' ); echo "\t", ''; if ( 0 == strlen( $p_page_title ) ) { echo string_display( $t_title ); } else { if ( 0 == strlen( $t_title ) ) { echo $p_page_title; } else { echo $p_page_title . ' - ' . string_display( $t_title ); } } echo '', "\n"; } # -------------------- # (5) Print the link to include the css file function html_css() { $t_css_url = config_get( 'css_include_file' ); echo "\t", '', "\n"; # fix for NS 4.x css echo "\t", '', "\n"; } # -------------------- # (6) Print an HTML meta tag to redirect to another page # This function is optional and may be called by pages that need a redirect. # $p_time is the number of seconds to wait before redirecting. # If we have handled any errors on this page and the 'stop_on_errors' config # option is turned on, return false and don't redirect. function html_meta_redirect( $p_url, $p_time = null, $p_sanitize = false ) { if ( ON == config_get( 'stop_on_errors' ) && error_handled() ) { return false; } if ( null === $p_time ) { $p_time = current_user_get_pref( 'redirect_delay' ); } if ( $p_sanitize ) { $t_url = string_sanitize_url( $p_url ); } else { $t_url = $p_url; } echo "\t\n"; return true; } # --------------------- # (6a) Javascript... function html_head_javascript() { if ( ON == config_get( 'use_javascript' ) ) { echo "\t" . '' . "\n"; echo "\t" . '' . "\n"; global $g_enable_projax; if ( $g_enable_projax ) { echo ''; echo ''; } } } # -------------------- # (7) End the section function html_head_end() { echo '', "\n"; } # -------------------- # (8) Begin the section function html_body_begin() { echo '', "\n"; } # -------------------- # (9) Print the title displayed at the top of the page function html_header() { #$t_title = config_get( 'page_title' ); #echo '
', string_display( $t_title ), '
', "\n"; } # -------------------- # (10) Print a user-defined banner at the top of the page if there is one. function html_top_banner() { $t_page = config_get( 'top_include_page' ); if ( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) { PRINT ''; print '
'; if ( auth_is_user_authenticated() ) { print '
'; print_recently_visited(); print '
'; print_projectinfo(); PRINT '

'; } } else { if ( is_page_name( 'login_page' ) ) { $t_align = 'center'; } else { $t_align = 'left'; } echo '
'; echo 'Mantis Bugtracker'; echo '
'; } } # -------------------- # (11) Print the user's account information function html_login_info() { $t_now = date( config_get( 'complete_date_format' ) ); $t_username = current_user_get_field( 'username' ); $t_access_level = get_enum_element( 'access_levels', current_user_get_access_level() ); $t_realname = current_user_get_field( 'realname' ); print '
'; print ''; print ''; print '
'; } # -------------------- # (12) Print a user-defined banner at the bottom of the page if there is one. function html_bottom_banner() { $t_page = config_get( 'bottom_include_page' ); if ( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) { include( $t_page ); } } # -------------------- # (13) Print the page footer information function html_footer( $p_file ) { global $g_timer, $g_queries_array, $g_request_time; # If a user is logged in, update their last visit time. # We do this at the end of the page so that: # 1) we can display the user's last visit time on a page before updating it # 2) we don't invalidate the user cache immediately after fetching it # 3) don't do this on the password verification or update page, as it causes the # verification comparison to fail if ( auth_is_user_authenticated() && !( is_page_name( 'verify.php' ) || is_page_name( 'account_update.php' ) ) ) { $t_user_id = auth_get_current_user_id(); user_update_last_visit( $t_user_id ); } print '
'; # close page div. Opened at html_top_banner. print ''; } # -------------------- # (14) End the section function html_body_end() { echo '', "\n"; } # -------------------- # (15) Print the closing tag function html_end() { echo '', "\n"; } ########################################################################### # HTML Menu API ########################################################################### function prepare_custom_menu_options( $p_config ) { $t_custom_menu_options = config_get( $p_config ); $t_options = array(); foreach( $t_custom_menu_options as $t_custom_option ) { $t_access_level = $t_custom_option[1]; if ( access_has_project_level( $t_access_level ) ) { $t_caption = lang_get_defaulted( $t_custom_option[0] ); $t_link = $t_custom_option[2]; $t_options[] = "$t_caption"; } } return $t_options; } # -------------------- # Print the main menu function print_menu() { if ( auth_is_user_authenticated() ) { $t_protected = current_user_get_field( 'protected' ); $t_current_project = helper_get_current_project(); PRINT ''; } } # -------------------- # Print the project switcher and issues jumper if user is authenticated function print_projectinfo() { if ( auth_is_user_authenticated() ) { print '
'; print ''; print '
'; } } # -------------------- # Print the menu bar with a list of projects to which the user has access function print_project_menu_bar() { $t_project_ids = current_user_get_accessible_projects(); PRINT ''; PRINT ''; PRINT ''; PRINT ''; PRINT '
'; } # -------------------- # Print the menu bar with a list of projects to which the user has access function print_subproject_menu_bar( $p_project_id, $p_parents = '' ) { $t_subprojects = current_user_get_accessible_subprojects( $p_project_id ); $t_char = ':'; foreach ( $t_subprojects as $t_subproject ) { PRINT "$t_char " . string_display( project_get_field( $t_subproject, 'name' ) ) . ''; print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' ); $t_char = ','; } } # -------------------- # Print the menu for the graph summary section function print_menu_graph() { if ( config_get( 'use_jpgraph' ) ) { $t_icon_path = config_get( 'icon_path' ); PRINT '
'; PRINT '' . lang_get( 'synthesis_link' ) . ' | '; PRINT '' . lang_get( 'status_link' ) . ' | '; PRINT '' . lang_get( 'priority_link' ) . ' | '; PRINT '' . lang_get( 'severity_link' ) . ' | '; PRINT '' . lang_get( 'category_link' ) . ' | '; PRINT '' . lang_get( 'resolution_link' ) . ''; } } # -------------------- # Print the menu for the manage section # $p_page specifies the current page name so it's link can be disabled function print_manage_menu( $p_page = '' ) { $t_manage_user_page = 'manage_user_page.php'; $t_manage_project_menu_page = 'manage_proj_page.php'; $t_manage_custom_field_page = 'manage_custom_field_page.php'; $t_manage_config_page = 'adm_config_report.php'; $t_manage_prof_menu_page = 'manage_prof_menu_page.php'; # $t_documentation_page = 'documentation_page.php'; switch ( $p_page ) { case $t_manage_user_page: $t_manage_user_page = ''; break; case $t_manage_project_menu_page: $t_manage_project_menu_page = ''; break; case $t_manage_custom_field_page: $t_manage_custom_field_page = ''; break; case $t_manage_config_page: $t_manage_config_page = ''; break; case $t_manage_prof_menu_page: $t_manage_prof_menu_page = ''; break; # case $t_documentation_page: # $t_documentation_page = ''; # break; } PRINT '
'; if ( access_has_global_level( config_get( 'manage_user_threshold' ) ) ) { print_bracket_link( $t_manage_user_page, lang_get( 'manage_users_link' ) ); } if ( access_has_project_level( config_get( 'manage_project_threshold' ) ) ) { print_bracket_link( $t_manage_project_menu_page, lang_get( 'manage_projects_link' ) ); } if ( access_has_global_level( config_get( 'manage_custom_fields_threshold' ) ) ) { print_bracket_link( $t_manage_custom_field_page, lang_get( 'manage_custom_field_link' ) ); } if ( access_has_global_level( config_get( 'manage_global_profile_threshold' ) ) ) { print_bracket_link( $t_manage_prof_menu_page, lang_get( 'manage_global_profiles_link' ) ); } if ( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) { print_bracket_link( $t_manage_config_page, lang_get( 'manage_config_link' ) ); } # print_bracket_link( $t_documentation_page, lang_get( 'documentation_link' ) ); PRINT '
'; } # -------------------- # Print the menu for the manage configuration section # $p_page specifies the current page name so it's link can be disabled function print_manage_config_menu( $p_page = '' ) { $t_configuration_report = 'adm_config_report.php'; $t_permissions_summary_report = 'adm_permissions_report.php'; $t_manage_work_threshold = 'manage_config_work_threshold_page.php'; $t_manage_email = 'manage_config_email_page.php'; $t_manage_workflow = 'manage_config_workflow_page.php'; switch ( $p_page ) { case $t_configuration_report: $t_configuration_report = ''; break; case $t_permissions_summary_report: $t_permissions_summary_report = ''; break; case $t_manage_work_threshold: $t_manage_work_threshold = ''; break; case $t_manage_email: $t_manage_email = ''; break; case $t_manage_workflow: $t_manage_workflow = ''; break; } PRINT '
'; if ( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) { print_bracket_link( $t_configuration_report, lang_get_defaulted( 'configuration_report' ) ); print_bracket_link( $t_permissions_summary_report, lang_get( 'permissions_summary_report' ) ); print_bracket_link( $t_manage_work_threshold, lang_get( 'manage_threshold_config' ) ); print_bracket_link( $t_manage_workflow, lang_get( 'manage_workflow_config' ) ); print_bracket_link( $t_manage_email, lang_get( 'manage_email_config' ) ); } PRINT '
'; } # -------------------- # Print the menu for the account section # $p_page specifies the current page name so it's link can be disabled function print_account_menu( $p_page='' ) { $t_account_page = 'account_page.php'; $t_account_prefs_page = 'account_prefs_page.php'; $t_account_profile_menu_page = 'account_prof_menu_page.php'; $t_account_sponsor_page = 'account_sponsor_page.php'; switch ( $p_page ) { case $t_account_page : $t_account_page = ''; break; case $t_account_prefs_page : $t_account_prefs_page = ''; break; case $t_account_profile_menu_page : $t_account_profile_menu_page = ''; break; case $t_account_sponsor_page : $t_account_sponsor_page = ''; break; } print_bracket_link( $t_account_page, lang_get( 'account_link' ) ); print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) ); if ( access_has_project_level( config_get( 'add_profile_threshold' ) ) ) { print_bracket_link( $t_account_profile_menu_page, lang_get( 'manage_profiles_link' ) ); } if ( ( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_project_level( config_get( 'view_sponsorship_total_threshold' ) ) ) && !current_user_is_anonymous() ) { print_bracket_link( $t_account_sponsor_page, lang_get( 'my_sponsorship' ) ); } } # -------------------- # Print the menu for the docs section # $p_page specifies the current page name so it's link can be disabled function print_doc_menu( $p_page='' ) { $t_documentation_html = config_get( 'manual_url' ); $t_proj_doc_page = 'proj_doc_page.php'; $t_proj_doc_add_page = 'proj_doc_add_page.php'; switch ( $p_page ) { case $t_documentation_html : $t_documentation_html = ''; break; case $t_proj_doc_page : $t_proj_doc_page = ''; break; case $t_proj_doc_add_page : $t_proj_doc_add_page = ''; break; } print_bracket_link( $t_documentation_html, lang_get( 'user_documentation' ) ); print_bracket_link( $t_proj_doc_page, lang_get( 'project_documentation' ) ); if ( file_allow_project_upload() ) { print_bracket_link( $t_proj_doc_add_page, lang_get( 'add_file' ) ); } } # -------------------- # Print the menu for the summary section # $p_page specifies the current page name so it's link can be disabled function print_summary_menu( $p_page='' ) { PRINT '
'; print_bracket_link( 'print_all_bug_page.php', lang_get( 'print_all_bug_page_link' ) ); if ( config_get( 'use_jpgraph' ) != 0 ) { $t_summary_page = 'summary_page.php'; $t_summary_jpgraph_page = 'summary_jpgraph_page.php'; switch ( $p_page ) { case $t_summary_page : $t_summary_page = ''; break; case $t_summary_jpgraph_page: $t_summary_jpgraph_page = ''; break; } print_bracket_link( $t_summary_page, lang_get( 'summary_link' ) ); print_bracket_link( $t_summary_jpgraph_page, lang_get( 'summary_jpgraph_link' ) ); } PRINT '
'; } #========================= # Candidates for moving to print_api #========================= # -------------------- # Print the color legend for the status colors function html_status_legend() { PRINT '
'; PRINT ''; PRINT ''; $t_arr = explode_enum_string( config_get( 'status_enum_string' ) ); $enum_count = count( $t_arr ); $width = (int)(100 / $enum_count); for ( $i=0; $i < $enum_count; $i++) { $t_s = explode_enum_arr( $t_arr[$i] ); $t_val = get_enum_element( 'status', $t_s[0] ); $t_color = get_status_color( $t_s[0] ); PRINT ""; } PRINT ''; PRINT '
$t_val
'; if ( ON == config_get( 'status_percentage_legend' ) ) { html_status_percentage_legend(); } } # -------------------- # Print the legend for the status percentage function html_status_percentage_legend() { $t_mantis_bug_table = config_get( 'mantis_bug_table' ); $t_project_id = helper_get_current_project(); $t_user_id = auth_get_current_user_id(); #checking if it's a per project statistic or all projects $t_specific_where = helper_project_specific_where( $t_project_id, $t_user_id ); $query = "SELECT status, COUNT(*) AS number FROM $t_mantis_bug_table WHERE $t_specific_where GROUP BY status"; $result = db_query( $query ); $t_bug_count = 0; $t_status_count_array = array(); while ( $row = db_fetch_array( $result ) ) { $t_status_count_array[ $row['status'] ] = $row['number']; $t_bug_count += $row['number']; } $t_arr = explode_enum_string( config_get( 'status_enum_string' ) ); $enum_count = count( $t_arr ); if ( $t_bug_count > 0 ) { echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; for ( $i=0; $i < $enum_count; $i++) { $t_s = explode_enum_arr( $t_arr[$i] ); $t_color = get_status_color( $t_s[0] ); $t_status = $t_s[0]; if ( !isset( $t_status_count_array[ $t_status ] ) ) { $t_status_count_array[ $t_status ] = 0; } $width = round( ( $t_status_count_array[ $t_status ] / $t_bug_count ) * 100 ); if ($width > 0) { echo ""; } } echo ''; echo '
'.lang_get( 'issue_status_percentage' ).'
$width%
'; } } # -------------------- # Print an html button inside a form function html_button ( $p_action, $p_button_text, $p_fields = null, $p_method = 'post' ) { $p_action = urlencode( $p_action ); $p_button_text = string_attribute( $p_button_text ); if ( null === $p_fields ) { $p_fields = array(); } if ( strtolower( $p_method ) == 'get' ) { $t_method = 'get'; } else { $t_method = 'post'; } PRINT "
\n"; foreach ( $p_fields as $key => $val ) { $key = string_attribute( $key ); $val = string_attribute( $val ); PRINT " \n"; } PRINT " \n"; PRINT "
\n"; } # -------------------- # Print a button to update the given bug function html_button_bug_update( $p_bug_id ) { if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { html_button( string_get_bug_update_page(), lang_get( 'update_bug_button' ), array( 'bug_id' => $p_bug_id ) ); } } # -------------------- # Print Change Status to: button # This code is similar to print_status_option_list except # there is no masking, except for the current state function html_button_bug_change_status( $p_bug_id ) { $t_bug_project_id = bug_get_field( $p_bug_id, 'project_id' ); $t_bug_current_state = bug_get_field( $p_bug_id, 'status' ); $t_current_access = access_get_project_level( $t_bug_project_id ); $t_enum_list = get_status_option_list( $t_current_access, $t_bug_current_state, false, ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() && ( ON == config_get( 'allow_reporter_close' ) ) ) ); if ( count( $t_enum_list ) > 0 ) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each( $t_enum_list ); $t_default = $t_default_arr['key']; ksort( $t_enum_list ); reset( $t_enum_list ); echo "
"; $t_button_text = lang_get( 'bug_status_to_button' ); echo ""; echo " '; $t_bug_id = string_attribute( $p_bug_id ); echo "\n"; echo "
\n"; } } # -------------------- # Print Assign To: combo box of possible handlers function html_button_bug_assign_to( $p_bug_id ) { # make sure status is allowed of assign would cause auto-set-status $t_status = bug_get_field( $p_bug_id, 'status' ); # workflow implementation if ( ON == config_get( 'auto_set_status_to_assigned' ) && !bug_check_workflow( $t_status, config_get( 'bug_assigned_status' ) ) ) { # workflow return; } # make sure current user has access to modify bugs. if ( !access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $p_bug_id ) ) { return; } $t_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' ); $t_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); $t_current_user_id = auth_get_current_user_id(); $t_new_status = ( ON == config_get( 'auto_set_status_to_assigned' ) ) ? config_get( 'bug_assigned_status' ) : $t_status; $t_options = array(); $t_default_assign_to = null; if ( ( $t_handler_id != $t_current_user_id ) && ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_current_user_id ) ) ) { $t_options[] = array( $t_current_user_id, '[' . lang_get( 'myself' ) . ']' ); $t_default_assign_to = $t_current_user_id; } if ( ( $t_handler_id != $t_reporter_id ) && user_exists( $t_reporter_id ) && ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_reporter_id ) ) ) { $t_options[] = array( $t_reporter_id, '[' . lang_get( 'reporter' ) . ']' ); if ( $t_default_assign_to === null ) { $t_default_assign_to = $t_reporter_id; } } PRINT "
"; $t_button_text = lang_get( 'bug_assign_to_button' ); PRINT ""; PRINT " "; $t_bug_id = string_attribute( $p_bug_id ); PRINT "\n"; PRINT "
\n"; } # -------------------- # Print a button to move the given bug to a different project function html_button_bug_move( $p_bug_id ) { $t_status = bug_get_field( $p_bug_id, 'status' ); if ( access_has_bug_level( config_get( 'move_bug_threshold' ), $p_bug_id ) ) { html_button( 'bug_actiongroup_page.php', lang_get( 'move_bug_button' ), array( 'bug_arr[]' => $p_bug_id, 'action' => 'MOVE' ) ); } } # -------------------- # Print a button to move the given bug to a different project function html_button_bug_create_child( $p_bug_id ) { if ( ON == config_get( 'enable_relationship' ) ) { if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) ); } } } # -------------------- # Print a button to reopen the given bug function html_button_bug_reopen( $p_bug_id ) { $t_status = bug_get_field( $p_bug_id, 'status' ); $t_reopen_status = config_get( 'bug_reopen_status' ); $t_project = bug_get_field( $p_bug_id, 'project_id' ); if ( access_has_bug_level( config_get( 'reopen_bug_threshold' ), $p_bug_id ) || ( ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) && ( ON == config_get( 'allow_reporter_reopen' ) ) ) ) { html_button( 'bug_change_status_page.php', lang_get( 'reopen_bug_button' ), array( 'bug_id' => $p_bug_id , 'new_status' => $t_reopen_status, 'reopen_flag' => ON ) ); } } # -------------------- # Print a button to monitor the given bug function html_button_bug_monitor( $p_bug_id ) { if ( access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_bug_id ) ) { html_button( 'bug_monitor.php', lang_get( 'monitor_bug_button' ), array( 'bug_id' => $p_bug_id, 'action' => 'add' ) ); } } # -------------------- # Print a button to unmonitor the given bug # no reason to ever disallow someone from unmonitoring a bug function html_button_bug_unmonitor( $p_bug_id ) { html_button( 'bug_monitor.php', lang_get( 'unmonitor_bug_button' ), array( 'bug_id' => $p_bug_id, 'action' => 'delete' ) ); } # -------------------- # Print a button to delete the given bug function html_button_bug_delete( $p_bug_id ) { if ( access_has_bug_level( config_get( 'delete_bug_threshold' ), $p_bug_id ) ) { html_button( 'bug_actiongroup_page.php', lang_get( 'delete_bug_button' ), array( 'bug_arr[]' => $p_bug_id, 'action' => 'DELETE' ) ); } } # -------------------- # Print a button to create a wiki page function html_button_wiki( $p_bug_id ) { if ( ON == config_get( 'wiki_enable' ) ) { if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { html_button( 'wiki.php', lang_get_defaulted( 'Wiki' ), array( 'id' => $p_bug_id, 'type' => 'issue' ), 'get' ); } } } # -------------------- # Print all buttons for view bug pages function html_buttons_view_bug_page( $p_bug_id ) { $t_resolved = config_get( 'bug_resolved_status_threshold' ); $t_status = bug_get_field( $p_bug_id, 'status' ); $t_readonly = bug_is_readonly( $p_bug_id ); PRINT ''; if ( !$t_readonly ) { # UPDATE button echo ''; # ASSIGN button echo ''; } # Change State button echo ''; # MONITOR/UNMONITOR button echo ''; if ( !$t_readonly ) { # CREATE CHILD button echo ''; } if ( $t_resolved <= $t_status ) { # resolved is not the same as readonly PRINT ''; } if ( !$t_readonly ) { # MOVE button echo ''; } # DELETE button echo ''; helper_call_custom_function( 'print_bug_view_page_custom_buttons', array( $p_bug_id ) ); echo '
'; html_button_bug_update( $p_bug_id ); echo ''; html_button_bug_assign_to( $p_bug_id ); echo ''; html_button_bug_change_status( $p_bug_id ); echo ''; if ( !current_user_is_anonymous() ) { if ( user_is_monitoring_bug( auth_get_current_user_id(), $p_bug_id ) ) { html_button_bug_unmonitor( $p_bug_id ); } else { html_button_bug_monitor( $p_bug_id ); } } echo ''; html_button_bug_create_child( $p_bug_id ); echo ''; # REOPEN button html_button_bug_reopen( $p_bug_id ); PRINT ''; html_button_bug_move( $p_bug_id ); echo ''; html_button_bug_delete( $p_bug_id ); echo '
'; } ?>