mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 03:46:42 +02:00
MDL-19580 cleanup of require css and js filepicker code
This commit is contained in:
parent
b14e77c966
commit
ff5fe31160
14 changed files with 169 additions and 121 deletions
|
@ -18,6 +18,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
|||
|
||||
function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
|
||||
global $CFG;
|
||||
require_once("$CFG->dirroot/repository/lib.php");
|
||||
|
||||
$options = (array)$options;
|
||||
foreach ($options as $name=>$value) {
|
||||
|
@ -29,6 +30,8 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
|||
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
|
||||
}
|
||||
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
|
||||
|
||||
repository_head_setup();
|
||||
}
|
||||
|
||||
function setHelpButton($helpbuttonargs, $function='helpbutton') {
|
||||
|
@ -84,14 +87,14 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
|
|||
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
}
|
||||
$client_id = uniqid();
|
||||
$repository_info = repository_get_client($context, $client_id, $this->_options['filetypes'], $this->_options['returnvalue']);
|
||||
$repojs = repository_get_client($context, $client_id, $this->_options['filetypes'], $this->_options['returnvalue']);
|
||||
|
||||
$id = $this->_attributes['id'];
|
||||
$elname = $this->_attributes['name'];
|
||||
|
||||
$str = $this->_getTabs();
|
||||
$str .= '<input type="hidden" name="'.$elname.'" id="'.$id.'" '.$draftvalue.' />';
|
||||
$str .= $repository_info['css'].$repository_info['js'];
|
||||
$str .= $repojs;
|
||||
|
||||
$str .= <<<EOD
|
||||
<a href="#nonjsfp" class="btnaddfile" onclick="return callpicker('$client_id', '$id', '$draftvalue')">$straddfile</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue