View Issue Details

IDProjectCategoryView StatusLast Update
0003315mantisbtbugtrackerpublic2005-05-31 19:08
ReporterAlain Eckenschwiller Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version1.0.0a3 
Summary0003315: Allow user to add custom fields in Reports, Exports and Bugs View
Description

It would be nice if user could add custom fields in

  • printed reports
  • CSV exports
  • bugs list overview...
Additional Information

allow user to design by hiding or showing fields in bugs overview form (view_all_bug_page.php).
allow user to order them too.

TagsNo tags attached.
Attached Files
/home/jhanley/projects/mantisbt.tar.gz (Attachment missing)
mantis.patch (15,880 bytes)   
? mantis.patch
? core/view_columns_api.php
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.168
diff -u -r1.168 config_defaults_inc.php
--- config_defaults_inc.php	27 May 2004 22:09:20 -0000	1.168
+++ config_defaults_inc.php	7 Jun 2004 01:10:59 -0000
@@ -944,6 +944,7 @@
 	$g_mantis_custom_field_string_table     = $g_db_table_prefix.'_custom_field_string_table';
 	$g_mantis_upgrade_table					= $g_db_table_prefix.'_upgrade_table';
 	$g_mantis_filters_table					= $g_db_table_prefix.'_filters_table';
+	$g_mantis_view_columns_table                            = $g_db_table_prefix.'_view_columns_table';
 	$g_mantis_sponsorship_table				= $g_db_table_prefix.'_sponsorship_table';
 
 	###########################
Index: view_all_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_inc.php,v
retrieving revision 1.141
diff -u -r1.141 view_all_inc.php
--- view_all_inc.php	26 May 2004 05:25:18 -0000	1.141
+++ view_all_inc.php	7 Jun 2004 01:10:59 -0000
@@ -17,7 +17,9 @@
 	require_once( $t_core_path.'string_api.php' );
 	require_once( $t_core_path.'date_api.php' );
 	require_once( $t_core_path.'icon_api.php' );
-
+	require_once( $t_core_path.'view_columns_api.php' );
+?>
+<?php
 	$t_filter = current_user_get_bug_filter();
 
 	$t_sort = $t_filter['sort'];
@@ -34,7 +36,7 @@
 
 	# -- ====================== BUG LIST ============================ -- 
 
