mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-21403 hardcoded JS legacy code should not use new $PAGE->requires-> api, switching to html_writer instead
This commit is contained in:
parent
5a197e9130
commit
25b6fe050c
@ -19,14 +19,14 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
|
||||
}
|
||||
|
||||
function toHtml() {
|
||||
global $PAGE;
|
||||
global $CFG;
|
||||
if ($this->_flagFrozen) {
|
||||
return $this->getFrozenHtml();
|
||||
} else {
|
||||
$id = $this->getAttribute('id');
|
||||
$unmask = get_string('unmaskpassword', 'form');
|
||||
$unmaskjs = $PAGE->requires->data_for_js('punmask',Array('id'=>$id, 'unmaskstr'=>$unmask))->asap();
|
||||
$unmaskjs .= $PAGE->requires->js('/lib/form/passwordunmask.js')->asap();
|
||||
$unmaskjs = html_writer::script(js_writer::set_variable('punmask', array('id'=>$id, 'unmaskstr'=>$unmask)));
|
||||
$unmaskjs .= html_writer::script('', $CFG->httpswwwroot.'/lib/form/passwordunmask.js');
|
||||
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' /><div class="unmask" id="'.$id.'unmaskdiv"></div>'.$unmaskjs;
|
||||
}
|
||||
} //end func toHtml
|
||||
|
@ -538,11 +538,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||
}
|
||||
$result->toc .= "\t</ul>\n";
|
||||
if ($scorm->hidetoc == 0) {
|
||||
$result->toc .= $PAGE->requires->data_for_js('scormdata', array(
|
||||
$result->toc .= html_writer::script(js_writer::set_variable('scormdata', array(
|
||||
'plusicon' => $OUTPUT->pix_url('pix/plus', 'scorm'),
|
||||
'minusicon' => $OUTPUT->pix_url('pix/minus', 'scorm')))->asap();
|
||||
$result->toc .= $PAGE->requires->js('/lib/cookies.js')->asap();
|
||||
$result->toc .= $PAGE->requires->js('/mod/scorm/datamodels/scorm_datamodels.js')->asap();
|
||||
'minusicon' => $OUTPUT->pix_url('pix/minus', 'scorm'))));
|
||||
$result->toc .= html_writer::script('', $CFG->wwwroot.'/lib/cookies.js');
|
||||
$result->toc .= html_writer::script('', $CFG->wwwroot.'/mod/scorm/datamodels/scorm_datamodels.js');
|
||||
}
|
||||
|
||||
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'¤torg='.$currentorg.$modestr;
|
||||
|
@ -81,11 +81,10 @@
|
||||
print_error('cannotfindsco', 'scorm');
|
||||
}
|
||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
||||
$PAGE->requires->js('/lib/cookies.js')->asap();
|
||||
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
|
||||
include($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
|
||||
} else {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
|
||||
include($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
|
||||
}
|
||||
|
||||
// set the start time of this SCO
|
||||
|
@ -165,6 +165,7 @@
|
||||
|
||||
$PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,'cheight'=>$scorm->height))->in_head();
|
||||
$PAGE->requires->js('/mod/scorm/request.js')->in_head();
|
||||
$PAGE->requires->js('/lib/cookies.js')->in_head();
|
||||
$PAGE->requires->js('/mod/scorm/loaddatamodel.php?id='.$cm->id.$scoidstr.$modestr.$attemptstr)->in_head();
|
||||
$PAGE->requires->js('/mod/scorm/rd.js')->in_head();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user