mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +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
4 changed files with 10 additions and 10 deletions
|
@ -19,14 +19,14 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toHtml() {
|
function toHtml() {
|
||||||
global $PAGE;
|
global $CFG;
|
||||||
if ($this->_flagFrozen) {
|
if ($this->_flagFrozen) {
|
||||||
return $this->getFrozenHtml();
|
return $this->getFrozenHtml();
|
||||||
} else {
|
} else {
|
||||||
$id = $this->getAttribute('id');
|
$id = $this->getAttribute('id');
|
||||||
$unmask = get_string('unmaskpassword', 'form');
|
$unmask = get_string('unmaskpassword', 'form');
|
||||||
$unmaskjs = $PAGE->requires->data_for_js('punmask',Array('id'=>$id, 'unmaskstr'=>$unmask))->asap();
|
$unmaskjs = html_writer::script(js_writer::set_variable('punmask', array('id'=>$id, 'unmaskstr'=>$unmask)));
|
||||||
$unmaskjs .= $PAGE->requires->js('/lib/form/passwordunmask.js')->asap();
|
$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;
|
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' /><div class="unmask" id="'.$id.'unmaskdiv"></div>'.$unmaskjs;
|
||||||
}
|
}
|
||||||
} //end func toHtml
|
} //end func toHtml
|
||||||
|
|
|
@ -538,11 +538,11 @@ function scorm_get_toc($user,$scorm,$liststyle,$currentorg='',$scoid='',$mode='n
|
||||||
}
|
}
|
||||||
$result->toc .= "\t</ul>\n";
|
$result->toc .= "\t</ul>\n";
|
||||||
if ($scorm->hidetoc == 0) {
|
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'),
|
'plusicon' => $OUTPUT->pix_url('pix/plus', 'scorm'),
|
||||||
'minusicon' => $OUTPUT->pix_url('pix/minus', 'scorm')))->asap();
|
'minusicon' => $OUTPUT->pix_url('pix/minus', 'scorm'))));
|
||||||
$result->toc .= $PAGE->requires->js('/lib/cookies.js')->asap();
|
$result->toc .= html_writer::script('', $CFG->wwwroot.'/lib/cookies.js');
|
||||||
$result->toc .= $PAGE->requires->js('/mod/scorm/datamodels/scorm_datamodels.js')->asap();
|
$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;
|
$url = $CFG->wwwroot.'/mod/scorm/player.php?a='.$scorm->id.'¤torg='.$currentorg.$modestr;
|
||||||
|
|
|
@ -81,11 +81,10 @@
|
||||||
print_error('cannotfindsco', 'scorm');
|
print_error('cannotfindsco', 'scorm');
|
||||||
}
|
}
|
||||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe
|
$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')) {
|
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 {
|
} 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
|
// 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->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('/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/loaddatamodel.php?id='.$cm->id.$scoidstr.$modestr.$attemptstr)->in_head();
|
||||||
$PAGE->requires->js('/mod/scorm/rd.js')->in_head();
|
$PAGE->requires->js('/mod/scorm/rd.js')->in_head();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue