MDL-26677 fixed undefined index usewatermarks in flickr plugin

This commit is contained in:
Dongsheng Cai 2011-05-02 16:21:55 +08:00
parent c3f85e22d9
commit d55846d8bd
2 changed files with 8 additions and 3 deletions

View File

@ -66,9 +66,14 @@ if (!empty($edit) || !empty($new)) {
if ($edit) {
$settings = array();
$settings['name'] = $fromform->name;
var_dump($fromform);
if (!$instance->readonly) {
foreach($configs as $config) {
$settings[$config] = $fromform->$config;
if (isset($fromform->$config)) {
$settings[$config] = $fromform->$config;
} else {
$settings[$config] = null;
}
}
}
$success = $instance->set_option($settings);

View File

@ -456,7 +456,7 @@ class repository_flickr_public extends repository {
public function instance_config_form($mform) {
$mform->addElement('text', 'email_address', get_string('emailaddress', 'repository_flickr_public'));
$mform->addElement('checkbox', 'usewatermarks', get_string('watermark', 'repository_flickr_public'));
//$mform->addRule('email_address', get_string('required'), 'required', null, 'client');
$mform->setDefault('usewatermarks', 0);
}
/**
@ -498,7 +498,7 @@ class repository_flickr_public extends repository {
public static function plugin_init() {
//here we create a default instance for this type
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name'=>'', 'email_address' => null), 0);
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
if (empty($id)) {
return false;
} else {