]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-15351, fixed draft files browsing"
authordongsheng <dongsheng>
Mon, 22 Jun 2009 02:59:32 +0000 (02:59 +0000)
committerdongsheng <dongsheng>
Mon, 22 Jun 2009 02:59:32 +0000 (02:59 +0000)
repository/local/repository.class.php

index 3d588239c0470947e3c2058bb283d3fea750f9f4..a17c76081d33e823620dad7a5a1c2f0335d79c91 100755 (executable)
@@ -50,6 +50,28 @@ class repository_local extends repository {
         $ret = array();
         $ret['dynload'] = true;
         $list = array();
+
+        // list draft files
+        if ($encodedpath == 'draft') {
+            $fs = get_file_storage();
+            $context = get_context_instance(CONTEXT_USER, $USER->id);
+            $files = $fs->get_area_files($context->id, 'user_draft');
+            foreach ($files as $file) {
+                if ($file->get_filename()!='.') {
+                    $node = array(
+                        'title' => $file->get_filename(),
+                        'size' => 0,
+                        'date' => '',
+                        'source'=> $file->get_id(),
+                        'thumbnail' => $CFG->wwwroot .'/pix/f/text-32.png'
+                    );
+                    $list[] = $node;
+                }
+            }
+            $ret['list'] = $list;
+            return $ret;
+        }
+
         if (!empty($encodedpath)) {
             $params = unserialize(base64_decode($encodedpath));
             if (is_array($params)) {
@@ -77,27 +99,6 @@ class repository_local extends repository {
             $list[] = $node;
         }
 
-        // list draft files
-        if ($encodedpath == 'draft') {
-            $fs = get_file_storage();
-            $context = get_context_instance(CONTEXT_USER, $USER->id);
-            $files = $fs->get_area_files($context->id, 'user_draft');
-            foreach ($files as $file) {
-                if ($file->get_filename()!='.') {
-                    $node = array(
-                        'title' => $file->get_filename(),
-                        'size' => 0,
-                        'date' => '',
-                        'source'=> $file->get_id(),
-                        'thumbnail' => $CFG->wwwroot .'/pix/f/text-32.png'
-                    );
-                    $list[] = $node;
-                }
-            }
-            $ret['list'] = $list;
-            return $ret;
-        }
-
         try {
             $browser = get_file_browser();