Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

mantisbt/core html_api.php,1.142,1.143: msg#00096

bug-tracking.mantis.cvs

Subject: mantisbt/core html_api.php,1.142,1.143

Update of /cvsroot/mantisbt/mantisbt/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16878/core

Modified Files:
html_api.php
Log Message:
Fixed 5013: html_status_percentage_legend() generates notices

Index: html_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- html_api.php 17 Dec 2004 15:21:23 -0000 1.142
+++ html_api.php 18 Dec 2004 12:23:57 -0000 1.143
@@ -697,54 +697,62 @@
$t_mantis_bug_table = config_get( 'mantis_bug_table' );
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
-
+
#checking if it's a per project statistic or all projects
if ( ALL_PROJECTS == $t_project_id ) {
# Only projects to which the user have access
$t_accessible_projects_array =
user_get_accessible_projects( $t_user_id );
if ( count( $t_accessible_projects_array ) > 0 ) {
- $specific_where = ' (project_id='. implode( '
OR project_id=', $t_accessible_projects_array ).')';
+ $t_specific_where = 'WHERE (project_id='.
implode( ' OR project_id=', $t_accessible_projects_array ).')';
} else {
- $specific_where = '1=1';
+ $t_specific_where = '';
}
} else {
- $specific_where = " project_id='$t_project_id'";
+ $t_specific_where = "WHERE project_id='$t_project_id'";
}
-
+
+ # Can't we use a more efficient query that is based on DISTINCT
statuses + COUNT?
$query = "SELECT status
FROM $t_mantis_bug_table
- WHERE $specific_where
- ORDER BY status";
+ $t_specific_where";
$result = db_query( $query );
-
- $bug_count = db_num_rows( $result );
- $t_status_array = array();

- while ( $row = db_fetch_array( $result ) ) {
- $t_status_array[] = $row[status];
- }
+ $t_bug_count = db_num_rows( $result );
+ $t_status_count_array = array();

- $t_status_count_array = array_count_values( $t_status_array );
+ while ( $row = db_fetch_array( $result ) ) {
+ $t_current_status = $row['status'];

- PRINT '<br />';
- PRINT '<table class="width100" cellspacing="0">';
- PRINT '<tr>';
+ if ( isset( $t_status_count_array[$t_current_status] )
) {
+ $t_status_count_array[$t_current_status]++;
+ } else {
+ $t_status_count_array[$t_current_status] = 1;
+ }
+ }

+ echo '<table class="width100" cellspacing="0">';
+ echo '<tr>';

$t_arr = explode_enum_string( config_get(
'status_enum_string' ) );
$enum_count = count( $t_arr );
for ( $i=0; $i < $enum_count; $i++) {
$t_s = explode_enum_arr( $t_arr[$i] );
$t_color = get_status_color( $t_s[0] );
- $width = round( ( $t_status_count_array[ $t_s[0] ] /
$bug_count ) * 100 );
-
+ $t_status = $t_s[0];
+
+ if ( !isset( $t_status_count_array[ $t_status ] ) ) {
+ $t_status_count_array[ $t_status ] = 0;
+ }
+
+ $width = round( ( $t_status_count_array[ $t_status ] /
$t_bug_count ) * 100 );
+
if ($width > 0) {
PRINT "<td class=\"small-caption-center\"
width=\"$width%\" bgcolor=\"$t_color\">$width%</td>";
}
}

- PRINT '</tr>';
- PRINT '</table>';
+ echo '</tr>';
+ echo '</table>';
}

# --------------------



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
video.h264.deve...    technology.erps...    drivers.hostap/...    user-groups.lin...    games.railroad-...    handhelds.linux...    lang.harbour.de...    recreation.radi...    culture.publica...    xfree86.devel/2...    music.john-cage...    otrs.cvs/2003-0...    network.e-smith...    asplinux.suppor...    qnx.openqnx.dev...    ietf.nfsv4/2005...    editors.vim/200...    kde.devel.kopet...    web.zope.zwiki....    freebsd.devel.m...    java.xdoclet.de...    php.simpletest....    bacula.user/200...    security.virus....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation