Commit c24077ce authored by Patrick O'Keeffe's avatar Patrick O'Keeffe Committed by Robert Lyon
Browse files

patch to change all "text/javascript" to "application/javascript" (bug 1396426)

Change-Id: I448b74850bb387c8d9569a3df72da3927ca691d9
parent 8eb87414
......@@ -183,7 +183,7 @@ if (count($authinstances) > 1) {
}
}
$remoteusernames = json_encode(get_records_menu('auth_remote_user', 'localusr', $id));
$js = "<script type='text/javascript'>
$js = "<script type='application/javascript'>
var externalauths = ['" . implode("','", $externalauthjs) . "'];
var remoteusernames = " . $remoteusernames . ";
jQuery(document).ready(function() {
......
......@@ -122,7 +122,7 @@ if ($artefact->get('artefacttype') == 'folder') {
$rendered = $artefact->render_self($options);
$content = '';
if (!empty($rendered['javascript'])) {
$content = '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
$content = '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
}
$content .= $rendered['html'];
......
......@@ -236,7 +236,7 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
$rendered = $artefact->render_self(array('viewid' => $view, 'details' => true));
$result->html = $rendered['html'];
if (!empty($rendered['javascript'])) {
$result->html .= '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
$result->html .= '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
}
}
}
......
......@@ -260,7 +260,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$html = '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>
<span class="blocktype_internalmedia_mp3" id="' . $id . '">('
. get_string('flashanimation', 'blocktype.file/internalmedia') . ')</span>
<script type="text/javascript">
<script type="application/javascript">
var so = new SWFObject("' . $url . '","player","' . $width . '","' . ($height + 20). '","7");
so.addParam("allowfullscreen","false");
so.addVariable("displayheight"," ' . $height . '");
......@@ -312,7 +312,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
$html = '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>
<span class="blocktype_internalmedia_mp3" id="' . $id . '" style="display:block;width:'.$width.'px;height:'.$height.'px;"></span>
<span id="' . $id . '_h">' . get_string('flashanimation', 'blocktype.file/internalmedia') . '</span>
<script type="text/javascript">
<script type="application/javascript">
flowplayer("'.$id.'", "'.$playerurl.'", {
clip: {
url: "'.$escapedurl.'",
......@@ -352,7 +352,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return '<a href="' . $url . '">' . hsc($artefact->get('title')) . '</a><br>'
. '<span class="blocktype_internalmedia_real">
<script type="text/javascript">
<script type="application/javascript">
//<![CDATA[
document.write(\'<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="240" height="180">\\
<param name="src" value="' . $url . '">\\
......@@ -468,7 +468,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
);
}
return '<script src="'.get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer.js"></script>
<script src="' . get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js" type="text/javascript"></script>';
<script src="' . get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js" type="application/javascript"></script>';
}
public static function default_copy_type() {
......
......@@ -42,7 +42,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
$rendered = $resumefield->render_self(array('viewid' => $instance->get('view')));
$result = $rendered['html'];
if (!empty($rendered['javascript'])) {
$result .= '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
$result .= '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
}
$smarty->assign($artefact->artefacttype, $result);
}
......
......@@ -50,7 +50,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
$rendered = $resumefield->render_self($configdata);
$result = $rendered['html'];
if (!empty($rendered['javascript'])) {
$result .= '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
$result .= '<script type="application/javascript">' . $rendered['javascript'] . '</script>';
}
return $result;
}
......
......@@ -249,7 +249,7 @@ class PluginAuthBrowserid extends PluginAuth {
*/
public static function login_form_js() {
global $HEADDATA, $SESSION;
$HEADDATA[] = '<script src="https://login.persona.org/include.js" type="text/javascript"></script>';
$HEADDATA[] = '<script src="https://login.persona.org/include.js" type="application/javascript"></script>';
$wwwroot = get_config('wwwroot');
$returnurl = hsc(get_relative_script_path());
// We can't use $USER->get('sesskey') because there is no $USER object yet.
......@@ -264,7 +264,7 @@ class PluginAuthBrowserid extends PluginAuth {
<input style="display: none" type="submit">
</form>
<script type="text/javascript">
<script type="application/javascript">
function browserid_login() {
navigator.id.get(function(assertion) {
if (assertion) {
......
......@@ -1354,7 +1354,7 @@ function get_login_form_js($form) {
$strcookiesnotenabled = json_encode(get_string('cookiesnotenabled'));
$cookiename = get_config('cookieprefix') . 'ctest';
$js = <<< EOF
<script type="text/javascript">
<script type="application/javascript">
var loginbox = $('loginform_container');
document.cookie = "$cookiename=1";
if (document.cookie) {
......
......@@ -1003,8 +1003,8 @@ class BlockInstance {
$html = $pieform->build();
// We probably need a new version of $pieform->build() that separates out the js
// Temporary evil hack:
if (preg_match('/<script type="text\/javascript">(new Pieform\(.*\);)<\/script>/', $html, $matches)) {
$js = "var pf_{$form['name']} = " . $matches[1] . "pf_{$form['name']}.init();";
if (preg_match('/<script type="(text|application)\/javascript">(new Pieform\(.*\);)<\/script>/', $html, $matches)) {
$js = "var pf_{$form['name']} = " . $matches[2] . "pf_{$form['name']}.init();";
}
else {
$js = '';
......
......@@ -41,7 +41,7 @@ if ($USER->is_logged_in()) {
// include slimbox2 js and css files, if it is enabled...
if (get_config_plugin('blocktype', 'gallery', 'useslimbox2')) {
$langdir = (get_string('thisdirection', 'langconfig') == 'rtl' ? '-rtl' : '');
$stylesheets = array_merge($stylesheets, array('<script type="text/javascript" src="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/js/slimbox2.js') . '"></script>',
$stylesheets = array_merge($stylesheets, array('<script type="application/javascript" src="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/js/slimbox2.js') . '"></script>',
'<link rel="stylesheet" type="text/css" href="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/css/slimbox2' . $langdir . '.css') . '">'
));
}
......
......@@ -59,7 +59,7 @@ function globalErrorHandler(data) {
function show_login_form(submit) {
if($('ajax-login-form') == null) {
var loginForm = DIV({id: 'ajax-login-form'});
loginForm.innerHTML = '<h2>' + get_string('login') + '</h2><a href="/">&laquo; ' + get_string('home') + '<\/a><div id="loginmessage">' + get_string('sessiontimedout') + '</div><form class="pieform" name="login" method="post" action="" id="login" onsubmit="' + submit + '(this, 42); return false;"><table cellspacing="0" border="0" class="maharatable"><tbody><tr id="login_login_username_header" class="required text"><th><label for="login_login_username">' + get_string('username') + ':<\/label><\/th><\/tr><tr id="login_login_username_container"><td><input type="text" class="required text autofocus" id="login_login_username" name="login_username" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_login_password_header" class="required password"><th><label for="login_login_password">' + get_string('password') + ':<\/label><\/th><\/tr><tr id="login_login_password_container"><td><input type="password" class="required password" id="login_login_password" name="login_password" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_submit_container"><td><input type="submit" class="submit" id="login_submit" name="submit" value="' + get_string('login') + '"><\/td><\/tr><\/tbody><\/table><div id="homepage"><\/div><input type="hidden" name="sesskey" value=""><input type="hidden" name="pieform_login" value=""><\/form><script type="text\/javascript">var login_btn = null;addLoadEvent(function() { connect($(\'login_submit\'), \'onclick\', function() { login_btn = \'login_submit\'; });});connect(\'login\', \'onsubmit\', function() { formStartProcessing(\'login\', login_btn); });<\/script>';
loginForm.innerHTML = '<h2>' + get_string('login') + '</h2><a href="/">&laquo; ' + get_string('home') + '<\/a><div id="loginmessage">' + get_string('sessiontimedout') + '</div><form class="pieform" name="login" method="post" action="" id="login" onsubmit="' + submit + '(this, 42); return false;"><table cellspacing="0" border="0" class="maharatable"><tbody><tr id="login_login_username_header" class="required text"><th><label for="login_login_username">' + get_string('username') + ':<\/label><\/th><\/tr><tr id="login_login_username_container"><td><input type="text" class="required text autofocus" id="login_login_username" name="login_username" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_login_password_header" class="required password"><th><label for="login_login_password">' + get_string('password') + ':<\/label><\/th><\/tr><tr id="login_login_password_container"><td><input type="password" class="required password" id="login_login_password" name="login_password" value=""><\/td><\/tr><tr><td class="description"> <\/td><\/tr><tr id="login_submit_container"><td><input type="submit" class="submit" id="login_submit" name="submit" value="' + get_string('login') + '"><\/td><\/tr><\/tbody><\/table><div id="homepage"><\/div><input type="hidden" name="sesskey" value=""><input type="hidden" name="pieform_login" value=""><\/form><script type="application\/javascript">var login_btn = null;addLoadEvent(function() { connect($(\'login_submit\'), \'onclick\', function() { login_btn = \'login_submit\'; });});connect(\'login\', \'onsubmit\', function() { formStartProcessing(\'login\', login_btn); });<\/script>';
appendChildNodes(document.body, DIV({id: 'overlay'}));
appendChildNodes(document.body, loginForm);
$('login_login_username').focus();
......
......@@ -8,7 +8,7 @@
TableRendererPageLoaded = false;
addLoadEvent(function() { TableRendererPageLoaded = true; });
document.write('<script type="text/javascript" src="' + config.wwwroot + 'js/Pager.js"></script>');
document.write('<script type="application/javascript" src="' + config.wwwroot + 'js/Pager.js"></script>');
function TableRenderer(target, source, columns, options) {
// to use on the callbacks
......
......@@ -50,9 +50,9 @@ function get_cookieconsent_code() {
$wwwroot = get_config('wwwroot');
return <<<CODE
<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
<script type="text/javascript" src="{$wwwroot}js/cookieconsent/plugin.js"></script>
<script type="application/javascript" src="{$wwwroot}js/cookieconsent/plugin.js"></script>
{$stylesheets}
<script type="text/javascript">
<script type="application/javascript">
// <![CDATA[
cc.initialise({$initialisation});
// ]]>
......
......@@ -143,7 +143,7 @@ function pieform_element_autocomplete_get_headdata($element) {
$lang = str_replace('_', '-', substr($lang, 0, ((substr_count($lang, '_') > 0) ? 5 : 2)));
$langfile = '';
if ($lang != 'en' && file_exists(get_config('docroot') . "js/select2/select2_locale_{$lang}.js")) {
$langfile = '<script type="text/javascript" src="' .
$langfile = '<script type="application/javascript" src="' .
get_config('wwwroot') . "js/select2/select2_locale_{$lang}.js" .
'"></script>';
}
......@@ -151,7 +151,7 @@ function pieform_element_autocomplete_get_headdata($element) {
// Try parent language pack, which, for example, would be 'pt' for 'pt-BR'.
$lang = substr($lang, 0, 2);
if ($lang != 'en' && file_exists(get_config('docroot') . "js/select2/select2_locale_{$lang}.js")) {
$langfile = '<script type="text/javascript" src="' .
$langfile = '<script type="application/javascript" src="' .
get_config('wwwroot') . "js/select2/select2_locale_{$lang}.js" .
'"></script>';
}
......@@ -159,7 +159,7 @@ function pieform_element_autocomplete_get_headdata($element) {
$r = <<<JS
<link rel="stylesheet" href="{$cssfile}" />
<script type="text/javascript" src="{$jsfile}"></script>
<script type="application/javascript" src="{$jsfile}"></script>
{$langfile}
JS;
return array($r);
......
......@@ -94,6 +94,6 @@ EOF;
}/*}}}*/
function pieform_element_checkboxes_get_headdata() {/*{{{*/
$result = '<script type="text/javascript">' . pieform_element_checkboxes_js() . "\n</script>";
$result = '<script type="application/javascript">' . pieform_element_checkboxes_js() . "\n</script>";
return array($result);
}/*}}}*/
......@@ -30,7 +30,7 @@ function pieform_element_color(Pieform $form, $element) {
// Transparency optional control
if ($transparent) {
$optional = <<<EOF
<script type="text/javascript">
<script type="application/javascript">
var {$baseid}_oldval = '';
function {$baseid}_toggle(x) {
if ( x.checked ) {
......@@ -115,7 +115,7 @@ function pieform_element_color_get_value(Pieform $form, $element) {
function pieform_element_color_get_headdata($element) {
$libfile = get_config('wwwroot') . 'js/jscolor/jscolor.js';
$result = array(
'<script type="text/javascript" src="' . $libfile . '"></script>'
'<script type="application/javascript" src="' . $libfile . '"></script>'
);
return $result;
}
......
......@@ -1481,12 +1481,12 @@ function pieform_element_filebrowser_views_js(Pieform $form, $element) {
*/
function pieform_element_filebrowser_get_headdata($element) {
global $THEME;
$headdata = array('<script type="text/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js"></script>');
$headdata = array('<script type="application/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js"></script>');
if ($element['config']['upload']) {
// only add dropzone if filebrowser is allowed to upload
$headdata[] = '<script type="text/javascript" src="' . get_config('wwwroot') . 'js/dropzone/dropzone.min.js"></script>';
$headdata[] = '<script type="application/javascript" src="' . get_config('wwwroot') . 'js/dropzone/dropzone.min.js"></script>';
$headdata[] = '<link href="' . get_config('wwwroot') . 'js/dropzone/css/dropzone.css" type="text/css" rel="stylesheet">';
$headdata[] = '<script type="text/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filedropzone.js"></script>';
$headdata[] = '<script type="application/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filedropzone.js"></script>';
}
$strings = PluginArtefactFile::jsstrings('filebrowser');
$jsstrings = '';
......@@ -1495,7 +1495,7 @@ function pieform_element_filebrowser_get_headdata($element) {
$jsstrings .= "strings.$s=" . json_encode(get_raw_string($s, $section)) . ';';
}
}
$headdata[] = '<script type="text/javascript">' . $jsstrings . '</script>';
$headdata[] = '<script type="application/javascript">' . $jsstrings . '</script>';
$pluginsheets = $THEME->get_url('style/style.css', true, 'artefact/file');
foreach (array_reverse($pluginsheets) as $sheet) {
......
......@@ -56,7 +56,7 @@ function pieform_element_switchbox(Pieform $form, $element) {
$settings .= (isset($element['off_callback'])) ? 'off_callback: ' . $element['off_callback'] . ', ' : '';
$js = <<<JS
<script type="text/javascript">
<script type="application/javascript">
jQuery('#{$elementid}').switchButton({
{$settings}
});
......@@ -80,9 +80,9 @@ function pieform_element_switchbox_get_headdata($element) {
$r = <<<JS
<link rel="stylesheet" href="{$cssfile}" />
<script type="text/javascript" src="{$jqueryjs}"></script>
<script type="text/javascript" src="{$jsfile}"></script>
<script type="text/javascript">
<script type="application/javascript" src="{$jqueryjs}"></script>
<script type="application/javascript" src="{$jsfile}"></script>
<script type="application/javascript">
// Basic callback that submits the form the switchbutton is in
function switchbox_submit() {
if (typeof formchangemanager !== 'undefined') {
......@@ -97,4 +97,4 @@ JS;
function pieform_element_switchbox_get_value(Pieform $form, $element) {
return pieform_element_checkbox_get_value($form, $element);
}
\ No newline at end of file
}
......@@ -80,7 +80,7 @@ function pieform_element_wysiwyg_rule_required(Pieform $form, $value, $element,
function pieform_element_wysiwyg_get_headdata() {
global $_PIEFORM_WYSIWYGS;
if (is_html_editor_enabled()) {
$result = '<script type="text/javascript">'
$result = '<script type="application/javascript">'
. "\nvar editor_to_focus;"
. "\nPieformManager.connect('onsubmit', null, tinyMCE.triggerSave);"
. "\nPieformManager.connect('onload', null, function() {\n";
......
......@@ -53,7 +53,7 @@ function print_iframe_progress_handler($percent, $status) {
function print_export_footer($strexportgenerated, $continueurl, $continueurljs, $jsmessages=array(), $newlocation) {
?>
<script type="text/javascript">
<script type="application/javascript">
document.write('<div class="progress-bar" style="width: 100%;"><p><?php echo $strexportgenerated . ' <a href="' . $continueurljs . '" target="_top">' . get_string('continue', 'export') . '</a>'; ?></p></div>');
if (!window.opera) {
// Opera can't handle this for some reason - it vomits out the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment