mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
Merge branch 'MDL-26244_url' of https://github.com/andyjdavis/moodle
This commit is contained in:
commit
2d0316d60d
3 changed files with 15 additions and 15 deletions
|
@ -79,7 +79,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function toHtml(){
|
function toHtml(){
|
||||||
global $CFG, $COURSE, $USER, $PAGE, $OUTPUT;
|
global $PAGE, $OUTPUT;
|
||||||
|
|
||||||
$id = $this->_attributes['id'];
|
$id = $this->_attributes['id'];
|
||||||
$elname = $this->_attributes['name'];
|
$elname = $this->_attributes['name'];
|
||||||
|
@ -94,20 +94,9 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{
|
||||||
if (empty($this->_options['usefilepicker'])) {
|
if (empty($this->_options['usefilepicker'])) {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
$strsaved = get_string('filesaved', 'repository');
|
|
||||||
$straddlink = get_string('choosealink', 'repository');
|
|
||||||
if ($COURSE->id == SITEID) {
|
|
||||||
$context = context_system::instance();
|
|
||||||
} else {
|
|
||||||
$context = context_course::instance($COURSE->id);
|
|
||||||
}
|
|
||||||
$client_id = uniqid();
|
$client_id = uniqid();
|
||||||
|
|
||||||
$str .= <<<EOD
|
|
||||||
<button id="filepicker-button-{$client_id}" style="display:none">
|
|
||||||
$straddlink
|
|
||||||
</button>
|
|
||||||
EOD;
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->accepted_types = '*';
|
$args->accepted_types = '*';
|
||||||
$args->return_types = FILE_EXTERNAL;
|
$args->return_types = FILE_EXTERNAL;
|
||||||
|
@ -117,6 +106,15 @@ EOD;
|
||||||
$fp = new file_picker($args);
|
$fp = new file_picker($args);
|
||||||
$options = $fp->options;
|
$options = $fp->options;
|
||||||
|
|
||||||
|
if (count($options->repositories) > 0) {
|
||||||
|
$straddlink = get_string('choosealink', 'repository');
|
||||||
|
$str .= <<<EOD
|
||||||
|
<button id="filepicker-button-{$client_id}" style="display:none">
|
||||||
|
$straddlink
|
||||||
|
</button>
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
|
|
||||||
// print out file picker
|
// print out file picker
|
||||||
$str .= $OUTPUT->render($fp);
|
$str .= $OUTPUT->render($fp);
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,10 @@ class data_field_url extends data_field_base {
|
||||||
// Just the URL field
|
// Just the URL field
|
||||||
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
|
$str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
|
||||||
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
|
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
|
||||||
|
if (count($options->repositories) > 0) {
|
||||||
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button>';
|
$str .= '<button id="filepicker-button-'.$options->client_id.'" style="display:none">'.$straddlink.'</button>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print out file picker
|
// print out file picker
|
||||||
//$str .= $OUTPUT->render($fp);
|
//$str .= $OUTPUT->render($fp);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* this.options.client_id, the instance id
|
* this.options.client_id, the instance id
|
||||||
* this.options.contextid
|
* this.options.contextid
|
||||||
* this.options.itemid
|
* this.options.itemid
|
||||||
* this.options.repositories, stores all repositories displaied in file picker
|
* this.options.repositories, stores all repositories displayed in file picker
|
||||||
* this.options.formcallback
|
* this.options.formcallback
|
||||||
*
|
*
|
||||||
* Active repository options
|
* Active repository options
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue