]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-16697, update javascript parameters list"
authordongsheng <dongsheng>
Fri, 14 Aug 2009 07:37:56 +0000 (07:37 +0000)
committerdongsheng <dongsheng>
Fri, 14 Aug 2009 07:37:56 +0000 (07:37 +0000)
lib/form/filepicker.js
lib/form/filepicker.php

index 3910c7c226fe56a063a8845a26beaadd31de19c6..0daf894cf0295c547c066718b4f814f45728fa29 100644 (file)
@@ -1,7 +1,7 @@
-function updatefile(client_id, obj) {
-    document.getElementById('repo_info_'+client_id).innerHTML = obj['file'];
+function fp_callback(params) {
+    document.getElementById('file_info_'+params['client_id']).innerHTML = '<div class="mdl-left"><a href="'+params['url']+'">'+params['file']+'</a></div>';
 }
-function callpicker(client_id, id) {
+function callpicker(id, client_id, itemid) {
     var picker = document.createElement('DIV');
     picker.id = 'file-picker-'+client_id;
     picker.className = 'file-picker';
@@ -13,7 +13,7 @@ function callpicker(client_id, id) {
     params.maxbytes = filepicker.maxbytes;
     params.maxfiles = filepicker.maxfiles;
     params.target = el;
-    params.callback = updatefile;
-    open_filepicker(client_id, params);
+    params.callback = fp_callback;
+    var fp = open_filepicker(client_id, params);
     return false;
 }
index 94b50943204d4b313b3d69d25ec564609208b48e..2d55ee326b20454b457100c386af1aa23af8c2d7 100644 (file)
@@ -100,8 +100,9 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
         $str .= $PAGE->requires->data_for_js('filepicker', Array('maxbytes'=>$this->_options['maxbytes'],'maxfiles'=>1))->asap();
         $str .= $PAGE->requires->js('lib/form/filepicker.js')->asap();
         $str .= <<<EOD
-<a href="#nonjsfp" class="btnaddfile" onclick="return callpicker('$client_id', '$id', '$draftvalue')">$straddfile</a>
-<span id="repo_info_{$client_id}" class="notifysuccess">$currentfile</span>
+<button onclick="return callpicker('$id', '$client_id', '$draftvalue')">$straddfile</button>
+<span id="file_info_{$client_id}" class="notifysuccess">$currentfile</span>
+
 <noscript>
 <a name="nonjsfp"></a>
 <object type="text/html" data="{$CFG->httpswwwroot}/repository/filepicker.php?action=embedded&itemid={$draftitemid}&ctx_id=$context->id" height="300" width="800" style="border:1px solid #000">Error</object>