mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-8364 moved javascript into print_header
This commit is contained in:
parent
39de90acd5
commit
9d17f1d331
1 changed files with 8 additions and 4 deletions
|
@ -20,6 +20,7 @@ $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||||
|
|
||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
|
$script = '';
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
/// Adding an official tag from submitted value
|
/// Adding an official tag from submitted value
|
||||||
case 'addofficial':
|
case 'addofficial':
|
||||||
|
@ -56,11 +57,13 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write newly added tags back into window opener.
|
/// Write newly added tags back into window opener.
|
||||||
echo '<script type="text/javascript">
|
$script = '<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
var o = opener.document.createElement("option");
|
var o = opener.document.createElement("option");
|
||||||
o.innerHTML = "<option>'.$tag->text.'</option>";
|
o.innerHTML = "<option>'.$tag->text.'</option>";
|
||||||
o.value = '.$tagid.';
|
o.value = '.$tagid.';
|
||||||
opener.document.entry[\'otags[]\'].insertBefore(o, null);
|
opener.document.entry[\'otags[]\'].insertBefore(o, null);
|
||||||
|
//]]>
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +108,8 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove parent window option via javascript.
|
/// Remove parent window option via javascript.
|
||||||
echo '<script>
|
$script = '<script>
|
||||||
|
//<![CDATA[
|
||||||
var i=0;
|
var i=0;
|
||||||
while (i < window.opener.document.entry[\'otags[]\'].length) {
|
while (i < window.opener.document.entry[\'otags[]\'].length) {
|
||||||
if (window.opener.document.entry[\'otags[]\'].options[i].value == '.$tagid.') {
|
if (window.opener.document.entry[\'otags[]\'].options[i].value == '.$tagid.') {
|
||||||
|
@ -121,7 +125,7 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
//]]>
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +139,7 @@ switch ($action) {
|
||||||
|
|
||||||
|
|
||||||
/// Print the table.
|
/// Print the table.
|
||||||
print_header();
|
print_header (get_string('tagmanagement'), '', '', '', $script);
|
||||||
include_once('tags.html');
|
include_once('tags.html');
|
||||||
print_footer();
|
print_footer();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue