"MDL-13766, repository api, fixed typeid value"

This commit is contained in:
dongsheng
2009-06-04 06:40:35 +00:00
parent adf541d99a
commit a3d8df257b
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -43,11 +43,11 @@ $return = true;
if (!empty($edit) || !empty($new)) {
if (!empty($edit)) {
$instance = repository::get_instance($edit);
$instancetype = repository::get_type_by_id($instance->typeid);
$instancetype = repository::get_type_by_id($instance->options['typeid']);
$classname = 'repository_' . $instancetype->get_typename();
$configs = $instance->get_instance_option_names();
$plugin = $instancetype->get_typename();
$typeid = $instance->typeid;
$typeid = $instance->options['typeid'];
} else {
$plugin = $new;
$typeid = $new;
+2 -2
View File
@@ -9,10 +9,10 @@ class repository_filesystem extends repository {
);
public function __construct($repositoryid, $context = SITEID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
if (empty($this->root_path)) {
if (empty($this->options['root_path'])) {
return;
}
$this->root_path = trim($this->root_path);
$this->root_path = trim($this->options['root_path']);
if (!empty($options['ajax'])) {
// if created from filepicker
if (empty($this->root_path)) {
+3 -3
View File
@@ -1020,7 +1020,7 @@ abstract class repository {
$delete .= '<a href="' . $baseurl . '&amp;type='.$typename.'&amp;delete=' . $i->id . '">' . $deletestr . '</a>' . "\n";
}
$type = repository::get_type_by_id($i->typeid);
$type = repository::get_type_by_id($i->options['typeid']);
$table->data[] = array($i->name, $type->get_readablename(), $delete, $settings);
//display a grey row if the type is defined as not visible
@@ -1612,8 +1612,8 @@ final class repository_instance_form extends moodleform {
$result = $this->instance->instance_config_form($mform);
// and set the data if we have some.
foreach ($this->instance->get_instance_option_names() as $config) {
if (!empty($this->instance->$config)) {
$data[$config] = $this->instance->$config;
if (!empty($this->instance->options[$config])) {
$data[$config] = $this->instance->options[$config];
} else {
$data[$config] = '';
}