/** * Print Change Status to: AJAXified button * This code is similar to button_bug_change_status except that the * button is AJAXified. * Uses projax.php * * @param int $p_bug_id * @param int $t_project_id * @param int $t_user_id * @return null */ function kanban_ajax_button_bug_change_status($p_bug_id, $t_project_id, $t_user_id) { global $g_projax; $t_bug_project_id = bug_get_field($p_bug_id, 'project_id'); $t_bug_current_state = bug_get_field($p_bug_id, 'status'); $t_current_access = access_get_project_level($t_bug_project_id); $t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close'), $t_bug_project_id); if (count($t_enum_list) > 0) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each($t_enum_list); $t_default = $t_default_arr['key']; ksort($t_enum_list); reset($t_enum_list); echo "<div id=\"ajax_statuschange\"><form method=\"post\" id=\"ajax_status_form\" action=\"xmlhttprequest.php\">"; # CSRF protection not required here - form does not result in modifications echo "<input type=\"hidden\" name=\"project_id\" id=\"project_id\" value=\"{$t_project_id}\" />"; echo "<input type=\"hidden\" name=\"user_id\" id=\"user_id\" value=\"{$t_user_id}\" />"; echo "<input type=\"hidden\" name=\"entrypoint\" id=\"entrypoint\" value=\"bug_update_status\" />"; $t_button_text = lang_get('bug_status_to_button'); // AJAX button options $options = array('url' => plugin_page('kanban_ajax_request'), 'with' => true, 'confirm' => lang_get('confirm_change_status'), 'success' => 'location.reload()', 'failure' => 'alert("Error: " ' + request . status + ')'); echo $g_projax->submit_to_remote('ajax_status', $t_button_text, $options); echo " <select name=\"new_status\">"; # space at beginning of line is important foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\" "; check_selected($key, $t_default); echo ">{$val}</option>"; } echo '</select>'; $t_bug_id = string_attribute($p_bug_id); echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n"; echo "</form></div>\n"; } }
function print_status_option_list($p_select_label, $p_current_value = 0, $p_allow_close = false, $p_project_id = ALL_PROJECTS) { $t_current_auth = access_get_project_level($p_project_id); $t_enum_list = get_status_option_list($t_current_auth, $p_current_value, true, $p_allow_close, $p_project_id); if (count($t_enum_list) > 1) { # resort the list into ascending order ksort($t_enum_list); reset($t_enum_list); echo '<select ' . helper_get_tab_index() . ' id="' . $p_select_label . '" name="' . $p_select_label . '">'; foreach ($t_enum_list as $key => $val) { echo '<option value="' . $key . '"'; check_selected($key, $p_current_value); echo '>' . string_html_specialchars($val) . '</option>'; } echo '</select>'; } else { if (count($t_enum_list) == 1) { echo array_pop($t_enum_list); } else { echo MantisEnum::getLabel(lang_get('status_enum_string'), $p_current_value); } } }
if ($t_show_status) { ?> <tr> <th class="category"> <label for="status"><?php echo lang_get('status'); ?> </label> </th> <td> <select <?php echo helper_get_tab_index(); ?> name="status"> <?php $t_resolution_options = get_status_option_list(access_get_project_level($t_project_id), config_get('bug_submit_status'), true, ON == config_get('allow_reporter_close'), $t_project_id); foreach ($t_resolution_options as $t_key => $t_value) { ?> <option value="<?php echo $t_key; ?> " <?php check_selected($t_key, config_get('bug_submit_status')); ?> > <?php echo $t_value; ?> </option> <?php }
function html_button_bug_change_status($p_bug_id) { $t_bug_project_id = bug_get_field($p_bug_id, 'project_id'); $t_bug_current_state = bug_get_field($p_bug_id, 'status'); $t_current_access = access_get_project_level($t_bug_project_id); $t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close')); if (count($t_enum_list) > 0) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each($t_enum_list); $t_default = $t_default_arr['key']; ksort($t_enum_list); reset($t_enum_list); echo "<form method=\"post\" action=\"bug_change_status_page.php\">"; $t_button_text = lang_get('bug_status_to_button'); echo "<input type=\"submit\" class=\"button\" value=\"{$t_button_text}\" />"; echo " <select name=\"new_status\">"; # space at beginning of line is important foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\" "; check_selected($key, $t_default); echo ">{$val}</option>"; } echo '</select>'; $t_bug_id = string_attribute($p_bug_id); echo "<input type=\"hidden\" name=\"bug_id\" value=\"{$t_bug_id}\" />\n"; echo "</form>\n"; } }
/** * Print Change Status to: button * This code is similar to print_status_option_list except * there is no masking, except for the current state * * @param BugData $p_bug Bug object * @return null */ function html_button_bug_change_status($p_bug) { $t_current_access = access_get_project_level($p_bug->project_id); # User must have rights to change status to use this button if (!access_has_bug_level(config_get('update_bug_status_threshold'), $p_bug->id)) { return; } $t_enum_list = get_status_option_list($t_current_access, $p_bug->status, false, bug_is_user_reporter($p_bug->id, auth_get_current_user_id()) && access_has_bug_level(config_get('report_bug_threshold'), $p_bug->id) && ON == config_get('allow_reporter_close'), $p_bug->project_id); if (count($t_enum_list) > 0) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each($t_enum_list); $t_default = $t_default_arr['key']; ksort($t_enum_list); reset($t_enum_list); echo "<form method=\"post\" action=\"bug_change_status_page.php\">"; # CSRF protection not required here - form does not result in modifications $t_button_text = lang_get('bug_status_to_button'); echo "<input type=\"submit\" class=\"button\" value=\"{$t_button_text}\" />"; echo " <select name=\"new_status\">"; # space at beginning of line is important foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\" "; check_selected($key, $t_default); echo ">{$val}</option>"; } echo '</select>'; $t_bug_id = string_attribute($p_bug->id); echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n"; echo "</form>\n"; } }
function write_bug_rows($p_rows) { $user_array = get_user_array(); $alive_user_ids = array(); $issues_array_html = ''; $allowed_statuses_html = ''; print '<div id="taskodrome_data" hidden="true"> '; $users = ''; $user_number = count($user_array); for ($i = 0; $i != $user_number; $i++) { $users .= '<p hidden="true" class="user_data" '; $users .= 'name="' . $user_array[$i]->name . '" '; $users .= 'id="' . $user_array[$i]->id . '"'; $users .= '></p>'; $alive_user_ids[$user_array[$i]->id] = 1; } print $users; $t_rows = count($p_rows); for ($i = 0; $i < $t_rows; $i++) { $t_row = $p_rows[$i]; $handler_id = $t_row->handler_id; if (!array_key_exists($t_row->handler_id, $alive_user_ids)) { $handler_id = 0; } $issues_array_html .= '<p hidden="true" class="issue_data" '; $issues_array_html .= 'id="' . $t_row->id . '" '; $issues_array_html .= 'summary="' . htmlentities($t_row->summary) . '" '; $issues_array_html .= 'status="' . $t_row->status . '" '; $issues_array_html .= 'handler_id="' . $handler_id . '" '; $issues_array_html .= 'topColor="#0000FF" '; $issues_array_html .= 'bottomColor="#FF0000" '; $issues_array_html .= 'updateTime="' . $t_row->last_updated . '"'; $issues_array_html .= '></p>'; $t_all_statuses = get_status_option_list(access_get_project_level($t_row->project_id), $t_row->status, true, false, $t_row->project_id); $allowed_statuses_html .= '<p hidden="true" class="status_pair" '; $allowed_statuses_html .= 'id="' . $t_row->id . '" '; $src_status_str = ''; $dst_status_str = ''; foreach ($t_all_statuses as $src_status => $src_st) { $src_status_str .= $src_status . ';'; $t_enum_list = get_status_option_list(access_get_project_level($t_row->project_id), $src_status, true, bug_is_user_reporter($t_row->id, auth_get_current_user_id()) && access_has_bug_level(config_get('report_bug_threshold'), $t_row->id) && ON == config_get('allow_reporter_close'), $t_row->project_id); foreach ($t_enum_list as $dst_status => $dst_st) { $dst_status_str .= $dst_status . ','; } $dst_status_str .= ';'; } $allowed_statuses_html .= 'src_status="' . $src_status_str . '" '; $allowed_statuses_html .= 'dst_status="' . $dst_status_str . '"'; $allowed_statuses_html .= '></p>'; } print $issues_array_html; print $allowed_statuses_html; $status_order = null; foreach (plugin_config_get("status_board_order") as $t_value) { $status_order .= $t_value . ';'; } print '<p hidden="true" class="status_board_order" value="' . $status_order . '"></p>'; print '<p hidden="true" id="cooldown_period_days" value="' . plugin_config_get("cooldown_period_days") . '"></p>'; print '<p hidden="true" id="cooldown_period_hours" value="' . plugin_config_get("cooldown_period_hours") . '"></p>'; print '</div>'; print '<section class="tabs"> <br> <input type="radio" id="radio_dg" name="group" > <input type="radio" id="radio_sg" name="group" > [ <label id="label_dg" class="radio_label" for="radio_dg" >' . plugin_lang_get("assignment_board") . '</label> ] [ <label id="label_sg" class="radio_label" for="radio_sg" >' . plugin_lang_get("status_board") . '</label> ] <div class="tabs_cont"> <div id="tab_c1"> '; print '<div id="dev-grid" class="grid"> <canvas id="panel"> </canvas> </div> '; print '</div>'; print '<div id="tab_c2"> <div id="st-grid" class="grid"> <canvas id="panel_st"> </canvas> </div> '; html_page_bottom(); print '</div>'; print '</div> </section> '; }
/** * Print Change Status to: button * This code is similar to print_status_option_list except * there is no masking, except for the current state * * @param BugData $p_bug A valid bug object. * @return void */ function html_button_bug_change_status(BugData $p_bug) { $t_current_access = access_get_project_level($p_bug->project_id); # User must have rights to change status to use this button if (!access_has_bug_level(config_get('update_bug_status_threshold'), $p_bug->id)) { return; } $t_enum_list = get_status_option_list($t_current_access, $p_bug->status, false, bug_is_user_reporter($p_bug->id, auth_get_current_user_id()) && access_has_bug_level(config_get('report_bug_threshold'), $p_bug->id) && ON == config_get('allow_reporter_close'), $p_bug->project_id); if (count($t_enum_list) > 0) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each($t_enum_list); $t_default = $t_default_arr['key']; ksort($t_enum_list); reset($t_enum_list); echo '<form method="post" action="bug_change_status_page.php">'; # CSRF protection not required here - form does not result in modifications $t_button_text = lang_get('bug_status_to_button'); echo '<input type="submit" class="button" value="' . $t_button_text . '" />'; echo ' <select name="new_status">'; # space at beginning of line is important foreach ($t_enum_list as $t_key => $t_val) { echo '<option value="' . $t_key . '" '; check_selected($t_key, $t_default); echo '>' . $t_val . '</option>'; } echo '</select>'; $t_bug_id = string_attribute($p_bug->id); echo '<input type="hidden" name="id" value="' . $t_bug_id . '" />' . "\n"; echo '<input type="hidden" name="change_type" value="' . BUG_UPDATE_TYPE_CHANGE_STATUS . '" />' . "\n"; echo '</form>' . "\n"; } }
function print_status_option_list($p_select_label, $p_current_value = 0, $p_allow_close = false, $p_project_id = null) { $t_current_auth = access_get_project_level($p_project_id); $t_enum_list = get_status_option_list($t_current_auth, $p_current_value, true, $p_allow_close); if (count($t_enum_list) > 0) { # resort the list into ascending order ksort($t_enum_list); reset($t_enum_list); echo '<select ', helper_get_tab_index(), ' name="' . $p_select_label . '">'; foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\""; check_selected($key, $p_current_value); echo ">{$val}</option>"; } echo '</select>'; } else { echo get_enum_to_string('status_enum_string', $p_current_value); } }