Update of /cvsroot/mantisbt/mantisbt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3339
Modified Files:
view_all_inc.php
Log Message:
Support customizing which fields/custom fields should be shown in the View
Issues page via custom functions (vboctor)
More to come in this issue. Support for more fields, changing the print all
bugs page as well.
Index: view_all_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/view_all_inc.php,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- view_all_inc.php 18 Dec 2004 01:44:26 -0000 1.150
+++ view_all_inc.php 25 Jan 2005 12:44:22 -0000 1.151
@@ -28,10 +28,294 @@
$t_icon_path = config_get( 'icon_path' );
$t_update_bug_threshold = config_get( 'update_bug_threshold' );
+ $t_columns = helper_call_custom_function( 'get_columns_to_view',
array() );
+
# -- ====================== FILTER FORM ========================= --
filter_draw_selection_area( $f_page_number );
# -- ====================== end of FILTER FORM ================== --
+ function print_column_title_selection() {
+ echo '<td> </td>';
+ }
+
+ function print_column_title_edit() {
+ echo '<td> </td>';
+ }
+
+ function print_column_title_bug_id() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'id' ), 'id', $t_sort,
$t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'id' );
+ echo '</td>';
+ }
+
+ function print_column_title_priority() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( 'P', 'priority', $t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'priority' );
+ echo '</td>';
+ }
+
+ function print_column_title_attachment() {
+ $t_show_attachments = config_get( 'show_attachment_indicator' );
+
+ if ( ON == $t_show_attachments ) {
+ echo "\t<td>";
+ echo '<img src="' . $t_icon_path . 'attachment.png' .
'" alt="" />';
+ echo "</td>\n";
+ }
+ }
+
+ function print_column_title_category() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'category' ), 'category',
$t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'category' );
+ echo '</td>';
+ }
+
+ function print_column_title_sponsorship() {
+ global $t_sort, $t_dir;
+
+ $t_enable_sponsorship = config_get( 'enable_sponsorship' );
+
+ 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";
+ }
+ }
+
+ function print_column_title_severity() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'severity' ), 'severity',
$t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'severity' );
+ echo '</td>';
+ }
+
+ function print_column_title_status() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'status' ), 'status',
$t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'status' );
+ echo '</td>';
+ }
+
+ function print_column_title_last_updated() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'updated' ),
'last_updated', $t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'last_updated' );
+ echo '</td>';
+ }
+
+ function print_column_title_summary() {
+ global $t_sort, $t_dir;
+
+ echo '<td>';
+ print_view_bug_sort_link( lang_get( 'summary' ), 'summary',
$t_sort, $t_dir );
+ print_sort_icon( $t_dir, $t_sort, 'summary' );
+ echo '</td>';
+ }
+
+ function print_column_title_bugnotes_count() {
+ echo '<td> # </td>';
+ }
+
+ function print_column_selection( $p_row ) {
+ global $t_checkboxes_exist, $t_update_bug_threshold;
+
+ echo '<td>';
+ if ( access_has_bug_level( $t_update_bug_threshold,
$p_row['id'] ) ) {
+ $t_checkboxes_exist = true;
+ printf( "<input type=\"checkbox\" name=\"bug_arr[]\"
value=\"%d\" />" , $p_row['id'] );
+ } else {
+ echo " ";
+ }
+ echo '</td>';
+ }
+
+ function print_column_edit( $p_row ) {
+ global $t_icon_path, $t_update_bug_threshold;
+
+ echo '<td>';
+ if ( !bug_is_readonly( $p_row['id'] )
+ && access_has_bug_level( $t_update_bug_threshold,
$p_row['id'] ) ) {
+ echo '<a href="' . string_get_bug_update_url(
$p_row['id'] ) . '">';
+ echo '<img border="0" width="16" height="16" src="' .
$t_icon_path . 'update.png';
+ echo '" alt="' . lang_get( 'update_bug_button' ) . '"';
+ echo ' title="' . lang_get( 'update_bug_button' ) . '"
/></a>';
+ } else {
+ echo ' ';
+ }
+ echo '</td>';
+ }
+
+ function print_column_priority( $p_row ) {
+ echo '<td>';
+ if ( ON == config_get( 'show_priority_text' ) ) {
+ print_formatted_priority_string( $p_row['status'],
$p_row['priority'] );
+ } else {
+ print_status_icon( $p_row['priority'] );
+ }
+ echo '</td>';
+ }
+
+ function print_column_bug_id( $p_row ) {
+ echo '<td>';
+ print_bug_link( $p_row['id'], false );
+ echo '</td>';
+ }
+
+ function print_column_sponsorship( $p_row ) {
+ $t_enable_sponsorship = config_get( 'enable_sponsorship' );
+
+ if ( $t_enable_sponsorship == ON ) {
+ echo "\t<td class=\"right\">";
+ if ( $v_sponsorship_total > 0 ) {
+ $t_sponsorship_amount =
sponsorship_format_amount( $v_sponsorship_total );
+ echo string_no_break( $t_sponsorship_amount );
+ }
+ echo "</td>\n";
+ }
+ }
+
+ function print_column_bugnotes_count( $p_row ) {
+ global $t_filter;
+
+ # grab the bugnote count
+ $t_bugnote_stats = bug_get_bugnote_stats( $p_row['id'] );
+ if ( NULL != $t_bugnote_stats ) {
+ $bugnote_count = $t_bugnote_stats['count'];
+ $v_bugnote_updated = $t_bugnote_stats['last_modified'];
+ } else {
+ $bugnote_count = 0;
+ }
+
+ echo '<td class="center">';
+ if ( $bugnote_count > 0 ) {
+ $t_bugnote_link = '<a href="' .
string_get_bug_view_url( $p_row['id'] )
+ . '&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 ' ';
+ }
+ echo '</td>';
+ }
+
+ function print_column_attachment( $p_row ) {
+ $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";
+ }
+ }
+
+ function print_column_category( $p_row ) {
+ global $t_sort, $t_dir;
+
+ # grab the project name
+ $t_project_name = project_get_field( $p_row['project_id'],
'name' );
+
+ echo '<td class="center">';
+
+ # 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( $t_project_name,
'project_id', $t_sort, $t_dir );
+ echo ']</small><br />';
+ }
+
+ echo string_display( $p_row['category'] );
+ echo '</td>';
+ }
+
+ function print_column_severity( $p_row ) {
+ echo '<td class="center">';
+ print_formatted_severity_string( $p_row['status'],
$p_row['severity'] );
+ echo '</td>';
+ }
+
+ function print_column_status( $p_row ) {
+ echo '<td class="center">';
+ printf( '<u><a title="%s">%s</a></u>'
+ , get_enum_element( 'resolution', $p_row['resolution']
)
+ , get_enum_element( 'status', $p_row['status'] )
+ );
+
+ # print username instead of status
+ if ( ON == config_get( 'show_assigned_names' )
+ && $p_row['handler_id'] > 0 ) {
+ printf( ' (%s)', $p_row['handler_id'] );
+ }
+ echo '</td>';
+ }
+
+ function print_column_last_updated( $p_row ) {
+ global $t_filter;
+
+ $t_last_updated = date( config_get( 'short_date_format' ),
$p_row['last_updated'] );
+
+ echo '<td class="center">';
+ if ( $p_row['last_updated'] > strtotime(
'-'.$t_filter['highlight_changed'].' hours' ) ) {
+ printf( '<span class="bold">%s</span>', $t_last_updated
);
+ } else {
+ echo $t_last_updated;
+ }
+ echo '</td>';
+ }
+
+ function print_column_summary( $p_row ) {
+ global $t_icon_path;
+
+ $t_summary = string_attribute( $p_row['summary'] );
+
+ echo '<td class="left">', $t_summary;
+ if ( VS_PRIVATE == $p_row['view_state'] ) {
+ printf( ' <img src="%s" alt="(%s)" title="%s" />'
+ , $t_icon_path . 'protected.gif'
+ , lang_get( 'private' )
+ , lang_get( 'private' )
+ );
+ }
+ echo '</td>';
+ }
+
# -- ====================== BUG LIST ============================ --
$col_count = 10;
@@ -101,72 +385,12 @@
</tr>
<?php # -- Bug list column header row -- ?>
<tr class="row-category">
- <td> </td>
- <td> </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";
+ foreach( $t_columns as $t_column ) {
+ $t_title_function = 'print_column_title';
+ helper_call_custom_function( $t_title_function, array(
$t_column ) );
}
?>
- <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 # -- Spacer row -- ?>
@@ -176,199 +400,31 @@
<?php
function write_bug_rows ( $p_rows )
{
- global $t_icon_path;
- global $t_update_bug_threshold;
- global $t_enable_sponsorship;
- global $t_filter;
- global $t_show_attachments;
- global $t_sort;
- global $t_dir;
- global $t_checkboxes_exist;
-
+ global $t_columns;
mark_time( 'begin loop' );
# -- Loop over bug rows and create $v_* variables --
- for($i=0; $i < sizeof( $p_rows ); $i++) {
- # prefix bug data with v_
-
- extract( $p_rows[$i], EXTR_PREFIX_ALL, 'v' );
-
- $t_summary = string_attribute( $v_summary );
- $t_last_updated = date( config_get( 'short_date_format'
), $v_last_updated );
+ for ( $i = 0; $i < sizeof( $p_rows ); $i++ ) {
+ $t_row = $p_rows[$i];
# 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; ?>" border="1">
- <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 " ";
- }
- ?> </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" width="16" height="16"
src="' . $t_icon_path . 'update.png';
- echo '" alt="' . lang_get( 'update_bug_button'
) . '"';
- echo ' title="' . lang_get( 'update_bug_button'
) . '" /></a>';
- } else {
- echo ' ';
- }
- ?> </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 ) {
- $t_sponsorship_amount =
sponsorship_format_amount( $v_sponsorship_total );
- echo string_no_break(
$t_sponsorship_amount );
- }
- 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 )
- . '&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 ' ';
- }
- ?> </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 ' ';
- }
- 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 --
+ $status_color = get_status_color( $t_row['status'] );
- echo $t_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' )
- );
+ echo '<tr bgcolor="', $status_color, '" border="1">';
+
+ foreach( $t_columns as $t_column ) {
+ $t_column_value_function = 'print_column_value';
+ helper_call_custom_function(
$t_column_value_function, array( $t_column, $t_row ) );
}
- ?> </td>
- </tr>
-<?php
- # -- end of Repeating bug row --
+
+ echo '</tr>';
}
}
-?>
-<?php
- write_bug_rows($sticky_rows);
+ write_bug_rows( $sticky_rows );
+
# -- ====================== end of STICKY BUG LIST
========================= --
if ( 0 < sizeof($sticky_rows) ) {
?>
@@ -419,4 +475,4 @@
if ( STATUS_LEGEND_POSITION_BOTTOM == config_get(
'status_legend_position' ) ) {
html_status_legend();
}
-?>
+?>
\ No newline at end of file
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
|