MDL-13766, fix for filepicker in moodleform

This commit is contained in:
dongsheng 2008-08-05 05:58:06 +00:00
parent 4b844d63ef
commit 77a2e1461b

View File

@ -47,22 +47,22 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_button
$strsaved = get_string('filesaved', 'repository');
$itemid = time();
$ret = get_repository_client();
$str = $this->_getTabs();
$str .= '<input type="hidden" value="'.$itemid.'" name="repo_attachment" id="repo_value" />';
$suffix = $ret['suffix'];
$str = $this->_getTabs();
$str .= '<input type="hidden" value="'.$itemid.'" name="repo_attachment" id="repo_value_'.$suffix.'" />';
$str .= <<<EOD
<script type="text/javascript">
function updatefile(){
alert('$strsaved');
document.getElementById('repo_info').innerHTML = '$strsaved';
document.getElementById('repo_info_$suffix').innerHTML = '$strsaved';
}
function callpicker_$suffix(){
var el=document.getElementById('repo_value');
var el=document.getElementById('repo_value_$suffix');
openpicker_$suffix({"env":"form", 'itemid': $itemid, 'target':el, 'callback':updatefile})
}
</script>
EOD;
$str .= '<input' . $this->_getAttrString($this->_attributes) . ' onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info" style="color:green"></span>'.$ret['html'].$ret['js'];
$str .= '<input' . $this->_getAttrString($this->_attributes) . ' onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info_'.$suffix.'" style="color:green"></span>'.$ret['html'].$ret['js'];
return $str;
}
}