From d8a560c64e31cb2fdbcfe43a9d6ffe91a5edb05d Mon Sep 17 00:00:00 2001 From: jerome Date: Thu, 30 Oct 2008 02:54:11 +0000 Subject: [PATCH] MDL-15352: add warning message when no peer are set --- lang/en_utf8/repository_remotemoodle.php | 3 ++- repository/remotemoodle/repository.class.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lang/en_utf8/repository_remotemoodle.php b/lang/en_utf8/repository_remotemoodle.php index 4321b422865..10981f53ff7 100644 --- a/lang/en_utf8/repository_remotemoodle.php +++ b/lang/en_utf8/repository_remotemoodle.php @@ -11,4 +11,5 @@ $string['remoterep_description'] = 'Allow the service to be discovered

'; $string['connectionfailure'] = 'Failed to retrieve file listing - The host moodle has either a version older than 2.0, either its Moodle Remote Repository service hasn\'t been activated'; $string['failtoretrievelist'] = 'List could not be retrieved or is empty'; $string['usernotfound'] = 'The user $a is not registered into the remote Moodle'; -$string['usercannotaccess'] = 'You ($a) cannot access to this file'; \ No newline at end of file +$string['usercannotaccess'] = 'You ($a) cannot access to this file'; +$string['nopeer'] = '
Please setup some Moodle peers for your Moodle site.
'; diff --git a/repository/remotemoodle/repository.class.php b/repository/remotemoodle/repository.class.php index 783b6b8842f..a88093ebf25 100644 --- a/repository/remotemoodle/repository.class.php +++ b/repository/remotemoodle/repository.class.php @@ -300,8 +300,13 @@ class repository_remotemoodle extends repository { $peers[$host->id] = $host->name; } + $mform->addElement('select', 'peer', get_string('peer', 'repository_remotemoodle'),$peers); $mform->addRule('peer', get_string('required'), 'required', null, 'client'); + + if (empty($peers)) { + $mform->addElement('static', null, '', get_string('nopeer','repository_remotemoodle')); + } } /**