]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15348 Add changes for filepicker to support the display of existing files
authormoodler <moodler>
Mon, 8 Sep 2008 05:41:45 +0000 (05:41 +0000)
committermoodler <moodler>
Mon, 8 Sep 2008 05:41:45 +0000 (05:41 +0000)
lib/form/filepicker.php
version.php

index 856782a33b66c3a73d9184941ad9eb8e4c77cf1c..38fe4f5150a8197a552dcb841fbec5cf01406b67 100644 (file)
@@ -5,9 +5,9 @@ require_once("HTML/QuickForm/button.php");
 require_once(dirname(dirname(dirname(__FILE__))) . '/repository/lib.php');
 
 /**
- * HTML class for a button type element
+ * HTML class for a single filepicker element (based on button)
  *
- * @author       Dongsheng Cai <dongsheng@cvs.moodle.org>
+ * @author       Moodle.com
  * @version      1.0
  * @since        Moodle 2.0
  * @access       public
@@ -52,21 +52,24 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_button {
         if ($this->_flagFrozen) {
             return $this->getFrozenHtml();
         } else {
-            $strsaved = get_string('filesaved', 'repository');
+            $currentvalue = $this->getValue();
 
+            $strsaved = get_string('filesaved', 'repository');
             if (empty($COURSE->context)) {
-                $ctx = get_context_instance(CONTEXT_SYSTEM);
+                $context = get_context_instance(CONTEXT_SYSTEM);
             } else {
-                $ctx = $COURSE->context;
+                $context = $COURSE->context;
             }
-            $ret = repository_get_client($ctx);
+            $repository_info = repository_get_client($context);
+            $suffix = $repository_info['suffix'];
 
-            $suffix = $ret['suffix'];
             $id     = $this->_attributes['id'];
             $elname = $this->_attributes['name'];
 
             $str = $this->_getTabs();
-            $str .= '<input type="hidden" name="'.$elname.'" id="'.$id.'_'.$suffix.'" value="" />';
+            $str .= '<input type="hidden" value="'.$currentvalue.'" name="'.$this->_attributes['name'].'" id="'.$this->_attributes['id'].'_'.$suffix.'" />';
+            $id = $this->_attributes['id'];
+
             $str .= <<<EOD
 <script type="text/javascript">
 function updatefile_$suffix(str){
@@ -82,8 +85,7 @@ function callpicker_$suffix(){
 }
 </script>
 EOD;
-            // $this->_getAttrString($this->_attributes);
-            $str .= '<input value ="'.get_string('openpicker', 'repository').'" type="button" onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info_'.$suffix.'" style="color:green"></span>'.$ret['css'].$ret['js'];
+            $str .= '<input value ="'.get_string('openpicker', 'repository').'" type="button" onclick=\'callpicker_'.$suffix.'()\' />'.'<span id="repo_info_'.$suffix.'" class="notifysuccess">'.$currentvalue.'</span>'.$repository_info['css'].$repository_info['js'];
             return $str;
         }
     }
index 59022b3f57ca7300702244d57f76b6d92a3b463a..2d2d81200f6ab4400793c9579c795293e6c02dd6 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2008090108;  // YYYYMMDD   = date of the last version bump
+    $version = 2008090800;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20080908)';  // Human-friendly version name