From 220ff49742b9fa2a8fcd5684bbf606e9edaeea5f Mon Sep 17 00:00:00 2001 From: int2str Date: Thu, 27 Mar 2003 22:34:06 +0000 Subject: [PATCH] * bug_view_advanced_page.php bug_view_page.php: 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 --- bug_view_advanced_page.php | 3 +- bug_view_page.php | 3 +- config_defaults_inc.php | 10 ++++++- core/file_api.php | 16 ++++++++++- images/attachment.png | Bin 0 -> 243 bytes view_all_inc.php | 57 ++++++++++++++++++++++++++++++------- 6 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 images/attachment.png diff --git a/bug_view_advanced_page.php b/bug_view_advanced_page.php index 2a50291506..55207368e8 100644 --- a/bug_view_advanced_page.php +++ b/bug_view_advanced_page.php @@ -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 $ # -------------------------------------------------------- ?> > + diff --git a/bug_view_page.php b/bug_view_page.php index 2016b7f266..09d6c02cdf 100644 --- a/bug_view_page.php +++ b/bug_view_page.php @@ -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 $ # -------------------------------------------------------- ?> > + diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 75efb105df..d30964d6f1 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -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 $ # -------------------------------------------------------- @@ -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 ############################ diff --git a/core/file_api.php b/core/file_api.php index 5de152a817..75401afd1b 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -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; @@ -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 ) { diff --git a/images/attachment.png b/images/attachment.png new file mode 100644 index 0000000000000000000000000000000000000000..479d84eafb51082714cf68f9d97fb6232a2dd8bd GIT binary patch literal 243 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-t%)r2?(;C$b;3=*S<)SS9T^xl_H+M9WCijK0(?STfph~HH-M=IAg`g}z<~n| z4GsT+;{O@`gDD^lWC4M{u$m`OT%aV#FBmL}1|2Y4FkxSC9 z!GPJm<1GKN{|7%XAO8Q}V}^X&&xIoPYF`;y7^8n^t(5+K?iElMgQu&X%Q~loCIEK) BRR;h7 literal 0 HcmV?d00001 diff --git a/view_all_inc.php b/view_all_inc.php index 90ae476797..b77a637a84 100644 --- a/view_all_inc.php +++ b/view_all_inc.php @@ -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++; + } + ?>
@@ -210,53 +216,61 @@ -   +   -   +   - + - + - + # + '; + echo ''; + echo ''; + } + ?> + - + - + - + - + - + @@ -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' ); @@ -347,6 +369,21 @@ ?> + '; + if ( TRUE == $t_has_attachments ) { + echo '
'; + echo ''; + echo ''; + } else { + echo ' '; + } + echo ''; + } + ?> +