Skip to content

Commit

Permalink
* bug_view_advanced_page.php bug_view_page.php:
Browse files Browse the repository at this point in the history
   Added new HREF anchor for attachments.

* config_defaults_inc.php:
   Added new configuration option to optionally
	 show attachment indicators on view_all_bug_page.

* view_all_inc.php:
	 Added new (option) column containing a clickable
	 file attachment indicator.

* core/file_api.php:
   Added new function file_bug_has_attachments().

* images/attachment.png:
   New attachment indicator icon.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2130 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
int2str committed Mar 27, 2003
1 parent 986e0db commit 220ff49
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 14 deletions.
3 changes: 2 additions & 1 deletion bug_view_advanced_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_view_advanced_page.php,v 1.45 2003-03-24 06:26:41 jfitzell Exp $
# $Id: bug_view_advanced_page.php,v 1.46 2003-03-27 22:34:03 int2str Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -409,6 +409,7 @@
?>
<tr <?php echo helper_alternate_class() ?>>
<td class="category">
<a name="attachments" id="attachments" />
<?php echo lang_get( 'attached_files' ) ?>
</td>
<td colspan="5">
Expand Down
3 changes: 2 additions & 1 deletion bug_view_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_view_page.php,v 1.46 2003-03-24 06:26:42 jfitzell Exp $
# $Id: bug_view_page.php,v 1.47 2003-03-27 22:34:04 int2str Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -322,6 +322,7 @@
?>
<tr <?php echo helper_alternate_class() ?>>
<td class="category">
<a name="attachments" id="attachments" />
<?php echo lang_get( 'attached_files' ) ?>
</td>
<td colspan="5">
Expand Down
10 changes: 9 additions & 1 deletion config_defaults_inc.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: config_defaults_inc.php,v 1.116 2003-03-22 11:51:53 jlatour Exp $
# $Id: config_defaults_inc.php,v 1.117 2003-03-27 22:34:04 int2str Exp $
# --------------------------------------------------------


Expand Down Expand Up @@ -314,6 +314,14 @@
# --- see constant_inc.php. (*: BOTTOM or TOP)
$g_status_legend_position = STATUS_LEGEND_POSITION_BOTTOM;

# --- Show an attachment indicator on bug list ---
# Show a clickable attachment indicator on the bug
# list page if the bug has one or more files attached.
# Note: This option is disabled by default since it adds
# 1 database query per bug listed and thus might slow
# down the page display.
$g_show_attachment_indicator = OFF;

############################
# Mantis JPGRAPH Addon
############################
Expand Down
16 changes: 15 additions & 1 deletion core/file_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: file_api.php,v 1.32 2003-03-24 03:36:53 vboctor Exp $
# $Id: file_api.php,v 1.33 2003-03-27 22:34:05 int2str Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand All @@ -25,6 +25,20 @@ function file_get_display_name( $p_filename ) {
return $t_array[count( $t_array ) - 1];
}
# --------------------
# Check if a specific bug has attachments
function file_bug_has_attachments( $p_bug_id ) {
$c_bug_id = db_prepare_int( $p_bug_id );
$t_bug_file_table = config_get( 'mantis_bug_file_table' );

$query = "SELECT bug_id FROM $t_bug_file_table WHERE bug_id='$c_bug_id'";
$result = db_query( $query );

if ( 0 < db_num_rows( $result ) )
return TRUE;

return FALSE;
}
# --------------------
# List the attachments belonging to the specified bug. This is used from within
# bug_view_page.php and bug_view_advanced_page.php
function file_list_attachments ( $p_bug_id ) {
Expand Down
Binary file added images/attachment.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 47 additions & 10 deletions view_all_inc.php
Expand Up @@ -169,6 +169,12 @@
if ( STATUS_LEGEND_POSITION_TOP == config_get( 'status_legend_position' ) ) {
html_status_legend();
}

$t_show_attachments = config_get( 'show_attachment_indicator' );
if ( ON == $t_show_attachments ) {
$col_count++;
}

?>

<br />
Expand Down Expand Up @@ -210,53 +216,61 @@
</tr>
<?php # -- Bug list column header row -- ?>
<tr class="row-category">
<td class="center" width="2%">&nbsp;</td>
<td class="center">&nbsp;</td>

<td class="center" width="2%">&nbsp;</td>
<td class="center">&nbsp;</td>

<?php # -- Priority column -- ?>
<td class="center" width="5%">
<td class="center">
<?php print_view_bug_sort_link( 'P', 'priority', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'priority' ) ?>
</td>

<?php # -- Bug ID column -- ?>
<td class="center" width="8%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'id' ), 'id', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'id' ) ?>
</td>

<?php # -- Bugnote count column -- ?>
<td class="center" width="3%">
<td class="center">
#
</td>

<?php # -- Attachment indicator --
if ( ON == $t_show_attachments ) {
echo '<td class="center">';
echo '<img src="' . config_get( 'icon_path' ) . 'attachment.png' . '" alt="" />';
echo '</td>';
}
?>

<?php # -- Category column -- ?>
<td class="center" width="12%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'category' ), 'category', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'category' ) ?>
</td>

<?php # -- Severity column -- ?>
<td class="center" width="10%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'severity' ), 'severity', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'severity' ) ?>
</td>

<?php # -- Status column -- ?>
<td class="center" width="10%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'status' ), 'status', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'status' ) ?>
</td>

<?php # -- Last Updated column -- ?>
<td class="center" width="12%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'updated' ), 'last_updated', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'last_updated' ) ?>
</td>

<?php # -- Summary column -- ?>
<td class="center" width="38%">
<td class="center">
<?php print_view_bug_sort_link( lang_get( 'summary' ), 'summary', $t_sort, $t_dir ) ?>
<?php print_sort_icon( $t_dir, $t_sort, 'summary' ) ?>
</td>
Expand All @@ -282,6 +296,14 @@
# grab the bugnote count
$bugnote_count = bug_get_bugnote_count( $v_id );

# Check for attachments
$t_has_attachments = FALSE;
if ( ON == $t_show_attachments
&& ( $v_reporter_id == auth_get_current_user_id()
|| access_has_bug_level( config_get( 'view_attachments_threshold' ), $v_id ) ) ) {
$t_has_attachments = file_bug_has_attachments( $v_id );
}

# grab the project name
$project_name = project_get_field( $v_project_id, 'name' );

Expand Down Expand Up @@ -347,6 +369,21 @@
?>
</td>

<?php # -- Attachment indicator --

if ( ON == $t_show_attachments ) {
echo '<td class="center">';
if ( TRUE == $t_has_attachments ) {
echo '<a href="' . string_get_bug_view_url( $v_id ) . '#attachments">';
echo '<img border="0" src="' . config_get( 'icon_path' ) . 'attachment.png' . '" alt="" />';
echo '</a>';
} else {
echo '&nbsp;';
}
echo '</td>';
}
?>

<?php # -- Category -- ?>
<td class="center">
<?php
Expand Down

0 comments on commit 220ff49

Please sign in to comment.