Skip to content

Commit

Permalink
Obsolete jscalendar global config & use compatible date format
Browse files Browse the repository at this point in the history
Fixes #20040
  • Loading branch information
syncguru authored and dregad committed Dec 20, 2016
1 parent 0c00e73 commit 9720af8
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions bug_actiongroup_page.php
Expand Up @@ -279,13 +279,13 @@
$t_bug_id = $f_bug_arr[0];
$t_bug = bug_get( $t_bug_id );
if( !date_is_null( $t_bug->due_date ) ) {
$t_date_to_display = date( config_get( 'calendar_date_format' ), $t_bug->due_date );
$t_date_to_display = date( config_get( 'datetime_field_format' ), $t_bug->due_date );
}
}

echo '<input type="text" id="due_date" name="due_date" class="datetimepicker input-sm" size="20" maxlength="16" ' .
'data-picker-locale="' . lang_get_current_datetime_locale() .
'" data-picker-format="' . config_get( 'calendar_js_date_format' ) . '"' .
'" data-picker-format="' . config_get( 'datetime_picker_format' ) . '"' .
'" value="' . $t_date_to_display . '" />';
echo '<i class="fa fa-calendar fa-xlg"></i>';
} else {
Expand Down
4 changes: 2 additions & 2 deletions bug_change_status_page.php
Expand Up @@ -231,7 +231,7 @@
$t_date_to_display = '';

if( !date_is_null( $t_bug->due_date ) ) {
$t_date_to_display = date( config_get( 'calendar_date_format' ), $t_bug->due_date );
$t_date_to_display = date( config_get( 'datetime_field_format' ), $t_bug->due_date );
}
?>
<!-- Due date -->
Expand All @@ -242,7 +242,7 @@
<td>
<input type="text" id="due_date" name="due_date" class="datetimepicker input-sm" size="20" maxlength="16"
data-picker-locale="<?php lang_get_current_datetime_locale() ?>"
data-picker-format="<?php echo config_get( 'calendar_js_date_format' ) ?>
data-picker-format="<?php echo config_get( 'datetime_picker_format' ) ?>
<?php helper_get_tab_index() ?> value="<?php echo $t_date_to_display ?>" />
<i class="fa fa-calendar fa-xlg datetimepicker"></i>
</td>
Expand Down
4 changes: 2 additions & 2 deletions bug_report_page.php
Expand Up @@ -347,7 +347,7 @@ class="dropzone-form"
$t_date_to_display = '';

if( !date_is_null( $f_due_date ) ) {
$t_date_to_display = date( config_get( 'calendar_date_format' ), $f_due_date );
$t_date_to_display = date( config_get( 'datetime_field_format' ), $f_due_date );
}
?>
<tr>
Expand All @@ -357,7 +357,7 @@ class="dropzone-form"
<td>
<?php echo '<input ' . helper_get_tab_index() . ' type="text" id="due_date" name="due_date" class="datetimepicker input-sm" ' .
'data-picker-locale="' . lang_get_current_datetime_locale() .
'" data-picker-format="' . config_get( 'calendar_js_date_format' ) . '" ' .
'" data-picker-format="' . config_get( 'datetime_picker_format' ) . '" ' .
'size="20" maxlength="16" value="' . $t_date_to_display . '" />' ?>
<i class="fa fa-calendar fa-xlg"></i>
</td>
Expand Down
4 changes: 2 additions & 2 deletions bug_update_page.php
Expand Up @@ -351,10 +351,10 @@
$t_date_to_display = '';

if( !date_is_null( $t_bug->due_date ) ) {
$t_date_to_display = date( config_get( 'calendar_date_format' ), $t_bug->due_date );
$t_date_to_display = date( config_get( 'datetime_field_format' ), $t_bug->due_date );
}
echo '<input ' . helper_get_tab_index() . ' type="text" id="due_date" name="due_date" class="datetimepicker input-sm" size="20" ' .
'data-picker-locale="' . lang_get_current_datetime_locale() . '" data-picker-format="' . config_get( 'calendar_js_date_format' ) . '" ' .
'data-picker-locale="' . lang_get_current_datetime_locale() . '" data-picker-format="' . config_get( 'datetime_picker_format' ) . '" ' .
'" maxlength="16" value="' . $t_date_to_display . '" />';
echo '<i class="fa fa-calendar fa-xlg"></i>';
} else {
Expand Down
16 changes: 8 additions & 8 deletions config_defaults_inc.php
Expand Up @@ -1140,20 +1140,20 @@
$g_complete_date_format = 'Y-m-d H:i T';

/**
* calendar widget (datetimepicker) format string
* datetime picker widget format string
* go to http://momentjs.com/docs/#/displaying/format/
* for detailed instructions on date formatting
* @global string $g_calendar_date_format
* @global string $g_datetime_picker_format
*/
$g_calendar_js_date_format = 'Y-M-D H:m';
$g_datetime_picker_format = 'Y-MM-DD H:m';

/**
* calendar widget (datetimepicker) format string
* datetime field format string
* go to http://www.php.net/manual/en/function.date.php
* for detailed instructions on date formatting
* @global string $g_calendar_date_format
* @global string $g_datetime_field_format
*/
$g_calendar_date_format = 'Y-m-d H:i';
$g_datetime_field_format = 'Y-m-d H:i';

##############################
# MantisBT TimeZone Settings #
Expand Down Expand Up @@ -4276,8 +4276,8 @@
'bugnote_user_change_view_state_threshold',
'bugnote_user_delete_threshold',
'bugnote_user_edit_threshold',
'calendar_date_format',
'calendar_js_date_format',
'datetime_field_format',
'datetime_picker_format',
'cdn_enabled',
'change_view_status_threshold',
'check_mx_record',
Expand Down
6 changes: 0 additions & 6 deletions core/date_api.php
Expand Up @@ -42,12 +42,6 @@
require_api( 'user_pref_api.php' );
require_api( 'utility_api.php' );

# Keeps track of whether the external files required for jscalendar to work
# have already been included in the output sent to the client. jscalendar
# will not work correctly if it is included multiple times on the same page.
# @global bool $g_jscalendar_included_already
$g_calendar_already_imported = false;

$g_cache_timezone = array();

/**
Expand Down
2 changes: 2 additions & 0 deletions core/obsolete.php
Expand Up @@ -206,3 +206,5 @@
# changes in 2.0.0dev
config_obsolete( 'icon_path' );
config_obsolete( 'bug_print_page_fields' );
config_obsolete( 'calendar_js_date_format' );
config_obsolete( 'calendar_date_format' );
2 changes: 1 addition & 1 deletion javascript_config.php
Expand Up @@ -59,5 +59,5 @@ function print_config_value( $p_config_key ) {
# should only be known internally to the server.

echo "var config = new Array();\n";
print_config_value( 'calendar_js_date_format' );
print_config_value( 'datetime_picker_format' );
print_config_value( 'short_path' );
2 changes: 1 addition & 1 deletion manage_proj_ver_edit_page.php
Expand Up @@ -97,7 +97,7 @@
<?php echo lang_get( 'date_order' ) ?>
</td>
<td>
<input type="text" id="proj-version-date-order" name="date_order" class="datetime input-sm" size="32" value="<?php echo (date_is_null( $t_version->date_order ) ? '' : string_attribute( date( config_get( 'calendar_date_format' ), $t_version->date_order ) ) ) ?>" />
<input type="text" id="proj-version-date-order" name="date_order" class="datetime input-sm" size="32" value="<?php echo (date_is_null( $t_version->date_order ) ? '' : string_attribute( date( config_get( 'datetime_field_format' ), $t_version->date_order ) ) ) ?>" />
</td>
</tr>
<tr>
Expand Down

0 comments on commit 9720af8

Please sign in to comment.