View Issue Details

IDProjectCategoryView StatusLast Update
0007682mantisbtroadmappublic2007-12-21 23:16
Reporterseiji Assigned Tovboctor  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.1.0a2 
Target Version1.1.0Fixed in Version1.1.0a3 
Summary0007682: Add progress bar to Roadmap
Description

Roadmap is very useful function, but I would like to add progress bar like trac.
see attached patch and image.

Additional Information

It is necessary to improve stylesheet.

TagsNo tags attached.
Attached Files
progress_bar.png (42,515 bytes)   
progress_bar.png (42,515 bytes)   
progress_bar.diff (3,681 bytes)   
Index: css/default.css
===================================================================
--- css/default.css	(リビジョン 29)
+++ css/default.css	(リビジョン 34)
@@ -106,3 +106,6 @@
 .underline-small		{ text-decoration: underline; font-size: 8pt; }
 .strike					{ text-decoration: line-through; }
 .strike-small			{ text-decoration: line-through; font-size: 8pt; }
+
+.graph					{ position: relative; width: 400px; border: 1px solid #d7d7d7; margin-top: 1em; margin-bottom: 1em; padding: 1px; }
+.graph .bar				{ display: block; position: relative; background: #6bba70; text-align: center; font-weight: normal; color: #333; height: 2em; line-height: 2em; }
Index: core/custom_function_api.php
===================================================================
--- core/custom_function_api.php	(リビジョン 29)
+++ core/custom_function_api.php	(リビジョン 34)
@@ -52,25 +52,27 @@
 	}
 
 	# --------------------
-	# Prints one entry in the roadmap.
-	function custom_function_default_roadmap_print_issue( $p_issue_id ) {
-		$t_bug = bug_get( $p_issue_id );
-		
-		if ( bug_is_resolved( $p_issue_id ) ) {
-			$t_strike_start = '<strike>';
-			$t_strike_end = '</strike>';
-		} else {
-			$t_strike_start = $t_strike_end = '';
-		}
-		
-		$t_category = is_blank( $t_bug->category ) ? '' : '<b>[' . $t_bug->category . ']</b> ';
-		echo '- ', $t_strike_start, string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_attribute( $t_bug->summary );
+	# Prints one entries in the roadmap.
+	function custom_function_default_roadmap_print_issue( $p_issue_ids ) {
+		foreach ( $p_issue_ids as $t_issue_id ) {
+			$t_bug = bug_get( $t_issue_id );
+			if ( bug_is_resolved( $t_issue_id ) ) {
+				$t_strike_start = '<strike>';
+				$t_strike_end = '</strike>';
+			} else {
+				$t_strike_start = $t_strike_end = '';
+			}
 
-		if ( $t_bug->handler_id != 0 ) {
-			echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
+			$t_category = is_blank( $t_bug->category ) ? '' : '<b>[' . $t_bug->category . ']</b> ';
+			echo '- ', $t_strike_start, string_get_bug_view_link( $t_issue_id ), ': ', $t_category, string_attribute( $t_bug->summary );
+
+			if ( $t_bug->handler_id != 0 ) {
+				echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
+			}
+
+			echo ' - ', get_enum_element( 'status', $t_bug->status ), $t_strike_end, '.<br />';
+
 		}
-
-		echo ' - ', get_enum_element( 'status', $t_bug->status ), $t_strike_end, '.<br />';
 	}
 
 	# --------------------
Index: roadmap_page.php
===================================================================
--- roadmap_page.php	(リビジョン 29)
+++ roadmap_page.php	(リビジョン 34)
@@ -119,6 +119,7 @@
 			$t_first_entry = true;
 
 			$t_result = db_query( $query );
+			$t_issues_id = array();
 
 			while ( $t_row = db_fetch_array( $t_result ) ) {
 				# hide private bugs if user doesn't have access to view them.
@@ -164,11 +165,20 @@
 					$t_first_entry = false;
 				}
 
-				helper_call_custom_function( 'roadmap_print_issue', array( $t_issue_id ) );
+				$t_issues_id[] = $t_issue_id;
 			}
 
 			$i++;
 
+			$t_progress = ( $t_issues_planned == 0 ) ? 0 : (int)( $t_issues_resolved * 100 / $t_issues_planned );
+			// show progress bar
+			echo '<div class="graph">';
+			echo '  <span class="bar" style="width: ' . $t_progress . '%;">' . $t_progress . '%</span>';
+			echo '</div>';
+
+			// issue list
+			helper_call_custom_function( 'roadmap_print_issue', array( $t_issues_id ) );
+            
 			if ( $t_issues_planned > 0 ) {
 				echo '<br />';
 				echo sprintf( lang_get( 'resolved_progress' ), $t_issues_resolved, $t_issues_planned, $t_issues_resolved * 100 / $t_issues_planned );
progress_bar.diff (3,681 bytes)   

Activities

vboctor

vboctor

2006-12-23 01:24

manager   ~0013862

I've applied this patch but not as is. For example, I've kept the custom function as is (i.e. prints 1 issue).