. /** * @package MantisBT * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org */ /** * MantisBT Core API's */ require_once( 'core.php' ); require_once( 'email_api.php' ); auth_reauthenticate(); html_page_top( lang_get( 'manage_threshold_config' ) ); print_manage_menu( 'adm_permissions_report.php' ); print_manage_config_menu( 'manage_config_work_threshold_page.php' ); $t_user = auth_get_current_user_id(); $t_project_id = helper_get_current_project(); $t_access = user_get_access_level( $t_user, $t_project_id ); $t_show_submit = false; $t_access_levels = MantisEnum::getAssocArrayIndexedByValues( config_get( 'access_levels_enum_string' ) ); $t_overrides = array(); function set_overrides( $p_config ) { global $t_overrides; if ( !in_array( $p_config, $t_overrides ) ) { $t_overrides[] = $p_config; } } function get_section_begin_mcwt( $p_section_name ) { global $t_access_levels; echo ''; echo '' . "\n"; echo ''; echo ''; echo ''; foreach( $t_access_levels as $t_access_level => $t_access_label ) { echo ''; } echo '' . "\n"; } function get_capability_row( $p_caption, $p_threshold, $p_all_projects_only=false ) { global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; $t_file = config_get_global( $p_threshold ); if ( !is_array( $t_file ) ) { $t_file_exp = array(); foreach( $t_access_levels as $t_access_level => $t_label ) { if ( $t_access_level >= $t_file ) { $t_file_exp[] = $t_access_level; } } } else { $t_file_exp = $t_file; } $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); if ( !is_array( $t_global ) ) { $t_global_exp = array(); foreach( $t_access_levels as $t_access_level => $t_label ) { if ( $t_access_level >= $t_global ) { $t_global_exp[] = $t_access_level; } } } else { $t_global_exp = $t_global; } $t_project = config_get( $p_threshold ); if ( !is_array( $t_project ) ) { $t_project_exp = array(); foreach( $t_access_levels as $t_access_level => $t_label ) { if ( $t_access_level >= $t_project ) { $t_project_exp[] = $t_access_level; } } } else { $t_project_exp = $t_project; } $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); echo ''; foreach( $t_access_levels as $t_access_level => $t_access_label ) { $t_file = in_array( $t_access_level, $t_file_exp ); $t_global = in_array( $t_access_level, $t_global_exp ); $t_project = in_array( $t_access_level, $t_project_exp ) ; $t_colour = ''; if ( $t_global != $t_file ) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ( $t_can_change ) { set_overrides( $p_threshold ); } } if ( $t_project != $t_global ) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ( $t_can_change ) { set_overrides( $p_threshold ); } } if ( $t_can_change ) { $t_checked = $t_project ? "checked=\"checked\"" : ""; $t_value = ""; $t_show_submit = true; } else { if ( $t_project ) { $t_value = 'X'; } else { $t_value = ' '; } } echo ''; } if ( $t_can_change ) { echo ''; } else { echo ''; } echo '' . "\n"; } function get_capability_boolean( $p_caption, $p_threshold, $p_all_projects_only=false ) { global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; $t_file = config_get_global( $p_threshold ); $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); $t_project = config_get( $p_threshold ); $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); $t_colour = ''; if ( $t_global != $t_file ) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ( $t_can_change ) { set_overrides( $p_threshold ); } } if ( $t_project != $t_global ) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ( $t_can_change ) { set_overrides( $p_threshold ); } } echo ''; if ( $t_can_change ) { $t_checked = ( ON == config_get( $p_threshold ) ) ? "checked=\"checked\"" : ""; $t_value = ""; $t_show_submit = true; } else { if ( ON == config_get( $p_threshold ) ) { $t_value = 'X'; } else { $t_value = ' '; } } echo '' . $t_value . ''; if ( $t_can_change ) { echo ''; } else { echo ''; } echo '' . "\n"; } function get_capability_enum( $p_caption, $p_threshold, $p_enum, $p_all_projects_only=false ) { global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; $t_file = config_get_global( $p_threshold ); $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); $t_project = config_get( $p_threshold ); $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); $t_colour = ''; if ( $t_global != $t_file ) { $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override if ( $t_can_change ) { set_overrides( $p_threshold ); } } if ( $t_project != $t_global ) { $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides if ( $t_can_change ) { set_overrides( $p_threshold ); } } echo ''; if ( $t_can_change ) { echo ''; $t_show_submit = true; } else { $t_value = MantisEnum::getLabel( lang_get( $p_enum . '_enum_string' ), config_get( $p_threshold ) ) . ' '; echo ''; } if ( $t_can_change ) { echo ''; } else { echo ''; } echo '' . "\n"; } function get_section_end() { echo '
' . $p_section_name . '
' . lang_get( 'perm_rpt_capability' ) . '' . lang_get( 'access_levels' ) . ' ' . lang_get( 'alter_level' ) . ' 
 ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), $t_access_level ) . ' 
