function html_buttons_view_bug_page($p_bug_id) { $t_resolved = config_get('bug_resolved_status_threshold'); $t_status = bug_get_field($p_bug_id, 'status'); $t_readonly = bug_is_readonly($p_bug_id); print '<table><tr class="vcenter">'; if (!$t_readonly) { # UPDATE button echo '<td class="center">'; html_button_bug_update($p_bug_id); echo '</td>'; # ASSIGN button echo '<td class="center">'; html_button_bug_assign_to($p_bug_id); echo '</td>'; # Change State button echo '<td class="center">'; html_button_bug_change_status($p_bug_id); echo '</td>'; } # MONITOR/UNMONITOR button echo '<td class="center">'; if (!current_user_is_anonymous()) { if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) { html_button_bug_unmonitor($p_bug_id); } else { html_button_bug_monitor($p_bug_id); } } echo '</td>'; if (!$t_readonly) { # CREATE CHILD button echo '<td class="center">'; html_button_bug_create_child($p_bug_id); echo '</td>'; } if ($t_resolved <= $t_status) { # resolved is not the same as readonly print '<td class="center">'; # REOPEN button html_button_bug_reopen($p_bug_id); print '</td>'; } if (!$t_readonly) { # MOVE button echo '<td class="center">'; html_button_bug_move($p_bug_id); echo '</td>'; # DELETE button echo '<td class="center">'; html_button_bug_delete($p_bug_id); echo '</td>'; } helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id)); echo '</tr></table>'; }
/** * Print all buttons for view bug pages * @param int $p_bug_id * @return null */ function html_buttons_view_bug_page($p_bug_id) { $t_resolved = config_get('bug_resolved_status_threshold'); $t_closed = config_get('bug_closed_status_threshold'); $t_status = bug_get_field($p_bug_id, 'status'); $t_readonly = bug_is_readonly($p_bug_id); $t_sticky = config_get('set_bug_sticky_threshold'); $t_bug = bug_get($p_bug_id); echo '<table><tr class="vcenter">'; if (!$t_readonly) { # UPDATE button echo '<td class="center">'; html_button_bug_update($p_bug_id); echo '</td>'; # ASSIGN button echo '<td class="center">'; html_button_bug_assign_to($t_bug); echo '</td>'; } # Change status button/dropdown if (!$t_readonly) { echo '<td class="center">'; html_button_bug_change_status($t_bug); echo '</td>'; } # MONITOR/UNMONITOR button if (!current_user_is_anonymous()) { echo '<td class="center">'; if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) { html_button_bug_unmonitor($p_bug_id); } else { html_button_bug_monitor($p_bug_id); } echo '</td>'; } # STICK/UNSTICK button if (access_has_bug_level($t_sticky, $p_bug_id)) { echo '<td class="center">'; if (!bug_get_field($p_bug_id, 'sticky')) { html_button_bug_stick($p_bug_id); } else { html_button_bug_unstick($p_bug_id); } echo '</td>'; } # CLONE button if (!$t_readonly) { echo '<td class="center">'; html_button_bug_create_child($p_bug_id); echo '</td>'; } # REOPEN button echo '<td class="center">'; html_button_bug_reopen($t_bug); echo '</td>'; # CLOSE button echo '<td class="center">'; html_button_bug_close($t_bug); echo '</td>'; # MOVE button echo '<td class="center">'; html_button_bug_move($p_bug_id); echo '</td>'; # DELETE button echo '<td class="center">'; html_button_bug_delete($p_bug_id); echo '</td>'; helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id)); echo '</tr></table>'; }
/** * Copy list of users monitoring a bug to the monitor list of a second bug * @param int p_source_bug_id integer representing the bug ID of the source bug * @param int p_dest_bug_id integer representing the bug ID of the destination bug * @return bool (always true) * @access public * @uses database_api.php * @uses history_api.php * @uses user_api.php */ function bug_monitor_copy($p_source_bug_id, $p_dest_bug_id) { $c_source_bug_id = (int) $p_source_bug_id; $c_dest_bug_id = (int) $p_dest_bug_id; $t_bug_monitor_table = db_get_table('mantis_bug_monitor_table'); $query = 'SELECT user_id FROM ' . $t_bug_monitor_table . ' WHERE bug_id = ' . db_param(); $result = db_query_bound($query, array($c_source_bug_id)); $t_count = db_num_rows($result); for ($i = 0; $i < $t_count; $i++) { $t_bug_monitor = db_fetch_array($result); if (!user_is_monitoring_bug($t_bug_monitor['user_id'], $c_dest_bug_id)) { $query = 'INSERT INTO ' . $t_bug_monitor_table . ' ( user_id, bug_id ) VALUES ( ' . db_param() . ', ' . db_param() . ' )'; db_query_bound($query, array($t_bug_monitor['user_id'], $c_dest_bug_id)); history_log_event_special($c_dest_bug_id, BUG_MONITOR, $t_bug_monitor['user_id']); } } }
/** * Copy list of users monitoring a bug to the monitor list of a second bug * @param integer $p_source_bug_id Integer representing the bug identifier of the source bug. * @param integer $p_dest_bug_id Integer representing the bug identifier of the destination bug. * @return void * @access public * @uses database_api.php * @uses history_api.php * @uses user_api.php */ function bug_monitor_copy( $p_source_bug_id, $p_dest_bug_id ) { $c_source_bug_id = (int)$p_source_bug_id; $c_dest_bug_id = (int)$p_dest_bug_id; $t_query = 'SELECT user_id FROM {bug_monitor} WHERE bug_id = ' . db_param(); $t_result = db_query( $t_query, array( $c_source_bug_id ) ); while( $t_bug_monitor = db_fetch_array( $t_result ) ) { if( user_exists( $t_bug_monitor['user_id'] ) && !user_is_monitoring_bug( $t_bug_monitor['user_id'], $c_dest_bug_id ) ) { $t_query = 'INSERT INTO {bug_monitor} ( user_id, bug_id ) VALUES ( ' . db_param() . ', ' . db_param() . ' )'; db_query( $t_query, array( $t_bug_monitor['user_id'], $c_dest_bug_id ) ); history_log_event_special( $c_dest_bug_id, BUG_MONITOR, $t_bug_monitor['user_id'] ); } } }
function bug_monitor($p_bug_id, $p_user_id) { $c_bug_id = db_prepare_int($p_bug_id); $c_user_id = db_prepare_int($p_user_id); # Make sure we aren't already monitoring this bug if (user_is_monitoring_bug($p_user_id, $p_bug_id)) { return true; } $t_bug_monitor_table = config_get('mantis_bug_monitor_table'); # Insert monitoring record $query = "INSERT " . "INTO {$t_bug_monitor_table} " . "( user_id, bug_id ) " . "VALUES " . "( '{$c_user_id}', '{$c_bug_id}' )"; db_query($query); # log new monitoring action history_log_event_special($p_bug_id, BUG_MONITOR, $c_user_id); return true; }
/** * Print all buttons for view bug pages * @param int $p_bug_id * @return null */ function html_buttons_view_bug_page($p_bug_id) { $t_resolved = config_get('bug_resolved_status_threshold'); $t_closed = config_get('bug_closed_status_threshold'); $t_status = bug_get_field($p_bug_id, 'status'); $t_readonly = bug_is_readonly($p_bug_id); // WK/BFE: Folgende Zeile ist eine Kopie der vorigen., LB/BFE 2015 // bug_is_readonly -> bug_is_readonly_BFE // $t_readonly -> $t_readonly_BFE $t_readonly_BFE = bug_is_readonly_BFE($p_bug_id); $t_sticky = config_get('set_bug_sticky_threshold'); $t_bug = bug_get($p_bug_id); echo '<table><tr class="vcenter">'; // WK/BFE: Bedingund von $t_readonly auf $t_readonly_BFE geändert., LB/BFE 2015 if (!$t_readonly_BFE) { # UPDATE button echo '<td class="center">'; html_button_bug_update($p_bug_id); echo '</td>'; } if (!$t_readonly) { # ASSIGN button echo '<td class="center">'; html_button_bug_assign_to($t_bug); echo '</td>'; } # Change status button/dropdown if (!$t_readonly) { echo '<td class="center">'; html_button_bug_change_status($t_bug); echo '</td>'; } # MONITOR/UNMONITOR button if (!current_user_is_anonymous()) { echo '<td class="center">'; if (user_is_monitoring_bug(auth_get_current_user_id(), $p_bug_id)) { html_button_bug_unmonitor($p_bug_id); } else { html_button_bug_monitor($p_bug_id); } echo '</td>'; } # STICK/UNSTICK button if (access_has_bug_level($t_sticky, $p_bug_id)) { echo '<td class="center">'; if (!bug_get_field($p_bug_id, 'sticky')) { html_button_bug_stick($p_bug_id); } else { html_button_bug_unstick($p_bug_id); } echo '</td>'; } # CLONE button if (!$t_readonly) { echo '<td class="center">'; html_button_bug_create_child($p_bug_id); echo '</td>'; } # REOPEN button echo '<td class="center">'; html_button_bug_reopen($t_bug); echo '</td>'; # CLOSE button # LB/BFE 2015 Schließen-Button entfernt: https://issuetracking.bfe.tv/view.php?id=18093 /* echo '<td class="center">'; html_button_bug_close( $t_bug ); echo '</td>'; */ # MOVE button echo '<td class="center">'; html_button_bug_move($p_bug_id); echo '</td>'; # DELETE button echo '<td class="center">'; html_button_bug_delete($p_bug_id); echo '</td>'; helper_call_custom_function('print_bug_view_page_custom_buttons', array($p_bug_id)); echo '</tr></table>'; }