# MantisBT - A PHP based bugtracking system
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see .
/**
* This page allows actions to be performed on an array of bugs
*
* @package MantisBT
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses access_api.php
* @uses authentication_api.php
* @uses bug_api.php
* @uses bug_group_action_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses custom_field_api.php
* @uses event_api.php
* @uses form_api.php
* @uses gpc_api.php
* @uses helper_api.php
* @uses lang_api.php
* @uses print_api.php
* @uses string_api.php
* @uses utility_api.php
* @uses version_api.php
*/
require_once( 'core.php' );
require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
require_api( 'bug_api.php' );
require_api( 'bug_group_action_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'custom_field_api.php' );
require_api( 'event_api.php' );
require_api( 'form_api.php' );
require_api( 'gpc_api.php' );
require_api( 'helper_api.php' );
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
require_api( 'string_api.php' );
require_api( 'utility_api.php' );
require_api( 'version_api.php' );
auth_ensure_user_authenticated();
$f_action = gpc_get_string( 'action', '' );
$f_bug_arr = gpc_get_int_array( 'bug_arr', array() );
# redirects to all_bug_page if nothing is selected
if( is_blank( $f_action ) || ( 0 == count( $f_bug_arr ) ) ) {
print_header_redirect( 'view_all_bug_page.php' );
}
# run through the issues to see if they are all from one project
$t_project_id = ALL_PROJECTS;
$t_multiple_projects = false;
$t_user = auth_get_current_user_id();
$t_projects = array();
$t_view_bug_threshold = array();
bug_cache_array_rows( $f_bug_arr );
foreach( $f_bug_arr as $t_key => $t_bug_id ) {
$t_bug = bug_get( $t_bug_id );
# Per-project cache of the access threshold
if( !isset( $t_view_bug_threshold[$t_bug->project_id] ) ) {
$t_view_bug_threshold[$t_bug->project_id] = config_get(
'view_bug_threshold',
null,
$t_user,
$t_bug->project_id
);
}
# Remove any issues the user doesn't have access to
if( !access_has_bug_level( $t_view_bug_threshold[$t_bug->project_id], $t_bug_id ) ) {
unset( $f_bug_arr[$t_key] );
continue;
}
# Multiple projects check
if( $t_project_id != $t_bug->project_id ) {
if( ( $t_project_id != ALL_PROJECTS ) && !$t_multiple_projects ) {
$t_multiple_projects = true;
} else {
$t_project_id = $t_bug->project_id;
$t_projects[$t_project_id] = $t_project_id;
}
}
}
# Array of parameters to be used with plugin event
$t_event_params = array();
$t_event_params['bug_ids'] = $f_bug_arr;
$t_event_params['action'] = $f_action;
$t_event_params['has_bugnote'] = false;
$t_event_params['multiple_projects'] = $t_multiple_projects;
if( $t_multiple_projects ) {
$t_project_id = ALL_PROJECTS;
$t_projects[ALL_PROJECTS] = ALL_PROJECTS;
}
# override the project if necessary
if( $t_project_id != helper_get_current_project() ) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_project_id;
}
define( 'BUG_ACTIONGROUP_INC_ALLOW', true );
$t_finished = false;
$t_bugnote = false;
$t_external_action_prefix = 'EXT_';
if( strpos( $f_action, $t_external_action_prefix ) === 0 ) {
$t_form_page = 'bug_actiongroup_ext_page.php';
require_once( $t_form_page );
exit;
}
$t_custom_group_actions = config_get( 'custom_group_actions' );
foreach( $t_custom_group_actions as $t_custom_group_action ) {
if( $f_action == $t_custom_group_action['action'] ) {
require_once( $t_custom_group_action['form_page'] );
exit;
}
}
# Check if user selected to update a custom field.
$t_custom_fields_prefix = 'custom_field_';
if( strpos( $f_action, $t_custom_fields_prefix ) === 0 ) {
$t_custom_field_id = (int)substr( $f_action, mb_strlen( $t_custom_fields_prefix ) );
$f_action = 'CUSTOM';
$t_event_params['action'] = $f_action;
}
# Form name
$t_form_name = 'bug_actiongroup_' . $f_action;
switch( $f_action ) {
# Use a simple confirmation page, if close or delete...
case 'CLOSE' :
$t_finished = true;
$t_question_title = lang_get( 'close_bugs_conf_msg' );
$t_button_title = lang_get( 'close_group_bugs_button' );
$t_bugnote= true;
break;
case 'DELETE' :
$t_finished = true;
$t_question_title= lang_get( 'delete_bugs_conf_msg' );
$t_button_title = lang_get( 'delete_group_bugs_button' );
break;
case 'SET_STICKY' :
$t_finished = true;
$t_question_title= lang_get( 'set_sticky_bugs_conf_msg' );
$t_button_title = lang_get( 'set_sticky_group_bugs_button' );
break;
# ...else we define the variables used in the form
case 'MOVE' :
$t_question_title = lang_get( 'move_bugs_conf_msg' );
$t_button_title = lang_get( 'move_group_bugs_button' );
$t_form= 'project_id';
break;
case 'COPY' :
$t_question_title = lang_get( 'copy_bugs_conf_msg' );
$t_button_title = lang_get( 'copy_group_bugs_button' );
$t_form= 'project_id';
break;
case 'ASSIGN' :
$t_question_title = lang_get( 'assign_bugs_conf_msg' );
$t_button_title = lang_get( 'assign_group_bugs_button' );
$t_form = 'assign';
break;
case 'RESOLVE' :
$t_question_title = lang_get( 'resolve_bugs_conf_msg' );
$t_button_title = lang_get( 'resolve_group_bugs_button' );
$t_form = 'resolution';
if( ALL_PROJECTS != $t_project_id ) {
$t_question_title2 = lang_get( 'fixed_in_version' );
$t_form2 = 'fixed_in_version';
}
$t_bugnote= true;
break;
case 'UP_PRIOR' :
$t_question_title = lang_get( 'priority_bugs_conf_msg' );
$t_button_title = lang_get( 'priority_group_bugs_button' );
$t_form = 'priority';
break;
case 'UP_STATUS' :
$t_question_title = lang_get( 'status_bugs_conf_msg' );
$t_button_title = lang_get( 'status_group_bugs_button' );
$t_form = 'status';
$t_bugnote= true;
break;
case 'UP_CATEGORY' :
$t_question_title= lang_get( 'category_bugs_conf_msg' );
$t_button_title= lang_get( 'category_group_bugs_button' );
$t_form= 'category';
break;
case 'VIEW_STATUS' :
$t_question_title= lang_get( 'view_status_bugs_conf_msg' );
$t_button_title= lang_get( 'view_status_group_bugs_button' );
$t_form= 'view_status';
break;
case 'UP_PRODUCT_VERSION':
$t_question_title= lang_get( 'product_version_bugs_conf_msg' );
$t_button_title= lang_get( 'product_version_group_bugs_button' );
$t_form= 'product_version';
break;
case 'UP_FIXED_IN_VERSION':
$t_question_title= lang_get( 'fixed_in_version_bugs_conf_msg' );
$t_button_title= lang_get( 'fixed_in_version_group_bugs_button' );
$t_form= 'fixed_in_version';
break;
case 'UP_TARGET_VERSION':
$t_question_title= lang_get( 'target_version_bugs_conf_msg' );
$t_button_title= lang_get( 'target_version_group_bugs_button' );
$t_form= 'target_version';
break;
case 'UP_DUE_DATE':
$t_question_title= lang_get( 'due_date_bugs_conf_msg' );
$t_button_title= lang_get( 'due_date_group_bugs_button' );
$t_form= 'due_date';
break;
case 'CUSTOM' :
$t_custom_field_def = custom_field_get_definition( $t_custom_field_id );
$t_question_title = sprintf( lang_get( 'actiongroup_menu_update_field' ),
string_attribute( lang_get_defaulted( $t_custom_field_def['name'] ) )
);
$t_button_title = $t_question_title;
$t_form = 'custom_field_' . $t_custom_field_id;
$t_event_params['custom_field_id'] = $t_custom_field_id;
break;
default:
trigger_error( ERROR_GENERIC, ERROR );
}
$t_event_params['has_bugnote'] = $t_bugnote;
bug_group_action_print_top();
?>
if( $t_multiple_projects ) {
echo '
' . lang_get( 'multiple_projects' ) . '
}
?>
bug_group_action_print_hidden_fields( $f_bug_arr );
if( $f_action === 'CUSTOM' ) {
echo "";
}
?>
bug_group_action_print_bottom();
一键复制
编辑
Web IDE
原始数据
按行查看
历史