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 filter_api.php,1.106,1.107 print_api.php,1.128,1.129 profile_: msg#00031

bug-tracking.mantis.cvs

Subject: mantisbt/core filter_api.php,1.106,1.107 print_api.php,1.128,1.129 profile_api.php,1.12,1.13 version_api.php,1.21,1.22

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

Modified Files:
filter_api.php print_api.php profile_api.php version_api.php
Log Message:
Added Profile filter and changed version filters to work subprojects

Index: version_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/version_api.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- version_api.php 8 Mar 2005 13:41:19 -0000 1.21
+++ version_api.php 13 May 2005 00:14:40 -0000 1.22
@@ -270,6 +270,34 @@
}
return $rows;
}
+
+ # --------------------
+ # Return all versions for the specified project, including subprojects
+ function version_get_all_rows_with_subs( $p_project_id, $p_released =
null ) {
+ $t_project_where = helper_project_specific_where( $p_project_id
);
+
+ if ( $p_released === null ) {
+ $t_released_where = '';
+ } else {
+ $c_released = db_prepare_int( $p_released );
+ $t_released_where = "AND ( released = $c_released )";
+ }
+
+ $t_project_version_table = config_get(
'mantis_project_version_table' );
+
+ $query = "SELECT *
+ FROM $t_project_version_table
+ WHERE $t_project_where $t_released_where
+ ORDER BY date_order DESC";
+ $result = db_query( $query );
+ $count = db_num_rows( $result );
+ $rows = array();
+ for ( $i = 0 ; $i < $count ; $i++ ) {
+ $row = db_fetch_array( $result );
+ $rows[] = $row;
+ }
+ return $rows;
+ }

# --------------------
# Get the version_id, given the project_id and $p_version_id

Index: filter_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- filter_api.php 26 Apr 2005 18:22:58 -0000 1.106
+++ filter_api.php 13 May 2005 00:14:39 -0000 1.107
@@ -436,6 +436,35 @@
array_push( $t_where_clauses, "(
$t_bug_table.version=$t_clauses[0] )" );
}
}
+
+ # profile
+ $t_any_found = false;
+ foreach( $t_filter['show_profile'] as $t_filter_member ) {
+ if ( ( META_FILTER_ANY == $t_filter_member ) ||
( 0 === $t_filter_member ) ) {
+ $t_any_found = true;
+ }
+ }
+ if ( count( $t_filter['show_profile'] ) == 0 ) {
+ $t_any_found = true;
+ }
+ if ( !$t_any_found ) {
+ $t_clauses = array();
+
+ foreach( $t_filter['show_profile'] as $t_filter_member
) {
+ $t_filter_member = stripslashes(
$t_filter_member );
+ if ( META_FILTER_NONE == $t_filter_member ) {
+ array_push( $t_clauses, "0" );
+ } else {
+ $c_show_profile = db_prepare_int(
$t_filter_member );
+ array_push( $t_clauses,
"$c_show_profile" );
+ }
+ }
+ if ( 1 < count( $t_clauses ) ) {
+ array_push( $t_where_clauses, "(
$t_bug_table.profile_id in (". implode( ', ', $t_clauses ) .") )" );
+ } else {
+ array_push( $t_where_clauses, "(
$t_bug_table.profile_id=$t_clauses[0] )" );
+ }
+ }

# date filter
if ( ( 'on' == $t_filter['do_filter_by_date'] ) &&
@@ -950,7 +979,7 @@

$t_show_version = ( ON == config_get(
'show_product_version' ) )
|| ( ( AUTO == config_get(
'show_product_version' ) )
- && ( count(
version_get_all_rows( $t_project_id ) ) > 0 ) );
+ && ( count(
version_get_all_rows_with_subs( $t_project_id ) ) > 0 ) );

?>

@@ -973,6 +1002,9 @@
<td class="small-caption" valign="top">
<a href="<?php PRINT $t_filters_url .
'show_resolution[]'; ?>" id="show_resolution_filter"><?php PRINT lang_get(
'resolution' ) ?>:</a>
</td>
+ <td class="small-caption" valign="top">
+ <a href="<?php PRINT $t_filters_url .
'show_profile[]'; ?>" id="show_profile_filter"><?php PRINT lang_get( 'profile'
) ?>:</a>
+ </td>
</tr>