-	$col_count = 10;
+	$col_count = view_columns_get_column_count();
 
 	if ( STATUS_LEGEND_POSITION_TOP == config_get( 'status_legend_position' ) ) {
 		html_status_legend();
@@ -55,13 +57,10 @@
 <form method="get" action="bug_actiongroup_page.php">
 <table id="buglist" class="width100" cellspacing="1">
 <tr>
-	<td class="form-title" colspan="<?php echo $col_count - 2; ?>">
-		<?php 
+	<td class="form-title" colspan="<?php echo $col_count - 3; ?>">
+		<?php echo lang_get( 'viewing_bugs_title' ) ?>
+		<?php
 			# -- Viewing range info --
-
-			$v_start = 0;
-			$v_end   = 0;
-
 			if ( sizeof( $rows ) > 0 ) {
 				$v_start = $t_filter['per_page'] * ($f_page_number-1) +1;
 				$v_end   = $v_start + sizeof( $rows ) -1;
@@ -80,7 +79,7 @@
 		?> </span>
 	</td>
 
-	<td class="right" colspan="2">
+	<td class="right" colspan="3">
 		<span class="small"> <?php 
 			# -- Page number links -- 
 
@@ -89,264 +88,19 @@
 	</td>
 </tr>
 <?php # -- Bug list column header row -- ?>
-<tr class="row-category">
-	<td> &nbsp; </td>
-	<td> &nbsp; </td>
-	<td> <?php 
-		# -- Priority column -- 
-
-		print_view_bug_sort_link( 'P', 'priority', $t_sort, $t_dir ); 
-		print_sort_icon( $t_dir, $t_sort, 'priority' );
-	?> </td>
-	<td> <?php 
-		# -- Bug ID column --
-
-		print_view_bug_sort_link( lang_get( 'id' ), 'id', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'id' );
-	?> </td>
-<?php
-		# -- Sponsorship Amount -- 
-
-		if ( ON == $t_enable_sponsorship ) {
-			echo "\t<td>";
-			print_view_bug_sort_link( sponsorship_get_currency(), 'sponsorship_total', $t_sort, $t_dir );
-			print_sort_icon( $t_dir, $t_sort, 'sponsorship_total' );
-			echo "</td>\n";
-		}
-	
-		# -- Bugnote count column -- 
-?>
-	<td> # </td>
-<?php 
-		# -- Attachment indicator --
-
-		if ( ON == $t_show_attachments ) {
-			echo "\t<td>";
-			echo '<img src="' . $t_icon_path . 'attachment.png' . '" alt="" />';
-			echo "</td>\n";
-		}
-?>
-	<td> <?php 
-		# -- Category column -- 
-
-		print_view_bug_sort_link( lang_get( 'category' ), 'category', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'category' );
-	?> </td>
-	<td> <?php 
-		# -- Severity column -- 
-
-		print_view_bug_sort_link( lang_get( 'severity' ), 'severity', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'severity' );
-	?> </td>
-	<td> <?php
-		# -- Status column --
-
-		print_view_bug_sort_link( lang_get( 'status' ), 'status', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'status' );
-	?> </td>
-	<td> <?php 
-		# -- Last Updated column -- 
-
-		print_view_bug_sort_link( lang_get( 'updated' ), 'last_updated', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'last_updated' );
-	?> </td>
-	<td> <?php 
-		# -- Summary column -- 
-
-		print_view_bug_sort_link( lang_get( 'summary' ), 'summary', $t_sort, $t_dir );
-		print_sort_icon( $t_dir, $t_sort, 'summary' );
-	?> </td>
-</tr>
-
+<?php view_columns_draw_view_header_rows($t_dir, $t_sort); ?>
 <?php # -- Spacer row -- ?>
 <tr>
-	<td class="spacer" colspan="<?php echo $col_count; ?>"> &nbsp; </td>
+	<td class="spacer" colspan="<?php echo $col_count ?>">&nbsp;</td>
 </tr>
+<?php mark_time( 'begin loop' ); ?>
+<?php # -- Loop over bug rows and create $v_* variables -- ?>
+<?php view_columns_draw_view_data_rows( $rows, $t_checkboxes_exist ); ?>
+<?php # -- ====================== end of BUG LIST ========================= -- ?>
 
-<?php 
-	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' );
-
-		$v_summary = string_display_links( $v_summary );
-		$t_last_updated = date( config_get( 'short_date_format' ), $v_last_updated );
-
-		# choose color based on status
-		$status_color = get_status_color( $v_status );
-
-		# grab the bugnote count
-		$t_bugnote_stats = bug_get_bugnote_stats( $v_id );
-		if ( NULL != $t_bugnote_stats ) {
-			$bugnote_count = $t_bugnote_stats['count'];
-			$v_bugnote_updated = $t_bugnote_stats['last_modified'];
-		} else {
-			$bugnote_count = 0;
-		}
-
-		# Check for attachments
-		$t_attachment_count = 0;
-		if ( ( ON == $t_show_attachments ) 
-		  && ( 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; ?>">
-	<td> <?php
-		# -- Checkbox -- 
-
-		if ( access_has_bug_level( $t_update_bug_threshold, $v_id ) ) {
-			$t_checkboxes_exist = true;
-			printf( "<input type=\"checkbox\" name=\"bug_arr[]\" value=\"%d\" />" , $v_id );
-		} else {
-			echo "&nbsp;";
-		}
-	?> </td>
-	<td> <?php 
-		# -- Pencil shortcut --
-
-		if ( !bug_is_readonly( $v_id ) 
-		  && access_has_bug_level( $t_update_bug_threshold, $v_id ) ) {
-			echo '<a href="' . string_get_bug_update_url( $v_id ) . '">';
-			echo '<img border="0" src="' . $t_icon_path . 'update.png';
-			echo '" alt="' . lang_get( 'update_bug_button' ) . '" /></a>';
-		} else {
-			echo '&nbsp;';
-		}
-	?> </td>
-	<td> <?php
-		# -- Priority --
-
-		if ( ON == config_get( 'show_priority_text' ) ) {
-			print_formatted_priority_string( $v_status, $v_priority );
-		} else {
-			print_status_icon( $v_priority );
-		}
-	?> </td>
-	<td class="center"> <?php 
-		# -- Bug ID and details link -- 
-
-		print_bug_link( $v_id, false );
-	?> </td>
-<?php
-		# -- Sponsorship Amount -- 
-
-		if ( $t_enable_sponsorship == ON ) {
-			echo "\t<td class=\"right\">";
-			if ( $v_sponsorship_total > 0 ) {
-				echo sponsorship_format_amount( $v_sponsorship_total );
-			}
-			echo "</td>\n";
-		}
-?>
-	<td class="center"> <?php
-		# -- Bugnote count --
-
-		if ( $bugnote_count > 0 ) {
-			$t_bugnote_link = '<a href="' . string_get_bug_view_url( $v_id ) 
-				. '&amp;nbn=' . $bugnote_count . '#bugnotes">' 
-				. $bugnote_count . '</a>'; 
-
-			if ( $v_bugnote_updated > strtotime( '-'.$t_filter['highlight_changed'].' hours' ) ) {
-				printf( '<span class="bold">%s</span>', $t_bugnote_link );
-			} else {
-				echo $t_bugnote_link;
-				}
-		} else {
-			echo '&nbsp;';
-		}
-	?> </td>
-<?php 
-		# -- Attachment indicator --
-	  
-		if ( ON == $t_show_attachments ) {
-			echo "\t<td>";
-			if ( 0 < $t_attachment_count ) {
-				echo '<a href="' . string_get_bug_view_url( $v_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 ' &nbsp; ';
-			}
-			echo "</td>\n";
-		}
-?>
-	<td class="center"> <?php 
-		# -- Category -- 
-
-		# type project name if viewing 'all projects'
-		if ( ON == config_get( 'show_bug_project_links' ) 
-		  && helper_get_current_project() == ALL_PROJECTS ) {
-			echo '<small>[';
-			print_view_bug_sort_link( $project_name, 'project_id', $t_sort, $t_dir );
-			echo ']</small><br />';
-		}
-
-		echo string_display( $v_category );
-	?> </td>
-	<td class="center"> <?php 
-		# -- Severity --
-
-		print_formatted_severity_string( $v_status, $v_severity );
-	?> </td>
-	<td class="center"> <?php 
-		# -- Status / Handler --
-
-		printf( '<u><a title="%s">%s</a></u>'
-			, get_enum_element( 'resolution', $v_resolution ) 
-			, get_enum_element( 'status', $v_status )
-		);
-
-		# print username instead of status
-		if ( ON == config_get( 'show_assigned_names' ) 
-		  && $v_handler_id > 0 ) {
-			echo ' (';
-			print_user( $v_handler_id );
-			echo ')';
-		}
-	?> </td>
-	<td class="center"> <?php 
-		# -- Last Updated -- 
-	
-		if ( $v_last_updated > strtotime( '-'.$t_filter['highlight_changed'].' hours' ) ) {
-			printf( '<span class="bold">%s</span>', $t_last_updated );
-		} else {
-			echo $t_last_updated;
-		}
-	?> </td>
-	<td class="left"> <?php 
-		# -- Summary --
-
-		echo $v_summary;
-		if ( VS_PRIVATE == $v_view_state ) {
-			printf( ' <img src="%s" alt="(%s)" title="%s" />'
-				, $t_icon_path . 'protected.gif'
-				, lang_get( 'private' )
-				, lang_get( 'private' )
-			);
-		}
-	 ?> </td>
-</tr>
-<?php 
-	# -- end of Repeating bug row --
-	}
-
-	# -- ====================== end of BUG LIST ========================= --
-
-	# -- ====================== MASS BUG MANIPULATION =================== -- 
-?>
+<?php # -- ====================== MASS BUG MANIPULATION ========================= -- ?>
 	<tr>
-		<td class="left" colspan="<?php echo $col_count-2; ?>">
+		<td colspan="<?php echo $col_count - 3 ?>">
 <?php
 		if ( $t_checkboxes_exist ) {
 ?>
@@ -360,12 +114,14 @@
 		}
 ?>
 		</td>
-		<?php # -- Page number links -- ?>
-		<td class="right" colspan="2">
-			<span class="small">
-				<?php print_page_links( 'view_all_bug_page.php', 1, $t_page_count, $f_page_number ) ?>
-			</span>
-		</td>
+		<?php # -- Page view links -- ?>
+			<td class="right" colspan="3">
+		<?php view_columns_draw_views_selector(); ?>
+			<?php # -- Page number links -- ?>
+				<span class="small">
+                                <?php print_page_links( 'view_all_bug_page.php', 1, $t_page_count, $f_page_number ) ?>
+                        </span>
+                </td>
 	</tr>
 <?php # -- ====================== end of MASS BUG MANIPULATION ========================= -- ?>
 </table>
Index: view_all_set.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_set.php,v
retrieving revision 1.31
diff -u -r1.31 view_all_set.php
--- view_all_set.php	18 May 2004 19:32:58 -0000	1.31
+++ view_all_set.php	7 Jun 2004 01:11:00 -0000
@@ -280,11 +280,24 @@
 				$t_setting_arr['custom_fields'] = $t_custom_fields_data;
 
 				break;
-		# Just set the search string value
-		case '5':
-				$t_setting_arr['search'] = $f_search;
-
-				break;
+                case '5':
+                                $t_setting_arr['search'] = $f_search;
+                                                                                                                                                    
+                                break;
+
+		# Change column view
+		case '6':
+			$t_view_columns_string = view_columns_db_get_view_columns( $f_view_query_id );
+			# If we can use the query that we've requested,
+                        # grab it. We will overwrite the current one at the
+                        # bottom of this page
+                        if ( $t_view_columns_string != null ) {
+                                $t_cookie_detail = explode( '#', $t_view_columns_string, 2 );
+                                $t_setting_arr = unserialize( $t_cookie_detail[1] );
+
+                                break;
+                        }
+			break;
 		# does nothing. catch all case
 		default:
 				break;
Index: core/current_user_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/current_user_api.php,v
retrieving revision 1.17
diff -u -r1.17 current_user_api.php
--- core/current_user_api.php	8 Apr 2004 22:44:59 -0000	1.17
+++ core/current_user_api.php	7 Jun 2004 01:11:00 -0000
@@ -12,6 +12,7 @@
 	$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
 
 	require_once( $t_core_dir . 'filter_api.php' );
+	require_once( $t_core_dir . 'view_columns_api.php' );
 
 	### Current User API ###
 
@@ -111,4 +112,33 @@
 
 		return $t_filter;
 	}
+	
+	# --------------------
+        # return the bug column format parameters for the current user
+        #  this could be modified to call a user_api function to get the
+        #  filter out of a db or whatever
+        # This is a modified version of current_user_get_bug_filter
+        function current_user_get_bug_view_columns() {
+                # check to see if new cookie is needed
+                if ( !view_columns_is_cookie_valid() ) {
+			PRINT "<!-- Truely Invalid Cookie --!>\n";
+                        return false;
+                }
+
+                $f_view_columns_string	= gpc_get_string( 'view_columns', '' );
+                $t_view_all_cookie	= '';
+                $t_cookie_detail	= '';
+                $t_view_columns		= '';
+
+                if ( '' != $f_view_columns_string ) {
+                        $t_view_columns = unserialize( $f_view_columns_string );
+                } else {
+                        $t_view_all_cookie_id	= gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
+                        $t_view_all_cookie	= view_columns_db_get_view_columns( $t_view_all_cookie_id );
+                        $t_cookie_detail	= explode( '#', $t_view_all_cookie, 2 );
+                        $t_view_columns		= unserialize( $t_cookie_detail[1] );
+                }
+
+                return $t_view_columns;
+        }
 ?>
Index: core/filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.37
diff -u -r1.37 filter_api.php
--- core/filter_api.php	28 May 2004 06:11:58 -0000	1.37
+++ core/filter_api.php	7 Jun 2004 01:11:01 -0000
@@ -407,7 +407,7 @@
 
 			$t_from_clauses = array( $t_bug_text_table, $t_project_table );
 
-			array_push( $t_join_clauses, ",($t_bug_table LEFT JOIN $t_bugnote_table ON $t_bugnote_table.bug_id = $t_bug_table.id)" );
+			array_push( $t_join_clauses, ",$t_bug_table LEFT JOIN $t_bugnote_table ON $t_bugnote_table.bug_id = $t_bug_table.id" );
 
 			array_push( $t_join_clauses, "LEFT JOIN $t_bugnote_text_table ON $t_bugnote_text_table.id = $t_bugnote_table.bugnote_text_id" );
 		} else {
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.176
diff -u -r1.176 strings_english.txt
--- lang/strings_english.txt	26 May 2004 04:45:08 -0000	1.176
+++ lang/strings_english.txt	7 Jun 2004 01:11:02 -0000
@@ -865,6 +865,9 @@
 $s_open_queries = 'Manage Filters';
 $s_query_delete_msg = 'Are you sure you wish to delete this query?';
 
+# stored column views strings
+$s_switch_view_query = 'Switch View';
+
 # view_bug_advanced_page.php
 $s_view_simple_link = 'View Simple';
 $s_viewing_bug_advanced_details_title = 'Viewing Issue Advanced Details';
mantis.patch (15,880 bytes)   

Relationships

related to 0000934 closedvboctor Would be nice to select what columns to view 
has duplicate 0005594 closedvboctor csv-export for custom fields 

Activities

DGtlRift

DGtlRift

2004-04-12 18:38

reporter   ~0005369

Hacked up the filter_api.php to do something like this but really wasn't sure about how to handle the formating of the columns.. I think there is a better way to do this but I really wasn't sure how.

grangeway

grangeway

2004-05-31 16:59

reporter   ~0005641

could you try uploading that file with a different name - using both mozilla and IE, it's not downloadable

DGtlRift

DGtlRift

2004-06-03 21:43

reporter   ~0005657

Yes.. I've been on vacation for a few weeks and got back on Monday, but then had some issues with cvs on source forge, but I'm merging the changes from the latest nightly and I will post the new changes here within a day or two.

There are still some cluegy things about it (still not user configurable) but I just need to add an interface for that.

redcom

redcom

2004-06-06 08:06

reporter   ~0005662

Not exactly the right forum for a lesson in cvs, but how do I do a cvs diff on a working path to include a file that is not not added (with cvs add.) The reason I ask is because I cannot do a cvs add on a file since the repository tells me that it is read only, but cvs diff tells me that the file is of unknown status.

DGtlRift

DGtlRift

2004-06-06 21:11

reporter   ~0005664

Nevermind about the cvs diff, I just added the file as it's own attachment.