Merge branch 'MDL-31000-master-3' of git://git.luns.net.uk/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 31 Jan 2012 23:25:05 +0000 (00:25 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 31 Jan 2012 23:25:05 +0000 (00:25 +0100)
1  2 
repository/lib.php

diff --combined repository/lib.php
@@@ -826,6 -826,7 +826,7 @@@ abstract class repository 
              $options['visible'] = $record->visible;
              $options['type']    = $record->repositorytype;
              $options['typeid']  = $record->typeid;
+             $options['sortorder'] = $record->sortorder;
              // tell instance what file types will be accepted by file picker
              $classname = 'repository_' . $record->repositorytype;
  
                      }
                      if ($record->repositorytype == 'coursefiles') {
                          // coursefiles plugin needs managefiles permission
 -                        $capability = $capability && has_capability('moodle/course:managefiles', $current_context);
 +                        if (!empty($current_context)) {
 +                            $capability = $capability && has_capability('moodle/course:managefiles', $current_context);
 +                        } else {
 +                            $capability = $capability && has_capability('moodle/course:managefiles', get_system_context());
 +                        }
                      }
                      if ($is_supported && $capability) {
                          $repositories[$repository->id] = $repository;
          $meta->icon = $OUTPUT->pix_url('icon', 'repository_'.$meta->type)->out(false);
          $meta->supported_types = $ft->get_extensions($this->supported_filetypes());
          $meta->return_types = $this->supported_returntypes();
+         $meta->sortorder = $this->options['sortorder'];
          return $meta;
      }