Skip to content

Commit

Permalink
Obsolete use_javascript:
Browse files Browse the repository at this point in the history
Following brief discussion on Mailing list, from a server side,
we can't tell if someone is running a plugin such as no-script
for firefox, so the frontend should deal with handling the case
where javascript is not available on a client, as opposed to
having this as a configuration variable.
  • Loading branch information
mantis committed Sep 27, 2014
1 parent aded8cc commit 75be0f4
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 100 deletions.
5 changes: 0 additions & 5 deletions admin/check/check_display_inc.php
Expand Up @@ -36,11 +36,6 @@

check_print_section_header_row( 'Display' );

check_print_test_row(
'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(
'bug_link_tag is not blank/null',
config_get_global( 'bug_link_tag' ),
Expand Down
10 changes: 2 additions & 8 deletions bug_report_page.php
Expand Up @@ -362,13 +362,9 @@
</tr>
<tr>
<td colspan="2" class="none">
<?php if( ON == config_get( 'use_javascript' ) ) { ?>
<?php collapse_open( 'profile' ); collapse_icon( 'profile' ); ?>
<?php echo lang_get( 'or_fill_in' ); ?>
<?php collapse_open( 'profile' ); collapse_icon( 'profile' ); ?>
<?php echo lang_get( 'or_fill_in' ); ?>
<table class="width100" cellspacing="0">
<?php } else { ?>
<?php echo lang_get( 'or_fill_in' ); ?>
<?php } ?>
<tr>
<th class="category">
<label for="platform"><?php echo lang_get( 'platform' ) ?></label>
Expand Down Expand Up @@ -422,11 +418,9 @@
?>
</td>
</tr>
<?php if( ON == config_get( 'use_javascript' ) ) { ?>
</table>
<?php collapse_closed( 'profile' ); collapse_icon( 'profile' ); echo lang_get( 'or_fill_in' );?>
<?php collapse_end( 'profile' ); ?>
<?php } ?>
</td>
</tr>
<?php } ?>
Expand Down
2 changes: 1 addition & 1 deletion bugnote_add_inc.php
Expand Up @@ -114,7 +114,7 @@
<?php echo lang_get( 'time_tracking' ) ?>
</th>
<td>
<?php if( config_get( 'time_tracking_stopwatch' ) && config_get( 'use_javascript' ) ) { ?>
<?php if( config_get( 'time_tracking_stopwatch' ) ) { ?>
<input type="text" name="time_tracking" class="stopwatch_time" size="8" placeholder="hh:mm:ss" />
<input type="button" name="time_tracking_toggle" class="stopwatch_toggle" value="<?php echo lang_get( 'time_tracking_stopwatch_start' ) ?>" />
<input type="button" name="time_tracking_reset" class="stopwatch_reset" value="<?php echo lang_get( 'time_tracking_stopwatch_reset' ) ?>" />
Expand Down
12 changes: 1 addition & 11 deletions config_defaults_inc.php
Expand Up @@ -3282,16 +3282,6 @@
*/
$g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';

#################################
# MantisBT Javascript Variables #
#################################

/**
* allow the use of Javascript?
* @global int $g_use_javascript
*/
$g_use_javascript = ON;

###############################
# MantisBT Speed Optimisation #
###############################
Expand Down Expand Up @@ -4177,7 +4167,7 @@
'hostname','html_valid_tags', 'html_valid_tags_single_line', 'default_language',
'language_auto_map', 'fallback_language', 'login_method', 'plugins_enabled', 'session_handler',
'session_save_path', 'session_validation', 'show_detailed_errors', 'show_queries_count',
'stop_on_errors', 'use_javascript', 'version_suffix',
'stop_on_errors', 'version_suffix',
'fileinfo_magic_db_file', 'css_include_file', 'css_rtl_include_file', 'meta_include_file',
'file_type_icons', 'path', 'icon_path', 'short_path', 'absolute_path', 'core_path',
'class_path','library_path', 'language_path', 'absolute_path_default_upload_folder',
Expand Down
12 changes: 2 additions & 10 deletions core/collapse_api.php
Expand Up @@ -122,10 +122,6 @@ function collapse_closed( $p_name, $p_section = '' ) {
* @return void
*/
function collapse_icon( $p_name, $p_section = '' ) {
if( OFF == config_get( 'use_javascript' ) ) {
return;
}

global $g_open_collapse_section;

if( $g_open_collapse_section === true ) {
Expand Down Expand Up @@ -164,11 +160,7 @@ function collapse_end( $p_name, $p_section = '' ) {

$g_open_collapse_section = false;

if( ON == config_get( 'use_javascript' ) ) {
ob_end_flush();
} else {
ob_end_clean();
}
ob_end_flush();

$g_current_collapse_section = null;
}
Expand All @@ -181,7 +173,7 @@ function collapse_end( $p_name, $p_section = '' ) {
function collapse_display( $p_block ) {
global $g_collapse_cache_token;

if( !isset( $g_collapse_cache_token[$p_block] ) || OFF == config_get( 'use_javascript' ) ) {
if( !isset( $g_collapse_cache_token[$p_block] ) ) {
return true;
}

Expand Down
92 changes: 42 additions & 50 deletions core/filter_api.php
Expand Up @@ -2203,7 +2203,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
);
}

$t_dynamic_filter_expander_class = ( config_get( 'use_javascript' ) && config_get( 'use_dynamic_filters' ) ) ? ' class="dynamic-filter-expander"' : '';
$t_dynamic_filter_expander_class = ( config_get( 'use_dynamic_filters' ) ) ? ' class="dynamic-filter-expander"' : '';
?>

<tr <?php echo 'class="' . $t_trclass . '"';?>>
Expand Down Expand Up @@ -3459,7 +3459,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
<div id="filter-links" class="filter-links">
<ul>
<?php
$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=';
$f_switch_view_link = ( 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 ) {
Expand Down Expand Up @@ -3879,13 +3879,10 @@ function print_filter_do_filter_by_date( $p_hide_checkbox = false ) {
<?php
}

# Make sure the date selection controls are enabled by default
# if we do not use javascript
$t_menu_disabled =
!config_get( 'use_javascript' )
|| 'on' == $g_filter[FILTER_PROPERTY_FILTER_BY_DATE]
? ''
: ' disabled="disabled" ';
$t_menu_disabled = '';
if( 'on' !== $g_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) {
$t_menu_disabled = ' disabled="disabled" ';
}
?>

<!-- Start date -->
Expand Down Expand Up @@ -4241,47 +4238,42 @@ function print_filter_custom_field_date( $p_field_num, $p_field_id ) {
$t_end_time = 0;
}

if( OFF == config_get( 'use_javascript' ) ) {
$t_start_disable = false;
$t_end_disable = false;
} else {
$t_start_disable = true;
$t_end_disable = true;

# if $g_filter['custom_fields'][$p_field_id][0] is not set (ie no filter),
# we will drop through the following switch and use the default values
# above, so no need to check if stuff is set or not.
switch( $g_filter['custom_fields'][$p_field_id][0] ) {
case CUSTOM_FIELD_DATE_ANY:
case CUSTOM_FIELD_DATE_NONE:
break;
case CUSTOM_FIELD_DATE_BETWEEN:
$t_start_disable = false;
$t_end_disable = false;
$t_start = $t_start_time;
$t_end = $t_end_time;
break;
case CUSTOM_FIELD_DATE_ONORBEFORE:
$t_start_disable = false;
$t_start = $t_end_time;
break;
case CUSTOM_FIELD_DATE_BEFORE:
$t_start_disable = false;
$t_start = $t_end_time;
break;
case CUSTOM_FIELD_DATE_ON:
$t_start_disable = false;
$t_start = $t_start_time;
break;
case CUSTOM_FIELD_DATE_AFTER:
$t_start_disable = false;
$t_start = $t_start_time;
break;
case CUSTOM_FIELD_DATE_ONORAFTER:
$t_start_disable = false;
$t_start = $t_start_time;
break;
}
$t_start_disable = true;
$t_end_disable = true;

# if $g_filter['custom_fields'][$p_field_id][0] is not set (ie no filter),
# we will drop through the following switch and use the default values
# above, so no need to check if stuff is set or not.
switch( $g_filter['custom_fields'][$p_field_id][0] ) {
case CUSTOM_FIELD_DATE_ANY:
case CUSTOM_FIELD_DATE_NONE:
break;
case CUSTOM_FIELD_DATE_BETWEEN:
$t_start_disable = false;
$t_end_disable = false;
$t_start = $t_start_time;
$t_end = $t_end_time;
break;
case CUSTOM_FIELD_DATE_ONORBEFORE:
$t_start_disable = false;
$t_start = $t_end_time;
break;
case CUSTOM_FIELD_DATE_BEFORE:
$t_start_disable = false;
$t_start = $t_end_time;
break;
case CUSTOM_FIELD_DATE_ON:
$t_start_disable = false;
$t_start = $t_start_time;
break;
case CUSTOM_FIELD_DATE_AFTER:
$t_start_disable = false;
$t_start = $t_start_time;
break;
case CUSTOM_FIELD_DATE_ONORAFTER:
$t_start_disable = false;
$t_start = $t_start_time;
break;
}

echo '<table cellspacing="0" cellpadding="0"><tr><td>' . "\n";
Expand Down
19 changes: 9 additions & 10 deletions core/html_api.php
Expand Up @@ -430,16 +430,15 @@ function require_js( $p_script_path ) {
* @return void
*/
function html_head_javascript() {
if( config_get( 'use_javascript' ) ) {
global $g_scripts_included;
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";
html_javascript_link( 'jquery-1.9.1.min.js' );
html_javascript_link( 'jquery-ui-1.10.0.custom.min.js' );
html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}
global $g_scripts_included;

echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_config.php' ) . '"></script>' . "\n";
echo "\t" . '<script type="text/javascript" src="' . helper_mantis_url( 'javascript_translations.php' ) . '"></script>' . "\n";
html_javascript_link( 'jquery-1.9.1.min.js' );
html_javascript_link( 'jquery-ui-1.10.0.custom.min.js' );
html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}
}

Expand Down
1 change: 1 addition & 0 deletions core/obsolete.php
Expand Up @@ -188,3 +188,4 @@
config_obsolete( 'colour_project' );
config_obsolete( 'colour_global' );
config_obsolete( 'content_expire' );
config_obsolete( 'use_javascript' );
6 changes: 2 additions & 4 deletions docbook/Admin_Guide/en-US/Configuration.xml
Expand Up @@ -2343,9 +2343,7 @@ $g_main_menu_custom_options = array(
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.
bandwidth reduction.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -3763,7 +3761,7 @@ or
<term>$g_time_tracking_stopwatch</term>
<listitem>
<para>
Instead of a text field turning this option on places a stopwatch on the page with <guibutton>Start/Stop</guibutton> and <guibutton>Reset</guibutton> buttons next to it. You must have $g_use_javascript switched on for this to take effect. A bit gimmicky, but who cares.
Instead of a text field turning this option on places a stopwatch on the page with <guibutton>Start/Stop</guibutton> and <guibutton>Reset</guibutton> buttons next to it. A bit gimmicky, but who cares.
</para>
</listitem>
</varlistentry>
Expand Down
2 changes: 1 addition & 1 deletion view_all_inc.php
Expand Up @@ -227,7 +227,7 @@ function write_bug_rows( array $p_rows ) {
<td class="left" colspan="<?php echo $t_col_count; ?>">
<span class="floatleft">
<?php
if( $g_checkboxes_exist && ON == config_get( 'use_javascript' ) ) {
if( $g_checkboxes_exist ) {
echo '<input type="checkbox" id="bug_arr_all" name="bug_arr_all" value="all" class="check_all" />';
echo '<label for="bug_arr_all">' . lang_get( 'select_all' ) . '</label>';
}
Expand Down

0 comments on commit 75be0f4

Please sign in to comment.