"MDL-13766, upload plugin"

This commit is contained in:
dongsheng 2008-09-01 08:21:39 +00:00
parent 5a3b9db98c
commit a62542e08b
3 changed files with 60 additions and 3 deletions

View file

@ -46,9 +46,6 @@ class repository_local extends repository {
// no login required
$ret['nologin'] = true;
// define upload form in file picker
// Use ajax upload file
$ret['upload'] = array('name'=>get_string('attachment', 'repository'), 'id'=>'repo-form');
// todo: link to file manager
$ret['manage'] = $CFG->wwwroot .'/files/index.php'; // temporary

BIN
repository/upload/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,60 @@
<?php
/**
* repository_upload class
* A subclass of repository, which is used to upload file
*
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class repository_upload extends repository {
public function __construct($repositoryid, $context = SITEID, $options = array()){
global $SESSION, $action, $CFG;
parent::__construct($repositoryid, $context, $options);
if($action=='upload'){
$this->info = repository_store_to_filepool('repo_upload_file');
}
}
public function print_login($ajax = true) {
global $SESSION;
return $this->get_listing();
}
public function get_listing($path='', $search='') {
global $CFG, $action;
if($action=='upload'){
return $this->info;
}else{
$ret = array();
$ret['nologin'] = true;
// define upload form in file picker
$ret['upload'] = array('label'=>get_string('attachment', 'repository'), 'id'=>'repo-form');
$ret['manage'] = $CFG->wwwroot .'/files/index.php'; // temporary
$ret['list'] = array();
$ret['dynload'] = false;
return $ret;
}
}
public function print_listing() {
}
public function print_search() {
return true;
}
public static function has_admin_config() {
return true;
}
public static function get_option_names() {
return array();
}
// empty function is necessary to make it possible to edit the name of the repository
public function admin_config_form(&$mform) {
}
}
?>