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

This commit is contained in:
Marina Glancy 2014-10-07 10:25:29 +08:00
commit 8dfd73e04a
12 changed files with 58 additions and 14 deletions

View file

@ -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.

View file

@ -9,6 +9,8 @@
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" />
<FIELD NAME="practice" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="modattempts" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="usepassword" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
@ -188,4 +190,4 @@
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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'));

View file

@ -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));
}
$settings->add(new admin_setting_configcheckbox('lesson/requiremodintro',
get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1));
}

View file

@ -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 |

View file

@ -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:

View file

@ -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 |

View file

@ -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"

View file

@ -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"

View file

@ -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;