<tr class="row-1">
@@ -1197,7 +1229,42 @@
}
?>
</td>
- </tr>
+ <td class="small-caption" valign="top"
id="show_profile_filter_target">
+ <?php
+ $t_output = '';
+ $t_any_found =
false;
+ if ( count(
$t_filter['show_profile'] ) == 0 ) {
+ PRINT
lang_get( 'any' );
+ } else {
+
$t_first_flag = true;
+
foreach( $t_filter['show_profile'] as $t_current ) {
+
?>
+
<input type="hidden" name="show_profile[]" value="<?php echo $t_current;?>" />
+
<?php
+
$t_this_string = '';
+
if ( ( $t_current == META_FILTER_ANY ) || ( is_blank( $t_current ) ) || (
$t_current === 0 ) ) {
+
$t_any_found = true;
+
} else {
+
$t_profile = profile_get_row_direct( $t_current );
+

+
$t_this_string = "${t_profile['platform']} ${t_profile['os']}
${t_profile['os_build']}";
+
}
+
if ( $t_first_flag != true ) {
+
$t_output = $t_output . '<br />';
+
} else {
+
$t_first_flag = false;
+
}
+
$t_output = $t_output . $t_this_string;
+ }
+ if (
true == $t_any_found ) {
+
PRINT lang_get( 'any' );
+ } else {
+
PRINT $t_output;
+ }
+ }
+ ?>
+ </td>
+ </tr>

<tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>>
<td class="small-caption" valign="top">
@@ -1229,6 +1296,9 @@
<td colspan="1" class="small-caption" valign="top">
<a href="<?php PRINT $t_filters_url .
'show_priority[]'; ?>" id="show_priority_filter"><?php PRINT lang_get(
'priority' ) ?>:</a>
</td>
+ <td colspan="1" class="small-caption" valign="top">
+ &nbsp;
+ </td>
</tr>

<tr class="row-1">
@@ -1453,7 +1523,11 @@
}
}
?>
- </td>
+ </td>
+ <td colspan="1" class="small-caption" valign="top">
+ &nbsp;
+ </td>
+
</tr>

<tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>>
@@ -1755,7 +1829,7 @@
}
?>
</td>
- <td class="small-caption" valign="top" colspan="2">
+ <td class="small-caption" valign="top" colspan="3">
</td>
</tr>
<?php
@@ -2199,6 +2273,7 @@

'hide_status' => 'int',

'fixed_in_version' => 'string',

'user_monitor' => 'int',
+
'show_profile' => 'int'
);
foreach( $t_multi_select_list as $t_multi_field_name =>
$t_multi_field_type ) {
if ( !isset( $p_filter_arr[$t_multi_field_name] ) ) {
@@ -2216,7 +2291,7 @@
$t_checked_array = array();
foreach ( $p_filter_arr[$t_multi_field_name] as
$t_filter_value ) {
$t_filter_value = stripslashes(
$t_filter_value );
- if ( ( 5 == $t_cookie_vers ) && (
$t_filter_value == 'any' ) ) {
+ if ( ( 5 <= $t_cookie_vers ) && (
$t_filter_value == 'any' ) ) {
$t_filter_value =
META_FILTER_ANY;
}
if ( 'string' == $t_multi_field_type ) {
@@ -2417,7 +2492,7 @@
<select <?php PRINT $t_select_modifier;?> name="show_version[]">
<option value="[any]" <?php check_selected(
$t_filter['show_version'], META_FILTER_ANY ); ?>>[<?php echo lang_get( 'any' )
?>]</option>
<option value="[none]" <?php check_selected(
$t_filter['show_version'], META_FILTER_NONE ); ?>>[<?php echo lang_get( 'none'
) ?>]</option>
- <?php print_version_option_list(
$t_filter['show_version'], null, VERSION_RELEASED, false ) ?>
+ <?php print_version_option_list(
$t_filter['show_version'], null, VERSION_RELEASED, false, true ) ?>
</select>
<?php
}
@@ -2428,7 +2503,7 @@
<select <?php PRINT $t_select_modifier;?>
name="fixed_in_version[]">
<option value="[any]" <?php check_selected(
$t_filter['fixed_in_version'], META_FILTER_ANY ); ?>>[<?php echo lang_get(
'any' ) ?>]</option>
<option value="[none]" <?php check_selected(
$t_filter['fixed_in_version'], META_FILTER_NONE ); ?>>[<?php echo lang_get(
'none' ) ?>]</option>
- <?php print_version_option_list(
$t_filter['fixed_in_version'], null, VERSION_ALL, false ) ?>
+ <?php print_version_option_list(
$t_filter['fixed_in_version'], null, VERSION_ALL, false, true ) ?>
</select>
<?php
}
@@ -2442,6 +2517,16 @@
</select>
<?php
}
+
+ function print_filter_show_profile() {
+ global $t_select_modifier, $t_filter;
+ ?><!-- Profile -->
+ <select <?php PRINT $t_select_modifier;?> name="show_profile[]">
+ <option value="[any]" <?php check_selected(
$t_filter['show_profile'], META_FILTER_ANY ); ?>>[<?php echo lang_get( 'any' )
?>]</option>
+ <?php print_profile_option_list_for_project(
helper_get_current_project(), $t_filter['show_profile'] ); ?>
+ </select>
+ <?php
+ }

function print_filter_per_page(){
global $t_filter;

Index: profile_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/profile_api.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- profile_api.php 21 Mar 2005 12:44:20 -0000 1.12
+++ profile_api.php 13 May 2005 00:14:40 -0000 1.13
@@ -153,7 +153,22 @@

return db_fetch_array( $result );
}
+
+ # --------------------
+ # Return a profile row from the database
+ function profile_get_row_direct( $p_profile_id ) {
+ $c_profile_id = db_prepare_int( $p_profile_id );
+
+ $t_user_profile_table = config_get( 'mantis_user_profile_table'
);
+
+ $query = "SELECT *
+ FROM $t_user_profile_table
+ WHERE id='$c_profile_id'";
+ $result = db_query( $query );

+ return db_fetch_array( $result );
+ }
+
# --------------------
# Return an array containing all rows for a given user
function profile_get_all_rows( $p_user_id ) {
@@ -187,6 +202,30 @@
profile_get_all_rows( $p_user_id ) );
}
}
+
+ # --------------------
+ # Return an array containing all profiles used in a given project
+ function profile_get_all_for_project( $p_project_id ) {
+ $t_project_where = helper_project_specific_where( $p_project_id
);
+
+ $t_bug_table = config_get( 'mantis_bug_table' );
+ $t_user_profile_table = config_get( 'mantis_user_profile_table'
);
+
+ $query = "SELECT up.*
+ FROM $t_user_profile_table up, $t_bug_table b
+ WHERE $t_project_where
+ AND up.id = b.profile_id";
+ $result = db_query( $query );
+
+ $t_rows = array();
+ $t_row_count = db_num_rows( $result );
+
+ for ( $i=0 ; $i < $t_row_count ; $i++ ) {
+ array_push( $t_rows, db_fetch_array( $result ) );
+ }
+
+ return $t_rows;
+ }

