Skip to content

Commit

Permalink
Revert move-js-to-footer
Browse files Browse the repository at this point in the history
This change (see issue #13282) introduced several regressions.

This reverts commit 2dbc86b, reversing
changes made to aa9b4f8.

Fixes #20081, #20088
  • Loading branch information
dregad committed Sep 11, 2015
1 parent 1a1b5d1 commit 8d7ea37
Showing 1 changed file with 41 additions and 32 deletions.
73 changes: 41 additions & 32 deletions core/html_api.php
Expand Up @@ -31,6 +31,7 @@
* html_title
* html_css
* html_rss_link
* html_head_javascript
* (html_meta_redirect)
* html_page_top2
* html_page_top2a
Expand Down Expand Up @@ -206,6 +207,8 @@ function html_page_top1( $p_page_title = null ) {
# Advertise the availability of the browser search plug-ins.
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="' . string_sanitize_url( 'browser_search_plugin.php?type=text', true ) . '" />' . "\n";
echo "\t", '<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="' . string_sanitize_url( 'browser_search_plugin.php?type=id', true ) . '" />' . "\n";

html_head_javascript();
}

/**
Expand Down Expand Up @@ -300,7 +303,7 @@ function html_page_bottom1a( $p_file = null ) {
}

/**
* Print the document type and the opening <html> tag
* (1) Print the document type and the opening <html> tag
* @return void
*/
function html_begin() {
Expand All @@ -309,23 +312,23 @@ function html_begin() {
}

/**
* Begin the <head> section
* (2) Begin the <head> section
* @return void
*/
function html_head_begin() {
echo '<head>', "\n";
}

/**
* Print the content-type
* (3) Print the content-type
* @return void
*/
function html_content_type() {
echo "\t", '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />', "\n";
}

/**
* Print the window title
* (4) Print the window title
* @param string $p_page_title Window title.
* @return void
*/
Expand Down Expand Up @@ -356,7 +359,7 @@ function require_css( $p_stylesheet_path ) {
}

/**
* Print the link to include the CSS file
* (5) Print the link to include the CSS file
* @return void
*/
function html_css() {
Expand Down Expand Up @@ -390,7 +393,7 @@ function html_css_link( $p_filename ) {


/**
* Print an HTML meta tag to redirect to another page
* (6) Print an HTML meta tag to redirect to another page
* This function is optional and may be called by pages that need a redirect.
* $p_time is the number of seconds to wait before redirecting.
* If we have handled any errors on this page return false and don't redirect.
Expand Down Expand Up @@ -434,7 +437,31 @@ function require_js( $p_script_path ) {
}

/**
* End the <head> section
* (6a) Javascript...
* @return void
*/
function html_head_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";

if ( config_get_global( 'cdn_enabled' ) == ON ) {
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jquery/' . JQUERY_VERSION . '/jquery.min.js"></script>' . "\n";
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERY_UI_VERSION . '/jquery-ui.min.js"></script>' . "\n";
} else {
html_javascript_link( 'jquery-' . JQUERY_VERSION . '.min.js' );
html_javascript_link( 'jquery-ui-' . JQUERY_UI_VERSION . '.min.js' );
}

html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}
}

/**
* (7) End the <head> section
* @return void
*/
function html_head_end() {
Expand All @@ -444,7 +471,7 @@ function html_head_end() {
}

/**
* Begin the <body> section
* (8) Begin the <body> section
* @return void
*/
function html_body_begin() {
Expand All @@ -462,7 +489,7 @@ function html_body_begin() {
}

/**
* Print a user-defined banner at the top of the page if there is one.
* (9) Print a user-defined banner at the top of the page if there is one.
* @return void
*/
function html_top_banner() {
Expand Down Expand Up @@ -500,7 +527,7 @@ function html_top_banner() {
}

/**
* Print the user's account information
* (10) Print the user's account information
* Also print the select box where users can switch projects
* @return void
*/
Expand Down Expand Up @@ -595,7 +622,7 @@ function html_login_info() {
}

/**
* Print a user-defined banner at the bottom of the page if there is one.
* (11) Print a user-defined banner at the bottom of the page if there is one.
* @return void
*/
function html_bottom_banner() {
Expand Down Expand Up @@ -633,7 +660,7 @@ function html_is_auto_refresh() {
}

/**
* Print the page footer information
* (13) Print the page footer information
* @return void
*/
function html_footer() {
Expand Down Expand Up @@ -751,37 +778,19 @@ function html_footer() {
}

/**
* End the <body> section
* (14) End the <body> section
* @return void
*/
function html_body_end() {
global $g_scripts_included;

event_signal( 'EVENT_LAYOUT_BODY_END' );

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";

if ( config_get_global( 'cdn_enabled' ) == ON ) {
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jquery/' . JQUERY_VERSION . '/jquery.min.js"></script>' . "\n";
echo "\t" . '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERY_UI_VERSION . '/jquery-ui.min.js"></script>' . "\n";
} else {
html_javascript_link( 'jquery-' . JQUERY_VERSION . '.min.js' );
html_javascript_link( 'jquery-ui-' . JQUERY_UI_VERSION . '.min.js' );
}

html_javascript_link( 'common.js' );
foreach ( $g_scripts_included as $t_script_path ) {
html_javascript_link( $t_script_path );
}

echo '</div>', "\n";

echo '</body>', "\n";
}

/**
* Print the closing <html> tag
* (15) Print the closing <html> tag
* @return void
*/
function html_end() {
Expand Down

0 comments on commit 8d7ea37

Please sign in to comment.