View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004315 | mantisbt | filters | public | 2004-08-11 17:29 | 2005-04-18 10:46 |
Reporter | leeguy | Assigned To | thraxisp | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | git trunk | ||||
Fixed in Version | 1.0.0a1 | ||||
Summary | 0004315: Show filter without reloading whole page | ||||
Description | Individual filters could be loaded and displayed without reloading the whole page. | ||||
Additional Information | Current implementations uses XMLHttpRequest and DHTML. I've tested it (on WinXP) in IE 5, 5.5 & 6, Firefox 0.9 and Opera 7.5. Not sure about other platforms/browsers | ||||
Tags | No tags attached. | ||||
Attached Files | dhtml_filter.patch (41,101 bytes)
? return_dynamic_filters.php ? javascript/addLoadEvent.js ? javascript/dynamic_filters.js ? javascript/xmlhttprequest.js Index: view_all_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/view_all_inc.php,v retrieving revision 1.142 diff -u -r1.142 view_all_inc.php --- view_all_inc.php 1 Aug 2004 05:53:01 -0000 1.142 +++ view_all_inc.php 11 Aug 2004 22:12:13 -0000 @@ -49,6 +49,15 @@ if ( ON == $t_enable_sponsorship ) { $col_count++; } + + $t_dynamic_filters = config_get( 'dhtml_filters' ); + if ( ON == $t_dynamic_filters){ + ?> + <script type="text/javascript" src="javascript/xmlhttprequest.js"></script> + <script type="text/javascript" src="javascript/addLoadEvent.js"></script> + <script type="text/javascript" src="javascript/dynamic_filters.js"></script> + <?php + } ?> <br /> Index: view_filters_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/view_filters_page.php,v retrieving revision 1.19 diff -u -r1.19 view_filters_page.php --- view_filters_page.php 1 Aug 2004 03:29:25 -0000 1.19 +++ view_filters_page.php 11 Aug 2004 22:12:35 -0000 @@ -170,81 +170,27 @@ <tr class="row-1"> <!-- Reporter --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="reporter_id[]"> - <option value="any" <?php check_selected( $t_filter['reporter_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php - if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { - PRINT '<option value="' . META_FILTER_MYSELF . '" '; - check_selected( $t_filter['reporter_id'], META_FILTER_MYSELF ); - PRINT '>[' . lang_get( 'myself' ) . ']</option>'; - } - ?> - <?php print_reporter_option_list( $t_filter['reporter_id'] ) ?> - </select> + <?php print_filter_reporter_id(); ?> </td> <!-- Monitored by --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="user_monitor[]"> - <option value="any" <?php check_selected( $t_filter['user_monitor'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php - if ( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) { - PRINT '<option value="' . META_FILTER_MYSELF . '" '; - check_selected( $t_filter['user_monitor'], META_FILTER_MYSELF ); - PRINT '>[' . lang_get( 'myself' ) . ']</option>'; - } - ?> - <?php print_reporter_option_list( $t_filter['user_monitor'] ) ?> - </select> + <?php print_filter_user_monitor(); ?> </td> <!-- Handler --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="handler_id[]"> - <option value="any" <?php check_selected( $t_filter['handler_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="none" <?php check_selected( $t_filter['handler_id'], 'none' ); ?>><?php echo lang_get( 'none' ) ?></option> - <option value="any"></option> - <?php - if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { - PRINT '<option value="' . META_FILTER_MYSELF . '" '; - check_selected( $t_filter['handler_id'], META_FILTER_MYSELF ); - PRINT '>[' . lang_get( 'myself' ) . ']</option>'; - } - ?> - <?php print_assign_to_option_list( $t_filter['handler_id'] ) ?> - </select> - <?php - if ( 'simple' == $f_view_type ) { - ?> - <br /><input type="checkbox" name="and_not_assigned" <?php check_checked( $t_filter['and_not_assigned'], 'on' ); ?> /> <?php echo lang_get( 'or_unassigned' ) ?> - <?php - } - ?> + <?php print_filter_handler_id(); ?> </td> <!-- Category --> <td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_category[]"> - <option value="any" <?php check_selected( $t_filter['show_category'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php # This shows orphaned categories as well as selectable categories ?> - <?php print_category_complete_option_list( $t_filter['show_category'] ) ?> - </select> + <?php print_filter_show_category(); ?> </td> <!-- Severity --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_severity[]"> - <option value="any" <?php check_selected( $t_filter['show_severity'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_enum_string_option_list( 'severity', $t_filter['show_severity'] ) ?> - </select> + <?php print_filter_show_severity(); ?> </td> <!-- Resolution --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_resolution[]"> - <option value="any" <?php check_selected( $t_filter['show_resolution'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_enum_string_option_list( 'resolution', $t_filter['show_resolution'] ) ?> - </select> + <?php print_filter_show_resolution(); ?> </td> </tr> @@ -266,23 +212,13 @@ <tr class="row-1"> <!-- Status --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_status[]"> - <option value="any" <?php check_selected( $t_filter['show_status'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_enum_string_option_list( 'status', $t_filter['show_status'] ) ?> - </select> + <?php print_filter_show_status(); ?> </td> <!-- Hide Status --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> <?php if ( 'simple' == $f_view_type ) { - ?> - <select <?php PRINT $t_select_modifier;?> name="hide_status[]"> - <option value="none"><?php echo lang_get( 'none' ) ?></option> - <option value="none"></option> - <?php print_enum_string_option_list( 'status', $t_filter['hide_status'] ) ?> - </select> - <?php + print_filter_hide_status(); } else { echo ' '; } @@ -290,27 +226,15 @@ </td> <!-- Build --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_build[]"> - <option value="any" <?php check_selected( $t_filter['show_build'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_build_option_list( $t_filter['show_build'] ) ?> - </select> + <?php print_filter_show_build(); ?> </td> <!-- Version --> <td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="show_version[]"> - <option value="any" <?php check_selected( $t_filter['show_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_version_option_list( $t_filter['show_version'], null, VERSION_RELEASED ) ?> - </select> + <?php print_filter_show_version(); ?> </td> <!-- Fixed in Version --> <td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"> - <select <?php PRINT $t_select_modifier;?> name="fixed_in_version[]"> - <option value="any" <?php check_selected( $t_filter['fixed_in_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> - <option value="any"></option> - <?php print_version_option_list( $t_filter['fixed_in_version'], null, VERSION_ALL ) ?> - </select> + <?php print_filter_fixed_in_version(); ?> </td> </tr> @@ -329,88 +253,18 @@ <tr class="row-2"> <!-- Number of bugs per page --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <input type="text" name="per_page" size="3" maxlength="7" value="<?php echo $t_filter['per_page'] ?>" /> + <?php print_filter_per_page(); ?> </td> <!-- View Status --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <select name="view_state"> - <?php - PRINT '<option value="any" '; - check_selected( $t_filter['view_state'], 'any' ); - PRINT '>' . lang_get( 'any' ) . '</option>'; - PRINT '<option value="any"></option>'; - PRINT '<option value="' . VS_PUBLIC . '" '; - check_selected( $t_filter['view_state'], VS_PUBLIC ); - PRINT '>' . lang_get( 'public' ) . '</option>'; - PRINT '<option value="' . VS_PRIVATE . '" '; - check_selected( $t_filter['view_state'], VS_PRIVATE ); - PRINT '>' . lang_get( 'private' ) . '</option>'; - ?> - </select> + <?php print_filter_view_state(); ?> </td> <!-- Highlight changed bugs --> <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"> - <input type="text" name="highlight_changed" size="3" maxlength="7" value="<?php echo $t_filter['highlight_changed'] ?>" /> + <?php print_filter_highlight_changed(); ?> </td> <td valign="top" class="left" colspan="<?php echo ( 4 * $t_custom_cols ); ?>"> - <table cellspacing="0" cellpadding="0"> - <!-- Start date --> - <tr> - <td> - <?php echo lang_get( 'start_date' ) ?>: - </td> - <td> - <?php - $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); - foreach( $t_chars as $t_char ) { - if ( strcasecmp( $t_char, "M" ) == 0 ) { - print "<select name=\"start_month\">"; - print_month_option_list( $t_filter['start_month'] ); - print "</select>\n"; - } - if ( strcasecmp( $t_char, "D" ) == 0 ) { - print "<select name=\"start_day\">"; - print_day_option_list( $t_filter['start_day'] ); - print "</select>\n"; - } - if ( strcasecmp( $t_char, "Y" ) == 0 ) { - print "<select name=\"start_year\">"; - print_year_option_list( $t_filter['start_year'] ); - print "</select>\n"; - } - } - ?> - </td> - </tr> - <!-- End date --> - <tr> - <td> - <?php echo lang_get( 'end_date' ) ?>: - </td> - <td> - <?php - $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); - foreach( $t_chars as $t_char ) { - if ( strcasecmp( $t_char, "M" ) == 0 ) { - print "<select name=\"end_month\">"; - print_month_option_list( $t_filter['end_month'] ); - print "</select>\n"; - } - if ( strcasecmp( $t_char, "D" ) == 0 ) { - print "<select name=\"end_day\">"; - print_day_option_list( $t_filter['end_day'] ); - print "</select>\n"; - } - if ( strcasecmp( $t_char, "Y" ) == 0 ) { - print "<select name=\"end_year\">"; - print_year_option_list( $t_filter['end_year'] ); - print "</select>\n"; - } - } - ?> - </td> - </tr> - </table> + <?php print_filter_do_filter_by_date(); ?> </td> </tr> @@ -443,22 +297,8 @@ <?php for ( $j = 0; $j < $t_per_row; $j++ ) { echo '<td colspan="' . ( 1 * $t_filter_cols ) . '">'; - if ( isset( $t_accessible_custom_fields_names[$t_base + $j] ) ) { - echo '<select ' . $t_select_modifier . ' name="custom_field_' . $t_accessible_custom_fields_ids[$t_base + $j] .'[]">'; - echo '<option value="any" '; - check_selected( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ], 'any' ); - echo '>' . lang_get( 'any' ) .'</option>'; - echo '<option value=""></option>'; - foreach( $t_accessible_custom_fields_values[$t_base + $j] as $t_item ) { - if ( ( strtolower( $t_item ) != "any" ) && ( trim( $t_item ) != "" ) ) { - echo '<option value="' . htmlentities( $t_item ) . '" '; - if ( isset( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ] ) ) { - check_selected( $t_filter['custom_fields'][ $t_accessible_custom_fields_ids[$t_base + $j] ], $t_item ); - } - echo '>' . $t_item . '</option>' . "\n"; - } - } - echo '</select>'; + if ( isset( $t_accessible_custom_fields_ids[$t_base + $j] ) ) { + print_filter_custom_field($t_accessible_custom_fields_ids[$t_base + $j]); } else { echo ' '; } Index: core/current_user_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/current_user_api.php,v retrieving revision 1.21 diff -u -r1.21 current_user_api.php --- core/current_user_api.php 6 Aug 2004 15:38:50 -0000 1.21 +++ core/current_user_api.php 11 Aug 2004 20:47:19 -0000 @@ -96,7 +96,7 @@ $t_filter = ''; if ( !is_blank( $f_filter_string ) ) { - $t_filter = unserialize( $f_filter_string ); + $t_filter = @unserialize( $f_filter_string ); } else if ( !filter_is_cookie_valid() ) { return false; } else { Index: core/filter_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v retrieving revision 1.54 diff -u -r1.54 filter_api.php --- core/filter_api.php 8 Aug 2004 15:19:37 -0000 1.54 +++ core/filter_api.php 11 Aug 2004 21:10:03 -0000 @@ -405,8 +405,8 @@ $t_custom_fields = custom_field_get_ids(); foreach( $t_custom_fields as $t_cfid ) { - $t_first_time = true; - $t_custom_where_clause = ''; + $t_first_time = true; + $t_custom_where_clause = ''; # Ignore all custom filters that are not set, or that are set to '' or "any" $t_any_found = false; foreach( $t_filter['custom_fields'][$t_cfid] as $t_filter_member ) { @@ -646,8 +646,8 @@ } ?> <br /> - <form method="post" name="filters" action="<?php PRINT $t_action; ?>"> - <input type="hidden" name="type" value="5" /> + <form method="post" name="filters" id="filters_form" action="<?php PRINT $t_action; ?>"> + <input type="hidden" name="type" value="1" /> <?php if ( $p_for_screen == false ) { PRINT '<input type="hidden" name="print" value="1" />'; @@ -702,22 +702,22 @@ <tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'reporter_id[]'; ?>"><?php PRINT lang_get( 'reporter' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'reporter_id[]'; ?>" id="reporter_id_filter"><?php PRINT lang_get( 'reporter' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'user_monitor[]'; ?>"><?php PRINT lang_get( 'monitored_by' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'user_monitor[]'; ?>" id="user_monitor_filter"><?php PRINT lang_get( 'monitored_by' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'handler_id[]'; ?>"><?php PRINT lang_get( 'assigned_to' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'handler_id[]'; ?>" id="handler_id_filter"><?php PRINT lang_get( 'assigned_to' ) ?>:</a> </td> <td colspan="2" class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_category[]'; ?>"><?php PRINT lang_get( 'category' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_category[]'; ?>" id="show_category_filter"><?php PRINT lang_get( 'category' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_severity[]'; ?>"><?php PRINT lang_get( 'severity' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_severity[]'; ?>" id="show_severity_filter"><?php PRINT lang_get( 'severity' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_resolution[]'; ?>"><?php PRINT lang_get( 'resolution' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_resolution[]'; ?>" id="show_resolution_filter"><?php PRINT lang_get( 'resolution' ) ?>:</a> </td> <?php @@ -728,7 +728,7 @@ </tr> <tr class="row-1"> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="reporter_id_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -738,6 +738,9 @@ $t_first_flag = true; foreach( $t_filter['reporter_id'] as $t_current ) { $t_this_name = ''; + ?> + <input type="hidden" name="reporter_id[]" value="<?php echo $t_current;?>" /> + <?php if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; } else if ( META_FILTER_MYSELF == $t_current ) { @@ -764,7 +767,7 @@ } ?> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="user_monitor_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -773,6 +776,9 @@ } else { $t_first_flag = true; foreach( $t_filter['user_monitor'] as $t_current ) { + ?> + <input type="hidden" name="user_monitor[]" value="<?php echo $t_current;?>" /> + <?php $t_this_name = ''; if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -800,7 +806,7 @@ } ?> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="handler_id_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -809,6 +815,9 @@ } else { $t_first_flag = true; foreach( $t_filter['handler_id'] as $t_current ) { + ?> + <input type="hidden" name="handler_id[]" value="<?php echo $t_current;?>" /> + <?php $t_this_name = ''; if ( 'none' == $t_current ) { $t_this_name = lang_get( 'none' ); @@ -841,7 +850,7 @@ } ?> </td> - <td colspan="2" class="small-caption" valign="top"> + <td colspan="2" class="small-caption" valign="top" id="show_category_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -850,6 +859,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_category'] as $t_current ) { + ?> + <input type="hidden" name="show_category[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -871,7 +883,7 @@ } ?> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="show_severity_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -880,6 +892,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_severity'] as $t_current ) { + ?> + <input type="hidden" name="show_severity[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -901,7 +916,7 @@ } ?> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="show_resolution_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -910,6 +925,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_resolution'] as $t_current ) { + ?> + <input type="hidden" name="show_resolution[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -940,24 +958,24 @@ <tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_status[]'; ?>"><?php PRINT lang_get( 'status' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_status[]'; ?>" id="show_status_filter"><?php PRINT lang_get( 'status' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>"><?php PRINT lang_get( 'hide_status' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'hide_status[]'; ?>" id="hide_status_filter"><?php PRINT lang_get( 'hide_status' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_build[]'; ?>"><?php PRINT lang_get( 'product_build' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_build[]'; ?>" id="show_build_filter"><?php PRINT lang_get( 'product_build' ) ?>:</a> </td> <td colspan="2" class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'show_version[]'; ?>"><?php PRINT lang_get( 'product_version' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'show_version[]'; ?>" id="show_version_filter"><?php PRINT lang_get( 'product_version' ) ?>:</a> </td> <td colspan="2" class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'fixed_in_version[]'; ?>"><?php PRINT lang_get( 'fixed_in_version' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'fixed_in_version[]'; ?>" id="fixed_in_version_filter"><?php PRINT lang_get( 'fixed_in_version' ) ?>:</a> </td> </tr> <tr class="row-1"> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="show_status_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -966,6 +984,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_status'] as $t_current ) { + ?> + <input type="hidden" name="show_status[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -986,8 +1007,8 @@ } } ?> - </td> - <td class="small-caption" valign="top"> + </td> + <td class="small-caption" valign="top" id="hide_status_filter_target"> <?php $t_output = ''; $t_none_found = false; @@ -996,6 +1017,9 @@ } else { $t_first_flag = true; foreach( $t_filter['hide_status'] as $t_current ) { + ?> + <input type="hidden" name="hide_status[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'none' ) || ( is_blank( $t_current ) ) ) { $t_none_found = true; @@ -1021,7 +1045,7 @@ } ?> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="show_build_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -1030,6 +1054,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_build'] as $t_current ) { + ?> + <input type="hidden" name="show_build[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -1051,7 +1078,7 @@ } ?> </td> - <td colspan="2" class="small-caption" valign="top"> + <td colspan="2" class="small-caption" valign="top" id="show_version_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -1060,6 +1087,9 @@ } else { $t_first_flag = true; foreach( $t_filter['show_version'] as $t_current ) { + ?> + <input type="hidden" name="show_version[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -1081,7 +1111,7 @@ } ?> </td> - <td colspan="2" class="small-caption" valign="top"> + <td colspan="2" class="small-caption" valign="top" id="fixed_in_version_filter_target"> <?php $t_output = ''; $t_any_found = false; @@ -1090,6 +1120,9 @@ } else { $t_first_flag = true; foreach( $t_filter['fixed_in_version'] as $t_current ) { + ?> + <input type="hidden" name="fixed_in_version[]" value="<?php echo $t_current;?>" /> + <?php $t_this_string = ''; if ( ( $t_current == 'any' ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; @@ -1115,16 +1148,16 @@ <tr <?php PRINT "class=\"" . $t_trclass . "\""; ?>> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'per_page'; ?>"><?php PRINT lang_get( 'show' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'per_page'; ?>" id="per_page_filter"><?php PRINT lang_get( 'show' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'view_state'; ?>"><?php PRINT lang_get( 'view_status' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'view_state'; ?>" id="view_state_filter"><?php PRINT lang_get( 'view_status' ) ?>:</a> </td> <td class="small-caption" valign="top"> - <a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>"><?php PRINT lang_get( 'changed' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'highlight_changed'; ?>" id="highlight_changed_filter"><?php PRINT lang_get( 'changed' ) ?>:</a> </td> <td class="small-caption" valign="top" colspan="4"> - <a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a> + <a href="<?php PRINT $t_filters_url . 'do_filter_by_date'; ?>" id="do_filter_by_date_filter"><?php PRINT lang_get( 'use_date_filters' ) ?>:</a> </td> <?php if ( $t_custom_cols > $t_filter_cols ) { @@ -1133,10 +1166,11 @@ ?> </tr> <tr class="row-1"> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="per_page_filter_target"> <?php PRINT $t_filter['per_page']; ?> + <input type="hidden" name="per_page" value="<?php echo $t_filter['per_page'];?>" /> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="view_state_filter_target"> <?php if ( VS_PUBLIC == $t_filter['view_state'] ) { PRINT lang_get( 'public' ); @@ -1146,13 +1180,22 @@ PRINT lang_get( 'any' ); } ?> + <input type="hidden" name="view_state" value="<?php echo $t_filter['view_state'];?>" /> </td> - <td class="small-caption" valign="top"> + <td class="small-caption" valign="top" id="highlight_changed_filter_target"> <?php PRINT $t_filter['highlight_changed']; ?> </td> - <td class="small-caption" valign="top" colspan="4"> + <td class="small-caption" valign="top" colspan="4" id="do_filter_by_date_filter_target"> <?php if ( 'on' == $t_filter['do_filter_by_date'] ) { + ?> + <input type="hidden" name="start_month" value="<?php echo $t_filter['start_month'];?>" /> + <input type="hidden" name="start_day" value="<?php echo $t_filter['start_day'];?>" /> + <input type="hidden" name="start_year" value="<?php echo $t_filter['start_year'];?>" /> + <input type="hidden" name="end_month" value="<?php echo $t_filter['end_month'];?>" /> + <input type="hidden" name="end_day" value="<?php echo $t_filter['end_day'];?>" /> + <input type="hidden" name="end_year" value="<?php echo $t_filter['end_year'];?>" /> + <?php $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); $t_time = mktime( 0, 0, 0, $t_filter['start_month'], $t_filter['start_day'], $t_filter['start_year'] ); foreach( $t_chars as $t_char ) { @@ -1221,14 +1264,14 @@ if ( isset( $t_accessible_custom_fields_names[ $i ] ) ) { $t_fields .= '<td class="small-caption" valign="top"> '; - $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]">'; + $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_'. $t_accessible_custom_fields_ids[$i] .'_filter">'; $t_fields .= string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) ); $t_fields .= '</a> </td> '; } $t_output = ''; $t_any_found = false; - $t_values .= '<td class="small-caption" valign="top"> ' ; + $t_values .= '<td class="small-caption" valign="top" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> ' ; if ( !isset( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] ) ) { $t_values .= lang_get( 'any' ); } else { @@ -1248,6 +1291,7 @@ } $t_output = $t_output . $t_this_string; + $t_values .= '<input type="hidden" name="custom_field_'.$t_accessible_custom_fields_ids[$i].'[]" value="'.$t_current.'" />'; } if ( true == $t_any_found ) { @@ -1735,4 +1779,306 @@ return $p_filter_arr; } + + + /** + * The following functions each print out an individual filter field. + * They are derived from view_filters_page.php + * + * The functions follow a strict naming convention: + * + * print_filter_[filter_name] + * + * Where [filter_name] is the same as the "name" of the form element for + * that filter. This naming convention is depended upon by the controller + * at the end of the script. + */ + /** + * I expect that this code could be made simpler by refactoring into a + * class so as to avoid all those calls to global(which are pretty ugly) + * + * These functions could also be shared by view_filters_page.php + * + */ + function print_filter_reporter_id(){ + global $t_select_modifier, $t_filter; + ?> + <select <?php PRINT $t_select_modifier;?> name="reporter_id[]"> + <option value="any" <?php check_selected( $t_filter['reporter_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php + if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { + PRINT '<option value="' . META_FILTER_MYSELF . '" '; + check_selected( $t_filter['reporter_id'], META_FILTER_MYSELF ); + PRINT '>[' . lang_get( 'myself' ) . ']</option>'; + } + ?> + <?php print_reporter_option_list( $t_filter['reporter_id'] ) ?> + </select> + <?php + } + + + function print_filter_user_monitor(){ + global $t_select_modifier, $t_filter; + ?> + <!-- Monitored by --> + <select <?php PRINT $t_select_modifier;?> name="user_monitor[]"> + <option value="any" <?php check_selected( $t_filter['user_monitor'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php + if ( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) { + PRINT '<option value="' . META_FILTER_MYSELF . '" '; + check_selected( $t_filter['user_monitor'], META_FILTER_MYSELF ); + PRINT '>[' . lang_get( 'myself' ) . ']</option>'; + } + ?> + <?php print_reporter_option_list( $t_filter['user_monitor'] ) ?> + </select> + <?php + } + + function print_filter_handler_id(){ + global $t_select_modifier, $t_filter, $f_view_type; + ?> + <!-- Handler --> + <select <?php PRINT $t_select_modifier;?> name="handler_id[]"> + <option value="any" <?php check_selected( $t_filter['handler_id'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="none" <?php check_selected( $t_filter['handler_id'], 'none' ); ?>><?php echo lang_get( 'none' ) ?></option> + <option value="any"></option> + <?php + if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { + PRINT '<option value="' . META_FILTER_MYSELF . '" '; + check_selected( $t_filter['handler_id'], META_FILTER_MYSELF ); + PRINT '>[' . lang_get( 'myself' ) . ']</option>'; + } + ?> + <?php print_assign_to_option_list( $t_filter['handler_id'] ) ?> + </select> + <?php + if ( 'simple' == $f_view_type ) { + ?> + <br /><input type="checkbox" name="and_not_assigned" <?php check_checked( $t_filter['and_not_assigned'], 'on' ); ?> /> <?php echo lang_get( 'or_unassigned' ) ?> + <?php + } + } + + function print_filter_show_category(){ + global $t_select_modifier, $t_filter; + ?> + <!-- Category --> + <select <?php PRINT $t_select_modifier;?> name="show_category[]"> + <option value="any" <?php check_selected( $t_filter['show_category'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php # This shows orphaned categories as well as selectable categories ?> + <?php print_category_complete_option_list( $t_filter['show_category'] ) ?> + </select> + <?php + } + + function print_filter_show_severity(){ + global $t_select_modifier, $t_filter; + ?><!-- Severity --> + <select <?php PRINT $t_select_modifier;?> name="show_severity[]"> + <option value="any" <?php check_selected( $t_filter['show_severity'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_enum_string_option_list( 'severity', $t_filter['show_severity'] ) ?> + </select> + <?php + } + + function print_filter_show_resolution(){ + global $t_select_modifier, $t_filter; + ?><!-- Resolution --> + <select <?php PRINT $t_select_modifier;?> name="show_resolution[]"> + <option value="any" <?php check_selected( $t_filter['show_resolution'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_enum_string_option_list( 'resolution', $t_filter['show_resolution'] ) ?> + </select> + <?php + } + + function print_filter_show_status(){ + global $t_select_modifier, $t_filter; + ?> <!-- Status --> + <select <?php PRINT $t_select_modifier;?> name="show_status[]"> + <option value="any" <?php check_selected( $t_filter['show_status'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_enum_string_option_list( 'status', $t_filter['show_status'] ) ?> + </select> + <?php + } + + function print_filter_hide_status(){ + global $t_select_modifier, $t_filter; + ?><!-- Hide Status --> + <select <?php PRINT $t_select_modifier;?> name="hide_status[]"> + <option value="none"><?php echo lang_get( 'none' ) ?></option> + <option value="none"></option> + <?php print_enum_string_option_list( 'status', $t_filter['hide_status'] ) ?> + </select> + <?php + } + + function print_filter_show_build(){ + global $t_select_modifier, $t_filter; + ?><!-- Build --> + <select <?php PRINT $t_select_modifier;?> name="show_build[]"> + <option value="any" <?php check_selected( $t_filter['show_build'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_build_option_list( $t_filter['show_build'] ) ?> + </select> + <?php + } + + function print_filter_show_version(){ + global $t_select_modifier, $t_filter; + ?><!-- Version --> + <select <?php PRINT $t_select_modifier;?> name="show_version[]"> + <option value="any" <?php check_selected( $t_filter['show_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_version_option_list( $t_filter['show_version'], null, VERSION_RELEASED ) ?> + </select> + <?php + } + + function print_filter_fixed_in_version(){ + global $t_select_modifier, $t_filter; + ?><!-- Fixed in Version --> + <select <?php PRINT $t_select_modifier;?> name="fixed_in_version[]"> + <option value="any" <?php check_selected( $t_filter['fixed_in_version'], 'any' ); ?>><?php echo lang_get( 'any' ) ?></option> + <option value="any"></option> + <?php print_version_option_list( $t_filter['fixed_in_version'], null, VERSION_ALL ) ?> + </select> + <?php + } + + function print_filter_per_page(){ + global $t_filter; + ?><!-- Number of bugs per page --> + <input type="text" name="per_page" size="3" maxlength="7" value="<?php echo $t_filter['per_page'] ?>" /> + <?php + } + + function print_filter_view_state(){ + global $t_select_modifier, $t_filter; + ?><!-- View Status --> + <select name="view_state"> + <?php + PRINT '<option value="any" '; + check_selected( $t_filter['view_state'], 'any' ); + PRINT '>' . lang_get( 'any' ) . '</option>'; + PRINT '<option value="any"></option>'; + PRINT '<option value="' . VS_PUBLIC . '" '; + check_selected( $t_filter['view_state'], VS_PUBLIC ); + PRINT '>' . lang_get( 'public' ) . '</option>'; + PRINT '<option value="' . VS_PRIVATE . '" '; + check_selected( $t_filter['view_state'], VS_PRIVATE ); + PRINT '>' . lang_get( 'private' ) . '</option>'; + ?> + </select> + <?php + } + + function print_filter_highlight_changed(){ + global $t_filter; + ?><!-- Highlight changed bugs --> + <input type="text" name="highlight_changed" size="3" maxlength="7" value="<?php echo $t_filter['highlight_changed'] ?>" /> + <?php + } + + function print_filter_do_filter_by_date(){ + global $t_filter; + ?><table cellspacing="0" cellpadding="0"> + <!-- Start date --> + <tr> + <td> + <?php echo lang_get( 'start_date' ) ?>: + </td> + <td nowrap="nowrap"> + <?php + $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); + foreach( $t_chars as $t_char ) { + if ( strcasecmp( $t_char, "M" ) == 0 ) { + print "<select name=\"start_month\">"; + print_month_option_list( $t_filter['start_month'] ); + print "</select>\n"; + } + if ( strcasecmp( $t_char, "D" ) == 0 ) { + print "<select name=\"start_day\">"; + print_day_option_list( $t_filter['start_day'] ); + print "</select>\n"; + } + if ( strcasecmp( $t_char, "Y" ) == 0 ) { + print "<select name=\"start_year\">"; + print_year_option_list( $t_filter['start_year'] ); + print "</select>\n"; + } + } + ?> + </td> + </tr> + <!-- End date --> + <tr> + <td> + <?php echo lang_get( 'end_date' ) ?>: + </td> + <td> + <?php + $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); + foreach( $t_chars as $t_char ) { + if ( strcasecmp( $t_char, "M" ) == 0 ) { + print "<select name=\"end_month\">"; + print_month_option_list( $t_filter['end_month'] ); + print "</select>\n"; + } + if ( strcasecmp( $t_char, "D" ) == 0 ) { + print "<select name=\"end_day\">"; + print_day_option_list( $t_filter['end_day'] ); + print "</select>\n"; + } + if ( strcasecmp( $t_char, "Y" ) == 0 ) { + print "<select name=\"end_year\">"; + print_year_option_list( $t_filter['end_year'] ); + print "</select>\n"; + } + } + ?> + </td> + </tr> + </table> + <?php + } + + function print_filter_custom_field($p_field_id){ + global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier; + + $j = array_search($p_field_id, $t_accessible_custom_fields_ids); + if($j === null || $j === false){ + # Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE. + ?> + <span style="color:red;weight:bold;"> + unknown custom filter (custom <?php $p_field_id; ?>) + </span> + <?php + } elseif ( isset( $t_accessible_custom_fields_names[$j] ) ) { + echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id .'[]">'; + echo '<option value="any" '; + check_selected( $t_filter['custom_fields'][ $p_field_id ], 'any' ); + echo '>' . lang_get( 'any' ) .'</option>'; + echo '<option value=""></option>'; + foreach( $t_accessible_custom_fields_values[$j] as $t_item ) { + if ( ( strtolower( $t_item ) != "any" ) && ( trim( $t_item ) != "" ) ) { + echo '<option value="' . htmlentities( $t_item ) . '" '; + if ( isset( $t_filter['custom_fields'][ $p_field_id ] ) ) { + check_selected( $t_filter['custom_fields'][ $p_field_id ], $t_item ); + } + echo '>' . $t_item . '</option>' . "\n"; + } + } + echo '</select>'; + } + + } + ?> | ||||
Oh, that looks nice. I'm very tempted to include that in 0.19.0, let's see if that's doable. |
|
There's still an issue wrt a submit button. It's not clear that to see the changes you should click on the "Search" button. I see three potential solutions: I'm not sure between the first two. The third is a little too jumpy for me, but others may think it's appropriate. |
|
I've removed the "hide" behaviour(It was just eye-candy, really). Now, after displaying a filter, the label looses the link. Also, I moved the only language reference into PHP and added 'loading' to strings_english. updated patch and files are in dhtml_filter_2.zip |
|
This would be a very usefull feature for our project. A few questions: . Can it be turned on/off with a config flag? Keep up the Great work! |
|
One of the original problems addressed by the separate page was the long loading time for the view_all_bug_page when there are a lot of people in the reporter list. |
|
Could this be a configurable option? |
|
This looks great! I would love to see mantis get more partial page updates through DHTML and javascript. (though after applying the patch, it seems to function the same for me. I have "$g_dhtml_filters = ON" in the config and no errors occur. but everything seems to behave the same -- i had to manually apply so i'm guessing some line somewhere is missing). I may just pull back to the version that the patch was for apply, then merge that with what our current code looks like. edited on: 09-14-04 16:50 |
|
I would like this patch integrated into Mantis soon, however, before this is done, I wanted to ask a couple of questions: (I don't have any experience with DHTML, so excuse my ignorance)
|
|
I already have this patch installed on my instance, so I can answer your questions:
Also I noticed that when this dhtml filter is used, there is no simple way to see "advanced filtering" page. To do this, you have to right click on a fitering parameter, choose "open in new window" and then choose "[Advanced filters]". This is not a good way, of course, so I've added a new link "Advanced filters" just to the left of right group of filter buttons. See screenshot. |
|
In refrence to leeguy note on 08-11-04 18:12, solution 3 could be enhanced if there are no other filter items refined after a period of time it will auto submit. That way if the user is changing four or so items it doesn't burden the server with reloading the page when the user hasn't completed the filter selection. |
|
Patches added to CVS. |
|