mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
"MDL-16697, rename callback functions"
This commit is contained in:
parent
bff522352e
commit
dd07016297
@ -1,7 +1,13 @@
|
||||
function fp_callback(params) {
|
||||
document.getElementById('file_info_'+params['client_id']).innerHTML = '<div class="mdl-left"><a href="'+params['url']+'">'+params['file']+'</a></div>';
|
||||
function filepicker_callback(params) {
|
||||
alert('test');
|
||||
var html = '<div class="mdl-left"><a href="'+params['url']+'">'+params['file']+'</a>';
|
||||
html += '<a href="###" onclick=\'rm_file('+params['id']+', "'+params['file']+'", this)\'>ii</a>';
|
||||
html += '</div>';
|
||||
document.getElementById('file_info_'+params['client_id']).innerHTML = html;
|
||||
}
|
||||
function callpicker(id, client_id, itemid) {
|
||||
|
||||
// launch file picker from filepicker element
|
||||
function launch_filepicker(id, client_id, itemid) {
|
||||
var picker = document.createElement('DIV');
|
||||
picker.id = 'file-picker-'+client_id;
|
||||
picker.className = 'file-picker';
|
||||
@ -13,7 +19,7 @@ function callpicker(id, client_id, itemid) {
|
||||
params.maxbytes = filepicker.maxbytes;
|
||||
params.maxfiles = filepicker.maxfiles;
|
||||
params.target = el;
|
||||
params.callback = fp_callback;
|
||||
params.callback = filepicker_callback;
|
||||
var fp = open_filepicker(client_id, params);
|
||||
return false;
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
||||
function toHtml() {
|
||||
global $CFG, $COURSE, $USER, $PAGE;
|
||||
|
||||
|
||||
if ($this->_flagFrozen) {
|
||||
return $this->getFrozenHtml();
|
||||
}
|
||||
@ -89,6 +90,8 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
||||
}
|
||||
$client_id = uniqid();
|
||||
$repojs = repository_get_client($context, $client_id, $this->_options['filetypes'], $this->_options['returnvalue']);
|
||||
$PAGE->requires->data_for_js('filepicker', array('maxbytes'=>$this->_options['maxbytes'],'maxfiles'=>1));
|
||||
$PAGE->requires->js('lib/form/filepicker.js');
|
||||
|
||||
$id = $this->_attributes['id'];
|
||||
$elname = $this->_attributes['name'];
|
||||
@ -97,10 +100,8 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
||||
$str .= '<input type="hidden" name="'.$elname.'" id="'.$id.'" '.$draftvalue.' />';
|
||||
$str .= $repojs;
|
||||
|
||||
$str .= $PAGE->requires->data_for_js('filepicker', Array('maxbytes'=>$this->_options['maxbytes'],'maxfiles'=>1))->asap();
|
||||
$str .= $PAGE->requires->js('lib/form/filepicker.js')->asap();
|
||||
$str .= <<<EOD
|
||||
<button onclick="return callpicker('$id', '$client_id', '$draftvalue')">$straddfile</button>
|
||||
<a href="#nonjsfp" onclick="return launch_filepicker('$id', '$client_id', '$draftvalue')">$straddfile</a>
|
||||
<span id="file_info_{$client_id}" class="notifysuccess">$currentfile</span>
|
||||
|
||||
<noscript>
|
||||
|
Loading…
x
Reference in New Issue
Block a user