Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
View
@@ -37,8 +37,8 @@
check_print_section_header_row( 'Display' );
check_print_test_row(
- 'dhtml_filters = ON requires use_javascript = ON',
- !config_get_global( 'dhtml_filters' ) || config_get_global( 'use_javascript' )
+ 'use_dynamic_filters = ON requires use_javascript = ON',
+ !config_get_global( 'use_dynamic_filters' ) || ( config_get_global( 'use_dynamic_filters' ) && config_get_global( 'use_javascript' ) )
);
check_print_test_row(
11 config_defaults_inc.php
View
@@ -2925,12 +2925,13 @@
$g_view_filters = SIMPLE_DEFAULT;
/**
- * This switch enables the use of xmlhttprequest protocol to speed up the
- * filter display. Rather than launching a separate page, the filters are
- * updated in-line in the view_all_bugs_page.
- * @global int $g_dhtml_filters
+ * This switch enables the use of AJAX to dynamically load and create filter
+ * form controls upon request. This method will reduce the amount of data that
+ * needs to be transferred upon each page load dealing with filters and thus
+ * will result in speed improvements and bandwidth reduction.
+ * @global int $g_use_dynamic_filters
*/
-$g_dhtml_filters = ON;
+$g_use_dynamic_filters = ON;
/**
* The threshold required for users to be able to create permalinks. To turn
276 core/filter_api.php
View
@@ -2182,30 +2182,32 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
META_FILTER_ANY,
);
}
+
+ $t_dynamic_filter_expander_class = config_get( 'use_javascript' ) && config_get( 'use_dynamic_filters' ) ? ' class="dynamic-filter-expander"' : '';
?>
<tr <?php echo "class=\"" . $t_trclass . "\"";?>>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]';?>" id="reporter_id_filter"><?php echo lang_get( 'reporter_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]';?>" id="user_monitor_filter"><?php echo lang_get( 'monitored_by_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]';?>" id="handler_id_filter"><?php echo lang_get( 'assigned_to_label' )?></a>
+ <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>
</td>
<td colspan="2" class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_CATEGORY_ID . '[]';?>" id="show_category_filter"><?php echo lang_get( 'category_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_SEVERITY . '[]';?>" id="show_severity_filter"><?php echo lang_get( 'severity_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RESOLUTION . '[]';?>" id="show_resolution_filter"><?php echo lang_get( 'resolution_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
<?php if( ON == config_get( 'enable_profiles' ) ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROFILE_ID . '[]';?>" id="show_profile_filter"><?php echo lang_get( 'profile_label' )?></a>
+ <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>
<?php } ?>
</td>
<?php if( $t_filter_cols > 8 ) {
@@ -2468,25 +2470,25 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<tr <?php echo "class=\"" . $t_trclass . "\"";?>>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STATUS . '[]';?>" id="show_status_filter"><?php echo lang_get( 'status_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
<?php if( 'simple' == $t_view_type ) {?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS . '[]';?>" id="hide_status_filter"><?php echo lang_get( 'hide_status_label' )?></a>
+ <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>
<?php
}?>
</td>
<td class="small-caption" valign="top">
<?php if ( $t_show_build ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_BUILD . '[]';?>" id="show_build_filter"><?php echo lang_get( 'product_build_label' )?></a>
+ <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>
<?php } ?>
</td>
<?php if( $t_show_product_version ) {?>
<td colspan="2" class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VERSION . '[]';?>" id="show_version_filter"><?php echo lang_get( 'product_version_label' )?></a>
+ <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>
</td>
<td colspan="1" class="small-caption" valign="top">
- <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>
+ <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>
</td>
<?php
} else {?>
@@ -2499,11 +2501,11 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<?php
}?>
<td colspan="1" class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PRIORITY . '[]';?>" id="show_priority_filter"><?php echo lang_get( 'priority_label' )?></a>
+ <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>
</td>
<?php if( $t_show_product_version ) {?>
<td colspan="1" class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]';?>" id="show_target_version_filter"><?php echo lang_get( 'target_version_label' )?></a>
+ <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>
</td>
<?php
} else {?>
@@ -2785,22 +2787,22 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<tr <?php echo "class=\"" . $t_trclass . "\"";?>>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE;?>" id="per_page_filter"><?php echo lang_get( 'show_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE;?>" id="view_state_filter"><?php echo lang_get( 'view_status_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_STICKY;?>" id="sticky_issues_filter"><?php echo lang_get( 'sticky_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top" colspan="2">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED;?>" id="highlight_changed_filter"><?php echo lang_get( 'changed_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top" >
- <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>
+ <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>
</td>
<td class="small-caption" valign="top" colspan="2">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE;?>" id="relationship_type_filter"><?php echo lang_get( 'bug_relationships_label' )?></a>
+ <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>
</td>
<?php if( $t_filter_cols > 8 ) {
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
echo '<input type="hidden" name="', FILTER_PROPERTY_HIGHLIGHT_CHANGED, '" value="', $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED], '" />';
?>
</td>
- <td class="small-caption" valign="top" id="do_filter_by_date_filter_target">
- <?php
- if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) {
- ?>
- <script type="text/javascript">
- <!--
- function SwitchDateFields() {
- // All fields need to be enabled to go back to the script
- document.filters_open.start_month.disabled = ! document.filters_open.filter_by_date.checked;
- document.filters_open.start_day.disabled = ! document.filters_open.filter_by_date.checked;
- document.filters_open.start_year.disabled = ! document.filters_open.filter_by_date.checked;
- document.filters_open.end_month.disabled = ! document.filters_open.filter_by_date.checked;
- document.filters_open.end_day.disabled = ! document.filters_open.filter_by_date.checked;
- document.filters_open.end_year.disabled = ! document.filters_open.filter_by_date.checked;
-
- return true;
- }
- // -->
- </script>
- <?php
- }
-
- # end if dhtml_filters
+ <td class="small-caption" valign="top" id="do_filter_by_date_filter_target">
+ <?php
if( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) {
echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DATE, '" value="', $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], '" />';
echo '<input type="hidden" name="', FILTER_PROPERTY_START_MONTH, '" value="', $t_filter[FILTER_PROPERTY_START_MONTH], '" />';
@@ -2932,22 +2913,22 @@ function SwitchDateFields() {
<tr <?php echo "class=\"" . $t_trclass . "\"";?>>
<td class="small-caption" valign="top">
<?php if( ON == config_get( 'enable_profiles' ) ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PLATFORM;?>" id="platform_filter"><?php echo lang_get( 'platform_label' )?></a>
+ <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>
<?php } ?>
</td>
<td class="small-caption" valign="top">
<?php if( ON == config_get( 'enable_profiles' ) ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS;?>" id="os_filter"><?php echo lang_get( 'os_label' )?></a>
+ <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>
<?php } ?>
</td>
<td class="small-caption" valign="top">
<?php if( ON == config_get( 'enable_profiles' ) ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_OS_BUILD;?>" id="os_build_filter"><?php echo lang_get( 'os_version_label' )?></a>
+ <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>
<?php } ?>
</td>
<td class="small-caption" valign="top" colspan="5">
<?php if ( access_has_global_level( config_get( 'tag_view_threshold' ) ) ) { ?>
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_TAG_STRING;?>" id="tag_string_filter"><?php echo lang_get( 'tags_label' )?></a>
+ <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>
<?php } ?>
</td>
<?php if( $t_filter_cols > 8 ) {
@@ -3120,7 +3101,7 @@ function SwitchDateFields() {
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] . '[]" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter">';
+ $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 . '>';
$t_fields .= string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) );
$t_fields .= '</a> </td> ';
}
@@ -3132,51 +3113,6 @@ function SwitchDateFields() {
$t_values .= lang_get( 'any' );
} else {
if( $t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE ) {
-
- /** @todo moved embedded javascript here from print_filter_custom_field_date
- * it appears not to load properly on Firefox and other browsers if loaded through the httpxmlreq
- */
- $t_field_id = $t_accessible_custom_fields_ids[$i];
- $t_js_toggle_func = "toggle_custom_date_field_" . $t_field_id . "_controls";
- if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) {
- ?>
- <script type="text/javascript">
- <!--
- function <?php echo $t_js_toggle_func . "_start";?>(disable) {
- document.filters_open.custom_field_<?php echo $t_field_id;?>_start_year.disabled = disable ;
- document.filters_open.custom_field_<?php echo $t_field_id;?>_start_month.disabled = disable ;
- document.filters_open.custom_field_<?php echo $t_field_id;?>_start_day.disabled = disable ;
- } ;
-
- function <?php echo $t_js_toggle_func . "_end";?>(disable) {
- document.filters_open.custom_field_<?php echo $t_field_id;?>_end_year.disabled = disable ;
- document.filters_open.custom_field_<?php echo $t_field_id;?>_end_month.disabled = disable ;
- document.filters_open.custom_field_<?php echo $t_field_id;?>_end_day.disabled = disable ;
- } ;
-
- function <?php echo $t_js_toggle_func;?>() {
- switch (document.filters_open.custom_field_<?php echo $t_field_id;?>_control.selectedIndex) {
- case <?php echo CUSTOM_FIELD_DATE_ANY;?>:
- case <?php echo CUSTOM_FIELD_DATE_NONE;?>:
- <?php echo $t_js_toggle_func . "_start";?>(true) ;
- <?php echo $t_js_toggle_func . "_end";?>(true) ;
- break ;
- case <?php echo CUSTOM_FIELD_DATE_BETWEEN;?>:
- <?php echo $t_js_toggle_func . "_start";?>(false) ;
- <?php echo $t_js_toggle_func . "_end";?>(false) ;
- break ;
- default:
- <?php echo $t_js_toggle_func . "_start";?>(false) ;
- <?php echo $t_js_toggle_func . "_end";?>(true) ;
- break ;
- }
- }
- // -->
- </script>
-<?php
- }
-
- # end if dhtml_filters
$t_short_date_format = config_get( 'short_date_format' );
if( !isset( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] ) ) {
$t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0;
@@ -3292,7 +3228,7 @@ function <?php echo $t_js_toggle_func;?>() {
?>
<tr class="row-1">
<td class="small-caption category2" valign="top">
- <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>
+ <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>
</td>
<td class="small-caption" valign="top" id="note_user_id_filter_target">
<?php
@@ -3334,7 +3270,7 @@ function <?php echo $t_js_toggle_func;?>() {
?>
</td>
<td class="small-caption" valign="top">
- <a href="<?php echo $t_filters_url . 'show_sort';?>" id="show_sort_filter"><?php echo lang_get( 'sort_label' )?></a>
+ <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>
</td>
<td class="small-caption" valign="top" id="show_sort_filter_target">
<?php
@@ -3364,9 +3300,9 @@ function <?php echo $t_js_toggle_func;?>() {
if( 'advanced' == $t_view_type ) {
?>
<td class="small-caption" valign="top" colspan="2">
- <a href="<?php echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID;?>" id="project_id_filter"><?php echo lang_get( 'email_project_label' )?></a>
+ <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>
</td>
- <td class="small-caption" valign="top" id="project_id_filter_target">
+ <td class="small-caption" valign="top" id="project_id_filter_target">
<?php
$t_output = '';
if( !is_array( $t_filter[FILTER_PROPERTY_PROJECT_ID] ) ) {
@@ -3471,7 +3407,7 @@ function <?php echo $t_js_toggle_func;?>() {
}
?>
<div class="filter-links"><?php
- $f_switch_view_link = ( ON == config_get( 'dhtml_filters' ) ? 'view_all_set.php?type=6&amp;view_type=' : 'view_filters_page.php?view_type=' );
+ $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=';
$t_view_filters = config_get( 'view_filters' );
if(( SIMPLE_ONLY != $t_view_filters ) && ( ADVANCED_ONLY != $t_view_filters ) ) {
if( 'advanced' == $t_view_type ) {
@@ -3514,7 +3450,7 @@ function <?php echo $t_js_toggle_func;?>() {
function print_filter_reporter_id() {
global $t_select_modifier, $t_filter;
?>
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_REPORTER_ID;?>[]">
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_REPORTER_ID;?>[]">
<?php
# if current user is a reporter, and limited reports set to ON, only display that name
# @@@ thraxisp - access_has_project_level checks greater than or equal to,
@@ -3531,7 +3467,7 @@ function print_filter_reporter_id() {
echo '<option value="' . $t_id . '" selected="selected">' . $t_display_name . '</option>';
} else {
?>
- <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>
+ <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>
<?php
if( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) {
echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3551,8 +3487,8 @@ function print_filter_user_monitor() {
global $t_select_modifier, $t_filter;
?>
<!-- Monitored by -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_MONITOR_USER_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_MONITOR_USER_ID;?>[]">
+ <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>
<?php
if( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) {
echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3577,10 +3513,10 @@ function print_filter_handler_id() {
global $t_select_modifier, $t_filter, $f_view_type;
?>
<!-- Handler -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HANDLER_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HANDLER_ID;?>[]">
+ <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>
<?php if( access_has_project_level( config_get( 'view_handler_threshold' ) ) ) {?>
- <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>
+ <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>
<?php
if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) {
echo '<option value="' . META_FILTER_MYSELF . '" ';
@@ -3601,8 +3537,8 @@ function print_filter_show_category() {
global $t_select_modifier, $t_filter;
?>
<!-- Category -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_CATEGORY_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_CATEGORY_ID;?>[]">
+ <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>
<?php print_category_filter_option_list( $t_filter[FILTER_PROPERTY_CATEGORY_ID] )?>
</select>
<?php
@@ -3616,8 +3552,8 @@ function print_filter_platform() {
?>
<!-- Platform -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PLATFORM;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PLATFORM], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PLATFORM;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PLATFORM], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php
log_event( LOG_FILTERING, 'Platform = ' . var_export( $t_filter[FILTER_PROPERTY_PLATFORM], true ) );
print_platform_option_list( $t_filter[FILTER_PROPERTY_PLATFORM] );
@@ -3634,8 +3570,8 @@ function print_filter_os() {
?>
<!-- OS -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_OS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_OS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php print_os_option_list( $t_filter[FILTER_PROPERTY_OS] )?>
</select>
<?php
@@ -3649,8 +3585,8 @@ function print_filter_os_build() {
?>
<!-- OS Build -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS_BUILD;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_OS_BUILD;?>[]">
+ <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>
<?php print_os_build_option_list( $t_filter[FILTER_PROPERTY_OS_BUILD] )?>
</select>
<?php
@@ -3662,8 +3598,8 @@ function print_filter_os_build() {
function print_filter_show_severity() {
global $t_select_modifier, $t_filter;
?><!-- Severity -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_SEVERITY;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_SEVERITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_SEVERITY;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_SEVERITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php print_enum_string_option_list( 'severity', $t_filter[FILTER_PROPERTY_SEVERITY] )?>
</select>
<?php
@@ -3675,8 +3611,8 @@ function print_filter_show_severity() {
function print_filter_show_resolution() {
global $t_select_modifier, $t_filter;
?><!-- Resolution -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_RESOLUTION;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_RESOLUTION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_RESOLUTION;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_RESOLUTION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php print_enum_string_option_list( 'resolution', $t_filter[FILTER_PROPERTY_RESOLUTION] )?>
</select>
<?php
@@ -3688,8 +3624,8 @@ function print_filter_show_resolution() {
function print_filter_show_status() {
global $t_select_modifier, $t_filter;
?> <!-- Status -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_STATUS;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_STATUS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_STATUS;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_STATUS], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php print_enum_string_option_list( 'status', $t_filter[FILTER_PROPERTY_STATUS] )?>
</select>
<?php
@@ -3701,7 +3637,7 @@ function print_filter_show_status() {
function print_filter_hide_status() {
global $t_select_modifier, $t_filter;
?><!-- Hide Status -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HIDE_STATUS;?>[]">
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_HIDE_STATUS;?>[]">
<option value="<?php echo META_FILTER_NONE?>">[<?php echo lang_get( 'none' )?>]</option>
<?php print_enum_string_option_list( 'status', $t_filter[FILTER_PROPERTY_HIDE_STATUS] )?>
</select>
@@ -3714,9 +3650,9 @@ function print_filter_hide_status() {
function print_filter_show_build() {
global $t_select_modifier, $t_filter;
?><!-- Build -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_BUILD;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
- <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_BUILD;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_BUILD], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
<?php print_build_option_list( $t_filter[FILTER_PROPERTY_BUILD] )?>
</select>
<?php
@@ -3728,9 +3664,9 @@ function print_filter_show_build() {
function print_filter_show_version() {
global $t_select_modifier, $t_filter;
?><!-- Version -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_VERSION;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
- <option value="<?php echo META_FILTER_NONE?>" <?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_VERSION;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <option value="<?php echo META_FILTER_NONE?>"<?php check_selected( $t_filter[FILTER_PROPERTY_VERSION], META_FILTER_NONE );?>>[<?php echo lang_get( 'none' )?>]</option>
<?php print_version_option_list( $t_filter[FILTER_PROPERTY_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
</select>
<?php
@@ -3742,9 +3678,9 @@ function print_filter_show_version() {
function print_filter_show_fixed_in_version() {
global $t_select_modifier, $t_filter;
?><!-- Fixed in Version -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_FIXED_IN_VERSION;?>[]">
- <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>
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_FIXED_IN_VERSION;?>[]">
+ <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>
+ <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>
<?php print_version_option_list( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
</select>
<?php
@@ -3756,9 +3692,9 @@ function print_filter_show_fixed_in_version() {
function print_filter_show_target_version() {
global $t_select_modifier, $t_filter;
?><!-- Fixed in Version -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_TARGET_VERSION;?>[]">
- <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>
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_TARGET_VERSION;?>[]">
+ <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>
+ <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>
<?php print_version_option_list( $t_filter[FILTER_PROPERTY_TARGET_VERSION], /* projectId */ null, /* released */ VERSION_ALL, /* leadingBlank */ false, /* withSubs */ true )?>
</select>
<?php
@@ -3770,8 +3706,8 @@ function print_filter_show_target_version() {
function print_filter_show_priority() {
global $t_select_modifier, $t_filter;
?><!-- Priority -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PRIORITY;?>[]">
- <option value="<?php echo META_FILTER_ANY?>" <?php check_selected( $t_filter[FILTER_PROPERTY_PRIORITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PRIORITY;?>[]">
+ <option value="<?php echo META_FILTER_ANY?>"<?php check_selected( $t_filter[FILTER_PROPERTY_PRIORITY], META_FILTER_ANY );?>>[<?php echo lang_get( 'any' )?>]</option>
<?php print_enum_string_option_list( 'priority', $t_filter[FILTER_PROPERTY_PRIORITY] )?>
</select>
<?php
@@ -3783,8 +3719,8 @@ function print_filter_show_priority() {
function print_filter_show_profile() {
global $t_select_modifier, $t_filter;
?><!-- Profile -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROFILE_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROFILE_ID;?>[]">
+ <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>
<?php print_profile_option_list_for_project( helper_get_current_project(), $t_filter[FILTER_PROPERTY_PROFILE_ID] );?>
</select>
<?php
@@ -3808,13 +3744,13 @@ function print_filter_view_state() {
?><!-- View Status -->
<select name="<?php echo FILTER_PROPERTY_VIEW_STATE;?>">
<?php
- echo '<option value="' . META_FILTER_ANY . '" ';
+ echo '<option value="' . META_FILTER_ANY . '"';
check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], META_FILTER_ANY );
echo '>[' . lang_get( 'any' ) . ']</option>';
- echo '<option value="' . VS_PUBLIC . '" ';
+ echo '<option value="' . VS_PUBLIC . '"';
check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], VS_PUBLIC );
echo '>' . lang_get( 'public' ) . '</option>';
- echo '<option value="' . VS_PRIVATE . '" ';
+ echo '<option value="' . VS_PRIVATE . '"';
check_selected( $t_filter[FILTER_PROPERTY_VIEW_STATE], VS_PRIVATE );
echo '>' . lang_get( 'private' ) . '</option>';
?>
@@ -3828,7 +3764,7 @@ function print_filter_view_state() {
function print_filter_sticky_issues() {
global $t_filter;
?><!-- Show or hide sticky bugs -->
- <input type="checkbox" name="<?php echo FILTER_PROPERTY_STICKY;?>" <?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_STICKY] ), true );?> />
+ <input type="checkbox" name="<?php echo FILTER_PROPERTY_STICKY;?>"<?php check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_STICKY] ), true );?> />
<?php
}
@@ -3843,28 +3779,24 @@ function print_filter_highlight_changed() {
}
/**
- * print filter by date fields with javascript
- * @todo Javascript should be removed and added dynamically
- * via external script
+ * print filter by date fields
*/
function print_filter_do_filter_by_date( $p_hide_checkbox = false ) {
global $t_filter;
- ?>
+?>
<table cellspacing="0" cellpadding="0">
- <?php if( !$p_hide_checkbox ) {
- ?>
- <tr><td colspan="2">
- <input type="checkbox" name="<?php echo FILTER_PROPERTY_FILTER_BY_DATE;?>" <?php
- check_checked( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on' );
- if( ON == config_get( 'use_javascript' ) ) {
- print "onclick=\"SwitchDateFields();\"";
- }?> />
- <?php echo lang_get( 'use_date_filters' )?>
- </td></tr>
- <?php
+<?php
+ if( !$p_hide_checkbox ) {
+?>
+ <tr>
+ <td colspan="2">
+ <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>
+ </td>
+ </tr>
+<?php
}
- $t_menu_disabled = ( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ? '' : ' disabled ';
- ?>
+ $t_menu_disabled = ( !config_get( 'use_javascript' ) || 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ? '' : ' disabled="disabled" ';
+?>
<!-- Start date -->
<tr>
@@ -3969,13 +3901,13 @@ function print_filter_note_user_id() {
global $t_select_modifier, $t_filter, $f_view_type;
?>
<!-- BUGNOTE REPORTER -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_NOTE_USER_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_NOTE_USER_ID;?>[]">
+ <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>
<?php if( access_has_project_level( config_get( 'view_handler_threshold' ) ) ) {?>
- <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>
+ <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>
<?php
if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) {
- echo '<option value="' . META_FILTER_MYSELF . '" ';
+ echo '<option value="' . META_FILTER_MYSELF . '"';
check_selected( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], META_FILTER_MYSELF );
echo '>[' . lang_get( 'myself' ) . ']</option>';
}
@@ -4017,8 +3949,8 @@ function print_filter_plugin_field( $p_field_name, $p_filter_object ) {
break;
case FILTER_TYPE_MULTI_STRING:
- echo '<select ', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
- string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '" ',
+ echo '<select', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
+ string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '"',
check_selected( $t_filter[ $p_field_name ], META_FILTER_ANY ), '>[', lang_get( 'any' ), ']</option>';
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 ) {
break;
case FILTER_TYPE_MULTI_INT:
- echo '<select ', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
- string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '" ',
+ echo '<select', $t_select_modifier, ( $t_size > 0 ? " size=\"$t_size\"" : '' ), ' name="',
+ string_attribute( $p_field_name ), '[]">', '<option value="', META_FILTER_ANY, '"',
check_selected( $t_filter[ $p_field_name ], META_FILTER_ANY ), '>[', lang_get( 'any' ), ']</option>';
foreach( $p_filter_object->options() as $t_option_value => $t_option_name ) {
@@ -4069,14 +4001,14 @@ function print_filter_custom_field( $p_field_id ) {
} else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
} else {
- echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
- echo '<option value="' . META_FILTER_ANY . '" ';
+ echo '<select' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
+ echo '<option value="' . META_FILTER_ANY . '"';
check_selected( $t_filter['custom_fields'][$p_field_id], META_FILTER_ANY );
echo '>[' . lang_get( 'any' ) . ']</option>';
# don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
if( !in_array( $t_accessible_custom_fields_types[$j], array( CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST ) ) ) {
- echo '<option value="' . META_FILTER_NONE . '" ';
+ echo '<option value="' . META_FILTER_NONE . '"';
check_selected( $t_filter['custom_fields'][$p_field_id], META_FILTER_NONE );
echo '>[' . lang_get( 'none' ) . ']</option>';
}
@@ -4084,7 +4016,7 @@ function print_filter_custom_field( $p_field_id ) {
$t_max_length = config_get( 'max_dropdown_length' );
foreach( $t_accessible_custom_fields_values[$j] as $t_item ) {
if(( utf8_strtolower( $t_item ) !== META_FILTER_ANY ) && ( utf8_strtolower( $t_item ) !== META_FILTER_NONE ) ) {
- echo '<option value="' . string_attribute( $t_item ) . '" ';
+ echo '<option value="' . string_attribute( $t_item ) . '"';
if( isset( $t_filter['custom_fields'][$p_field_id] ) ) {
check_selected( $t_filter['custom_fields'][$p_field_id], $t_item );
}
@@ -4252,7 +4184,7 @@ function print_filter_custom_field_date( $p_field_num, $p_field_id ) {
}
echo "\n<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
- echo "<select size=\"1\" name=\"custom_field_" . $p_field_id . "_control\" OnChange=\"" . $t_js_toggle_func . "();\">\n";
+ echo "<select size=\"1\" name=\"custom_field_" . $p_field_id . "_control\">\n";
echo '<option value="' . CUSTOM_FIELD_DATE_ANY . '"';
check_selected( $t_filter['custom_fields'][$p_field_id][0], CUSTOM_FIELD_DATE_ANY );
echo '>' . lang_get( 'any' ) . '</option>' . "\n";
@@ -4294,8 +4226,8 @@ function print_filter_project_id() {
global $t_select_modifier, $t_filter, $f_view_type;
?>
<!-- Project -->
- <select <?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROJECT_ID;?>[]">
- <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>
+ <select<?php echo $t_select_modifier;?> name="<?php echo FILTER_PROPERTY_PROJECT_ID;?>[]">
+ <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>
<?php print_project_option_list( $t_filter[FILTER_PROPERTY_PROJECT_ID] )?>
</select>
<?php
16 core/helper_api.php
View
@@ -147,24 +147,24 @@ function check_selected( $p_var, $p_val = true ) {
# catch the case where one entry is 0 and the other is a string.
if( is_string( $t_this_var ) && is_string( $p_val ) ) {
if( $t_this_var === $p_val ) {
- echo ' selected="selected" ';
+ echo ' selected="selected"';
return;
}
}
else if( $t_this_var == $p_val ) {
- echo ' selected="selected" ';
+ echo ' selected="selected"';
return;
}
}
} else {
if( is_string( $p_var ) && is_string( $p_val ) ) {
if( $p_var === $p_val ) {
- echo ' selected="selected" ';
+ echo ' selected="selected"';
return;
}
}
else if( $p_var == $p_val ) {
- echo ' selected="selected" ';
+ echo ' selected="selected"';
return;
}
}
@@ -189,24 +189,24 @@ function check_checked( $p_var, $p_val = true ) {
# catch the case where one entry is 0 and the other is a string.
if( is_string( $t_this_var ) && is_string( $p_val ) ) {
if( $t_this_var === $p_val ) {
- echo ' checked="checked" ';
+ echo ' checked="checked"';
return;
}
}
else if( $t_this_var == $p_val ) {
- echo ' checked="checked" ';
+ echo ' checked="checked"';
return;
}
}
} else {
if( is_string( $p_var ) && is_string( $p_val ) ) {
if( $p_var === $p_val ) {
- echo ' checked="checked" ';
+ echo ' checked="checked"';
return;
}
}
else if( $p_var == $p_val ) {
- echo ' checked="checked" ';
+ echo ' checked="checked"';
return;
}
}
1  core/obsolete.php
View
@@ -156,3 +156,4 @@
config_obsolete( 'show_queries_list' );
config_obsolete( 'administrator_email', 'webmaster_email' );
config_obsolete( 'session_key' );
+config_obsolete( 'dhtml_filters', 'use_dynamic_filters' );
2  core/print_api.php
View
@@ -532,7 +532,7 @@ function print_subproject_option_list( $p_parent_id, $p_project_id = null, $p_fi
}
echo $t_full_id . '"';
check_selected( $p_project_id, $t_full_id );
- echo '>' . str_repeat( '&nbsp;', count( $p_parents ) ) . str_repeat( '&raquo;', count( $p_parents ) ) . ' ' . string_attribute( project_get_field( $t_id, 'name' ) ) . '</option>' . "\n";
+ echo '>' . str_repeat( '&#160;', count( $p_parents ) ) . str_repeat( '&#187;', count( $p_parents ) ) . ' ' . string_attribute( project_get_field( $t_id, 'name' ) ) . '</option>' . "\n";
print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents );
}
}
17 docbook/Admin_Guide/en-US/Configuration.xml
View
@@ -2095,13 +2095,16 @@
</listitem>
</varlistentry>
<varlistentry>
- <term>$g_dhtml_filters = OFF;</term>
- <listitem>
- <para>Controls the use of DHTML filters that will display the
- filter in view page using DHTML and javascript. Default is OFF.
- This requires $g_use_javascript to ne set to ON. This may not work
- in all browsers as it requires xmlhttprequest
- functionality.
+ <term>$g_use_dynamic_filters = ON;</term>
+ <listitem>
+ <para>This switch enables the use of AJAX to dynamically
+ load and create filter form controls upon request.
+ This method will reduce the amount of data that needs
+ to be transferred upon each page load dealing with
+ filters and thus will result in speed improvements and
+ bandwidth reduction. This requires $g_use_javascript
+ to be set to ON. By default, this configuration option
+ is set to ON.
</para>
</listitem>
</varlistentry>
1  javascript/addLoadEvent.js
View
@@ -1 +0,0 @@
-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
View
@@ -73,6 +73,40 @@ $(document).ready( function() {
}
});
+ $('a.dynamic-filter-expander').click(function(event) {
+ event.preventDefault();
+ var fieldID = $(this).attr('id');
+ var targetID = fieldID + '_target';
+ var viewType = $('#filters_form_open input[name=view_type]').val();
+ $('#' + targetID).html('<span class="dynamic-filter-loading">' + translations['loading'] + "</span>");
+ $.ajax({
+ url: 'return_dynamic_filters.php',
+ data: 'view_type=' + viewType + '&filter_target=' + fieldID,
+ cache: false,
+ context: $('#' + targetID),
+ success: function(html) {
+ $(this).html(html);
+ $('input[type=checkbox]#use_date_filters').click(function() {
+ if (!$(this).is(':checked')) {
+ $('form#filters_form_open select[name=start_year]').attr('disabled', 'disabled');
+ $('form#filters_form_open select[name=start_month]').attr('disabled', 'disabled');
+ $('form#filters_form_open select[name=start_day]').attr('disabled', 'disabled');
+ $('form#filters_form_open select[name=end_year]').attr('disabled', 'disabled');
+ $('form#filters_form_open select[name=end_month]').attr('disabled', 'disabled');
+ $('form#filters_form_open select[name=end_day]').attr('disabled', 'disabled');
+ } else {
+ $('form#filters_form_open select[name=start_year]').removeAttr('disabled');
+ $('form#filters_form_open select[name=start_month]').removeAttr('disabled');
+ $('form#filters_form_open select[name=start_day]').removeAttr('disabled');
+ $('form#filters_form_open select[name=end_year]').removeAttr('disabled');
+ $('form#filters_form_open select[name=end_month]').removeAttr('disabled');
+ $('form#filters_form_open select[name=end_day]').removeAttr('disabled');
+ }
+ });
+ }
+ });
+ });
+
$('input.autofocus:first, select.autofocus:first, textarea.autofocus:first').focus();
$('input[type=checkbox].check_all').click(function() {
@@ -171,6 +205,24 @@ $(document).ready( function() {
});
$('[name=form_set_project]').children('.button').hide();
setBugLabel();
+
+ $('input[type=checkbox]#use_date_filters').click(function() {
+ if (!$(this).is(':checked')) {
+ $('form[name=filters] select[name=start_year]').attr('disabled', 'disabled');
+ $('form[name=filters] select[name=start_month]').attr('disabled', 'disabled');
+ $('form[name=filters] select[name=start_day]').attr('disabled', 'disabled');
+ $('form[name=filters] select[name=end_year]').attr('disabled', 'disabled');
+ $('form[name=filters] select[name=end_month]').attr('disabled', 'disabled');
+ $('form[name=filters] select[name=end_day]').attr('disabled', 'disabled');
+ } else {
+ $('form[name=filters] select[name=start_year]').removeAttr('disabled');
+ $('form[name=filters] select[name=start_month]').removeAttr('disabled');
+ $('form[name=filters] select[name=start_day]').removeAttr('disabled');
+ $('form[name=filters] select[name=end_year]').removeAttr('disabled');
+ $('form[name=filters] select[name=end_month]').removeAttr('disabled');
+ $('form[name=filters] select[name=end_day]').removeAttr('disabled');
+ }
+ });
});
function setBugLabel() {
47 javascript/dev/addLoadEvent.js
View
@@ -1,47 +0,0 @@
-/*
-# Mantis - a php based bugtracking system
-
-# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
-# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
-
-# Mantis is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# Mantis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
- *
- * --------------------------------------------------------
- * $Id$
- * --------------------------------------------------------
- */
-/*
-Care Of:
- Simon Willison
- http://simon.incutio.com/archive/2004/05/26/addLoadEvent
- Thnx Dude!
-
-******** USEAGE ********************************
-addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
-addLoadEvent(function() {
- // more code to run on page load
-});
-*/
-function addLoadEvent(func) {
- var oldonload = window.onload;
-
- if (typeof window.onload != 'function') {
- window.onload = func;
- } else {
- window.onload = function() {
- oldonload();
- func();
- }
- }
-}
175 javascript/dev/dynamic_filters.js
View
@@ -1,175 +0,0 @@
-/*
-# Mantis - a php based bugtracking system
-
-# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
-# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
-
-# Mantis is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# Mantis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
- *
- * --------------------------------------------------------
- * $Id$
- * --------------------------------------------------------
- */
-/*
-// +----------------------------------------------------------------------+
-// | Orginial Code Care Of: |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 2004 Bitflux GmbH |
-// +----------------------------------------------------------------------+
-// | Licensed under the Apache License, Version 2.0 (the "License"); |
-// | you may not use this file except in compliance with the License. |
-// | You may obtain a copy of the License at |
-// | http://www.apache.org/licenses/LICENSE-2.0 |
-// | Unless required by applicable law or agreed to in writing, software |
-// | distributed under the License is distributed on an "AS IS" BASIS, |
-// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
-// | implied. See the License for the specific language governing |
-// | permissions and limitations under the License. |
-// +----------------------------------------------------------------------+
-// | Author: Bitflux GmbH <devel@bitflux.ch> |
-// | http://blog.bitflux.ch/p1735.html |
-// +----------------------------------------------------------------------+
-//
-//
-// +----------------------------------------------------------------------+
-// | Heavily Modified by Jeff Minard (07/09/04) |
-// +----------------------------------------------------------------------+
-// | Same stuff as above, yo! |
-// +----------------------------------------------------------------------+
-// | Author: Jeff Minard <jeff-js@creatimation.net> |
-// | http://www.creatimation.net |
-// | http://www.creatimation.net/journal/live-request |
-// +----------------------------------------------------------------------+
-//
-// +----------------------------------------------------------------------+
-// | What is this nonsense?? (07/09/04) |
-// +----------------------------------------------------------------------+
-// | This is a script that, by using XMLHttpRequest javascript objects |
-// | you can quickly add some very click live interactive feed back to |
-// | your pages that reuire server side interaction. |
-// | |
-// | For instance, you use this to emulate a "live searching" feature |
-// | wherein users type in key phrases, and once they have stopped typing |
-// | the script will automatically search and retrive *without* a page |
-// | reload.
-// | |
-// | In another instance, I use this to product live comments by passing |
-// | the text to a Textile class that parses it to valid HTML. After |
-// | parsing, the html is returned and displayed on the page as the |
-// | user types. |
-// +----------------------------------------------------------------------+
-//
-//
-// +----------------------------------------------------------------------+
-// | Modified by Lee O'Mara <lomara@omara.ca> 12/08/2004 |
-// +----------------------------------------------------------------------+
-// | Hacked apart Jeff's script for use in Mantis. |
-// | |
-// | This script gets filters from the server and displays them without |
-// | reloading the page. |
-// | |
-// | The script tries to follow the notion of "unobtrusive javascript". |
-// | There are no event handlers in the HTML code. The events are added |
-// | on pageload(based on specific id names). |
-// +----------------------------------------------------------------------+
-*/
-
-var processURI = './return_dynamic_filters.php';
-var liveReq = false;
-
-/**
- * Build the XMLHttpRequest and send it
- */
-function liveReqDoReq() {
-
- if (liveReq && liveReq.readyState < 4) {
- liveReq.abort();
- }
-
- if (window.XMLHttpRequest) {
- // branch for IE7, Firefox, Opera, etc.
- liveReq = new XMLHttpRequest();
- } else if (window.ActiveXObject) {
- // branch for IE5, IE6 via ActiveX
- liveReq = new ActiveXObject("Microsoft.XMLHTTP");
- }
-
- name = this.id;
- liveReq.onreadystatechange = function(){liveReqProcessReqChange(name);};
- t_view = document.getElementById('filters_form_open').elements['view_type'].value;
- liveReq.open("GET", processURI + "?view_type=" + t_view + "&filter_target=" + this.id);
-
- // show "Loading..." while waiting
- document.getElementById(this.id+'_target').innerHTML = translations['loading'];
-
- liveReq.send(null);
-
- return false;
-}
-
-/**
- * Processes the results of the XMLHttpRequest
- */
-function liveReqProcessReqChange(name) {
- if (liveReq.readyState == 4) {
- document.getElementById(name+'_target').innerHTML = liveReq.responseText;
- replaceWithContent(name);
- }
-}
-
-/**
- * Strip the tag, leave the content.
- */
-function replaceWithContent(id){
- tag = document.getElementById(id);
- if (!tag) return false;
- t_parent = tag.parentNode;
- if (!t_parent) return false;
- for(var i=0; i <tag.childNodes.length; i++){
- child = tag.childNodes[i].cloneNode(true);
- t_parent.insertBefore(child, tag);
- }
- t_parent.removeChild(tag);
-}
-
-/**
- * Initialise the filter links
- */
-function labelInit(){
- // keep browsers that don't support DOM or
- // XMLHttpRequest from getting in trouble
- if (document.getElementById && (window.XMLHttpRequest || window.ActiveXObject)) {
-
- t_form = document.getElementById("filters_form_open");
- if (!t_form) return false;
-
- t_links = t_form.getElementsByTagName("a");
- if (!t_links) return false;
-
- for(var i=0; i < t_links.length; i++){
- var t_link = t_links[i];
- if (t_link.id.substring((t_link.id.length - 7), t_link.id.length) == "_filter"){
- // only attach event handler if a target is found
- if (document.getElementById(t_link.id+'_target')){
- // setup the event handler
- t_link.onclick = liveReqDoReq;
- } else {
- alert("missing target for:" +t_link.id);
- }
- }
- }
- }
-}
-
-addLoadEvent(labelInit);
239 javascript/dev/xmlhttprequest.js
View
@@ -1,239 +0,0 @@
-/*
-# Mantis - a php based bugtracking system
-
-# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
-# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
-
-# Mantis is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# Mantis is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
- *
- * --------------------------------------------------------
- * $Id$
- * --------------------------------------------------------
- */
-/*
-
-Cross-Browser XMLHttpRequest v1.1
-=================================
-
-Emulate Gecko 'XMLHttpRequest()' functionality in IE and Opera. Opera requires
-the Sun Java Runtime Environment <http://www.java.com/>.
-
-by Andrew Gregory
-http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/
-
-This work is licensed under the Creative Commons Attribution License. To view a
-copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or send
-a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,
-USA.
-
-Not Supported in Opera
-----------------------
-* user/password authentication
-* responseXML data member
-
-Not Fully Supported in Opera
-----------------------------
-* async requests
-* abort()
-* getAllResponseHeaders(), getAllResponseHeader(header)
-*/
-
-/*
- * commented out (30/07/2004) because it was causing subsequent request to freeze
-// IE support
-if (window.ActiveXObject && !window.XMLHttpRequest) {
- window.XMLHttpRequest = function() {
- return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP');
- };
-}
-*/
-
-// Gecko support
-/* ;-) */
-// Opera support
-if (window.opera && !window.XMLHttpRequest) {
- window.XMLHttpRequest = function() {
- this.readyState = 0; // 0=uninitialized,1=loading,2=loaded,3=interactive,4=complete
- this.status = 0; // HTTP status codes
- this.statusText = '';
- this._headers = [];
- this._aborted = false;
- this._async = true;
- this.abort = function() {
- this._aborted = true;
- };
- this.getAllResponseHeaders = function() {
- return this.getAllResponseHeader('*');
- };
- this.getAllResponseHeader = function(header) {
- var ret = '';
- for (var i = 0; i < this._headers.length; i++) {
- if (header == '*' || this._headers[i].h == header) {
- ret += this._headers[i].h + ': ' + this._headers[i].v + '\n';
- }
- }
- return ret;
- };
- this.setRequestHeader = function(header, value) {
- this._headers[this._headers.length] = {h:header, v:value};
- };
- this.open = function(method, url, async, user, password) {
- this.method = method;
- this.url = url;
- this._async = true;
- this._aborted = false;
- if (arguments.length >= 3) {
- this._async = async;
- }
- if (arguments.length > 3) {
- // user/password support requires a custom Authenticator class
- opera.postError('XMLHttpRequest.open() - user/password not supported');
- }
- this._headers = [];
- this.readyState = 1;
- if (this.onreadystatechange) {
- this.onreadystatechange();
- }
- };
- this.send = function(data) {
- if (!navigator.javaEnabled()) {
- alert("XMLHttpRequest.send() - Java must be installed and enabled.");
- return;
- }
- if (this._async) {
- setTimeout(this._sendasync, 0, this, data);
- // this is not really asynchronous and won't execute until the current
- // execution context ends
- } else {
- this._sendsync(data);
- }
- }
- this._sendasync = function(req, data) {
- if (!req._aborted) {
- req._sendsync(data);
- }
- };
- this._sendsync = function(data) {
- this.readyState = 2;
- if (this.onreadystatechange) {
- this.onreadystatechange();
- }
- // open connection
- var url = new java.net.URL(new java.net.URL(window.location.href), this.url);
- var conn = url.openConnection();
- for (var i = 0; i < this._headers.length; i++) {
- conn.setRequestProperty(this._headers[i].h, this._headers[i].v);
- }
- this._headers = [];
- if (this.method == 'POST') {
- // POST data
- conn.setDoOutput(true);
- var wr = new java.io.OutputStreamWriter(conn.getOutputStream());
- wr.write(data);
- wr.flush();
- wr.close();
- }
- // read response headers
- // NOTE: the getHeaderField() methods always return nulls for me :(
- var gotContentEncoding = false;
- var gotContentLength = false;
- var gotContentType = false;
- var gotDate = false;
- var gotExpiration = false;
- var gotLastModified = false;
- for (var i = 0; ; i++) {
- var hdrName = conn.getHeaderFieldKey(i);
- var hdrValue = conn.getHeaderField(i);
- if (hdrName == null && hdrValue == null) {
- break;
- }
- if (hdrName != null) {
- this._headers[this._headers.length] = {h:hdrName, v:hdrValue};
- switch (hdrName.toLowerCase()) {
- case 'content-encoding': gotContentEncoding = true; break;
- case 'content-length' : gotContentLength = true; break;
- case 'content-type' : gotContentType = true; break;
- case 'date' : gotDate = true; break;
- case 'expires' : gotExpiration = true; break;
- case 'last-modified' : gotLastModified = true; break;
- }
- }
- }
- // try to fill in any missing header information
- var val;
- val = conn.getContentEncoding();
- if (val != null && !gotContentEncoding) this._headers[this._headers.length] = {h:'Content-encoding', v:val};
- val = conn.getContentLength();
- if (val != -1 && !gotContentLength) this._headers[this._headers.length] = {h:'Content-length', v:val};
- val = conn.getContentType();
- if (val != null && !gotContentType) this._headers[this._headers.length] = {h:'Content-type', v:val};
- val = conn.getDate();
- if (val != 0 && !gotDate) this._headers[this._headers.length] = {h:'Date', v:(new Date(val)).toUTCString()};
- val = conn.getExpiration();
- if (val != 0 && !gotExpiration) this._headers[this._headers.length] = {h:'Expires', v:(new Date(val)).toUTCString()};
- val = conn.getLastModified();
- if (val != 0 && !gotLastModified) this._headers[this._headers.length] = {h:'Last-modified', v:(new Date(val)).toUTCString()};
- // read response data
- var reqdata = '';
- var stream = conn.getInputStream();
- if (stream) {
- var reader = new java.io.BufferedReader(new java.io.InputStreamReader(stream));
- var line;
- while ((line = reader.readLine()) != null) {
- if (this.readyState == 2) {
- this.readyState = 3;
- if (this.onreadystatechange) {
- this.onreadystatechange();
- }
- }
- reqdata += line + '\n';
- }
- reader.close();
- this.status = 200;
- this.statusText = 'OK';
- this.responseText = reqdata;
- this.readyState = 4;
- if (this.onreadystatechange) {
- this.onreadystatechange();
- }
- if (this.onload) {
- this.onload();
- }
- } else {
- // error
- this.status = 404;
- this.statusText = 'Not Found';
- this.responseText = '';
- this.readyState = 4;
- if (this.onreadystatechange) {
- this.onreadystatechange();
- }
- if (this.onerror) {
- this.onerror();
- }
- }
- };
- };
-}
-// ActiveXObject emulation
-if (!window.ActiveXObject && window.XMLHttpRequest) {
- window.ActiveXObject = function(type) {
- switch (type.toLowerCase()) {
- case 'microsoft.xmlhttp':
- case 'msxml2.xmlhttp':
- return new XMLHttpRequest();
- }
- return null;
- };
-}
1  javascript/dynamic_filters.js
View
@@ -1 +0,0 @@
-var processURI="./return_dynamic_filters.php";var liveReq=false;function liveReqDoReq(){if(liveReq&&liveReq.readyState<4){liveReq.abort()}if(window.XMLHttpRequest){liveReq=new XMLHttpRequest()}else{if(window.ActiveXObject){liveReq=new ActiveXObject("Microsoft.XMLHTTP")}}name=this.id;liveReq.onreadystatechange=function(){liveReqProcessReqChange(name)};t_view=document.getElementById("filters_form_open").elements.view_type.value;liveReq.open("GET",processURI+"?view_type="+t_view+"&filter_target="+this.id);document.getElementById(this.id+"_target").innerHTML=translations['loading'];liveReq.send(null);return false}function liveReqProcessReqChange(a){if(liveReq.readyState==4){document.getElementById(a+"_target").innerHTML=liveReq.responseText;replaceWithContent(a)}}function replaceWithContent(b){tag=document.getElementById(b);if(!tag){return false}t_parent=tag.parentNode;if(!t_parent){return false}for(var a=0;a<tag.childNodes.length;a++){child=tag.childNodes[a].cloneNode(true);t_parent.insertBefore(child,tag)}t_parent.removeChild(tag)}function labelInit(){if(document.getElementById&&(window.XMLHttpRequest||window.ActiveXObject)){t_form=document.getElementById("filters_form_open");if(!t_form){return false}t_links=t_form.getElementsByTagName("a");if(!t_links){return false}for(var b=0;b<t_links.length;b++){var a=t_links[b];if(a.id.substring((a.id.length-7),a.id.length)=="_filter"){if(document.getElementById(a.id+"_target")){a.onclick=liveReqDoReq}else{alert("missing target for:"+a.id)}}}}}addLoadEvent(labelInit);
1  javascript/xmlhttprequest.js
View
@@ -1 +0,0 @@
-if(window.opera&&!window.XMLHttpRequest){window.XMLHttpRequest=function(){this.readyState=0;this.status=0;this.statusText="";this._headers=[];this._aborted=false;this._async=true;this.abort=function(){this._aborted=true};this.getAllResponseHeaders=function(){return this.getAllResponseHeader("*")};this.getAllResponseHeader=function(c){var a="";for(var b=0;b<this._headers.length;b++){if(c=="*"||this._headers[b].h==c){a+=this._headers[b].h+": "+this._headers[b].v+"\n"}}return a};this.setRequestHeader=function(b,a){this._headers[this._headers.length]={h:b,v:a}};this.open=function(e,c,d,a,b){this.method=e;this.url=c;this._async=true;this._aborted=false;if(arguments.length>=3){this._async=d}if(arguments.length>3){opera.postError("XMLHttpRequest.open() - user/password not supported")}this._headers=[];this.readyState=1;if(this.onreadystatechange){this.onreadystatechange()}};this.send=function(a){if(!navigator.javaEnabled()){alert("XMLHttpRequest.send() - Java must be installed and enabled.");return}if(this._async){setTimeout(this._sendasync,0,this,a)}else{this._sendsync(a)}};this._sendasync=function(a,b){if(!a._aborted){a._sendsync(b)}};this._sendsync=function(r){this.readyState=2;if(this.onreadystatechange){this.onreadystatechange()}var f=new java.net.URL(new java.net.URL(window.location.href),this.url);var j=f.openConnection();for(var p=0;p<this._headers.length;p++){j.setRequestProperty(this._headers[p].h,this._headers[p].v)}this._headers=[];if(this.method=="POST"){j.setDoOutput(true);var b=new java.io.OutputStreamWriter(j.getOutputStream());b.write(r);b.flush();b.close()}var m=false;var k=false;var e=false;var c=false;var h=false;var q=false;for(var p=0;;p++){var o=j.getHeaderFieldKey(p);var l=j.getHeaderField(p);if(o==null&&l==null){break}if(o!=null){this._headers[this._headers.length]={h:o,v:l};switch(o.toLowerCase()){case"content-encoding":m=true;break;case"content-length":k=true;break;case"content-type":e=true;break;case"date":c=true;break;case"expires":h=true;break;case"last-modified":q=true;break}}}var s;s=j.getContentEncoding();if(s!=null&&!m){this._headers[this._headers.length]={h:"Content-encoding",v:s}}s=j.getContentLength();if(s!=-1&&!k){this._headers[this._headers.length]={h:"Content-length",v:s}}s=j.getContentType();if(s!=null&&!e){this._headers[this._headers.length]={h:"Content-type",v:s}}s=j.getDate();if(s!=0&&!c){this._headers[this._headers.length]={h:"Date",v:(new Date(s)).toUTCString()}}s=j.getExpiration();if(s!=0&&!h){this._headers[this._headers.length]={h:"Expires",v:(new Date(s)).toUTCString()}}s=j.getLastModified();if(s!=0&&!q){this._headers[this._headers.length]={h:"Last-modified",v:(new Date(s)).toUTCString()}}var d="";var g=j.getInputStream();if(g){var a=new java.io.BufferedReader(new java.io.InputStreamReader(g));var n;while((n=a.readLine())!=null){if(this.readyState==2){this.readyState=3;if(this.onreadystatechange){this.onreadystatechange()}}d+=n+"\n"}a.close();this.status=200;this.statusText="OK";this.responseText=d;this.readyState=4;if(this.onreadystatechange){this.onreadystatechange()}if(this.onload){this.onload()}}else{this.status=404;this.statusText="Not Found";this.responseText="";this.readyState=4;if(this.onreadystatechange){this.onreadystatechange()}if(this.onerror){this.onerror()}}}}}if(!window.ActiveXObject&&window.XMLHttpRequest){window.ActiveXObject=function(a){switch(a.toLowerCase()){case"microsoft.xmlhttp":case"msxml2.xmlhttp":return new XMLHttpRequest()}return null}};
2  lang/strings_english.txt
View
@@ -1366,7 +1366,7 @@ If you requested this verification, visit the following URL to change your passw
'email_on_sponsorship_changed' => 'E-mail on Sponsorship changed',
'email_on_relationship_changed' => 'E-mail on Relationship changed',
- # DHTML filters
+ # Dynamic filters (load filter controls via AJAX upon request)
'loading' => 'Loading...',
# filter_api.php
2  return_dynamic_filters.php
View
@@ -115,7 +115,7 @@
$t_select_modifier = '';
if ( 'advanced' == $f_view_type ) {
- $t_select_modifier = 'multiple="multiple" size="10" ';
+ $t_select_modifier = ' multiple="multiple" size="10"';
}
/**
5 view_all_bug_page.php
View
@@ -50,11 +50,6 @@
require_api( 'project_api.php' );
require_api( 'user_api.php' );
-if ( config_get( 'dhtml_filters' ) ) {
- require_js( 'xmlhttprequest.js' );
- require_js( 'addLoadEvent.js' );
- require_js( 'dynamic_filters.js' );
-}
require_js( 'bugFilter.js' );
auth_ensure_user_authenticated();
56 view_filters_page.php
View
@@ -72,52 +72,6 @@
$t_target_field = '';
}
-if ( ON == config_get( 'use_javascript' ) ) {
- ?>
- <body onload="SetInitialFocus();">
-
- <script type="text/javascript">
- <!--
- function SetInitialFocus() {
- <?php
- global $t_target_field;
- if ( $t_target_field ) {
- $f_view_type = gpc_get_string( 'view_type', '' );
- if ( ( FILTER_PROPERTY_HIDE_STATUS . '[]' == $t_target_field ) && ( 'advanced' == $f_view_type ) ) {
- echo 'field_to_focus = "', FILTER_PROPERTY_STATUS, '[]";';
- } else {
- echo 'field_to_focus = "', $t_target_field, '";';
- }
- } else {
- print "field_to_focus = null;";
- }
- ?>
- if ( field_to_focus ) {
- eval( "document.filters['" + field_to_focus + "'].focus()" );
- }
-
- SwitchDateFields();
- }
-
- function SwitchDateFields() {
- // All fields need to be enabled to go back to the script
- <?php
- echo 'document.filters.', FILTER_PROPERTY_START_MONTH, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- echo 'document.filters.', FILTER_PROPERTY_START_DAY, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- echo 'document.filters.', FILTER_PROPERTY_START_YEAR, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- echo 'document.filters.', FILTER_PROPERTY_END_MONTH, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- echo 'document.filters.', FILTER_PROPERTY_END_DAY, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- echo 'document.filters.', FILTER_PROPERTY_END_YEAR, '.disabled = ! document.filters.', FILTER_PROPERTY_FILTER_BY_DATE, '.checked;';
- ?>
-
- return true;
- }
- // -->
- </script>
-
- <?php
-}
-
/** @todo thraxisp - could this be replaced by a call to filter_draw_selection_area2 */
$t_filter = current_user_get_bug_filter();
@@ -195,7 +149,7 @@ function SwitchDateFields() {
$t_select_modifier = '';
if ( 'advanced' == $f_view_type ) {
- $t_select_modifier = 'multiple="multiple" size="10" ';
+ $t_select_modifier = ' multiple="multiple" size="10"';
}
$t_show_product_version = version_should_show_product_version( $t_project_id );
@@ -203,7 +157,6 @@ function SwitchDateFields() {
$t_show_tags = access_has_global_level( config_get( 'tag_view_threshold' ) );
?>
-<br />
<form method="post" name="filters" action="<?php echo $t_action; ?>">
<?php # CSRF protection not required here - form does not result in modifications ?>
<input type="hidden" name="type" value="1" />
@@ -359,11 +312,7 @@ function SwitchDateFields() {
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'sticky' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
<td class="small-caption" colspan="<?php echo ( 3 * $t_custom_cols ); ?>">
- <input type="checkbox" name="do_filter_by_date" <?php
- check_checked( $t_filter['do_filter_by_date'], 'on' );
- if ( ON == config_get( 'use_javascript' ) ) {
- print "onclick=\"SwitchDateFields();\""; } ?> />
- <?php echo lang_get( 'use_date_filters' ) ?>
+ <label><input type="checkbox" id="use_date_filters" name="<?php echo FILTER_PROPERTY_FILTER_BY_DATE ?>" <?php check_checked( $t_filter['filter_by_date'], 'on' ) ?> /><?php echo lang_get( 'use_date_filters' )?></label>
</td>
<td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
<?php echo lang_get( 'bug_relationships' ) ?>
@@ -544,6 +493,5 @@ function SwitchDateFields() {
</tr>
</table>
</form>
-
<?php
html_page_bottom();
Please sign in to comment.
Something went wrong with that request. Please try again.