diff --git a/lang/en_utf8/repository.php b/lang/en_utf8/repository.php
index a36844cad5e..af0dd13e701 100644
--- a/lang/en_utf8/repository.php
+++ b/lang/en_utf8/repository.php
@@ -4,6 +4,7 @@ $string['back'] = '< Back';
$string['download'] = 'Download';
$string['close'] = 'Close';
$string['filename'] = 'Filename';
+$string['filesaved'] = 'File Saved!';
$string['invalidrepositoryid'] = 'Invalid Repository ID';
$string['invalidplugin'] = 'Invalid Repository Plug-in';
$string['manageuserrepository'] = 'Manage individual repository';
diff --git a/lib/form/filepicker.php b/lib/form/filepicker.php
index 8ffa04ddc6e..8e8097a120d 100644
--- a/lib/form/filepicker.php
+++ b/lib/form/filepicker.php
@@ -45,11 +45,15 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_button
return $this->getFrozenHtml();
} else {
$strsaved = get_string('filesaved', 'repository');
+ // TODO
+ // Use a better itemid value to identify a repository
+ // file
$itemid = time();
$ret = get_repository_client();
$suffix = $ret['suffix'];
$str = $this->_getTabs();
- $str .= '';
+ $str .= '';
+ $id = $this->_attributes['id'];
$str .= <<
function updatefile(){
@@ -57,12 +61,13 @@ function updatefile(){
document.getElementById('repo_info_$suffix').innerHTML = '$strsaved';
}
function callpicker_$suffix(){
- var el=document.getElementById('repo_value_$suffix');
+ var el=document.getElementById('${id}_${suffix}');
openpicker_$suffix({"env":"form", 'itemid': $itemid, 'target':el, 'callback':updatefile})
}
EOD;
- $str .= '_getAttrString($this->_attributes) . ' onclick=\'callpicker_'.$suffix.'()\' />'.''.$ret['html'].$ret['js'];
+ // $this->_getAttrString($this->_attributes);
+ $str .= ''.''.$ret['html'].$ret['js'];
return $str;
}
}
diff --git a/repository/lib.php b/repository/lib.php
index 83e9d264075..8735f04b978 100644
--- a/repository/lib.php
+++ b/repository/lib.php
@@ -494,6 +494,9 @@ function get_repository_client(){
this.show = function(){
panel.show();
}
+ this.hide = function(){
+ panel.hide();
+ }
this.create_picker = function(){
// display UI
panel.render();
@@ -694,6 +697,7 @@ function get_repository_client(){
_client.end = function(str){
_client.target.value = str;
_client.formcallback();
+ _client.instance.hide();
_client.viewfiles();
}
_client.callback = {