MDL-40709 skydrive: filter files by accepted types
authorDan Poltawski <dan@moodle.com>
Wed, 14 Aug 2013 07:56:58 +0000 (15:56 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 14 Aug 2013 07:56:58 +0000 (15:56 +0800)
This means images will only be shown in the image picker, videos
in the video picker - etc.

repository/skydrive/lib.php

index 50b6933..26464b8 100644 (file)
@@ -96,7 +96,11 @@ class repository_skydrive extends repository {
         $ret['dynload'] = true;
         $ret['nosearch'] = true;
         $ret['manage'] = 'https://skydrive.live.com/';
-        $ret['list'] = $this->skydrive->get_file_list($path);
+
+        $fileslist = $this->skydrive->get_file_list($path);
+        // Filter list for accepted types. Hopefully this will be done by core some day.
+        $fileslist = array_filter($fileslist, array($this, 'filter'));
+        $ret['list'] = $fileslist;
 
         // Generate path bar, always start with the plugin name.
         $ret['path']   = array();