]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13766, fix for filepicker in moodleform
authordongsheng <dongsheng>
Tue, 5 Aug 2008 05:58:06 +0000 (05:58 +0000)
committerdongsheng <dongsheng>
Tue, 5 Aug 2008 05:58:06 +0000 (05:58 +0000)
lib/form/filepicker.php

index a35e8a64e5f99cef8f36bb680ed9525df37d67f8..8ffa04ddc6e74a8323e8817fbd32b975ff32c418 100644 (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;
         }
     }