Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/manage_config_work_threshold_set.php

ef5584
ef5584
# Mantis - a php based bugtracking system
ef5584
ef5584
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
ef5584
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
ef5584
ef5584
# Mantis is free software: you can redistribute it and/or modify
ef5584
# it under the terms of the GNU General Public License as published by
ef5584
# the Free Software Foundation, either version 2 of the License, or
ef5584
# (at your option) any later version.
ef5584
#
ef5584
# Mantis is distributed in the hope that it will be useful,
ef5584
# but WITHOUT ANY WARRANTY; without even the implied warranty of
ef5584
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ef5584
# GNU General Public License for more details.
ef5584
#
ef5584
# You should have received a copy of the GNU General Public License
ef5584
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
ef5584
ef5584
	#------------------------------
ef5584
	#   $Revision: 2643 $
ef5584
	#     $Author: al $    
ef5584
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $  
ef5584
	#------------------------------
ef5584
ef5584
	require_once( 'core.php' );
ef5584
ef5584
	$t_core_path = config_get( 'core_path' );
ef5584
	require_once( $t_core_path.'email_api.php' );
ef5584
ef5584
	# helper_ensure_post();
ef5584
ef5584
	auth_reauthenticate();
ef5584
ef5584
	$t_redirect_url = 'manage_config_work_threshold_page.php';
ef5584
	$t_project = helper_get_current_project();
ef5584
ef5584
	html_page_top1( lang_get( 'manage_threshold_config' ) );
ef5584
	html_meta_redirect( $t_redirect_url );
ef5584
	html_page_top2();
ef5584
ef5584
	$t_access = current_user_get_access_level();
ef5584
ef5584
	function set_capability_row( $p_threshold, $p_all_projects_only=false ) {
ef5584
	    global $t_access, $t_project;
ef5584
ef5584
	    if ( ( $t_access >= config_get_access( $p_threshold ) )
ef5584
		          && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
ef5584
	        $f_threshold = gpc_get_int_array( 'flag_thres_' . $p_threshold, array( ) );
ef5584
	        $f_access = gpc_get_int( 'access_' . $p_threshold );
ef5584
            # @@debug @@ echo "
for $p_threshold "; var_dump($f_threshold, $f_access); echo '
';
ef5584
		    $t_access_levels = get_enum_to_array( config_get( 'access_levels_enum_string' ) );
ef5584
		    ksort( $t_access_levels );
ef5584
		    reset( $t_access_levels );
ef5584
ef5584
		    $t_lower_threshold = NOBODY;
ef5584
		    $t_array_threshold = array();
ef5584
ef5584
		    foreach( $t_access_levels as $t_access_level => $t_level_name ) {
ef5584
		        if ( in_array( $t_access_level, $f_threshold ) ) {
ef5584
		            if ( NOBODY == $t_lower_threshold ) {
ef5584
		                $t_lower_threshold = $t_access_level;
ef5584
		            }
ef5584
		            $t_array_threshold[] = $t_access_level;
ef5584
		        } else {
ef5584
		            if ( NOBODY <> $t_lower_threshold ) {
ef5584
		                $t_lower_threshold = -1;
ef5584
		            }
ef5584
		        }
ef5584
            # @@debug @@ var_dump($$t_access_level, $t_lower_threshold, $t_array_threshold); echo '
';
ef5584
            }
ef5584
            $t_existing_threshold = config_get( $p_threshold );
ef5584
            if ( -1 == $t_lower_threshold ) {
ef5584
                if ( $t_existing_threshold != $t_array_threshold ) {
ef5584
                    config_set( $p_threshold, $t_array_threshold, NO_USER, $t_project, $f_access );
ef5584
                }
ef5584
		    } else {
ef5584
                if ( $t_existing_threshold != $t_lower_threshold ) {
ef5584
                    config_set( $p_threshold, $t_lower_threshold, NO_USER, $t_project, $f_access );
ef5584
                }
ef5584
		    }
ef5584
		}
ef5584
	}
