| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 4 # MantisBT is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation, either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # MantisBT is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * @package MantisBT 19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 * 23 * @uses core.php 24 * @uses access_api.php 25 * @uses authentication_api.php 26 * @uses config_api.php 27 * @uses constant_inc.php 28 * @uses current_user_api.php 29 * @uses form_api.php 30 * @uses gpc_api.php 31 * @uses helper_api.php 32 * @uses html_api.php 33 * @uses lang_api.php 34 * @uses print_api.php 35 */ 36 37 /** 38 * MantisBT Core API's 39 */ 40 require_once ( 'core.php' ); 41 require_api( 'access_api.php' ); 42 require_api( 'authentication_api.php' ); 43 require_api( 'config_api.php' ); 44 require_api( 'constant_inc.php' ); 45 require_api( 'current_user_api.php' ); 46 require_api( 'form_api.php' ); 47 require_api( 'gpc_api.php' ); 48 require_api( 'helper_api.php' ); 49 require_api( 'html_api.php' ); 50 require_api( 'lang_api.php' ); 51 require_api( 'print_api.php' ); 52 53 form_security_validate( 'manage_config_workflow_set' ); 54 55 auth_reauthenticate(); 56 57 $t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) ); 58 access_ensure_project_level( $t_can_change_level ); 59 60 $t_redirect_url = 'manage_config_workflow_page.php'; 61 $t_project = helper_get_current_project(); 62 $t_access = current_user_get_access_level(); 63 64 html_page_top( lang_get( 'manage_workflow_config' ), $t_redirect_url ); 65 66 # process the changes to threshold values 67 $t_valid_thresholds = array( 'bug_submit_status', 'bug_resolved_status_threshold', 'bug_reopen_status' ); 68 69 foreach( $t_valid_thresholds as $t_threshold ) { 70 if( config_get_access( $t_threshold ) <= $t_access ) { 71 $f_value = gpc_get( 'threshold_' . $t_threshold ); 72 $f_access = gpc_get( 'access_' . $t_threshold ); 73 if ( ( $f_value != config_get( $t_threshold ) ) 74 || ( $f_access != config_get_access( $t_threshold ) ) ) { 75 config_set( $t_threshold, $f_value, NO_USER, $t_project, $f_access ); 76 } 77 } 78 } 79 80 # process the workflow by reversing the flags to a matrix and creating the appropriate string 81 if( config_get_access( 'status_enum_workflow' ) <= $t_access ) { 82 $f_value = gpc_get( 'flag', array() ); 83 $f_access = gpc_get( 'workflow_access' ); 84 $t_matrix = array(); 85 86 foreach( $f_value as $t_transition ) { 87 list( $t_from, $t_to ) = explode( ':', $t_transition ); 88 $t_matrix[$t_from][$t_to] = ''; 89 } 90 $t_statuses = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); 91 foreach( $t_statuses as $t_state => $t_label) { 92 $t_workflow_row = ''; 93 $t_default = gpc_get_int( 'default_' . $t_state ); 94 if ( isset( $t_matrix[$t_state] ) && isset( $t_matrix[$t_state][$t_default] ) ) { 95 $t_workflow_row .= $t_default . ':' . get_enum_element( 'status', $t_default ); 96 unset( $t_matrix[$t_state][$t_default] ); 97 $t_first = false; 98 } else { 99 # error default state isn't in the matrix 100 echo '<p>' . sprintf( lang_get( 'default_not_in_flow' ), get_enum_element( 'status', $t_default ), get_enum_element( 'status', $t_state ) ) . '</p>'; 101 $t_first = true; 102 } 103 if ( isset( $t_matrix[$t_state] ) ) { 104 foreach ( $t_matrix[$t_state] as $t_next_state => $t_junk ) { 105 if ( false == $t_first ) { 106 $t_workflow_row .= ','; 107 } 108 $t_workflow_row .= $t_next_state . ':' . get_enum_element( 'status', $t_next_state ); 109 $t_first = false; 110 } 111 } 112 if ( '' <> $t_workflow_row ) { 113 $t_workflow[$t_state] = $t_workflow_row; 114 } 115 } 116 if ( ( $t_workflow != config_get( 'status_enum_workflow' ) ) 117 || ( $f_access != config_get_access( 'status_enum_workflow' ) ) ) { 118 config_set( 'status_enum_workflow', $t_workflow, NO_USER, $t_project, $f_access ); 119 } 120 } 121 122 # process the access level changes 123 if( config_get_access( 'status_enum_workflow' ) <= $t_access ) { 124 # get changes to access level to change these values 125 $f_access = gpc_get( 'status_access' ); 126 127 # walk through the status labels to set the status threshold 128 $t_enum_status = explode( ',', config_get( 'status_enum_string' ) ); 129 $t_set_status = array(); 130 foreach( $t_statuses as $t_status_id => $t_status_label) { 131 $f_level = gpc_get( 'access_change_' . $t_status_id ); 132 if ( config_get( 'bug_submit_status' ) == $t_status_id ) { 133 if ( (int)$f_level != config_get( 'report_bug_threshold' ) ) { 134 config_set( 'report_bug_threshold', (int)$f_level, ALL_USERS, $t_project, $f_access ); 135 } 136 } else { 137 $t_set_status[$t_status_id] = (int)$f_level; 138 } 139 } 140 141 if ( ( $t_set_status != config_get( 'set_status_threshold' ) ) 142 || ( $f_access != config_get_access( 'status_enum_workflow' ) ) ) { 143 config_set( 'set_status_threshold', $t_set_status, ALL_USERS, $t_project, $f_access ); 144 } 145 } 146 147 form_security_purge( 'manage_config_workflow_set' ); 148 ?> 149 150 <br /> 151 <div> 152 <?php 153 echo lang_get( 'operation_successful' ) . '<br />'; 154 print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); 155 ?> 156 </div> 157 158 <?php 159 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |