New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace jscalendar with bootstrap-datetimepicker library #943
Changes from 1 commit
2ca5023
ed979aa
ed68855
9a26dec
e51f262
f92093d
44102be
7dd133a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,7 @@ function http_security_headers() { | |
http_csp_add( 'style-src', 'ajax.googleapis.com' ); | ||
http_csp_add( 'style-src', 'maxcdn.bootstrapcdn.com' ); | ||
http_csp_add( 'style-src', 'fonts.googleapis.com' ); | ||
http_csp_add( 'style-src', 'cdnjs.cloudflare.com' ); | ||
|
||
http_csp_add( 'font-src', 'fonts.gstatic.com' ); | ||
http_csp_add( 'font-src', 'maxcdn.bootstrapcdn.com' ); | ||
|
@@ -231,17 +232,7 @@ function http_security_headers() { | |
http_csp_add( 'script-src', 'maxcdn.bootstrapcdn.com' ); | ||
|
||
http_csp_add( 'img-src', 'ajax.googleapis.com' ); | ||
} | ||
|
||
# Relaxing policy for bug report page to allow inline scripts. | ||
# Should be removed once #20040 is fixed. | ||
if( 'bug_report_page.php' == basename( $_SERVER['SCRIPT_NAME'] ) ) { | ||
http_csp_add( 'script-src', "'unsafe-inline'" ); | ||
} | ||
|
||
# The JS Calendar control does unsafe eval, remove once we upgrade the control (see #20040) | ||
if( 'bug_update_page.php' == basename( $_SERVER['SCRIPT_NAME'] ) ) { | ||
http_csp_add( 'script-src', "'unsafe-eval'" ); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dregad fyi: csp exception no longer needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cheers |
||
|
||
http_csp_emit_header(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,3 +354,20 @@ function lang_get_defaulted( $p_string, $p_default = null, $p_lang = null ) { | |
} | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Maps current lang string to moment.js locale https://github.com/moment/moment/tree/develop/locale | ||
* @return string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Document what the return string will contain. |
||
*/ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove blank line between phpdoc and function. |
||
function lang_get_current_datetime_locale() { | ||
$t_lang = lang_get_current(); | ||
|
||
# Lookup $g_language_auto_map by value and then return the first key | ||
$t_auto_map = config_get( 'language_auto_map' ); | ||
$t_entry = array_search( $t_lang, $t_auto_map ); | ||
$t_key_arr = explode( ',', $t_entry ); | ||
|
||
return $t_key_arr[0]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,12 +257,18 @@ function layout_head_css() { | |
|
||
# theme text fonts | ||
html_css_cdn_link( 'https://fonts.googleapis.com/css?family=Open+Sans:300,400' ); | ||
|
||
# datetimepicker | ||
html_css_cdn_link( 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/' . DATETIME_PICKER_VERSION . '/css/bootstrap-datetimepicker.min.css' ); | ||
} else { | ||
html_css_link( 'bootstrap-' . BOOTSTRAP_VERSION . '.min.css' ); | ||
html_css_link( 'font-awesome-' . FONT_AWESOME_VERSION . '.min.css' ); | ||
|
||
# theme text fonts | ||
html_css_link( 'open-sans.css' ); | ||
|
||
# datetimepicker | ||
html_css_link( 'bootstrap-datetimepicker.min.css' ); | ||
} | ||
|
||
# page specific plugin styles | ||
|
@@ -307,11 +313,21 @@ function layout_head_javascript() { | |
* @return null | ||
*/ | ||
function layout_body_javascript() { | ||
# bootstrap | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove extra blank line. |
||
if ( config_get_global( 'cdn_enabled' ) == ON ) { | ||
# bootstrap | ||
html_javascript_cdn_link( 'https://maxcdn.bootstrapcdn.com/bootstrap/' . BOOTSTRAP_VERSION . '/js/bootstrap.min.js', BOOTSTRAP_HASH ); | ||
|
||
# moment & datetimepicker | ||
html_javascript_cdn_link( 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/' . MOMENT_VERSION . '/moment-with-locales.min.js' ); | ||
html_javascript_cdn_link( 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/' . DATETIME_PICKER_VERSION . '/js/bootstrap-datetimepicker.min.js' ); | ||
} else { | ||
# bootstrap | ||
html_javascript_link( 'bootstrap-' . BOOTSTRAP_VERSION . '.min.js' ); | ||
|
||
# moment & datetimepicker | ||
html_javascript_link( 'moment-with-locales.min.js' ); | ||
html_javascript_link( 'bootstrap-datetimepicker.min.js' ); | ||
} | ||
|
||
# theme scripts | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with prior version (month and day with leading 0), the new format should be
Y-MM-DD
.