From e1f29368603cb31e8dab89fb0d4ed3c2aec42a63 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Wed, 6 Aug 2008 03:26:57 +0000 Subject: [PATCH] MDL-13766, fix bugs in formlib --- lang/en_utf8/repository.php | 1 + lib/form/filepicker.php | 11 ++++++++--- repository/lib.php | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lang/en_utf8/repository.php b/lang/en_utf8/repository.php index a36844cad5..af0dd13e70 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 8ffa04ddc6..8e8097a120 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 83e9d26407..8735f04b97 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 = { -- 2.39.5