diff --git a/admin/presets/classes/helper.php b/admin/presets/classes/helper.php index c4050a53de9..3d165b1eb6a 100644 --- a/admin/presets/classes/helper.php +++ b/admin/presets/classes/helper.php @@ -181,13 +181,11 @@ class helper { static::add_item($presetid, 'enableanalytics', '0'); static::add_item($presetid, 'enabled', '0', 'core_competency'); static::add_item($presetid, 'pushcourseratingstouserplans', '0', 'core_competency'); - static::add_item($presetid, 'showdataretentionsummary', '0', 'tool_dataprivacy'); static::add_item($presetid, 'forum_maxattachments', '3'); - static::add_item($presetid, 'customusermenuitems', 'profile,moodle|/user/profile.php -grades,grades|/grade/report/mygrades.php -calendar,core_calendar|/calendar/view.php?view=month -privatefiles,moodle|/user/files.php'); + static::add_item($presetid, 'guestloginbutton', '0'); + // Set Activity chooser tabs to "Starred, All, Recommended". + static::add_item($presetid, 'activitychoosertabmode', '1'); // Modules: Hide chat, database, external tool (lti), IMS content package (imscp), lesson, SCORM, survey, wiki, workshop. static::add_plugin($presetid, 'mod', 'chat', false); @@ -205,8 +203,9 @@ privatefiles,moodle|/user/files.php'); static::add_plugin($presetid, 'availability', 'profile', false); // Blocks: Hide Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr, - // Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Private files, - // Recent blog entries, Search forums, Section links, Social activities,Tags, YouTube. + // Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users, + // Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities, + // Starred courses, Tags, YouTube. // Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback. static::add_plugin($presetid, 'block', 'activity_modules', false); static::add_plugin($presetid, 'block', 'blog_menu', false); @@ -234,6 +233,9 @@ privatefiles,moodle|/user/files.php'); static::add_plugin($presetid, 'block', 'tags', false); static::add_plugin($presetid, 'block', 'tag_youtube', false); static::add_plugin($presetid, 'block', 'feedback', false); + static::add_plugin($presetid, 'block', 'online_users', false); + static::add_plugin($presetid, 'block', 'recentlyaccessedcourses', false); + static::add_plugin($presetid, 'block', 'starredcourses', false); // Course formats: Disable Social format. static::add_plugin($presetid, 'format', 'social', false); @@ -241,8 +243,9 @@ privatefiles,moodle|/user/files.php'); // Data formats: Disable Javascript Object Notation (.json). static::add_plugin($presetid, 'dataformat', 'json', false); - // Enrolments: Disable Cohort sync. + // Enrolments: Disable Cohort sync, Guest access. static::add_plugin($presetid, 'enrol', 'cohort', false); + static::add_plugin($presetid, 'enrol', 'guest', false); // Filter: Disable MathJax, Activity names auto-linking. static::add_plugin($presetid, 'filter', 'mathjaxloader', TEXTFILTER_DISABLED); @@ -253,16 +256,14 @@ privatefiles,moodle|/user/files.php'); static::add_plugin($presetid, 'qbehaviour', 'deferredcbm', false); static::add_plugin($presetid, 'qbehaviour', 'immediatecbm', false); - // Question types: Disable Calculated, Calculated multichoice, Calculated simple, Description, Drag and drop markers, - // Drag and drop onto image, Embedded answers (Cloze), Essay, Numerical, Random short-answer matching. + // Question types: Disable Calculated, Calculated multichoice, Calculated simple, Drag and drop markers, + // Drag and drop onto image, Embedded answers (Cloze), Numerical, Random short-answer matching. static::add_plugin($presetid, 'qtype', 'calculated', false); static::add_plugin($presetid, 'qtype', 'calculatedmulti', false); static::add_plugin($presetid, 'qtype', 'calculatedsimple', false); - static::add_plugin($presetid, 'qtype', 'description', false); static::add_plugin($presetid, 'qtype', 'ddmarker', false); static::add_plugin($presetid, 'qtype', 'ddimageortext', false); static::add_plugin($presetid, 'qtype', 'multianswer', false); - static::add_plugin($presetid, 'qtype', 'essay', false); static::add_plugin($presetid, 'qtype', 'numerical', false); static::add_plugin($presetid, 'qtype', 'randomsamatch', false); @@ -291,15 +292,11 @@ privatefiles,moodle|/user/files.php'); static::add_item($presetid, 'enableanalytics', '1'); static::add_item($presetid, 'enabled', '1', 'core_competency'); static::add_item($presetid, 'pushcourseratingstouserplans', '1', 'core_competency'); - static::add_item($presetid, 'showdataretentionsummary', '1', 'tool_dataprivacy'); static::add_item($presetid, 'forum_maxattachments', '9'); - // In that case, the indentation coding style can't follow the rules to guarantee the setting value is created properly. - static::add_item($presetid, 'customusermenuitems', 'profile,moodle|/user/profile.php -grades,grades|/grade/report/mygrades.php -calendar,core_calendar|/calendar/view.php?view=month -privatefiles,moodle|/user/files.php' - ); + static::add_item($presetid, 'guestloginbutton', '1'); + // Set Activity chooser tabs to the default value ("Starred, All, Activities, Resources, Recommended"). + static::add_item($presetid, 'activitychoosertabmode', '0'); // Modules: Enable chat, database, external tool (lti), IMS content package (imscp), lesson, SCORM, survey, wiki, workshop. static::add_plugin($presetid, 'mod', 'chat', true); @@ -317,8 +314,9 @@ privatefiles,moodle|/user/files.php' static::add_plugin($presetid, 'availability', 'profile', true); // Blocks: Enable Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr, - // Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Private files, - // Recent blog entries, Search forums, Section links, Social activities,Tags, YouTube. + // Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users, + // Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities, + // Starred courses, Tags, YouTube. // Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback. static::add_plugin($presetid, 'block', 'activity_modules', true); static::add_plugin($presetid, 'block', 'blog_menu', true); @@ -341,6 +339,9 @@ privatefiles,moodle|/user/files.php' static::add_plugin($presetid, 'block', 'section_links', true); static::add_plugin($presetid, 'block', 'social_activities', true); static::add_plugin($presetid, 'block', 'tags', true); + static::add_plugin($presetid, 'block', 'online_users', true); + static::add_plugin($presetid, 'block', 'recentlyaccessedcourses', true); + static::add_plugin($presetid, 'block', 'starredcourses', true); // Course formats: Enable Social format. static::add_plugin($presetid, 'format', 'social', true); @@ -348,8 +349,9 @@ privatefiles,moodle|/user/files.php' // Data formats: Enable Javascript Object Notation (.json). static::add_plugin($presetid, 'dataformat', 'json', true); - // Enrolments: Enable Cohort sync. + // Enrolments: Enable Cohort sync, Guest access. static::add_plugin($presetid, 'enrol', 'cohort', true); + static::add_plugin($presetid, 'enrol', 'guest', true); // Filter: Enable MathJax, Activity names auto-linking. static::add_plugin($presetid, 'filter', 'mathjaxloader', TEXTFILTER_ON); @@ -360,16 +362,14 @@ privatefiles,moodle|/user/files.php' static::add_plugin($presetid, 'qbehaviour', 'deferredcbm', true); static::add_plugin($presetid, 'qbehaviour', 'immediatecbm', true); - // Question types: Enable Calculated, Calculated multichoice, Calculated simple, Description, Drag and drop markers, - // Drag and drop onto image, Embedded answers (Cloze), Essay, Numerical, Random short-answer matching. + // Question types: Enable Calculated, Calculated multichoice, Calculated simple, Drag and drop markers, + // Drag and drop onto image, Embedded answers (Cloze), Numerical, Random short-answer matching. static::add_plugin($presetid, 'qtype', 'calculated', true); static::add_plugin($presetid, 'qtype', 'calculatedmulti', true); static::add_plugin($presetid, 'qtype', 'calculatedsimple', true); - static::add_plugin($presetid, 'qtype', 'description', true); static::add_plugin($presetid, 'qtype', 'ddmarker', true); static::add_plugin($presetid, 'qtype', 'ddimageortext', true); static::add_plugin($presetid, 'qtype', 'multianswer', true); - static::add_plugin($presetid, 'qtype', 'essay', true); static::add_plugin($presetid, 'qtype', 'numerical', true); static::add_plugin($presetid, 'qtype', 'randomsamatch', true); diff --git a/admin/tool/admin_presets/tests/behat/apply_presets.feature b/admin/tool/admin_presets/tests/behat/apply_presets.feature index 3ae392d19b9..122740b84e4 100644 --- a/admin/tool/admin_presets/tests/behat/apply_presets.feature +++ b/admin/tool/admin_presets/tests/behat/apply_presets.feature @@ -12,7 +12,7 @@ Feature: I can apply presets Then I should not see "Setting changes" Scenario: Applying Starter Moodle preset changes status and settings -# Checking the settings before applying Full Moodle preset. +# Checking the settings before applying Full Moodle preset (we're only testing one of each type). Given I navigate to "Plugins > Activity modules > Manage activities" in site administration And "Hide" "icon" should exist in the "Chat" "table_row" And I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration @@ -30,15 +30,72 @@ Feature: I can apply presets And I open the action menu in "Starter" "table_row" And I choose "Review settings and apply" in the open action menu And I should see "Setting changes" -# We are not testing all the settings, just one of each type. - And I should see "Enable badges" in the "Setting changes" "table" - And I should see "Enable competencies" in the "core_competency" "table_row" - And I should see "Chat" in the "Setting changes" "table" - And I should see "Restriction by grouping" in the "Setting changes" "table" - And I should see "Logged in user" in the "Setting changes" "table" - And I should see "Social format" in the "format" "table_row" - And I should see "Immediate feedback with CBM" in the "Setting changes" "table" +# Checking all the settings to be applied for the Starter (if will help to identify possible regressions). + And I should see "Activities" in the "Setting changes" "table" + And I should see "Activity chooser tabs" in the "Setting changes" "table" + And I should see "Adaptive mode (no penalties)" in the "Setting changes" "table" + And I should see "Analytics" in the "Setting changes" "table" + And I should see "Blog menu" in the "Setting changes" "table" + And I should see "Blog tags" in the "Setting changes" "table" + And I should see "Calculated" in the "Setting changes" "table" And I should see "Calculated multichoice" in the "Setting changes" "table" + And I should see "Calculated simple" in the "Setting changes" "table" + And I should see "Chat" in the "Setting changes" "table" + And I should see "Cohort sync" in the "Setting changes" "table" + And I should see "Comments" in the "Setting changes" "table" + And I should see "Course completion status" in the "Setting changes" "table" + And I should see "Courses" in the "Setting changes" "table" + And I should see "Database" in the "Setting changes" "table" + And I should see "Deferred feedback with CBM" in the "Setting changes" "table" + And I should see "Drag and drop markers" in the "Setting changes" "table" + And I should see "Drag and drop onto image" in the "Setting changes" "table" + And I should see "Embedded answers (Cloze)" in the "Setting changes" "table" + And I should see "Enable badges" in the "Setting changes" "table" + And I should see "Enable blogs" in the "Setting changes" "table" + And I should see "Enable comments" in the "Setting changes" "table" + And I should see "Enable competencies" in the "core_competency" "table_row" + And I should see "Enable notes" in the "Setting changes" "table" + And I should see "Enable tags functionality" in the "Setting changes" "table" + And I should see "External tool" in the "Setting changes" "table" + And I should see "Flickr" in the "Setting changes" "table" + And I should see "Global search" in the "Setting changes" "table" + And I should see "Guest access" in the "Setting changes" "table" + And I should see "Guest login button" in the "Setting changes" "table" + And I should see "IMS content package" in the "Setting changes" "table" + And I should see "Immediate feedback with CBM" in the "Setting changes" "table" + And I should see "Latest badges" in the "Setting changes" "table" + And I should see "Learning plans" in the "Setting changes" "table" + And I should see "Lesson" in the "Setting changes" "table" + And I should see "Logged in user" in the "Setting changes" "table" + And I should see "Login" in the "Setting changes" "table" + And I should see "Main menu" in the "Setting changes" "table" + And I should see "Maximum number of attachments" in the "Setting changes" "table" + And I should see "Mentees" in the "Setting changes" "table" + And I should see "Network servers" in the "Setting changes" "table" + And I should see "Numerical" in the "Setting changes" "table" + And I should see "Online users" in the "Setting changes" "table" + And I should see "Private files" in the "Setting changes" "table" + And I should see "Random short-answer matching" in the "Setting changes" "table" + And I should see "Recent blog entries" in the "Setting changes" "table" + And I should see "Recently accessed courses" in the "Setting changes" "table" + And I should see "Restriction by grouping" in the "Setting changes" "table" + And I should see "Restriction by profile" in the "Setting changes" "table" + And I should see "SCORM package" in the "Setting changes" "table" + And I should see "Search forums" in the "Setting changes" "table" + And I should see "Section links" in the "Setting changes" "table" + And I should see "Server files" in the "Setting changes" "table" + And I should see "Show data retention summary" in the "Setting changes" "table" + And I should see "Social activities" in the "Setting changes" "table" + And I should see "Social format" in the "format" "table_row" + And I should see "Starred courses" in the "Setting changes" "table" + And I should see "Survey" in the "Setting changes" "table" + And I should see "Tags" in the "Setting changes" "table" + And I should see "TinyMCE HTML editor" in the "Setting changes" "table" + And I should see "URL downloader" in the "Setting changes" "table" + And I should see "Wiki" in the "Setting changes" "table" + And I should see "Wikimedia" in the "Setting changes" "table" + And I should see "Workshop" in the "Setting changes" "table" +# Apply the Starter preset. And I click on "Apply" "button" And I navigate to "Advanced features" in site administration And the field "Enable badges" matches value "0" diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index c35ae1f2b08..5d0d11b3e99 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3961,5 +3961,130 @@ privatefiles,moodle|/user/files.php'; upgrade_main_savepoint(true, 2022020200.03); } + if ($oldversion < 2022021100.01) { + // Some settings and plugins have been added/removed to the Starter and Full preset. Add them to the core presets if + // they haven't been included yet. + $params = ['name' => get_string('starterpreset', 'core_adminpresets'), 'iscore' => 1]; + $starterpreset = $DB->get_record('adminpresets', $params); + $params = ['name' => get_string('fullpreset', 'core_adminpresets'), 'iscore' => 1]; + $fullpreset = $DB->get_record('adminpresets', $params); + + $settings = [ + // Settings. Hide Guest login button for Starter preset (and back to show for Full). + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'none', + 'name' => 'guestloginbutton', + 'value' => '0', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'none', + 'name' => 'guestloginbutton', + 'value' => '1', + ], + // Settings. Set Activity chooser tabs to "Starred, All, Recommended"(1) for Starter and back it to default(0) for Full. + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'none', + 'name' => 'activitychoosertabmode', + 'value' => '1', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'none', + 'name' => 'activitychoosertabmode', + 'value' => '0', + ], + ]; + foreach ($settings as $notused => $setting) { + $params = ['adminpresetid' => $setting['presetid'], 'plugin' => $setting['plugin'], 'name' => $setting['name']]; + if (!$DB->record_exists('adminpresets_it', $params)) { + $record = new \stdClass(); + $record->adminpresetid = $setting['presetid']; + $record->plugin = $setting['plugin']; + $record->name = $setting['name']; + $record->value = $setting['value']; + $DB->insert_record('adminpresets_it', $record); + } + } + + $plugins = [ + // Plugins. Blocks. Disable/enable Online users, Recently accessed courses and Starred courses. + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'block', + 'name' => 'online_users', + 'enabled' => '0', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'block', + 'name' => 'online_users', + 'enabled' => '1', + ], + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'block', + 'name' => 'recentlyaccessedcourses', + 'enabled' => '0', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'block', + 'name' => 'recentlyaccessedcourses', + 'enabled' => '1', + ], + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'block', + 'name' => 'starredcourses', + 'enabled' => '0', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'block', + 'name' => 'starredcourses', + 'enabled' => '1', + ], + // Plugins. Enrolments. Disable/enable Guest access. + [ + 'presetid' => $starterpreset->id, + 'plugin' => 'enrol', + 'name' => 'guest', + 'enabled' => '0', + ], + [ + 'presetid' => $fullpreset->id, + 'plugin' => 'enrol', + 'name' => 'guest', + 'enabled' => '1', + ], + ]; + foreach ($plugins as $notused => $plugin) { + $params = ['adminpresetid' => $plugin['presetid'], 'plugin' => $plugin['plugin'], 'name' => $plugin['name']]; + if (!$DB->record_exists('adminpresets_plug', $params)) { + $record = new \stdClass(); + $record->adminpresetid = $plugin['presetid']; + $record->plugin = $plugin['plugin']; + $record->name = $plugin['name']; + $record->enabled = $plugin['enabled']; + $DB->insert_record('adminpresets_plug', $record); + } + } + + // Settings: Remove customusermenuitems setting from Starter and Full presets. + $sql = "(adminpresetid = ? OR adminpresetid = ?) AND plugin = 'none' AND name = 'customusermenuitems'"; + $params = [$starterpreset->id, $fullpreset->id]; + $DB->delete_records_select('adminpresets_it', $sql, $params); + + // Plugins. Question types. Re-enable Description and Essay for Starter. + $sql = "(adminpresetid = ? OR adminpresetid = ?) AND plugin = 'qtype' AND (name = 'description' OR name = 'essay')"; + $DB->delete_records_select('adminpresets_plug', $sql, $params); + + // Main savepoint reached. + upgrade_main_savepoint(true, 2022021100.01); + } + return true; } diff --git a/version.php b/version.php index 5509c4a942f..7060e9d3f9d 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2022021100.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2022021100.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev+ (Build: 20220211)'; // Human-friendly version name