diff --git a/admin/tool/behat/tests/behat/get_and_set_fields.feature b/admin/tool/behat/tests/behat/get_and_set_fields.feature
index 780a315f600..5e281be703e 100644
--- a/admin/tool/behat/tests/behat/get_and_set_fields.feature
+++ b/admin/tool/behat/tests/behat/get_and_set_fields.feature
@@ -159,6 +159,7 @@ Feature: Verify that all form fields values can be get and set
And I add a "Lesson" to section "1"
And I set the following fields to these values:
| Name | Test lesson |
+ | Description | Test lesson description |
| available[enabled] | 1 |
And I set the field "deadline[enabled]" to "1"
# Checkbox (AJAX) - Checking "the field matches value" before saving.
diff --git a/mod/lesson/db/install.xml b/mod/lesson/db/install.xml
index 73723db1539..dc77a6daf9d 100644
--- a/mod/lesson/db/install.xml
+++ b/mod/lesson/db/install.xml
@@ -9,6 +9,8 @@
+
+
@@ -188,4 +190,4 @@
-
\ No newline at end of file
+
diff --git a/mod/lesson/db/upgrade.php b/mod/lesson/db/upgrade.php
index a52295d1153..872b9328528 100644
--- a/mod/lesson/db/upgrade.php
+++ b/mod/lesson/db/upgrade.php
@@ -78,7 +78,26 @@ function xmldb_lesson_upgrade($oldversion) {
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
+ if ($oldversion < 2014091001) {
+ $table = new xmldb_table('lesson');
+ $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
+ // Conditionally launch add field.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+ $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+ upgrade_mod_savepoint(true, 2014091001, 'lesson');
+ }
+
+ if ($oldversion < 2014100600) {
+ // Previously there was no module intro in lesson so don't require
+ // it to be filled in for upgraded sites.
+ set_config('requiremodintro', 0, 'lesson');
+ upgrade_mod_savepoint(true, 2014100600, 'lesson');
+ }
+
return true;
}
-
-
diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php
index e21101de872..8e4c01b4a78 100644
--- a/mod/lesson/lib.php
+++ b/mod/lesson/lib.php
@@ -738,14 +738,26 @@ function lesson_get_extra_capabilities() {
*/
function lesson_supports($feature) {
switch($feature) {
- case FEATURE_GROUPS: return false;
- case FEATURE_GROUPINGS: return false;
- case FEATURE_MOD_INTRO: return false;
- case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
- case FEATURE_GRADE_HAS_GRADE: return true;
- case FEATURE_GRADE_OUTCOMES: return true;
- case FEATURE_BACKUP_MOODLE2: return true;
- default: return null;
+ case FEATURE_GROUPS:
+ return false;
+ case FEATURE_GROUPINGS:
+ return false;
+ case FEATURE_GROUPMEMBERSONLY:
+ return true;
+ case FEATURE_MOD_INTRO:
+ return true;
+ case FEATURE_COMPLETION_TRACKS_VIEWS:
+ return true;
+ case FEATURE_GRADE_HAS_GRADE:
+ return true;
+ case FEATURE_GRADE_OUTCOMES:
+ return true;
+ case FEATURE_BACKUP_MOODLE2:
+ return true;
+ case FEATURE_SHOW_DESCRIPTION:
+ return true;
+ default:
+ return null;
}
}
diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php
index 431f5ef3720..3d739c3f913 100644
--- a/mod/lesson/mod_form.php
+++ b/mod/lesson/mod_form.php
@@ -43,7 +43,8 @@ class mod_lesson_mod_form extends moodleform_mod {
$mform = $this->_form;
-//-------------------------------------------------------------------------------
+ $config = get_config('lesson');
+
$mform->addElement('header', 'general', get_string('general', 'form'));
/** Legacy slideshow width element to maintain backwards compatibility */
@@ -89,6 +90,7 @@ class mod_lesson_mod_form extends moodleform_mod {
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
+ $this->add_intro_editor($config->requiremodintro);
// Appearance.
$mform->addElement('header', 'appearancehdr', get_string('appearance'));
diff --git a/mod/lesson/settings.php b/mod/lesson/settings.php
index cd909a6c01b..4d49b52c98c 100644
--- a/mod/lesson/settings.php
+++ b/mod/lesson/settings.php
@@ -66,4 +66,6 @@ if ($ADMIN->fulltree) {
$defaultnextpages[LESSON_UNANSWEREDPAGE] = get_string("showanunansweredpage", "lesson");
$settings->add(new admin_setting_configselect('lesson_defaultnextpage', get_string('actionaftercorrectanswer','lesson'),
get_string('configactionaftercorrectanswer', 'lesson'), 0, $defaultnextpages));
-}
\ No newline at end of file
+ $settings->add(new admin_setting_configcheckbox('lesson/requiremodintro',
+ get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
+}
diff --git a/mod/lesson/tests/behat/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature
index 9d75adc15b4..7885749483f 100644
--- a/mod/lesson/tests/behat/date_availability.feature
+++ b/mod/lesson/tests/behat/date_availability.feature
@@ -27,6 +27,7 @@ Feature: A teacher can set available from and deadline dates to access a lesson
And I click on "id_available_enabled" "checkbox"
And I set the following fields to these values:
| Name | Test lesson |
+ | Description | Test lesson description |
| available[day] | 1 |
| available[month] | January |
| available[year] | 2020 |
@@ -54,6 +55,7 @@ Feature: A teacher can set available from and deadline dates to access a lesson
And I click on "id_deadline_enabled" "checkbox"
And I set the following fields to these values:
| Name | Test lesson |
+ | Description | Test lesson description |
| deadline[day] | 1 |
| deadline[month] | January |
| deadline[year] | 2000 |
diff --git a/mod/lesson/tests/behat/lesson_navigation.feature b/mod/lesson/tests/behat/lesson_navigation.feature
index 200f3136413..5cbad7cdc5e 100644
--- a/mod/lesson/tests/behat/lesson_navigation.feature
+++ b/mod/lesson/tests/behat/lesson_navigation.feature
@@ -22,6 +22,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson name |
+ | Description | Test lesson description |
And I follow "Test lesson name"
And I follow "Add a content page"
And I set the following fields to these values:
diff --git a/mod/lesson/tests/behat/lesson_review.feature b/mod/lesson/tests/behat/lesson_review.feature
index 053c3076f41..f210c7c6932 100644
--- a/mod/lesson/tests/behat/lesson_review.feature
+++ b/mod/lesson/tests/behat/lesson_review.feature
@@ -22,6 +22,7 @@ Feature: In a lesson activity, students can review the answers they gave to ques
And I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson name |
+ | Description | Test lesson description |
| Display ongoing score | Yes |
| Slideshow | Yes |
| Maximum number of answers | 10 |
diff --git a/mod/lesson/tests/behat/password_protection.feature b/mod/lesson/tests/behat/password_protection.feature
index 74548e27072..e83b1c86f05 100644
--- a/mod/lesson/tests/behat/password_protection.feature
+++ b/mod/lesson/tests/behat/password_protection.feature
@@ -22,6 +22,7 @@ Feature: A teacher can password protect a lesson
And I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson |
+ | Description | Test lesson description |
| Password protected lesson | Yes |
| id_password | moodle_rules |
And I follow "Test lesson"
diff --git a/mod/lesson/tests/behat/time_limit.feature b/mod/lesson/tests/behat/time_limit.feature
index 9089bae6edd..53fbfc1c1d8 100644
--- a/mod/lesson/tests/behat/time_limit.feature
+++ b/mod/lesson/tests/behat/time_limit.feature
@@ -22,6 +22,7 @@ Feature: A teacher can set a time limit for a lesson
And I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson |
+ | Description | Test lesson description |
| timed | 1 |
| maxtime | 1 |
And I follow "Test lesson"
diff --git a/mod/lesson/version.php b/mod/lesson/version.php
index f2ae75b9109..110187435d6 100644
--- a/mod/lesson/version.php
+++ b/mod/lesson/version.php
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2014051200; // The current module version (Date: YYYYMMDDXX)
+$plugin->version = 2014100600; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'mod_lesson'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 0;