function renderIssues($status) { $content = array(); $t_project_id = helper_get_current_project(); $t_bug_table = db_get_table('mantis_bug_table'); $t_user_id = auth_get_current_user_id(); $specific_where = helper_project_specific_where($t_project_id, $t_user_id); if ($this->severity) { $severityCond = '= ' . $this->severity; } else { $severityCond = '> -1'; } $query = "SELECT *\n\t\t\tFROM {$t_bug_table}\n\t\t\tWHERE {$specific_where}\n\t\t\tAND status = {$status}\n\t\t\tAND severity {$severityCond}\n\t\t\tORDER BY last_updated DESC\n\t\t\tLIMIT 20"; $result = db_query_bound($query); $category_count = db_num_rows($result); for ($i = 0; $i < $category_count; $i++) { $row = db_fetch_array($result); //pre_var_dump($row); $content[] = '<div class="portlet ui-helper-clearfix" id="' . $row['id'] . '"> <div class="portlet-header">' . string_get_bug_view_link($row['id']) . ': ' . $row['summary'] . '</div> <div class="portlet-content">' . ($row['reporter_id'] ? 'Reporter: ' . user_get_name($row['reporter_id']) . BR : '') . ($row['handler_id'] ? 'Assigned: ' . user_get_name($row['handler_id']) . BR : '') . '</div></div>'; } if ($row) { //pre_var_dump(array_keys($row)); } return $content; }
function custom_function_default_roadmap_print_issue($p_issue_id, $p_issue_level = 0) { static $t_status; $t_bug = bug_get($p_issue_id); if (bug_is_resolved($p_issue_id)) { $t_strike_start = '<strike>'; $t_strike_end = '</strike>'; } else { $t_strike_start = $t_strike_end = ''; } if ($t_bug->category_id) { $t_category_name = category_get_name($t_bug->category_id); } else { $t_category_name = ''; } $t_category = is_blank($t_category_name) ? '' : '<b>[' . string_display_line($t_category_name) . ']</b> '; echo utf8_str_pad('', $p_issue_level * 6, ' '), '- ', $t_strike_start, string_get_bug_view_link($p_issue_id), ': ', $t_category, string_display_line_links($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } if (!isset($t_status[$t_bug->status])) { $t_status[$t_bug->status] = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id); } echo ' - ', $t_status[$t_bug->status], $t_strike_end, '.<br />'; }
/** * Returns html string to display * @return string */ public function html() { $t_html = $this->html_start(); $t_html .= '<div class="action">' . sprintf(lang_get('timeline_issue_created'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)) . '</div>'; $t_html .= $this->html_end(); return $t_html; }
/** * Print the list of selected issues and the legend for the status colors. * * @param $p_bug_ids_array An array of issue ids. */ function bug_group_action_print_bug_list($p_bug_ids_array) { $t_legend_position = config_get('status_legend_position'); if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) { html_status_legend(); echo '<br />'; } echo '<div align="center">'; echo '<table class="width75" cellspacing="1">'; echo '<tr class="row-1">'; echo '<td class="category" colspan="2">'; echo lang_get('actiongroup_bugs'); echo '</td>'; echo '</tr>'; $t_i = 1; foreach ($p_bug_ids_array as $t_bug_id) { $t_class = sprintf("row-%d", $t_i++ % 2 + 1); echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary'))); } echo '</table>'; echo '</form>'; echo '</div>'; if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) { echo '<br />'; html_status_legend(); } }
/** * Returns html string to display * @return string */ public function html() { $t_string = $this->tag ? lang_get('timeline_issue_tagged') : lang_get('timeline_issue_untagged'); $t_tag_row = tag_get_by_name($this->tag_name); $t_html = $this->html_start(); $t_html .= '<div class="action">' . sprintf($t_string, user_get_name($this->user_id), string_get_bug_view_link($this->issue_id), $t_tag_row ? tag_get_link($t_tag_row) : $this->tag_name) . '</div>'; $t_html .= $this->html_end(); return $t_html; }
function custom_function_default_changelog_print_issue($p_issue_id) { $t_bug = bug_get($p_issue_id); echo '- ', string_get_bug_view_link($p_issue_id), ': <b>[', $t_bug->category, ']</b> ', string_attribute($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } echo '<br />'; }
/** * Returns html string to display * @return string */ public function html() { if ($this->user_id == $this->handler_id) { $t_string = sprintf(lang_get('timeline_issue_assigned_to_self'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); } else { $t_string = sprintf(lang_get('timeline_issue_assigned'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id), user_get_name($this->handler_id)); } $t_html = $this->html_start(); $t_html .= '<div class="action">' . $t_string . '</div>'; $t_html .= $this->html_end(); return $t_html; }
function custom_function_default_roadmap_print_issue($p_issue_id, $p_issue_level = 0) { $t_bug = bug_get($p_issue_id); if (bug_is_resolved($p_issue_id)) { $t_strike_start = '<strike>'; $t_strike_end = '</strike>'; } else { $t_strike_start = $t_strike_end = ''; } $t_category = is_blank($t_bug->category) ? '' : '<b>[' . $t_bug->category . ']</b> '; echo str_pad('', $p_issue_level * 6, ' '), '- ', $t_strike_start, string_get_bug_view_link($p_issue_id), ': ', $t_category, string_display_line_links($t_bug->summary); if ($t_bug->handler_id != 0) { echo ' (', prepare_user_name($t_bug->handler_id), ')'; } echo ' - ', get_enum_element('status', $t_bug->status), $t_strike_end, '.<br />'; }
/** * Returns html string to display * @return string */ public function html() { $t_resolved = config_get('bug_resolved_status_threshold'); $t_closed = config_get('bug_closed_status_threshold'); if ($this->old_status < $t_closed && $this->new_status >= $t_closed) { $t_string = sprintf(lang_get('timeline_issue_closed'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); } else { if ($this->old_status < $t_resolved && $this->new_status >= $t_resolved) { $t_string = sprintf(lang_get('timeline_issue_resolved'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); } else { if ($this->old_status >= $t_resolved && $this->new_status < $t_resolved) { $t_string = sprintf(lang_get('timeline_issue_reopened'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); } else { return ''; } } } $t_html = $this->html_start(); $t_html .= '<div class="action">' . $t_string . '</div>'; $t_html .= $this->html_end(); return $t_html; }
function string_process_bug_link($p_string, $p_include_anchor = true, $p_detail_info = true, $p_fqdn = false) { $t_tag = config_get('bug_link_tag'); # bail if the link tag is blank if ('' == $t_tag) { return $p_string; } preg_match_all('/(^|.+?)(?:(?<=^|\\W)' . preg_quote($t_tag, '/') . '(\\d+)|$)/s', $p_string, $t_matches, PREG_SET_ORDER); $t_result = ''; if ($p_include_anchor) { foreach ($t_matches as $t_match) { $t_result .= $t_match[1]; if (isset($t_match[2])) { $t_bug_id = $t_match[2]; if (bug_exists($t_bug_id)) { $t_result .= string_get_bug_view_link($t_bug_id, null, $p_detail_info, $p_fqdn); } else { $t_result .= $t_bug_id; } } } } else { foreach ($t_matches as $t_match) { $t_result .= $t_match[1]; if (isset($t_match[2])) { $t_bug_id = $t_match[2]; # We might as well create the link here even if the bug # doesn't exist. In the case above we don't want to do # the summary lookup on a non-existant bug. But here, we # can create the link and by the time it is clicked on, the # bug may exist. $t_result .= string_get_bug_view_url_with_fqdn($t_bug_id, null); } } } return $t_result; }
/** * Print list of bugs opened from the longest time * @return void */ function summary_print_by_age() { $t_project_id = helper_get_current_project(); $t_resolved = config_get('bug_resolved_status_threshold'); $t_specific_where = helper_project_specific_where($t_project_id); if (' 1<>1' == $t_specific_where) { return; } $t_query = 'SELECT * FROM {bug} WHERE status < ' . db_param() . ' AND ' . $t_specific_where . ' ORDER BY date_submitted ASC, priority DESC'; $t_result = db_query($t_query, array($t_resolved)); $t_count = 0; $t_private_bug_threshold = config_get('private_bug_threshold'); while ($t_row = db_fetch_array($t_result)) { # as we select all from bug_table, inject into the cache. bug_cache_database_result($t_row); # Skip private bugs unless user has proper permissions if (VS_PRIVATE == bug_get_field($t_row['id'], 'view_state') && false == access_has_bug_level($t_private_bug_threshold, $t_row['id'])) { continue; } if ($t_count++ == 10) { break; } $t_bugid = string_get_bug_view_link($t_row['id']); $t_summary = string_display_line($t_row['summary']); $t_days_open = intval((time() - $t_row['date_submitted']) / SECONDS_PER_DAY); echo '<tr>' . "\n"; echo '<td class="small">' . $t_bugid . ' - ' . $t_summary . '</td><td class="right">' . $t_days_open . '</td>' . "\n"; echo '</tr>' . "\n"; } }
</tr> <?php $t_sum_in_minutes = 0; $t_user_summary = array(); # Initialize the user summary array foreach ($t_bugnote_stats as $t_item) { $t_user_summary[$t_item[$t_name_field]] = 0; } # Calculate the totals foreach ($t_bugnote_stats as $t_item) { $t_sum_in_minutes += $t_item['sum_time_tracking']; $t_user_summary[$t_item[$t_name_field]] += $t_item['sum_time_tracking']; $t_item['sum_time_tracking'] = db_minutes_to_hhmm($t_item['sum_time_tracking']); if ($t_item['bug_id'] != $t_prev_id) { $t_link = sprintf(lang_get('label'), string_get_bug_view_link($t_item['bug_id'])) . lang_get('word_separator') . string_display($t_item['summary']); echo '<tr class="row-category-history"><td colspan="4">' . $t_link . '</td></tr>'; $t_prev_id = $t_item['bug_id']; } ?> <tr> <td class="small-caption"> <?php echo $t_item[$t_name_field]; ?> </td> <td class="small-caption"> <?php echo $t_item['sum_time_tracking']; ?> </td>
bug_set_field($t_bug_id, 'sticky', !$f_sticky); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } break; case 'CUSTOM': if (0 === $f_custom_field_id) { trigger_error(ERROR_GENERIC, ERROR); } $t_form_var = "custom_field_{$f_custom_field_id}"; $t_custom_field_value = gpc_get_custom_field($t_form_var, $t_custom_field_def['type'], null); custom_field_set_value($f_custom_field_id, $t_bug_id, $t_custom_field_value); break; default: trigger_error(ERROR_GENERIC, ERROR); } } $t_redirect_url = 'view_all_bug_page.php'; if (count($t_failed_ids) > 0) { html_page_top1(); html_page_top2(); echo '<div align="center">'; foreach ($t_failed_ids as $t_id => $t_reason) { printf("<p> %s: %s </p>\n", string_get_bug_view_link($t_id), $t_reason); } print_bracket_link($t_redirect_url, lang_get('proceed')); echo '</div>'; html_page_bottom1(__FILE__); } else { print_header_redirect($t_redirect_url); }
/** * Returns html string to display * @return string */ public function html() { switch ($this->type) { case IssueStatusChangeTimelineEvent::RESOLVED: $t_string = sprintf(lang_get('timeline_issue_resolved'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); break; case IssueStatusChangeTimelineEvent::CLOSED: $t_string = sprintf(lang_get('timeline_issue_closed'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); break; case IssueStatusChangeTimelineEvent::REOPENED: $t_string = sprintf(lang_get('timeline_issue_reopened'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)); break; case IssueStatusChangeTimelineEvent::IGNORED: return ''; default: # Unknown status change type trigger_error(ERROR_GENERIC, ERROR); return ''; } $t_html = $this->html_start(); $t_html .= '<div class="action">' . $t_string . '</div>'; $t_html .= $this->html_end(); return $t_html; }
if ($t_cost_col) { ?> <td class="small-caption bold right"> <?php echo lang_get('time_tracking_cost'); ?> </td> <?php } ?> </tr> <?php foreach ($t_bugnote_stats['issues'] as $t_issue_id => $t_issue) { $t_project_info = !isset($f_bug_id) && $f_project_id == ALL_PROJECTS ? '[' . project_get_name($t_issue['project_id']) . ']' . lang_get('word_separator') : ''; $t_link = sprintf(lang_get('label'), string_get_bug_view_link($t_issue_id)) . lang_get('word_separator') . $t_project_info . string_display($t_issue['summary']); echo '<tr class="row-category-history"><td colspan="4">' . $t_link . '</td></tr>'; foreach ($t_issue['users'] as $t_username => $t_user_info) { ?> <tr> <td class="small-caption"> <?php echo $t_username; ?> </td> <td class="small-caption"> <?php echo db_minutes_to_hhmm($t_user_info['minutes']); ?> </td> <?php
function summary_print_by_age() { $t_mantis_bug_table = db_get_table('mantis_bug_table'); $t_project_id = helper_get_current_project(); $t_user_id = auth_get_current_user_id(); $t_resolved = config_get('bug_resolved_status_threshold'); $specific_where = helper_project_specific_where($t_project_id); if (' 1<>1' == $specific_where) { return; } $query = "SELECT * FROM {$t_mantis_bug_table}\n\t\t\t\tWHERE status < {$t_resolved}\n\t\t\t\tAND {$specific_where}\n\t\t\t\tORDER BY date_submitted ASC, priority DESC"; $result = db_query($query); $t_count = 0; $t_private_bug_threshold = config_get('private_bug_threshold'); while ($row = db_fetch_array($result)) { // as we select all from bug_table, inject into the cache. bug_cache_database_result($row); // Skip private bugs unless user has proper permissions if (VS_PRIVATE == bug_get_field($row['id'], 'view_state') && false == access_has_bug_level($t_private_bug_threshold, $row['id'])) { continue; } if ($t_count++ == 10) { break; } $t_bugid = string_get_bug_view_link($row['id']); $t_summary = string_display_line($row['summary']); $t_days_open = intval((time() - $row['date_submitted']) / SECONDS_PER_DAY); print "<tr " . helper_alternate_class() . ">\n"; print "<td class=\"small\">{$t_bugid} - {$t_summary}</td><td class=\"right\">{$t_days_open}</td>\n"; print "</tr>\n"; } }
<p class="bugid"></p> <p class="commits"><?php echo $source_count[$bug->id]; ?> </p> <p class="category"><?php if ($bug->project_id != $current_project) { $project_name = project_get_name($bug->project_id); echo '<span class="project">' . $project_name . '</span> - '; } echo category_full_name($bug->category_id, false); ?> </p> <p class="summary"> <?php echo string_get_bug_view_link($bug->id) . ': ' . bug_format_summary($bug->id, 0); ?> </p> <p class="severity" style="background: <?php echo $sevcolor; ?> " title="Severity: <?php echo get_enum_element('severity', $bug->severity); ?> "> </p> <p class="resolution" style="background: <?php
$t_form_var = 'custom_field_' . $f_custom_field_id; $t_custom_field_value = gpc_get_custom_field($t_form_var, $t_custom_field_def['type'], null); custom_field_set_value($f_custom_field_id, $t_bug_id, $t_custom_field_value); bug_update_date($t_bug_id); email_bug_updated($t_bug_id); helper_call_custom_function('issue_update_notify', array($t_bug_id)); break; default: trigger_error(ERROR_GENERIC, ERROR); } # Bug Action Event event_signal('EVENT_BUG_ACTION', array($f_action, $t_bug_id)); } form_security_purge($t_form_name); $t_redirect_url = 'view_all_bug_page.php'; if (count($t_failed_ids) > 0) { html_page_top(); echo '<div><br />'; echo '<table class="width75">'; $t_separator = lang_get('word_separator'); foreach ($t_failed_ids as $t_id => $t_reason) { $t_label = sprintf(lang_get('label'), string_get_bug_view_link($t_id)) . $t_separator; printf("<tr><td width=\"50%%\">%s%s</td><td>%s</td></tr>\n", $t_label, bug_get_field($t_id, 'summary'), $t_reason); } echo '</table><br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); echo '</div>'; html_page_bottom(); } else { print_header_redirect($t_redirect_url); }
trigger_error(ERROR_GENERIC, ERROR); } /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ $t_form_var = "custom_field_{$f_custom_field_id}"; $t_custom_field_value = gpc_get_custom_field($t_form_var, $t_custom_field_def['type'], null); custom_field_set_value($f_custom_field_id, $t_bug_id, $t_custom_field_value); bug_update_date($t_bug_id); helper_call_custom_function('issue_update_notify', array($t_bug_id)); break; default: trigger_error(ERROR_GENERIC, ERROR); } // Bug Action Event event_signal('EVENT_BUG_ACTION', array($f_action, $t_bug_id)); } form_security_purge($t_form_name); $t_redirect_url = 'view_all_bug_page.php'; if (count($t_failed_ids) > 0) { html_page_top(); echo '<div align="center"><br />'; echo '<table class="width75">'; foreach ($t_failed_ids as $t_id => $t_reason) { printf("<tr><td width=\"50%%\">%s: %s</td><td>%s</td></tr>\n", string_get_bug_view_link($t_id), bug_get_field($t_id, 'summary'), $t_reason); } echo '</table><br />'; print_bracket_link($t_redirect_url, lang_get('proceed')); echo '</div>'; html_page_bottom(); } else { print_header_redirect($t_redirect_url); }
/** * Process $p_string, looking for bug ID references and creating bug view * links for them. * * Returns the processed string. * * If $p_include_anchor is true, include the href tag, otherwise just insert * the URL * * The bug tag ('#' by default) must be at the beginning of the string or * preceeded by a character that is not a letter, a number or an underscore * * if $p_include_anchor = false, $p_fqdn is ignored and assumed to true. * @param string $p_string String to be processed. * @param boolean $p_include_anchor Whether to include the href tag or just the URL. * @param boolean $p_detail_info Whether to include more detailed information (e.g. title attribute / project) in the returned string. * @param boolean $p_fqdn Whether to return an absolute or relative link. * @return string */ function string_process_bug_link($p_string, $p_include_anchor = true, $p_detail_info = true, $p_fqdn = false) { static $s_bug_link_callback = array(); $t_tag = config_get('bug_link_tag'); # bail if the link tag is blank if ('' == $t_tag || $p_string == '') { return $p_string; } if (!isset($s_bug_link_callback[$p_include_anchor][$p_detail_info][$p_fqdn])) { if ($p_include_anchor) { $s_bug_link_callback[$p_include_anchor][$p_detail_info][$p_fqdn] = function ($p_array) use($p_detail_info, $p_fqdn) { if (bug_exists((int) $p_array[2])) { $t_project_id = bug_get_field((int) $p_array[2], 'project_id'); $t_view_bug_threshold = config_get('view_bug_threshold', null, null, $t_project_id); if (access_has_bug_level($t_view_bug_threshold, (int) $p_array[2])) { return $p_array[1] . string_get_bug_view_link((int) $p_array[2], (bool) $p_detail_info, (bool) $p_fqdn); } } return $p_array[0]; }; # end of bug link callback closure } else { $s_bug_link_callback[$p_include_anchor][$p_detail_info][$p_fqdn] = function ($p_array) { if (bug_exists((int) $p_array[2])) { # Create link regardless of user's access to the bug return $p_array[1] . string_get_bug_view_url_with_fqdn((int) $p_array[2]); } return $p_array[0]; }; # end of bug link callback closure } } $p_string = preg_replace_callback('/(^|[^\\w&])' . preg_quote($t_tag, '/') . '(\\d+)\\b/', $s_bug_link_callback[$p_include_anchor][$p_detail_info][$p_fqdn], $p_string); return $p_string; }
/** * Print the list of selected issues and the legend for the status colors. * * @param array $p_bug_ids_array An array of issue ids. * @return void */ function bug_group_action_print_bug_list(array $p_bug_ids_array) { $t_legend_position = config_get('status_legend_position'); if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) { html_status_legend(); echo '<br />'; } echo '<div id="action-group-issues-div">'; echo '<table>'; echo '<tr class="row-1">'; echo '<th class="category" colspan="2">'; echo lang_get('actiongroup_bugs'); echo '</th>'; echo '</tr>'; $t_i = 1; foreach ($p_bug_ids_array as $t_bug_id) { # choose color based on status $t_status_label = html_get_status_css_class(bug_get_field($t_bug_id, 'status'), auth_get_current_user_id(), bug_get_field($t_bug_id, 'project_id')); echo sprintf("<tr class=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", $t_status_label, string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary'))); } echo '</table>'; echo '</div>'; if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) { echo '<br />'; html_status_legend(); } }
</tr> <?php $t_sum_in_minutes = 0; $t_user_summary = array(); # Initialize the user summary array foreach ($t_bugnote_stats as $t_item) { $t_user_summary[$t_item[$t_name_field]] = 0; } # Calculate the totals foreach ($t_bugnote_stats as $t_item) { $t_sum_in_minutes += $t_item['sum_time_tracking']; $t_user_summary[$t_item[$t_name_field]] += $t_item['sum_time_tracking']; $t_item['sum_time_tracking'] = db_minutes_to_hhmm($t_item['sum_time_tracking']); if ($t_item['bug_id'] != $t_prev_id) { $t_link = string_get_bug_view_link($t_item['bug_id']) . ": " . string_display($t_item['summary']); echo '<tr class="row-category-history"><td colspan="4">' . $t_link . "</td></tr>"; $t_prev_id = $t_item['bug_id']; helper_alternate_class(1); } ?> <tr <?php echo helper_alternate_class(); ?> > <td class="small-caption"> <?php echo $t_item[$t_name_field]; ?> </td> <td class="small-caption">
function print_recently_visited() { if (!last_visited_enabled()) { return; } $t_ids = last_visited_get_array(); if (count($t_ids) == 0) { return; } echo '<div class="recently-visited">' . lang_get('recently_visited') . ': '; $t_first = true; foreach ($t_ids as $t_id) { if (!$t_first) { echo ', '; } else { $t_first = false; } echo string_get_bug_view_link($t_id); } echo '</div>'; }
function print_bug_link($p_bug_id, $p_detail_info = true) { print string_get_bug_view_link($p_bug_id, null, $p_detail_info); }