Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue #12631: Replace old dynamic filter JavaScript code with jQuery

MantisBT was using a very old and messy method for handling dynamic
filters with client side JavaScript. This involved a lot of inline
JavaScript throughout the HTML output which is blocking our progress
towards bug #11826 - completely removing all inline JavaScript from the
HTML output.

This patch removes the old dynamic filter JavaScript approach and
replaces it with a smaller, faster, more reliable and easier to maintain
jQuery equivalent.
  • Loading branch information...
commit 7790835c52374ffedff76ed745ea18deae9e6848 1 parent 0d602be
David Hicks davidhicks authored
4 admin/check/check_display_inc.php
@@ -37,8 +37,8 @@
37 37 check_print_section_header_row( 'Display' );
38 38
39 39 check_print_test_row(
40   - 'dhtml_filters = ON requires use_javascript = ON',
41   - !config_get_global( 'dhtml_filters' ) || config_get_global( 'use_javascript' )
  40 + 'use_dynamic_filters = ON requires use_javascript = ON',
  41 + !config_get_global( 'use_dynamic_filters' ) || ( config_get_global( 'use_dynamic_filters' ) && config_get_global( 'use_javascript' ) )
42 42 );
43 43
44 44 check_print_test_row(
11 config_defaults_inc.php
@@ -2925,12 +2925,13 @@
2925 2925 $g_view_filters = SIMPLE_DEFAULT;
2926 2926
2927 2927 /**
2928   - * This switch enables the use of xmlhttprequest protocol to speed up the
2929   - * filter display. Rather than launching a separate page, the filters are
2930   - * updated in-line in the view_all_bugs_page.
2931   - * @global int $g_dhtml_filters
  2928 + * This switch enables the use of AJAX to dynamically load and create filter
  2929 + * form controls upon request. This method will reduce the amount of data that
  2930 + * needs to be transferred upon each page load dealing with filters and thus
  2931 + * will result in speed improvements and bandwidth reduction.
  2932 + * @global int $g_use_dynamic_filters
2932 2933 */
2933   -$g_dhtml_filters = ON;
  2934 +$g_use_dynamic_filters = ON;
2934 2935
2935 2936 /**
2936 2937 * The threshold required for users to be able to create permalinks. To turn
276 core/filter_api.php
@@ -2182,30 +2182,32 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
2182 2182 META_FILTER_ANY,
2183 2183 );
2184 2184 }
  2185 +
  2186 + $t_dynamic_filter_expander_class = config_get( 'use_javascript' ) && config_get( 'use_dynamic_filters' ) ? ' class="dynamic-filter-expander"' : '';
2185 2187 ?>
2186 2188
2187 2189 <tr <?php echo "class=\"" . $t_trclass . "\"";?>>
2188 2190 <td class="small-caption" valign="top">
2189   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]';?>" id="reporter_id_filter"><?php echo lang_get( 'reporter_label' )?></a>
  2191 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]';?>" id="reporter_id_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'reporter_label' )?></a>
2190 2192 </td>
2191 2193 <td class="small-caption" valign="top">
2192   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]';?>" id="user_monitor_filter"><?php echo lang_get( 'monitored_by_label' )?></a>
  2194 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]';?>" id="user_monitor_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'monitored_by_label' )?></a>
2193 2195 </td>
2194 2196 <td class="small-caption" valign="top">
2195   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]';?>" id="handler_id_filter"><?php echo lang_get( 'assigned_to_label' )?></a>
  2197 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]';?>" id="handler_id_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'assigned_to_label' )?></a>
2196 2198 </td>
2197 2199 <td colspan="2" class="small-caption" valign="top">
2198   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_CATEGORY_ID . '[]';?>" id="show_category_filter"><?php echo lang_get( 'category_label' )?></a>
  2200 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_CATEGORY_ID . '[]';?>" id="show_category_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'category_label' )?></a>
2199 2201 </td>
2200 2202 <td class="small-caption" valign="top">
2201   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SEVERITY . '[]';?>" id="show_severity_filter"><?php echo lang_get( 'severity_label' )?></a>
  2203 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SEVERITY . '[]';?>" id="show_severity_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'severity_label' )?></a>
2202 2204 </td>
2203 2205 <td class="small-caption" valign="top">
2204   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RESOLUTION . '[]';?>" id="show_resolution_filter"><?php echo lang_get( 'resolution_label' )?></a>
  2206 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RESOLUTION . '[]';?>" id="show_resolution_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'resolution_label' )?></a>
2205 2207 </td>
2206 2208 <td class="small-caption" valign="top">
2207 2209 <?php if( ON == config_get( 'enable_profiles' ) ) { ?>
2208   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROFILE_ID . '[]';?>" id="show_profile_filter"><?php echo lang_get( 'profile_label' )?></a>
  2210 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROFILE_ID . '[]';?>" id="show_profile_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'profile_label' )?></a>
2209 2211 <?php } ?>
2210 2212 </td>
2211 2213 <?php if( $t_filter_cols > 8 ) {
@@ -2468,25 +2470,25 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
2468 2470
2469 2471 <tr <?php echo "class=\"" . $t_trclass . "\"";?>>
2470 2472 <td class="small-caption" valign="top">
2471   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS . '[]';?>" id="show_status_filter"><?php echo lang_get( 'status_label' )?></a>
  2473 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS . '[]';?>" id="show_status_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'status_label' )?></a>
2472 2474 </td>
2473 2475 <td class="small-caption" valign="top">
2474 2476 <?php if( 'simple' == $t_view_type ) {?>
2475   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status_label' )?></a>
  2477 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS . '[]';?>" id="hide_status_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'hide_status_label' )?></a>
2476 2478 <?php
2477 2479 }?>
2478 2480 </td>
2479 2481 <td class="small-caption" valign="top">
2480 2482 <?php if ( $t_show_build ) { ?>
2481   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_BUILD . '[]';?>" id="show_build_filter"><?php echo lang_get( 'product_build_label' )?></a>
  2483 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_BUILD . '[]';?>" id="show_build_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'product_build_label' )?></a>
2482 2484 <?php } ?>
2483 2485 </td>
2484 2486 <?php if( $t_show_product_version ) {?>
2485 2487 <td colspan="2" class="small-caption" valign="top">
2486   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VERSION . '[]';?>" id="show_version_filter"><?php echo lang_get( 'product_version_label' )?></a>
  2488 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VERSION . '[]';?>" id="show_version_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'product_version_label' )?></a>
2487 2489 </td>
2488 2490 <td colspan="1" class="small-caption" valign="top">
2489   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FIXED_IN_VERSION . '[]';?>" id="show_fixed_in_version_filter"><?php echo lang_get( 'fixed_in_version_label' )?></a>
  2491 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FIXED_IN_VERSION . '[]';?>" id="show_fixed_in_version_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'fixed_in_version_label' )?></a>
2490 2492 </td>
2491 2493 <?php
2492 2494 } else {?>
@@ -2499,11 +2501,11 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
2499 2501 <?php
2500 2502 }?>
2501 2503 <td colspan="1" class="small-caption" valign="top">
2502   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRIORITY . '[]';?>" id="show_priority_filter"><?php echo lang_get( 'priority_label' )?></a>
  2504 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRIORITY . '[]';?>" id="show_priority_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'priority_label' )?></a>
2503 2505 </td>
2504 2506 <?php if( $t_show_product_version ) {?>
2505 2507 <td colspan="1" class="small-caption" valign="top">
2506   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]';?>" id="show_target_version_filter"><?php echo lang_get( 'target_version_label' )?></a>
  2508 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]';?>" id="show_target_version_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'target_version_label' )?></a>
2507 2509 </td>
2508 2510 <?php
2509 2511 } else {?>
@@ -2785,22 +2787,22 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
2785 2787
2786 2788 <tr <?php echo "class=\"" . $t_trclass . "\"";?>>
2787 2789 <td class="small-caption" valign="top">
2788   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE;?>" id="per_page_filter"><?php echo lang_get( 'show_label' )?></a>
  2790 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE;?>" id="per_page_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'show_label' )?></a>
2789 2791 </td>
2790 2792 <td class="small-caption" valign="top">
2791   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE;?>" id="view_state_filter"><?php echo lang_get( 'view_status_label' )?></a>
  2793 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE;?>" id="view_state_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'view_status_label' )?></a>
2792 2794 </td>
2793 2795 <td class="small-caption" valign="top">
2794   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STICKY;?>" id="sticky_issues_filter"><?php echo lang_get( 'sticky_label' )?></a>
  2796 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STICKY;?>" id="sticky_issues_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'sticky_label' )?></a>
2795 2797 </td>
2796 2798 <td class="small-caption" valign="top" colspan="2">
2797   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED;?>" id="highlight_changed_filter"><?php echo lang_get( 'changed_label' )?></a>
  2799 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED;?>" id="highlight_changed_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'changed_label' )?></a>
2798 2800 </td>
2799 2801 <td class="small-caption" valign="top" >
2800   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FILTER_BY_DATE;?>" id="do_filter_by_date_filter"><?php echo lang_get( 'use_date_filters_label' )?></a>
  2802 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_FILTER_BY_DATE;?>" id="do_filter_by_date_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'use_date_filters_label' )?></a>
2801 2803 </td>
2802 2804 <td class="small-caption" valign="top" colspan="2">
2803   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE;?>" id="relationship_type_filter"><?php echo lang_get( 'bug_relationships_label' )?></a>
  2805 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE;?>" id="relationship_type_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'bug_relationships_label' )?></a>
2804 2806 </td>
2805 2807 <?php if( $t_filter_cols > 8 ) {
2806 2808 echo '<td class="small-caption" valign="top" colspan="' . ( $t_filter_cols - 8 ) . '">&nbsp;</td>';
@@ -2839,29 +2841,8 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
2839 2841 echo '<input type="hidden" name="', FILTER_PROPERTY_HIGHLIGHT_CHANGED, '" value="', $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED], '" />';
2840 2842 ?>
2841 2843 </td>
2842   - <td class="small-caption" valign="top" id="do_filter_by_date_filter_target">
2843   - <?php
2844   - if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) {
2845   - ?>
2846   - <script type="text/javascript">
2847   - <!--
2848   - function SwitchDateFields() {
2849   - // All fields need to be enabled to go back to the script
2850   - document.filters_open.start_month.disabled = ! document.filters_open.filter_by_date.checked;
2851   - document.filters_open.start_day.disabled = ! document.filters_open.filter_by_date.checked;
2852   - document.filters_open.start_year.disabled = ! document.filters_open.filter_by_date.checked;
2853   - document.filters_open.end_month.disabled = ! document.filters_open.filter_by_date.checked;
2854   - document.filters_open.end_day.disabled = ! document.filters_open.filter_by_date.checked;
2855   - document.filters_open.end_year.disabled = ! document.filters_open.filter_by_date.checked;
2856   -
2857   - return true;
2858   - }
2859   - // -->
2860   - </script>
2861   - <?php
2862   - }
2863   -
2864   - # end if dhtml_filters
  2844 + <td class="small-caption" valign="top" id="do_filter_by_date_filter_target">
  2845 + <?php
2865 2846 if( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) {
2866 2847 echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DATE, '" value="', $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], '" />';
2867 2848 echo '<input type="hidden" name="', FILTER_PROPERTY_START_MONTH, '" value="', $t_filter[FILTER_PROPERTY_START_MONTH], '" />';
@@ -2932,22 +2913,22 @@ function SwitchDateFields() {
2932 2913 <tr <?php echo "class=\"" . $t_trclass . "\"";?>>
2933 2914 <td class="small-caption" valign="top">
2934 2915 <?php if( ON == config_get( 'enable_profiles' ) ) { ?>
2935   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PLATFORM;?>" id="platform_filter"><?php echo lang_get( 'platform_label' )?></a>
  2916 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PLATFORM;?>" id="platform_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'platform_label' )?></a>
2936 2917 <?php } ?>
2937 2918 </td>
2938 2919 <td class="small-caption" valign="top">
2939 2920 <?php if( ON == config_get( 'enable_profiles' ) ) { ?>
2940   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS;?>" id="os_filter"><?php echo lang_get( 'os_label' )?></a>
  2921 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS;?>" id="os_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'os_label' )?></a>
2941 2922 <?php } ?>
2942 2923 </td>
2943 2924 <td class="small-caption" valign="top">
2944 2925 <?php if( ON == config_get( 'enable_profiles' ) ) { ?>
2945   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS_BUILD;?>" id="os_build_filter"><?php echo lang_get( 'os_version_label' )?></a>
  2926 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS_BUILD;?>" id="os_build_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'os_version_label' )?></a>
2946 2927 <?php } ?>
2947 2928 </td>
2948 2929 <td class="small-caption" valign="top" colspan="5">
2949 2930 <?php if ( access_has_global_level( config_get( 'tag_view_threshold' ) ) ) { ?>
2950   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TAG_STRING;?>" id="tag_string_filter"><?php echo lang_get( 'tags_label' )?></a>
  2931 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TAG_STRING;?>" id="tag_string_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'tags_label' )?></a>
2951 2932 <?php } ?>
2952 2933 </td>
2953 2934 <?php if( $t_filter_cols > 8 ) {
@@ -3120,7 +3101,7 @@ function SwitchDateFields() {
3120 3101
3121 3102 if( isset( $t_accessible_custom_fields_names[$i] ) ) {
3122 3103 $t_fields .= '<td class="small-caption" valign="top"> ';
3123   - $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">';
  3104 + $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_dynamic_filter_expander_class . '>';
3124 3105 $t_fields .= string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) );
3125 3106 $t_fields .= '</a> </td> ';
3126 3107 }
@@ -3132,51 +3113,6 @@ function SwitchDateFields() {
3132 3113 $t_values .= lang_get( 'any' );
3133 3114 } else {
3134 3115 if( $t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE ) {
3135   -
3136   - /** @todo moved embedded javascript here from print_filter_custom_field_date
3137   - * it appears not to load properly on Firefox and other browsers if loaded through the httpxmlreq
3138   - */
3139   - $t_field_id = $t_accessible_custom_fields_ids[$i];
3140   - $t_js_toggle_func = "toggle_custom_date_field_" . $t_field_id . "_controls";
3141   - if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) {
3142   - ?>
3143   - <script type="text/javascript">
3144   - <!--
3145   - function <?php echo $t_js_toggle_func . "_start";?>(disable) {
3146   - document.filters_open.custom_field_<?php echo $t_field_id;?>_start_year.disabled = disable ;
3147   - document.filters_open.custom_field_<?php echo $t_field_id;?>_start_month.disabled = disable ;
3148   - document.filters_open.custom_field_<?php echo $t_field_id;?>_start_day.disabled = disable ;
3149   - } ;
3150   -
3151   - function <?php echo $t_js_toggle_func . "_end";?>(disable) {
3152   - document.filters_open.custom_field_<?php echo $t_field_id;?>_end_year.disabled = disable ;
3153   - document.filters_open.custom_field_<?php echo $t_field_id;?>_end_month.disabled = disable ;
3154   - document.filters_open.custom_field_<?php echo $t_field_id;?>_end_day.disabled = disable ;
3155   - } ;
3156   -
3157   - function <?php echo $t_js_toggle_func;?>() {
3158   - switch (document.filters_open.custom_field_<?php echo $t_field_id;?>_control.selectedIndex) {
3159   - case <?php echo CUSTOM_FIELD_DATE_ANY;?>:
3160   - case <?php echo CUSTOM_FIELD_DATE_NONE;?>:
3161   - <?php echo $t_js_toggle_func . "_start";?>(true) ;
3162   - <?php echo $t_js_toggle_func . "_end";?>(true) ;
3163   - break ;
3164   - case <?php echo CUSTOM_FIELD_DATE_BETWEEN;?>:
3165   - <?php echo $t_js_toggle_func . "_start";?>(false) ;
3166   - <?php echo $t_js_toggle_func . "_end";?>(false) ;
3167   - break ;
3168   - default:
3169   - <?php echo $t_js_toggle_func . "_start";?>(false) ;
3170   - <?php echo $t_js_toggle_func . "_end";?>(true) ;
3171   - break ;
3172   - }
3173   - }
3174   - // -->
3175   - </script>
3176   -<?php
3177   - }
3178   -
3179   - # end if dhtml_filters
3180 3116 $t_short_date_format = config_get( 'short_date_format' );
3181 3117 if( !isset( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] ) ) {
3182 3118 $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0;
@@ -3292,7 +3228,7 @@ function <?php echo $t_js_toggle_func;?>() {
3292 3228 ?>
3293 3229 <tr class="row-1">
3294 3230 <td class="small-caption category2" valign="top">
3295   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_NOTE_USER_ID;?>" id="note_user_id_filter"><?php echo lang_get( 'note_user_id_label' )?></a>
  3231 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_NOTE_USER_ID;?>" id="note_user_id_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'note_user_id_label' )?></a>
3296 3232 </td>
3297 3233 <td class="small-caption" valign="top" id="note_user_id_filter_target">
3298 3234 <?php
@@ -3334,7 +3270,7 @@ function <?php echo $t_js_toggle_func;?>() {
3334 3270 ?>
3335 3271 </td>
3336 3272 <td class="small-caption" valign="top">
3337   - <a href="<?php echo $t_filters_url . 'show_sort';?>" id="show_sort_filter"><?php echo lang_get( 'sort_label' )?></a>
  3273 + <a href="<?php echo $t_filters_url . 'show_sort';?>" id="show_sort_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'sort_label' )?></a>
3338 3274 </td>
3339 3275 <td class="small-caption" valign="top" id="show_sort_filter_target">
3340 3276 <?php
@@ -3364,9 +3300,9 @@ function <?php echo $t_js_toggle_func;?>() {
3364 3300 if( 'advanced' == $t_view_type ) {
3365 3301 ?>
3366 3302 <td class="small-caption" valign="top" colspan="2">
3367   - <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID;?>" id="project_id_filter"><?php echo lang_get( 'email_project_label' )?></a>
  3303 + <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID;?>" id="project_id_filter"<?php echo $t_dynamic_filter_expander_class ?>><?php echo lang_get( 'email_project_label' )?></a>
3368 3304 </td>
3369   - <td class="small-caption" valign="top" id="project_id_filter_target">
  3305 + <td class="small-caption" valign="top" id="project_id_filter_target">
3370 3306 <?php
3371 3307 $t_output = '';
3372 3308 if( !is_array( $t_filter[FILTER_PROPERTY_PROJECT_ID] ) ) {
@@ -3471,7 +3407,7 @@ function <?php echo $t_js_toggle_func;?>() {
3471 3407 }
3472 3408 ?>
3473 3409 <div class="filter-links"><?php
3474   - $f_switch_view_link = ( ON == config_get( 'dhtml_filters' ) ? 'view_all_set.php?type=6&amp;view_type=' : 'view_filters_page.php?view_type=' );
  3410 + $f_switch_view_link = config_get( 'use_javascript' ) && config_get( 'use_dynamic_filters' ) ? 'view_all_set.php?type=6&amp;view_type=' : 'view_filters_page.php?view_type=';
3475 3411 $t_view_filters = config_get( 'view_filters' );
3476 3412 if(( SIMPLE_ONLY != $t_view_filters ) && ( ADVANCED_ONLY != $t_view_filters ) ) {
3477 3413 if( 'advanced' == $t_view_type ) {
@@ -3514,7 +3450,7 @@ function <?php echo $t_js_toggle_func;?>() {
3514 3450 function print_filter_reporter_id() {
3515 3451 global $t_select_modifier, $t_filter;
3516 3452 ?>
3517   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_REPORTER_ID;?>[]">
  3453 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_REPORTER_ID;?>[]">
3518 3454 <?php
3519 3455 # if current user is a reporter, and limited reports set to ON, only display that name
3520 3456 # @@@ thraxisp - access_has_project_level checks greater than or equal to,
@@ -3531,7 +3467,7 @@ function print_filter_reporter_id() {
3531 3467 echo '<option value="' . $t_id . '" selected="selected">' . $t_display_name . '</option>';
3532 3468 } else {
3533 3469 ?>
3534   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_REPORTER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3470 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_REPORTER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3535 3471 <?php
3536 3472 if( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) {
3537 3473 echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3551,8 +3487,8 @@ function print_filter_user_monitor() {
3551 3487 global $t_select_modifier, $t_filter;
3552 3488 ?>
3553 3489 <!-- Monitored by -->
3554   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_MONITOR_USER_ID;?>[]">
3555   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3490 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_MONITOR_USER_ID;?>[]">
  3491 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3556 3492 <?php
3557 3493 if( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) {
3558 3494 echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3577,10 +3513,10 @@ function print_filter_handler_id() {
3577 3513 global $t_select_modifier, $t_filter, $f_view_type;
3578 3514 ?>
3579 3515 <!-- Handler -->
3580   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HANDLER_ID;?>[]">
3581   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3516 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HANDLER_ID;?>[]">
  3517 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3582 3518 <?php if( access_has_project_level( config_get( 'view_handler_threshold' ) ) ) {?>
3583   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3519 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_HANDLER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3584 3520 <?php
3585 3521 if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) {
3586 3522 echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3601,8 +3537,8 @@ function print_filter_show_category() {
3601 3537 global $t_select_modifier, $t_filter;
3602 3538 ?>
3603 3539 <!-- Category -->
3604   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_CATEGORY_ID;?>[]">
3605   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_CATEGORY_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3540 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_CATEGORY_ID;?>[]">
  3541 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_CATEGORY_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3606 3542 <?php print_category_filter_option_list( $t_filter[FILTER_PROPERTY_CATEGORY_ID] )?>
3607 3543 </select>
3608 3544 <?php
@@ -3616,8 +3552,8 @@ function print_filter_platform() {
3616 3552
3617 3553 ?>
3618 3554 <!-- Platform -->
3619   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PLATFORM;?>[]">
3620   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PLATFORM], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3555 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PLATFORM;?>[]">
  3556 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PLATFORM], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3621 3557 <?php
3622 3558 log_event( LOG_FILTERING, 'Platform = ' . var_export( $t_filter[FILTER_PROPERTY_PLATFORM], true ) );
3623 3559 print_platform_option_list( $t_filter[FILTER_PROPERTY_PLATFORM] );
@@ -3634,8 +3570,8 @@ function print_filter_os() {
3634 3570
3635 3571 ?>
3636 3572 <!-- OS -->
3637   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS;?>[]">
3638   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_OS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3573 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS;?>[]">
  3574 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_OS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3639 3575 <?php print_os_option_list( $t_filter[FILTER_PROPERTY_OS] )?>
3640 3576 </select>
3641 3577 <?php
@@ -3649,8 +3585,8 @@ function print_filter_os_build() {
3649 3585
3650 3586 ?>
3651 3587 <!-- OS Build -->
3652   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS_BUILD;?>[]">
3653   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_OS_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3588 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS_BUILD;?>[]">
  3589 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_OS_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3654 3590 <?php print_os_build_option_list( $t_filter[FILTER_PROPERTY_OS_BUILD] )?>
3655 3591 </select>
3656 3592 <?php
@@ -3662,8 +3598,8 @@ function print_filter_os_build() {
3662 3598 function print_filter_show_severity() {
3663 3599 global $t_select_modifier, $t_filter;
3664 3600 ?><!-- Severity -->
3665   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_SEVERITY;?>[]">
3666   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_SEVERITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3601 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_SEVERITY;?>[]">
  3602 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_SEVERITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3667 3603 <?php print_enum_string_option_list( 'severity', $t_filter[FILTER_PROPERTY_SEVERITY] )?>
3668 3604 </select>
3669 3605 <?php
@@ -3675,8 +3611,8 @@ function print_filter_show_severity() {
3675 3611 function print_filter_show_resolution() {
3676 3612 global $t_select_modifier, $t_filter;
3677 3613 ?><!-- Resolution -->
3678   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_RESOLUTION;?>[]">
3679   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_RESOLUTION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3614 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_RESOLUTION;?>[]">
  3615 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_RESOLUTION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3680 3616 <?php print_enum_string_option_list( 'resolution', $t_filter[FILTER_PROPERTY_RESOLUTION] )?>
3681 3617 </select>
3682 3618 <?php
@@ -3688,8 +3624,8 @@ function print_filter_show_resolution() {
3688 3624 function print_filter_show_status() {
3689 3625 global $t_select_modifier, $t_filter;
3690 3626 ?> <!-- Status -->
3691   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_STATUS;?>[]">
3692   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_STATUS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3627 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_STATUS;?>[]">
  3628 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_STATUS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3693 3629 <?php print_enum_string_option_list( 'status', $t_filter[FILTER_PROPERTY_STATUS] )?>
3694 3630 </select>
3695 3631 <?php
@@ -3701,7 +3637,7 @@ function print_filter_show_status() {
3701 3637 function print_filter_hide_status() {
3702 3638 global $t_select_modifier, $t_filter;
3703 3639 ?><!-- Hide Status -->
3704   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HIDE_STATUS;?>[]">
  3640 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HIDE_STATUS;?>[]">
3705 3641 <option value="<?php echo META_FILTER_NONE?>">[<?php echo lang_get( 'none' )?>]</option>
3706 3642 <?php print_enum_string_option_list( 'status', $t_filter[FILTER_PROPERTY_HIDE_STATUS] )?>
3707 3643 </select>
@@ -3714,9 +3650,9 @@ function print_filter_hide_status() {
3714 3650 function print_filter_show_build() {
3715 3651 global $t_select_modifier, $t_filter;
3716 3652 ?><!-- Build -->
3717   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_BUILD;?>[]">
3718   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3719   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3653 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_BUILD;?>[]">
  3654 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3655 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3720 3656 <?php print_build_option_list( $t_filter[FILTER_PROPERTY_BUILD] )?>
3721 3657 </select>
3722 3658 <?php
@@ -3728,9 +3664,9 @@ function print_filter_show_build() {
3728 3664 function print_filter_show_version() {
3729 3665 global $t_select_modifier, $t_filter;
3730 3666 ?><!-- Version -->
3731   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_VERSION;?>[]">
3732   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3733   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3667 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_VERSION;?>[]">
  3668 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3669 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3734 3670 <?php print_version_option_list( $t_filter[FILTER_PROPERTY_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
3735 3671 </select>
3736 3672 <?php
@@ -3742,9 +3678,9 @@ function print_filter_show_version() {
3742 3678 function print_filter_show_fixed_in_version() {
3743 3679 global $t_select_modifier, $t_filter;
3744 3680 ?><!-- Fixed in Version -->
3745   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_FIXED_IN_VERSION;?>[]">
3746   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3747   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3681 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_FIXED_IN_VERSION;?>[]">
  3682 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3683 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3748 3684 <?php print_version_option_list( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
3749 3685 </select>
3750 3686 <?php
@@ -3756,9 +3692,9 @@ function print_filter_show_fixed_in_version() {
3756 3692 function print_filter_show_target_version() {
3757 3693 global $t_select_modifier, $t_filter;
3758 3694 ?><!-- Fixed in Version -->
3759   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_TARGET_VERSION;?>[]">
3760   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_TARGET_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3761   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_TARGET_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3695 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_TARGET_VERSION;?>[]">
  3696 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_TARGET_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3697 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_TARGET_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3762 3698 <?php print_version_option_list( $t_filter[FILTER_PROPERTY_TARGET_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
3763 3699 </select>
3764 3700 <?php
@@ -3770,8 +3706,8 @@ function print_filter_show_target_version() {
3770 3706 function print_filter_show_priority() {
3771 3707 global $t_select_modifier, $t_filter;
3772 3708 ?><!-- Priority -->
3773   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PRIORITY;?>[]">
3774   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PRIORITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3709 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PRIORITY;?>[]">
  3710 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PRIORITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3775 3711 <?php print_enum_string_option_list( 'priority', $t_filter[FILTER_PROPERTY_PRIORITY] )?>
3776 3712 </select>
3777 3713 <?php
@@ -3783,8 +3719,8 @@ function print_filter_show_priority() {
3783 3719 function print_filter_show_profile() {
3784 3720 global $t_select_modifier, $t_filter;
3785 3721 ?><!-- Profile -->
3786   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROFILE_ID;?>[]">
3787   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PROFILE_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3722 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROFILE_ID;?>[]">
  3723 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PROFILE_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3788 3724 <?php print_profile_option_list_for_project( helper_get_current_project(), $t_filter[FILTER_PROPERTY_PROFILE_ID] );?>
3789 3725 </select>
3790 3726 <?php
@@ -3808,13 +3744,13 @@ function print_filter_view_state() {
3808 3744 ?><!-- View Status -->
3809 3745 <select name="<?php echo FILTER_PROPERTY_VIEW_STATE;?>">
3810 3746 <?php
3811   - echo '<option value="' . META_FILTER_ANY . '" ';
  3747 + echo '<option value="' . META_FILTER_ANY . '"';
3812 3748 check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], META_FILTER_ANY );
3813 3749 echo '>[' . lang_get( 'any' ) . ']</option>';
3814   - echo '<option value="' . VS_PUBLIC . '" ';
  3750 + echo '<option value="' . VS_PUBLIC . '"';
3815 3751 check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], VS_PUBLIC );
3816 3752 echo '>' . lang_get( 'public' ) . '</option>';
3817   - echo '<option value="' . VS_PRIVATE . '" ';
  3753 + echo '<option value="' . VS_PRIVATE . '"';
3818 3754 check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], VS_PRIVATE );
3819 3755 echo '>' . lang_get( 'private' ) . '</option>';
3820 3756 ?>
@@ -3828,7 +3764,7 @@ function print_filter_view_state() {
3828 3764 function print_filter_sticky_issues() {
3829 3765 global $t_filter;
3830 3766 ?><!-- Show or hide sticky bugs -->
3831   - <input type="checkbox" name="<?php echo FILTER_PROPERTY_STICKY;?>" <?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_STICKY] ), true );?> />
  3767 + <input type="checkbox" name="<?php echo FILTER_PROPERTY_STICKY;?>"<?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_STICKY] ), true );?> />
3832 3768 <?php
3833 3769 }
3834 3770
@@ -3843,28 +3779,24 @@ function print_filter_highlight_changed() {
3843 3779 }
3844 3780
3845 3781 /**
3846   - * print filter by date fields with javascript
3847   - * @todo Javascript should be removed and added dynamically
3848   - * via external script
  3782 + * print filter by date fields
3849 3783 */
3850 3784 function print_filter_do_filter_by_date( $p_hide_checkbox = false ) {
3851 3785 global $t_filter;
3852   - ?>
  3786 +?>
3853 3787 <table cellspacing="0" cellpadding="0">
3854   - <?php if( !$p_hide_checkbox ) {
3855   - ?>
3856   - <tr><td colspan="2">
3857   - <input type="checkbox" name="<?php echo FILTER_PROPERTY_FILTER_BY_DATE;?>" <?php
3858   - check_checked( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on' );
3859   - if( ON == config_get( 'use_javascript' ) ) {
3860   - print "onclick=\"SwitchDateFields();\"";
3861   - }?> />
3862   - <?php echo lang_get( 'use_date_filters' )?>
3863   - </td></tr>
3864   - <?php
  3788 +<?php
  3789 + if( !$p_hide_checkbox ) {
  3790 +?>
  3791 + <tr>
  3792 + <td colspan="2">
  3793 + <label><input type="checkbox" id="use_date_filters" name="<?php echo FILTER_PROPERTY_FILTER_BY_DATE ?>"<?php check_checked( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on' ) ?> /><?php echo lang_get( 'use_date_filters' )?></label>
  3794 + </td>
  3795 + </tr>
  3796 +<?php
3865 3797 }
3866   - $t_menu_disabled = ( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ? '' : ' disabled ';
3867   - ?>
  3798 + $t_menu_disabled = ( !config_get( 'use_javascript' ) || 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ? '' : ' disabled="disabled" ';
  3799 +?>
3868 3800
3869 3801 <!-- Start date -->
3870 3802 <tr>
@@ -3969,13 +3901,13 @@ function print_filter_note_user_id() {
3969 3901 global $t_select_modifier, $t_filter, $f_view_type;
3970 3902 ?>
3971 3903 <!-- BUGNOTE REPORTER -->
3972   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_NOTE_USER_ID;?>[]">
3973   - <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
  3904 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_NOTE_USER_ID;?>[]">
  3905 + <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
3974 3906 <?php if( access_has_project_level( config_get( 'view_handler_threshold' ) ) ) {?>
3975   - <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
  3907 + <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
3976 3908 <?php
3977 3909 if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) {
3978   - echo '<option value="' . META_FILTER_MYSELF . '" ';
  3910 + echo '<option value="' . META_FILTER_MYSELF . '"';
3979 3911 check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_MYSELF );
3980 3912 echo '>[' . lang_get( 'myself' ) . ']</option>';
3981 3913 }
@@ -4017,8 +3949,8 @@ function print_filter_plugin_field( $p_field_name, $p_filter_object ) {
4017 3949 break;
4018 3950
4019 3951 case FILTER_TYPE_MULTI_STRING:
4020   - echo '<select ', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
4021   - string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '" ',
  3952 + echo '<select', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
  3953 + string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '"',
4022 3954 check_selected( $t_filter[ $p_field_name ], META_FILTER_ANY ), '>[', lang_get( 'any' ), ']</option>';
4023 3955
4024 3956 foreach( $p_filter_object->options() as $t_option_value => $t_option_name ) {
@@ -4031,8 +3963,8 @@ function print_filter_plugin_field( $p_field_name, $p_filter_object ) {
4031 3963 break;
4032 3964
4033 3965 case FILTER_TYPE_MULTI_INT:
4034   - echo '<select ', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
4035   - string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '" ',
  3966 + echo '<select', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
  3967 + string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '"',
4036 3968 check_selected( $t_filter[ $p_field_name ], META_FILTER_ANY ), '>[', lang_get( 'any' ), ']</option>';
4037 3969
4038 3970 foreach( $p_filter_object->options() as $t_option_value => $t_option_name ) {
@@ -4069,14 +4001,14 @@ function print_filter_custom_field( $p_field_id ) {
4069 4001 } else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
4070 4002 echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
4071 4003 } else {
4072   - echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
4073   - echo '<option value="' . META_FILTER_ANY . '" ';
  4004 + echo '<select' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
  4005 + echo '<option value="' . META_FILTER_ANY . '"';
4074 4006 check_selected( $t_filter['custom_fields'][$p_field_id], META_FILTER_ANY );
4075 4007 echo '>[' . lang_get( 'any' ) . ']</option>';
4076 4008
4077 4009 # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
4078 4010 if( !in_array( $t_accessible_custom_fields_types[$j], array( CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST ) ) ) {
4079   - echo '<option value="' . META_FILTER_NONE . '" ';
  4011 + echo '<option value="' . META_FILTER_NONE . '"';
4080 4012 check_selected( $t_filter['custom_fields'][$p_field_id], META_FILTER_NONE );
4081 4013 echo '>[' . lang_get( 'none' ) . ']</option>';
4082 4014 }
@@ -4084,7 +4016,7 @@ function print_filter_custom_field( $p_field_id ) {
4084 4016 $t_max_length = config_get( 'max_dropdown_length' );
4085 4017 foreach( $t_accessible_custom_fields_values[$j] as $t_item ) {
4086 4018 if(( utf8_strtolower( $t_item ) !== META_FILTER_ANY ) && ( utf8_strtolower( $t_item ) !== META_FILTER_NONE ) ) {
4087   - echo '<option value="' . string_attribute( $t_item ) . '" ';
  4019 + echo '<option value="' . string_attribute( $t_item ) . '"';
4088 4020 if( isset( $t_filter['custom_fields'][$p_field_id] ) ) {
4089 4021 check_selected( $t_filter['custom_fields'][$p_field_id], $t_item );
4090 4022 }
@@ -4252,7 +4184,7 @@ function print_filter_custom_field_date( $p_field_num, $p_field_id ) {
4252 4184 }
4253 4185
4254 4186 echo "\n<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
4255   - echo "<select size=\"1\" name=\"custom_field_" . $p_field_id . "_control\" OnChange=\"" . $t_js_toggle_func . "();\">\n";
  4187 + echo "<select size=\"1\" name=\"custom_field_" . $p_field_id . "_control\">\n";
4256 4188 echo '<option value="' . CUSTOM_FIELD_DATE_ANY . '"';
4257 4189 check_selected( $t_filter['custom_fields'][$p_field_id][0], CUSTOM_FIELD_DATE_ANY );
4258 4190 echo '>' . lang_get( 'any' ) . '</option>' . "\n";
@@ -4294,8 +4226,8 @@ function print_filter_project_id() {
4294 4226 global $t_select_modifier, $t_filter, $f_view_type;
4295 4227 ?>
4296 4228 <!-- Project -->
4297   - <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROJECT_ID;?>[]">
4298   - <option value="<?php echo META_FILTER_CURRENT?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PROJECT_ID], META_FILTER_CURRENT );?>>[<?php echo lang_get( 'current' )?>]</option>
  4229 + <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROJECT_ID;?>[]">
  4230 + <option value="<?php echo META_FILTER_CURRENT?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PROJECT_ID], META_FILTER_CURRENT );?>>[<?php echo lang_get( 'current' )?>]</option>
4299 4231 <?php print_project_option_list( $t_filter[FILTER_PROPERTY_PROJECT_ID] )?>
4300 4232 </select>
4301 4233 <?php
16 core/helper_api.php
@@ -147,24 +147,24 @@ function check_selected( $p_var, $p_val = true ) {
147 147 # catch the case where one entry is 0 and the other is a string.
148 148 if( is_string( $t_this_var ) && is_string( $p_val ) ) {
149 149 if( $t_this_var === $p_val ) {
150   - echo ' selected="selected" ';
  150 + echo ' selected="selected"';
151 151 return;
152 152 }
153 153 }
154 154 else if( $t_this_var == $p_val ) {
155   - echo ' selected="selected" ';
  155 + echo ' selected="selected"';
156 156 return;
157 157 }
158 158 }
159 159 } else {
160 160 if( is_string( $p_var ) && is_string( $p_val ) ) {
161 161 if( $p_var === $p_val ) {
162   - echo ' selected="selected" ';
  162 + echo ' selected="selected"';
163 163 return;
164 164 }
165 165 }
166 166 else if( $p_var == $p_val ) {
167   - echo ' selected="selected" ';
  167 + echo ' selected="selected"';
168 168 return;
169 169 }
170 170 }
@@ -189,24 +189,24 @@ function check_checked( $p_var, $p_val = true ) {
189 189 # catch the case where one entry is 0 and the other is a string.
190 190 if( is_string( $t_this_var ) && is_string( $p_val ) ) {
191 191 if( $t_this_var === $p_val ) {
192   - echo ' checked="checked" ';
  192 + echo ' checked="checked"';
193 193 return;
194 194 }
195 195 }
196 196 else if( $t_this_var == $p_val ) {
197   - echo ' checked="checked" ';
  197 + echo ' checked="checked"';
198 198 return;
199 199 }
200 200 }
201 201 } else {
202 202 if( is_string( $p_var ) && is_string( $p_val ) ) {
203 203 if( $p_var === $p_val ) {
204   - echo ' checked="checked" ';
  204 + echo ' checked="checked"';
205 205 return;
206 206 }
207 207 }
208 208 else if( $p_var == $p_val ) {
209   - echo ' checked="checked" ';
  209 + echo ' checked="checked"';
210 210 return;
211 211 }
212 212 }
1  core/obsolete.php
@@ -156,3 +156,4 @@
156 156 config_obsolete( 'show_queries_list' );
157 157 config_obsolete( 'administrator_email', 'webmaster_email' );
158 158 config_obsolete( 'session_key' );
  159 +config_obsolete( 'dhtml_filters', 'use_dynamic_filters' );
2  core/print_api.php
@@ -532,7 +532,7 @@ function print_subproject_option_list( $p_parent_id, $p_project_id = null, $p_fi
532 532 }
533 533 echo $t_full_id . '"';
534 534 check_selected( $p_project_id, $t_full_id );
535   - echo '>' . str_repeat( '&nbsp;', count( $p_parents ) ) . str_repeat( '&raquo;', count( $p_parents ) ) . ' ' . string_attribute( project_get_field( $t_id, 'name' ) ) . '</option>' . "\n";
  535 + echo '>' . str_repeat( '&#160;', count( $p_parents ) ) . str_repeat( '&#187;', count( $p_parents ) ) . ' ' . string_attribute( project_get_field( $t_id, 'name' ) ) . '</option>' . "\n";
536 536 print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents );
537 537 }
538 538 }
17 docbook/Admin_Guide/en-US/Configuration.xml
@@ -2095,13 +2095,16 @@
2095 2095 </listitem>
2096 2096 </varlistentry>
2097 2097 <varlistentry>
2098   - <term>$g_dhtml_filters = OFF;</term>
2099   - <listitem>
2100   - <para>Controls the use of DHTML filters that will display the
2101   - filter in view page using DHTML and javascript. Default is OFF.
2102   - This requires $g_use_javascript to ne set to ON. This may not work
2103   - in all browsers as it requires xmlhttprequest
2104   - functionality.
  2098 + <term>$g_use_dynamic_filters = ON;</term>
  2099 + <listitem>
  2100 + <para>This switch enables the use of AJAX to dynamically
  2101 + load and create filter form controls upon request.
  2102 + This method will reduce the amount of data that needs
  2103 + to be transferred upon each page load dealing with
  2104 + filters and thus will result in speed improvements and
  2105 + bandwidth reduction. This requires $g_use_javascript
  2106 + to be set to ON. By default, this configuration option
  2107 + is set to ON.
2105 2108 </para>
2106 2109 </listitem>
2107 2110 </varlistentry>
1  javascript/addLoadEvent.js
... ... @@ -1 +0,0 @@
1   -function addLoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}};
52 javascript/common.js
@@ -73,6 +73,40 @@ $(document).ready( function() {
73 73 }
74 74 });
75 75
  76 + $('a.dynamic-filter-expander').click(function(event) {
  77 + event.preventDefault();
  78 + var fieldID = $(this).attr('id');
  79 + var targetID = fieldID + '_target';
  80 + var viewType = $('#filters_form_open input[name=view_type]').val();
  81 + $('#' + targetID).html('<span class="dynamic-filter-loading">' + translations['loading'] + "</span>");
  82 + $.ajax({
  83 + url: 'return_dynamic_filters.php',
  84 + data: 'view_type=' + viewType + '&filter_target=' + fieldID,
  85 + cache: false,
  86 + context: $('#' + targetID),
  87 + success: function(html) {
  88 + $(this).html(html);
  89 + $('input[type=checkbox]#use_date_filters').click(function() {
  90 + if (!$(this).is(':checked')) {
  91 + $('form#filters_form_open select[name=start_year]').attr('disabled', 'disabled');
  92 + $('form#filters_form_open select[name=start_month]').attr('disabled', 'disabled');
  93 + $('form#filters_form_open select[name=start_day]').attr('disabled', 'disabled');
  94 + $('form#filters_form_open select[name=end_year]').attr('disabled', 'disabled');
  95 + $('form#filters_form_open select[name=end_month]').attr('disabled', 'disabled');
  96 + $('form#filters_form_open select[name=end_day]').attr('disabled', 'disabled');
  97 + } else {
  98 + $('form#filters_form_open select[name=start_year]').removeAttr('disabled');
  99 + $('form#filters_form_open select[name=start_month]').removeAttr('disabled');
  100 + $('form#filters_form_open select[name=start_day]').removeAttr('disabled');
  101 + $('form#filters_form_open select[name=end_year]').removeAttr('disabled');
  102 + $('form#filters_form_open select[name=end_month]').removeAttr('disabled');
  103 + $('form#filters_form_open select[name=end_day]').removeAttr('disabled');
  104 + }
  105 + });
  106 + }
  107 + });
  108 + });
  109 +
76 110 $('input.autofocus:first, select.autofocus:first, textarea.autofocus:first').focus();
77 111
78 112 $('input[type=checkbox].check_all').click(function() {
@@ -171,6 +205,24 @@ $(document).ready( function() {
171 205 });
172 206 $('[name=form_set_project]').children('.button').hide();
173 207 setBugLabel();
  208 +
  209 + $('input[type=checkbox]#use_date_filters').click(function() {
  210 + if (!$(this).is(':checked')) {
  211 + $('form[name=filters] select[name=start_year]').attr('disabled', 'disabled');
  212 + $('form[name=filters] select[name=start_month]').attr('disabled', 'disabled');
  213 + $('form[name=filters] select[name=start_day]').attr('disabled', 'disabled');
  214 + $('form[name=filters] select[name=end_year]').attr('disabled', 'disabled');
  215 + $('form[name=filters] select[name=end_month]').attr('disabled', 'disabled');
  216 + $('form[name=filters] select[name=end_day]').attr('disabled', 'disabled');
  217 + } else {
  218 + $('form[name=filters] select[name=start_year]').removeAttr('disabled');
  219 + $('form[name=filters] select[name=start_month]').removeAttr('disabled');
  220 + $('form[name=filters] select[name=start_day]').removeAttr('disabled');
  221 + $('form[name=filters] select[name=end_year]').removeAttr('disabled');
  222 + $('form[name=filters] select[name=end_month]').removeAttr('disabled');
  223 + $('form[name=filters] select[name=end_day]').removeAttr('disabled');
  224 + }
  225 + });
174 226 });
175 227
176 228 function setBugLabel() {
47 javascript/dev/addLoadEvent.js
... ... @@ -1,47 +0,0 @@
1   -/*
2   -# Mantis - a php based bugtracking system
3   -
4   -# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
5   -# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
6   -
7   -# Mantis is free software: you can redistribute it and/or modify
8   -# it under the terms of the GNU General Public License as published by
9   -# the Free Software Foundation, either version 2 of the License, or
10   -# (at your option) any later version.
11   -#
12   -# Mantis is distributed in the hope that it will be useful,
13   -# but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   -# GNU General Public License for more details.
16   -#
17   -# You should have received a copy of the GNU General Public License
18   -# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
19   - *
20   - * --------------------------------------------------------
21   - * $Id$
22   - * --------------------------------------------------------
23   - */
24   -/*
25   -Care Of:
26   - Simon Willison
27   - http://simon.incutio.com/archive/2004/05/26/addLoadEvent
28   - Thnx Dude!
29   -
30   -******** USEAGE ********************************
31   -addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
32   -addLoadEvent(function() {
33   - // more code to run on page load
34   -});
35   -*/
36   -function addLoadEvent(func) {
37   - var oldonload = window.onload;
38   -
39   - if (typeof window.onload != 'function') {
40   - window.onload = func;
41   - } else {
42   - window.onload = function() {
43   - oldonload();
44   - func();
45   - }
46   - }
47   -}
175 javascript/dev/dynamic_filters.js
... ... @@ -1,175 +0,0 @@
1   -/*
2   -# Mantis - a php based bugtracking system
3   -
4   -# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
5   -# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
6   -
7   -# Mantis is free software: you can redistribute it and/or modify
8   -# it under the terms of the GNU General Public License as published by
9   -# the Free Software Foundation, either version 2 of the License, or
10   -# (at your option) any later version.
11   -#
12   -# Mantis is distributed in the hope that it will be useful,
13   -# but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   -# GNU General Public License for more details.
16   -#
17   -# You should have received a copy of the GNU General Public License
18   -# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
19   - *
20   - * --------------------------------------------------------
21   - * $Id$
22   - * --------------------------------------------------------
23   - */
24   -/*
25   -// +----------------------------------------------------------------------+
26   -// | Orginial Code Care Of: |
27   -// +----------------------------------------------------------------------+
28   -// | Copyright (c) 2004 Bitflux GmbH |
29   -// +----------------------------------------------------------------------+
30   -// | Licensed under the Apache License, Version 2.0 (the "License"); |
31   -// | you may not use this file except in compliance with the License. |
32   -// | You may obtain a copy of the License at |
33   -// | http://www.apache.org/licenses/LICENSE-2.0 |
34   -// | Unless required by applicable law or agreed to in writing, software |
35   -// | distributed under the License is distributed on an "AS IS" BASIS, |
36   -// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
37   -// | implied. See the License for the specific language governing |
38   -// | permissions and limitations under the License. |
39   -// +----------------------------------------------------------------------+
40   -// | Author: Bitflux GmbH <devel@bitflux.ch> |
41   -// | http://blog.bitflux.ch/p1735.html |
42   -// +----------------------------------------------------------------------+
43   -//
44   -//
45   -// +----------------------------------------------------------------------+
46   -// | Heavily Modified by Jeff Minard (07/09/04) |
47   -// +----------------------------------------------------------------------+
48   -// | Same stuff as above, yo! |
49   -// +----------------------------------------------------------------------+
50   -// | Author: Jeff Minard <jeff-js@creatimation.net> |
51   -// | http://www.creatimation.net |
52   -// | http://www.creatimation.net/journal/live-request |
53   -// +----------------------------------------------------------------------+
54   -//
55   -// +----------------------------------------------------------------------+
56   -// | What is this nonsense?? (07/09/04) |
57   -// +----------------------------------------------------------------------+
58   -// | This is a script that, by using XMLHttpRequest javascript objects |
59   -// | you can quickly add some very click live interactive feed back to |
60   -// | your pages that reuire server side interaction. |
61   -// | |
62   -// | For instance, you use this to emulate a "live searching" feature |
63   -// | wherein users type in key phrases, and once they have stopped typing |
64   -// | the script will automatically search and retrive *without* a page |
65   -// | reload.
66   -// | |
67   -// | In another instance, I use this to product live comments by passing |
68   -// | the text to a Textile class that parses it to valid HTML. After |
69   -// | parsing, the html is returned and displayed on the page as the |
70   -// | user types. |
71   -// +----------------------------------------------------------------------+
72   -//
73   -//
74   -// +----------------------------------------------------------------------+
75   -// | Modified by Lee O'Mara <lomara@omara.ca> 12/08/2004 |
76   -// +----------------------------------------------------------------------+
77   -// | Hacked apart Jeff's script for use in Mantis. |
78   -// | |
79   -// | This script gets filters from the server and displays them without |
80   -// | reloading the page. |
81   -// | |
82   -// | The script tries to follow the notion of "unobtrusive javascript". |
83   -// | There are no event handlers in the HTML code. The events are added |
84   -// | on pageload(based on specific id names). |
85   -// +----------------------------------------------------------------------+
86   -*/
87   -
88   -var processURI = './return_dynamic_filters.php';
89   -var liveReq = false;
90   -
91   -/**
92   - * Build the XMLHttpRequest and send it
93   - */
94   -function liveReqDoReq() {
95   -
96   - if (liveReq && liveReq.readyState < 4) {
97   - liveReq.abort();
98   - }
99   -
100   - if (window.XMLHttpRequest) {
101   - // branch for IE7, Firefox, Opera, etc.
102   - liveReq = new XMLHttpRequest();
103   - } else if (window.ActiveXObject) {
104   - // branch for IE5, IE6 via ActiveX
105   - liveReq = new ActiveXObject("Microsoft.XMLHTTP");
106   - }
107   -
108   - name = this.id;
109   - liveReq.onreadystatechange = function(){liveReqProcessReqChange(name);};
110   - t_view = document.getElementById('filters_form_open').elements['view_type'].value;
111   - liveReq.open("GET", processURI + "?view_type=" + t_view + "&filter_target=" + this.id);
112   -
113   - // show "Loading..." while waiting
114   - document.getElementById(this.id+'_target').innerHTML = translations['loading'];
115   -
116   - liveReq.send(null);
117   -
118   - return false;
119   -}
120   -
121   -/**
122   - * Processes the results of the XMLHttpRequest
123   - */
124   -function liveReqProcessReqChange(name) {
125   - if (liveReq.readyState == 4) {
126   - document.getElementById(name+'_target').innerHTML = liveReq.responseText;
127   - replaceWithContent(name);
128   - }
129   -}
130   -
131   -/**
132   - * Strip the tag, leave the content.
133   - */
134   -function replaceWithContent(id){
135   - tag = document.getElementById(id);
136   - if (!tag) return false;
137   - t_parent = tag.parentNode;
138   - if (!t_parent) return false;
139   - for(var i=0; i <tag.childNodes.length; i++){
140   - child = tag.childNodes[i].cloneNode(true);
141   - t_parent.insertBefore(child, tag);
142   - }
143   - t_parent.removeChild(tag);
144   -}
145   -
146   -/**
147   - * Initialise the filter links
148   - */
149   -function labelInit(){
150   - // keep browsers that don't support DOM or
151   - // XMLHttpRequest from getting in trouble
152   - if (document.getElementById && (window.XMLHttpRequest || window.ActiveXObject)) {
153   -
154   - t_form = document.getElementById("filters_form_open");
155   - if (!t_form) return false;
156   -
157   - t_links = t_form.getElementsByTagName("a");
158   - if (!t_links) return false;
159   -
160   - for(var i=0; i < t_links.length; i++){
161   - var t_link = t_links[i];
162   - if (t_link.id.substring((t_link.id.length - 7), t_link.id.length) == "_filter"){
163   - // only attach event handler if a target is found
164   - if (document.getElementById(t_link.id+'_target')){
165   - // setup the event handler
166   - t_link.onclick = liveReqDoReq;
167   - } else {
168   - alert("missing target for:" +t_link.id);
169   - }
170   - }
171   - }
172   - }
173   -}
174   -
175   -addLoadEvent(labelInit);
239 javascript/dev/xmlhttprequest.js
... ... @@ -1,239 +0,0 @@
1   -/*
2   -# Mantis - a php based bugtracking system
3   -
4   -# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
5   -# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
6   -
7   -# Mantis is free software: you can redistribute it and/or modify
8   -# it under the terms of the GNU General Public License as published by
9   -# the Free Software Foundation, either version 2 of the License, or
10   -# (at your option) any later version.
11   -#
12   -# Mantis is distributed in the hope that it will be useful,
13   -# but WITHOUT ANY WARRANTY; without even the implied warranty of
14   -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   -# GNU General Public License for more details.
16   -#
17   -# You should have received a copy of the GNU General Public License
18   -# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
19   - *
20   - * --------------------------------------------------------
21   - * $Id$
22   - * --------------------------------------------------------
23   - */
24   -/*
25   -
26   -Cross-Browser XMLHttpRequest v1.1
27   -=================================
28   -
29   -Emulate Gecko 'XMLHttpRequest()' functionality in IE and Opera. Opera requires
30   -the Sun Java Runtime Environment <http://www.java.com/>.
31   -
32   -by Andrew Gregory
33   -http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
34   -
35   -This work is licensed under the Creative Commons Attribution License. To view a
36   -copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or send
37   -a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,
38   -USA.
39   -
40   -Not Supported in Opera
41   -----------------------
42   -* user/password authentication
43   -* responseXML data member
44   -
45   -Not Fully Supported in Opera
46   -----------------------------
47   -* async requests
48   -* abort()
49   -* getAllResponseHeaders(), getAllResponseHeader(header)
50   -*/
51   -
52   -/*
53   - * commented out (30/07/2004) because it was causing subsequent request to freeze
54   -// IE support
55   -if (window.ActiveXObject && !window.XMLHttpRequest) {
56   - window.XMLHttpRequest = function() {
57   - return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP');
58   - };
59   -}
60   -*/