' . string_display( $p_caption ) . '' . $t_value . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 
' . string_display( $p_caption ) . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 
' . string_display( $p_caption ) . '' . $t_value . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 

' . "\n"; } $t_colour_project = config_get( 'colour_project'); $t_colour_global = config_get( 'colour_global'); echo "

\n"; if ( ALL_PROJECTS == $t_project_id ) { $t_project_title = lang_get( 'config_all_projects' ); } else { $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project_id ) ) ); } echo '

' . $t_project_title . '

' . "\n"; echo '

' . lang_get( 'colour_coding' ) . '
'; if ( ALL_PROJECTS <> $t_project_id ) { echo '' . lang_get( 'colour_project' ) .'
'; } echo '' . lang_get( 'colour_global' ) . '

'; echo "
\n"; echo form_security_field( 'manage_config_work_threshold_set' ); # Issues get_section_begin_mcwt( lang_get( 'issues' ) ); get_capability_row( lang_get( 'report_issue' ), 'report_bug_threshold' ); get_capability_enum( lang_get( 'submit_status' ), 'bug_submit_status', 'status' ); get_capability_row( lang_get( 'update_issue' ), 'update_bug_threshold' ); get_capability_boolean( lang_get( 'allow_close_immediate' ), 'allow_close_immediately' ); get_capability_boolean( lang_get( 'allow_reporter_close' ), 'allow_reporter_close' ); get_capability_row( lang_get( 'monitor_issue' ), 'monitor_bug_threshold' ); get_capability_row( lang_get( 'handle_issue' ), 'handle_bug_threshold' ); get_capability_row( lang_get( 'assign_issue' ), 'update_bug_assign_threshold' ); get_capability_row( lang_get( 'move_issue' ), 'move_bug_threshold', true ); get_capability_row( lang_get( 'delete_issue' ), 'delete_bug_threshold' ); get_capability_row( lang_get( 'reopen_issue' ), 'reopen_bug_threshold' ); get_capability_boolean( lang_get( 'allow_reporter_reopen' ), 'allow_reporter_reopen' ); get_capability_enum( lang_get( 'reopen_status' ), 'bug_reopen_status', 'status' ); get_capability_enum( lang_get( 'reopen_resolution' ), 'bug_reopen_resolution', 'resolution' ); get_capability_enum( lang_get( 'resolved_status' ), 'bug_resolved_status_threshold', 'status' ); get_capability_enum( lang_get( 'readonly_status' ), 'bug_readonly_status_threshold', 'status' ); get_capability_row( lang_get( 'update_readonly_issues' ), 'update_readonly_bug_threshold' ); get_capability_row( lang_get( 'update_issue_status' ), 'update_bug_status_threshold' ); get_capability_row( lang_get( 'view_private_issues' ), 'private_bug_threshold' ); get_capability_row( lang_get( 'set_view_status' ), 'set_view_status_threshold' ); get_capability_row( lang_get( 'update_view_status' ), 'change_view_status_threshold' ); get_capability_row( lang_get( 'show_list_of_users_monitoring_issue' ), 'show_monitor_list_threshold' ); get_capability_boolean( lang_get( 'set_status_assigned' ), 'auto_set_status_to_assigned' ); get_capability_enum( lang_get( 'assigned_status' ), 'bug_assigned_status', 'status' ); get_capability_boolean( lang_get( 'limit_access' ), 'limit_reporters', true ); get_section_end(); # Notes get_section_begin_mcwt( lang_get( 'notes' ) ); get_capability_row( lang_get( 'add_notes' ), 'add_bugnote_threshold' ); get_capability_row( lang_get( 'update_notes' ), 'update_bugnote_threshold' ); get_capability_boolean( lang_get( 'allow_user_edit' ), 'bugnote_allow_user_edit_delete' ); get_capability_row( lang_get( 'delete_note' ), 'delete_bugnote_threshold' ); get_capability_row( lang_get( 'view_private_notes' ), 'private_bugnote_threshold' ); get_section_end(); # Others get_section_begin_mcwt( lang_get('others' ) ); get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'changelog_link' ), 'view_changelog_threshold' ); get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'assigned_to' ), 'view_handler_threshold' ); get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'bug_history' ), 'view_history_threshold' ); get_capability_row( lang_get( 'send_reminders' ), 'bug_reminder_threshold' ); get_capability_row( lang_get( 'receive_reminders' ), 'reminder_receive_threshold' ); get_section_end(); if ( $t_show_submit ) { echo "\n"; } echo "
\n"; if ( $t_show_submit && ( 0 < count( $t_overrides ) ) ) { echo "
\n"; echo form_security_field( 'manage_config_revert' ); echo ""; echo ""; echo ""; echo "\n"; echo "
\n"; } html_page_bottom();