function file_bug_has_attachments($p_bug_id) { if (file_bug_attachment_count($p_bug_id) > 0) { return true; } else { return false; } }
/** * Print column content for column attachment count * * @param BugData $p_bug bug object * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } echo '<td class="column-attachments">'; if ($t_attachment_count > 0) { $t_href = string_get_bug_view_url($p_bug->id) . '#attachments'; $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id); echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>"; } else { echo '   '; } echo "</td>\n"; }
function print_column_attachment($p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; $t_show_attachments = config_get('show_attachment_indicator'); # Check for attachments $t_attachment_count = 0; if (ON == $t_show_attachments && file_can_view_bug_attachments($p_row['id'])) { $t_attachment_count = file_bug_attachment_count($p_row['id']); } if (ON == $t_show_attachments) { echo "\t<td>"; if (0 < $t_attachment_count) { echo '<a href="' . string_get_bug_view_url($p_row['id']) . '#attachments">'; echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"'; echo ' alt="' . lang_get('attachment_alt') . '"'; echo ' title="' . $t_attachment_count . ' ' . lang_get('attachments') . '"'; echo ' />'; echo '</a>'; } else { echo ' '; } echo "</td>\n"; } }
mark_time('begin loop'); # -- Loop over bug rows and create $v_* variables -- for ($i = 0; $i < sizeof($rows); $i++) { # prefix bug data with v_ extract($rows[$i], EXTR_PREFIX_ALL, 'v'); $t_summary = string_attribute($v_summary); $t_last_updated = date(config_get('normal_date_format'), $v_last_updated); # choose color based on status $status_color = get_status_color($v_status); # grab the bugnote count # @@@ thraxisp - not used??? # $bugnote_info = bug_get_bugnote_stats( $v_id ); # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($v_id)) { $t_attachment_count = file_bug_attachment_count($v_id); } # grab the project name $project_name = project_get_field($v_project_id, 'name'); ?> <tr bgcolor="<?php echo $status_color; ?> "> <?php # -- Bug ID and details link + Pencil shortcut -- ?> <td class="center" valign="top" width ="0" nowrap> <span class="small"> <?php
/** * return number of file attachment's linked to current bug * @return int */ public function get_attachment_count() { if ($this->attachment_count === null) { $this->attachment_count = file_bug_attachment_count($this->id); return $this->attachment_count; } else { return $this->attachment_count; } }
/** * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { global $t_icon_path; # Check for attachments # TODO: factor in the allow_view_own_attachments configuration option # instead of just using a global check. $t_attachment_count = 0; if( file_can_view_bug_attachments( $p_bug->id, null ) ) { $t_attachment_count = file_bug_attachment_count( $p_bug->id ); } echo '<td class="center column-attachments">'; if ( $t_attachment_count > 0 ) { $t_href = string_get_bug_view_url( $p_bug->id ) . '#attachments'; $t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $p_bug->id ); if ( config_get( 'show_attachment_indicator' ) ) { $t_alt_text = $t_attachment_count . lang_get( 'word_separator' ) . lang_get( 'attachments' ); echo "<a href=\"$t_href\" title=\"$t_href_title\"><img src=\"${t_icon_path}attachment.png\" alt=\"$t_alt_text\" title=\"$t_alt_text\" /></a>"; } else { echo "<a href=\"$t_href\" title=\"$t_href_title\">$t_attachment_count</a>"; } } else { echo '   '; } echo "</td>\n"; }
$t_count = count($rows); if ($t_count == 0) { echo '<tr><td> </td></tr>'; } for ($i = 0; $i < $t_count; $i++) { $t_bug = $rows[$i]; $t_summary = string_display_line_links($t_bug->summary); $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated); # choose color based on status $status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id); # Check for attachments $t_attachment_count = 0; # TODO: factor in the allow_view_own_attachments configuration option # instead of just using a global check. if (file_can_view_bug_attachments($t_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($t_bug->id); } # grab the project name $project_name = project_get_field($t_bug->project_id, 'name'); if (VS_PRIVATE == $t_bug->view_state) { $t_bug_class = 'my-buglist-private'; } else { $t_bug_class = ''; } ?> <tr class="my-buglist-bug <?php echo $t_bug_class; ?> <?php echo $status_label;
/** * * @param BugData $p_bug bug obect * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php * @return null * @access public */ function print_column_attachment_count($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { global $t_icon_path; # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } echo '<td class="center column-attachments">'; if ($t_attachment_count > 0) { $t_href = string_get_bug_view_url($p_bug->id) . '#attachments'; $t_href_title = sprintf(lang_get('view_attachments_for_issue'), $t_attachment_count, $p_bug->id); if (config_get('show_attachment_indicator')) { $t_alt_text = $t_attachment_count . lang_get('word_separator') . lang_get('attachments'); echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\"><img src=\"{$t_icon_path}attachment.png\" alt=\"{$t_alt_text}\" title=\"{$t_alt_text}\" /></a>"; } else { echo "<a href=\"{$t_href}\" title=\"{$t_href_title}\">{$t_attachment_count}</a>"; } } else { echo ' '; } echo "</td>\n"; }
/** * return the attachment count for an issue * @param BugData $p_bug A BugData object. * @return string * @access public */ function csv_format_attachment_count(BugData $p_bug) { # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } return csv_escape_string($t_attachment_count); }
/** * Gets the attachment count for an issue * @param BugData $p_bug A bug object. * @return string * @access public */ function excel_format_attachment_count(BugData $p_bug) { # Check for attachments $t_attachment_count = 0; if (file_can_view_bug_attachments($p_bug->id, null)) { $t_attachment_count = file_bug_attachment_count($p_bug->id); } return excel_prepare_number($t_attachment_count); }
/** * Prints bug-specific attachments * * @param $bug_id */ public function print_bug_attachments($bug_id) { $specmanagement_print_api = new specmanagement_print_api(); $attachment_count = file_bug_attachment_count($bug_id); echo '<tr>'; echo '<td />'; echo '<td class="infohead" colspan="2">' . plugin_lang_get('editor_bug_attachments') . ' (' . $attachment_count . ')</td>'; echo '</tr>'; echo '<tr id="attachments">'; echo '<td />'; echo '<td class="bug-attachments" colspan="2">'; $specmanagement_print_api->print_bug_attachments_list($bug_id); echo '</td>'; echo '</tr>'; }