ef5584
ef5584
	function set_capability_boolean( $p_threshold, $p_all_projects_only=false ) {
ef5584
	    global $t_access, $t_project;
ef5584
ef5584
	    if ( ( $t_access >= config_get_access( $p_threshold ) )
ef5584
		          && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
ef5584
	        $f_flag = gpc_get( 'flag_' . $p_threshold, OFF );
ef5584
	        $f_access = gpc_get_int( 'access_' . $p_threshold );
ef5584
	        $f_flag = ( OFF == $f_flag ) ? OFF : ON;
ef5584
            # @@debug @@ echo "
for $p_threshold "; var_dump($f_flag, $f_access); echo '
';
ef5584
ef5584
            if ( $f_flag != config_get( $p_threshold ) ) {
ef5584
                config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
ef5584
            }
ef5584
		}
ef5584
	}
ef5584
ef5584
	function set_capability_enum( $p_threshold, $p_all_projects_only=false ) {
ef5584
	    global $t_access, $t_project;
ef5584
ef5584
	    if ( ( $t_access >= config_get_access( $p_threshold ) )
ef5584
		          && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
ef5584
	        $f_flag = gpc_get( 'flag_' . $p_threshold );
ef5584
	        $f_access = gpc_get_int( 'access_' . $p_threshold );
ef5584
            # @@debug @@ echo "
for $p_threshold "; var_dump($f_flag, $f_access); echo '
';
ef5584
ef5584
            if ( $f_flag != config_get( $p_threshold ) ) {
ef5584
                config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
ef5584
            }
ef5584
		}
ef5584
	}
ef5584
ef5584
ef5584
	# Issues
ef5584
	set_capability_row( 'report_bug_threshold' );
ef5584
    set_capability_enum( 'bug_submit_status' );
ef5584
	set_capability_row( 'update_bug_threshold' );
ef5584
	set_capability_boolean( 'allow_close_immediately' );
ef5584
    set_capability_boolean( 'allow_reporter_close' );
ef5584
	set_capability_row( 'monitor_bug_threshold' );
ef5584
	set_capability_row( 'handle_bug_threshold' );
ef5584
 	set_capability_row( 'update_bug_assign_threshold' );
ef5584
	set_capability_row( 'move_bug_threshold', true );
ef5584
	set_capability_row( 'delete_bug_threshold' );
ef5584
	set_capability_row( 'reopen_bug_threshold' );
ef5584
    set_capability_boolean( 'allow_reporter_reopen' );
ef5584
    set_capability_enum( 'bug_reopen_status' );
ef5584
    set_capability_enum( 'bug_reopen_resolution' );
ef5584
    set_capability_enum( 'bug_resolved_status_threshold' );
ef5584
    set_capability_enum( 'bug_readonly_status_threshold' );
ef5584
	set_capability_row( 'private_bug_threshold' );
ef5584
	set_capability_row( 'update_readonly_bug_threshold' );
ef5584
	set_capability_row( 'update_bug_status_threshold' );
ef5584
	set_capability_row( 'set_view_status_threshold' );
ef5584
	set_capability_row( 'change_view_status_threshold' );
ef5584
	set_capability_row( 'show_monitor_list_threshold' );
ef5584
    set_capability_boolean( 'auto_set_status_to_assigned' );
ef5584
    set_capability_enum( 'bug_assigned_status' );
ef5584
    set_capability_boolean( 'limit_reporters', true );
ef5584
ef5584
	# Notes
ef5584
	set_capability_row( 'add_bugnote_threshold' );
ef5584
	set_capability_row( 'update_bugnote_threshold' );
ef5584
    set_capability_boolean( 'bugnote_allow_user_edit_delete' );
ef5584
	set_capability_row( 'delete_bugnote_threshold' );
ef5584
	set_capability_row( 'private_bugnote_threshold' );
ef5584
ef5584
ef5584
	# Others
ef5584
	set_capability_row( 'view_changelog_threshold' );
ef5584
	set_capability_row( 'view_handler_threshold' );
ef5584
	set_capability_row( 'view_history_threshold' );
ef5584
	set_capability_row( 'bug_reminder_threshold' );
ef5584
ef5584
?>
ef5584
ef5584
ef5584
ef5584
	echo '

' . lang_get( 'operation_successful' ) . '

';
ef5584
	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
ef5584
?>
ef5584
ef5584
ef5584