Merge branch 'MDL-32573' of git://github.com/danpoltawski/moodle

This commit is contained in:
Sam Hemelryk 2012-06-13 15:32:54 +12:00
commit a54a08b818
6 changed files with 14 additions and 17 deletions

View file

@ -270,7 +270,7 @@ class repository_alfresco extends repository {
* *
* @return bool * @return bool
*/ */
public function instance_config_form($mform) { public static function instance_config_form($mform) {
if (!class_exists('SoapClient')) { if (!class_exists('SoapClient')) {
$mform->addElement('static', null, get_string('notice'), get_string('soapmustbeenabled', 'repository_alfresco')); $mform->addElement('static', null, get_string('notice'), get_string('soapmustbeenabled', 'repository_alfresco'));
return false; return false;

View file

@ -195,7 +195,7 @@ class repository_equella extends repository {
* *
* @param moodleform $mform * @param moodleform $mform
*/ */
public function instance_config_form($mform) { public static function instance_config_form($mform) {
$mform->addElement('text', 'equella_url', get_string('equellaurl', 'repository_equella')); $mform->addElement('text', 'equella_url', get_string('equellaurl', 'repository_equella'));
$mform->setType('equella_url', PARAM_URL); $mform->setType('equella_url', PARAM_URL);

View file

@ -166,7 +166,7 @@ class repository_filesystem extends repository {
return $ret; return $ret;
} }
public function instance_config_form($mform) { public static function instance_config_form($mform) {
global $CFG, $PAGE; global $CFG, $PAGE;
if (has_capability('moodle/site:config', get_system_context())) { if (has_capability('moodle/site:config', get_system_context())) {
$path = $CFG->dataroot . '/repository/'; $path = $CFG->dataroot . '/repository/';

View file

@ -459,7 +459,7 @@ class repository_flickr_public extends repository {
* Add Instance settings input to Moodle form * Add Instance settings input to Moodle form
* @param object $mform * @param object $mform
*/ */
public function instance_config_form($mform) { public static function instance_config_form($mform) {
$mform->addElement('text', 'email_address', get_string('emailaddress', 'repository_flickr_public')); $mform->addElement('text', 'email_address', get_string('emailaddress', 'repository_flickr_public'));
$mform->addElement('checkbox', 'usewatermarks', get_string('watermark', 'repository_flickr_public')); $mform->addElement('checkbox', 'usewatermarks', get_string('watermark', 'repository_flickr_public'));
$mform->setDefault('usewatermarks', 0); $mform->setDefault('usewatermarks', 0);

View file

@ -2002,7 +2002,7 @@ abstract class repository {
* *
* @param moodleform $mform Moodle form (passed by reference) * @param moodleform $mform Moodle form (passed by reference)
*/ */
public function instance_config_form($mform) { public static function instance_config_form($mform) {
} }
/** /**
@ -2257,20 +2257,17 @@ final class repository_instance_form extends moodleform {
$mform =& $this->_form; $mform =& $this->_form;
$this->add_defaults(); $this->add_defaults();
//add fields
if (!$this->instance) { // Add instance config options.
$result = repository::static_function($this->plugin, 'instance_config_form', $mform); $result = repository::static_function($this->plugin, 'instance_config_form', $mform);
if ($result === false) { if ($result === false) {
$mform->removeElement('name'); // Remove the name element if no other config options.
} $mform->removeElement('name');
} else { }
if ($this->instance) {
$data = array(); $data = array();
$data['name'] = $this->instance->name; $data['name'] = $this->instance->name;
if (!$this->instance->readonly) { if (!$this->instance->readonly) {
$result = $this->instance->instance_config_form($mform);
if ($result === false) {
$mform->removeElement('name');
}
// and set the data if we have some. // and set the data if we have some.
foreach ($this->instance->get_instance_option_names() as $config) { foreach ($this->instance->get_instance_option_names() as $config) {
if (!empty($this->instance->options[$config])) { if (!empty($this->instance->options[$config])) {

View file

@ -152,7 +152,7 @@ class repository_webdav extends repository {
return array('webdav_type', 'webdav_server', 'webdav_port', 'webdav_path', 'webdav_user', 'webdav_password', 'webdav_auth'); return array('webdav_type', 'webdav_server', 'webdav_port', 'webdav_path', 'webdav_user', 'webdav_password', 'webdav_auth');
} }
public function instance_config_form($mform) { public static function instance_config_form($mform) {
$choices = array(0 => get_string('http', 'repository_webdav'), 1 => get_string('https', 'repository_webdav')); $choices = array(0 => get_string('http', 'repository_webdav'), 1 => get_string('https', 'repository_webdav'));
$mform->addElement('select', 'webdav_type', get_string('webdav_type', 'repository_webdav'), $choices); $mform->addElement('select', 'webdav_type', get_string('webdav_type', 'repository_webdav'), $choices);
$mform->addRule('webdav_type', get_string('required'), 'required', null, 'client'); $mform->addRule('webdav_type', get_string('required'), 'required', null, 'client');