|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis - a php based bugtracking system
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
|
|
4c79b5 |
# Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Mantis is free software: you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation, either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Mantis is distributed in the hope that it will be useful,
|
|
|
4c79b5 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
4c79b5 |
# GNU General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
# $Revision: 2643 $
|
|
|
4c79b5 |
# $Author: al $
|
|
|
4c79b5 |
# $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $
|
|
|
4c79b5 |
#------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
require_once( 'core.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_core_path = config_get( 'core_path' );
|
|
|
4c79b5 |
require_once( $t_core_path.'email_api.php' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# helper_ensure_post();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
auth_reauthenticate();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) );
|
|
|
4c79b5 |
access_ensure_project_level( $t_can_change_level );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$t_redirect_url = 'manage_config_workflow_page.php';
|
|
|
4c79b5 |
$t_project = helper_get_current_project();
|
|
|
4c79b5 |
$t_access = current_user_get_access_level();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html_page_top1( lang_get( 'manage_workflow_config' ) );
|
|
|
4c79b5 |
html_meta_redirect( $t_redirect_url );
|
|
|
4c79b5 |
html_page_top2();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# process the changes to threshold values
|
|
|
4c79b5 |
$t_valid_thresholds = array( 'bug_submit_status', 'bug_resolved_status_threshold', 'bug_reopen_status' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach( $t_valid_thresholds as $t_threshold ) {
|
|
|
4c79b5 |
if( config_get_access( $t_threshold ) <= $t_access ) {
|
|
|
4c79b5 |
$f_value = gpc_get( 'threshold_' . $t_threshold );
|
|
|
4c79b5 |
$f_access = gpc_get( 'access_' . $t_threshold );
|
|
|
4c79b5 |
if ( $f_value != config_get( $t_threshold ) ) {
|
|
|
4c79b5 |
config_set( $t_threshold, $f_value, NO_USER, $t_project, $f_access );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# process the workflow by reversing the flags to a matrix and creating the appropriate string
|
|
|
4c79b5 |
if( config_get_access( 'status_enum_workflow' ) <= $t_access ) {
|
|
|
4c79b5 |
$f_value = gpc_get( 'flag', array() );
|
|
|
4c79b5 |
$f_access = gpc_get( 'workflow_access' );
|
|
|
4c79b5 |
$t_matrix = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach( $f_value as $t_transition ) {
|
|
|
4c79b5 |
list( $t_from, $t_to ) = split( ':', $t_transition );
|
|
|
4c79b5 |
$t_matrix[$t_from][$t_to] = '';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$t_statuses = get_enum_to_array( config_get( 'status_enum_string' ) );
|
|
|
4c79b5 |
foreach( $t_statuses as $t_state => $t_label) {
|
|
|
4c79b5 |
$t_workflow_row = '';
|
|
|
4c79b5 |
$t_default = gpc_get_int( 'default_' . $t_state );
|
|
|
4c79b5 |
if ( isset( $t_matrix[$t_state] ) && isset( $t_matrix[$t_state][$t_default] ) ) {
|
|
|
4c79b5 |
$t_workflow_row .= $t_default . ':' . get_enum_element( 'status', $t_default );
|
|
|
4c79b5 |
unset( $t_matrix[$t_state][$t_default] );
|
|
|
4c79b5 |
$t_first = false;
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
# error default state isn't in the matrix
|
|
|
4c79b5 |
echo '' . sprintf( lang_get( 'default_not_in_flow' ), get_enum_element( 'status', $t_default ), get_enum_element( 'status', $t_state ) ) . ' ';
|
|
|
4c79b5 |
$t_first = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( isset( $t_matrix[$t_state] ) ) {
|
|
|
4c79b5 |
foreach ( $t_matrix[$t_state] as $t_next_state => $t_junk ) {
|
|
|
4c79b5 |
if ( false == $t_first ) {
|
|
|
4c79b5 |
$t_workflow_row .= ',';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$t_workflow_row .= $t_next_state . ':' . get_enum_element( 'status', $t_next_state );
|
|
|
4c79b5 |
$t_first = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( '' <> $t_workflow_row ) {
|
|
|
4c79b5 |
$t_workflow[$t_state] = $t_workflow_row;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ( $t_workflow != config_get( 'status_enum_workflow' ) ) {
|
|
|
4c79b5 |
config_set( 'status_enum_workflow', $t_workflow, NO_USER, $t_project, $f_access );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# process the access level changes
|
|
|
4c79b5 |
if( config_get_access( 'status_enum_workflow' ) <= $t_access ) {
|
|
|
4c79b5 |
# get changes to access level to change these values
|
|
|
4c79b5 |
$f_access = gpc_get( 'status_access' );
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# walk through the status labels to set the status threshold
|
|
|
4c79b5 |
$t_enum_status = explode_enum_string( config_get( 'status_enum_string' ) );
|
|
|
4c79b5 |
$t_set_status = array();
|
|
|
4c79b5 |
foreach( $t_statuses as $t_status_id => $t_status_label) {
|
|
|
4c79b5 |
$f_level = gpc_get( 'access_change_' . $t_status_id );
|
|
|
4c79b5 |
if ( NEW_ == $t_status_id ) {
|
|
|
4c79b5 |
if ( (int)$f_level != config_get( 'report_bug_threshold' ) ) {
|
|
|
4c79b5 |
config_set( 'report_bug_threshold', (int)$f_level, ALL_USERS, $t_project, $f_access );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
} else {
|
|
|
4c79b5 |
$t_set_status[$t_status_id] = (int)$f_level;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ( $t_set_status != config_get( 'set_status_threshold' ) ) {
|
|
|
4c79b5 |
config_set( 'set_status_threshold', $t_set_status, ALL_USERS, $t_project, $f_access );
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
echo '' . lang_get( 'operation_successful' ) . ' ';
|
|
|
4c79b5 |
print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
|
|
|
4c79b5 |
?>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|