MDL-26677 fixed undefined index usewatermarks in flickr plugin
authorDongsheng Cai <dongsheng@moodle.com>
Mon, 2 May 2011 08:21:55 +0000 (16:21 +0800)
committerDongsheng Cai <dongsheng@moodle.com>
Fri, 17 Jun 2011 04:11:54 +0000 (12:11 +0800)
admin/repositoryinstance.php
repository/flickr_public/lib.php

index 640ebc9..d034f18 100644 (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);
index 36910d3..b297f6d 100644 (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 {