# --------------------
# Return an array containing all global profiles

Index: print_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- print_api.php 1 May 2005 16:20:25 -0000 1.128
+++ print_api.php 13 May 2005 00:14:39 -0000 1.129
@@ -401,7 +401,9 @@
# --------------------
# prints the profiles given the user id
function print_profile_option_list( $p_user_id, $p_select_id='' ) {
- $t_default_profile = profile_get_default( $p_user_id );
+ if ( '' === $p_select_id ) {
+ $p_select_id = profile_get_default( $p_user_id );
+ }
$t_profiles = profile_get_all_for_user( $p_user_id );

PRINT '<option value=""></option>';
@@ -412,7 +414,27 @@
$v_os_build = string_display( $v_os_build );

PRINT "<option value=\"$v_id\"";
- check_selected( $v_id, $t_default_profile );
+ check_selected( $p_select_id, $v_id );
+ PRINT ">$v_platform $v_os $v_os_build</option>";
+ }
+ }
+ # --------------------
+ # prints the profiles used in a certain project
+ function print_profile_option_list_for_project( $p_project_id,
$p_select_id='') {
+ if ( '' === $p_select_id ) {
+ $p_select_id = profile_get_default( $p_user_id );
+ }
+ $t_profiles = profile_get_all_for_project( $p_user_id );
+
+ PRINT '<option value=""></option>';
+ foreach ( $t_profiles as $t_profile ) {
+ extract( $t_profile, EXTR_PREFIX_ALL, 'v' );
+ $v_platform = string_display( $v_platform );
+ $v_os = string_display( $v_os );
+ $v_os_build = string_display( $v_os_build );
+
+ PRINT "<option value=\"$v_id\"";
+ check_selected( $p_select_id, $v_id );
PRINT ">$v_platform $v_os $v_os_build</option>";
}
}
@@ -535,14 +557,20 @@
# $p_version = currently selected version.
# $p_project_id = project id, otherwise current project will be used.
# $p_released = null to get all, 1: only released, 0: only future
versions
- function print_version_option_list( $p_version='', $p_project_id =
null, $p_released = null, $p_leading_blank = true ) {
+ # $p_leading_black = allow selection of no version
+ # $p_with_subs = include subprojects
+ function print_version_option_list( $p_version='', $p_project_id =
null, $p_released = null, $p_leading_blank = true, $p_with_subs=false ) {
if ( null === $p_project_id ) {
$c_project_id = helper_get_current_project();
} else {
$c_project_id = db_prepare_int( $p_project_id );
}

- $versions = version_get_all_rows( $c_project_id, $p_released );
+ if ( $p_with_subs ) {
+ $versions = version_get_all_rows_with_subs(
$c_project_id, $p_released );
+ } else {
+ $versions = version_get_all_rows( $c_project_id,
$p_released );
+ }

if ( $p_leading_blank ) {
echo '<option value=""></option>';



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click


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

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | 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