From fbb219617b5be9090014580923133572cc2f7477 Mon Sep 17 00:00:00 2001 From: Elizabeth Dalton Date: Fri, 30 Nov 2018 08:16:17 +0800 Subject: [PATCH] MDL-64000 usertours: Add tours for key 3.6 features Tours originally written by Elizabeth Dalton, Mangled a little by Andrew Nicols and Sander Bangma, and language tweaks by Helen Foster. AMOS BEGIN CPY [pluginname,block_recentlyaccessedcourses],[tour3_title_recentcourses,tool_usertours] CPY [pluginname,block_myoverview],[tour3_title_overview,tool_usertours] CPY [groupmessages,core_message],[tour4_title_groupconvo,tool_usertours] CPY [favourites,moodle,core_message],[tour4_title_starred,tool_usertours] AMOS END Co-authored-by: Andrew Nicols Co-authored-by: Sander Bangma Co-authored-by: Helen Foster --- admin/tool/usertours/classes/manager.php | 39 +++++++++++++--- admin/tool/usertours/db/upgrade.php | 14 +++--- .../tool/usertours/lang/en/tool_usertours.php | 44 +++++++++++++++++++ admin/tool/usertours/tours/36_dashboard.json | 1 + admin/tool/usertours/tours/36_messaging.json | 1 + admin/tool/usertours/version.php | 2 +- 6 files changed, 88 insertions(+), 13 deletions(-) create mode 100644 admin/tool/usertours/tours/36_dashboard.json create mode 100644 admin/tool/usertours/tours/36_messaging.json diff --git a/admin/tool/usertours/classes/manager.php b/admin/tool/usertours/classes/manager.php index 15f142caf43..c250cfd849e 100644 --- a/admin/tool/usertours/classes/manager.php +++ b/admin/tool/usertours/classes/manager.php @@ -697,7 +697,7 @@ class manager { } /** - * Move a tour up or down. + * Move a tour up or down and redirect once complete. * * @param int $id The tour to move. */ @@ -707,6 +707,19 @@ class manager { $direction = required_param('direction', PARAM_INT); $tour = tour::instance($id); + self::_move_tour($tour, $direction); + + redirect(helper::get_list_tour_link()); + } + + /** + * Move a tour up or down. + * + * @param tour $tour The tour to move. + * + * @param int $direction + */ + protected static function _move_tour(tour $tour, $direction) { $currentsortorder = $tour->get_sortorder(); $targetsortorder = $currentsortorder + $direction; @@ -722,8 +735,6 @@ class manager { $tour->set_sortorder($targetsortorder); $tour->persist(); - - redirect(helper::get_list_tour_link()); } /** @@ -785,6 +796,13 @@ class manager { // the format filename => version. The version value needs to // be increased if the tour has been updated. $shippedtours = [ + '36_dashboard.json' => 1, + '36_messaging.json' => 1, + ]; + + // These are tours that we used to ship but don't ship any longer. + // We do not remove them, but we do disable them. + $unshippedtours = [ 'boost_administrator.json' => 1, 'boost_course_view.json' => 1, ]; @@ -813,12 +831,18 @@ class manager { unset($shippedtours[$filename]); } } + + if (isset($unshippedtours[$filename])) { + if ($version <= $unshippedtours[$filename]) { + $tour->set_enabled(tour::DISABLED); + $tour->persist(); + } + } } } - $existingtourrecords->close(); - foreach ($shippedtours as $filename => $version) { + foreach (array_reverse($shippedtours) as $filename => $version) { $filepath = $CFG->dirroot . "/{$CFG->admin}/tool/usertours/tours/" . $filename; $tourjson = file_get_contents($filepath); $tour = self::import_tour_from_json($tourjson); @@ -829,6 +853,11 @@ class manager { $tour->set_config(self::CONFIG_SHIPPED_FILENAME, $filename); $tour->set_config(self::CONFIG_SHIPPED_VERSION, $version); + // Bump new tours to the top of the list. + while ($tour->get_sortorder() > 0) { + self::_move_tour($tour, helper::MOVE_UP); + } + if (defined('BEHAT_SITE_RUNNING') || (defined('PHPUNIT_TEST') && PHPUNIT_TEST)) { // Disable this tour if this is behat or phpunit. $tour->set_enabled(false); diff --git a/admin/tool/usertours/db/upgrade.php b/admin/tool/usertours/db/upgrade.php index 088b76b7832..b649ecb06bb 100644 --- a/admin/tool/usertours/db/upgrade.php +++ b/admin/tool/usertours/db/upgrade.php @@ -35,13 +35,6 @@ use tool_usertours\manager; function xmldb_tool_usertours_upgrade($oldversion) { global $CFG, $DB; - if ($oldversion < 2016120501) { - // Update the tours shipped with Moodle. - manager::update_shipped_tours(); - - upgrade_plugin_savepoint(true, 2016120501, 'tool', 'usertours'); - } - // Automatically generated Moodle v3.2.0 release upgrade line. // Put any upgrade step following this. @@ -54,5 +47,12 @@ function xmldb_tool_usertours_upgrade($oldversion) { // Automatically generated Moodle v3.5.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2018113000) { + // Update the tours shipped with Moodle. + manager::update_shipped_tours(); + + upgrade_plugin_savepoint(true, 2018113000, 'tool', 'usertours'); + } + return true; } diff --git a/admin/tool/usertours/lang/en/tool_usertours.php b/admin/tool/usertours/lang/en/tool_usertours.php index 078e0469729..613d6a69077 100644 --- a/admin/tool/usertours/lang/en/tool_usertours.php +++ b/admin/tool/usertours/lang/en/tool_usertours.php @@ -179,3 +179,47 @@ $string['privacy:metadata:preference:requested'] = 'The time that a user last ma $string['privacy:metadata:preference:completed'] = 'The time that a user last completed a user tour.'; $string['privacy:request:preference:requested'] = 'You last requested the "{$a->name}" user tour on {$a->time}'; $string['privacy:request:preference:completed'] = 'You last marked the "{$a->name}" user tour as completed on {$a->time}'; + +// 3.6 Dashboard tour. +$string['tour3_title_dashboard'] = 'Your Dashboard'; +$string['tour3_content_dashboard'] = 'Your new Dashboard has many features to help you easily access the information most important to you.'; +$string['tour3_title_timeline'] = 'Timeline block'; +$string['tour3_content_timeline'] = 'The timeline shows your important upcoming events. + +You can choose to show activities in the next week, month, or further into the future. + +You can also show items which are overdue.'; +$string['tour3_title_recentcourses'] = 'Recently accessed courses'; +$string['tour3_content_recentcourses'] = 'The recently accessed courses block shows the courses that you last visited, allowing you to jump straight back in.'; +$string['tour3_title_overview'] = 'Course overview'; +$string['tour3_content_overview'] = 'The Course overview block shows all of the courses that you are enrolled in. + +You can choose to show courses currently in progress, or in the past or the future, or courses which you have starred.'; +$string['tour3_title_starring'] = 'Starring and hiding courses'; +$string['tour3_content_starring'] = 'You can choose to star a course to make it stand out, or hide a course which is no longer important to you. + +These actions only affect your view. + +You can also choose to display the courses in a list, or with summary information, or the default \'card\' view.'; +$string['tour3_title_displayoptions'] = 'Display options'; +$string['tour3_content_displayoptions'] = 'Courses may be sorted by course name or by last access date. + +You can also choose to display the courses in a list, with summary information, or the default \'card\' view.'; + +// 3.6 Messaging tour. +$string['tour4_title_messaging'] = 'New messaging interface'; +$string['tour4_content_messaging'] = 'Moodle 3.6 provides a new interface to messaging, ability for group messaging within a course, along with better control over who can message you.'; +$string['tour4_title_icon'] = 'Messaging'; +$string['tour4_content_icon'] = 'You can access your messages from any page using this icon. + +If you have any unread messages, the number of unread messages will show here too. + +Click on the icon to open the messaging drawer and continue the tour.'; +$string['tour4_title_groupconvo'] = 'Group messages'; +$string['tour4_content_groupconvo'] = 'If you are a member of a group with group messaging enabled, you\'ll see group conversations here. + +Course group conversations allow you to interact with the others in your group in a private and convenient location.'; +$string['tour4_title_starred'] = 'Starred'; +$string['tour4_content_starred'] = 'You can choose to star particular conversations to make them easier to find.'; +$string['tour4_title_settings'] = 'Messaging settings'; +$string['tour4_content_settings'] = 'You can access your messaging settings via the cog icon. A new privacy setting allows you to restrict who can message you.'; diff --git a/admin/tool/usertours/tours/36_dashboard.json b/admin/tool/usertours/tours/36_dashboard.json new file mode 100644 index 00000000000..1527c004a69 --- /dev/null +++ b/admin/tool/usertours/tours/36_dashboard.json @@ -0,0 +1 @@ +{"name":"Dashboard","description":"New dashboard features","pathmatch":"\/my\/%","enabled":"1","sortorder":"3","configdata":"{\"placement\":\"top\",\"orphan\":\"0\",\"backdrop\":\"0\",\"reflex\":\"0\",\"filtervalues\":{\"category\":[],\"course\":[\"0\"],\"courseformat\":[],\"role\":[],\"theme\":[]},\"majorupdatetime\":1543396938}","version":"2018051400","steps":[{"title":"tour3_title_dashboard,tool_usertours","content":"tour3_content_dashboard,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{\"backdrop\":\"1\"}"},{"title":"tour3_title_dashboard,tool_usertours","content":"tour3_content_timeline,tool_usertours","targettype":"1","targetvalue":"timeline","sortorder":"1","configdata":"{\"reflex\":\"0\"}"},{"title":"tour3_title_recentcourses,tool_usertours","content":"tour3_content_recentcourses,tool_usertours","targettype":"1","targetvalue":"recentlyaccessedcourses","sortorder":"2","configdata":"{\"placement\":\"top\",\"backdrop\":\"1\"}"},{"title":"tour3_title_overview,tool_usertours","content":"tour3_content_overview,tool_usertours","targettype":"1","targetvalue":"myoverview","sortorder":"3","configdata":"{}"},{"title":"tour3_title_starring,tool_usertours","content":"tour3_content_starring,tool_usertours","targettype":"0","targetvalue":".block-myoverview [data-display=\"cards\"] [data-region=\"course-content\"] .coursemenubtn","sortorder":"4","configdata":"{\"placement\":\"right\"}"},{"title":"tour3_title_starring,tool_usertours","content":"tour3_content_starring,tool_usertours","targettype":"0","targetvalue":".block-myoverview [data-display]:not([data-display=\"cards\"]) [data-region=\"course-content\"] .coursemenubtn","sortorder":"5","configdata":"{}"},{"title":"tour3_title_displayoptions,tool_usertours","content":"tour3_content_displayoptions,tool_usertours","targettype":"0","targetvalue":"#sortingdropdown","sortorder":"6","configdata":"{\"placement\":\"top\"}"}]} diff --git a/admin/tool/usertours/tours/36_messaging.json b/admin/tool/usertours/tours/36_messaging.json new file mode 100644 index 00000000000..bb5ca781d7d --- /dev/null +++ b/admin/tool/usertours/tours/36_messaging.json @@ -0,0 +1 @@ +{"name":"New Messaging System","description":"New messaging interface in Moodle 3.6","pathmatch":"\/course\/view.php%","enabled":"1","sortorder":"2","configdata":"{\"placement\":\"bottom\",\"orphan\":\"0\",\"backdrop\":\"0\",\"reflex\":\"0\",\"filtervalues\":{\"category\":[],\"course\":[\"0\"],\"courseformat\":[],\"role\":[],\"theme\":[]},\"majorupdatetime\":1543468823}","version":"2018051400","steps":[{"title":"tour4_title_messaging,tool_usertours","content":"tour4_content_messaging,tool_usertours","targettype":"2","targetvalue":"","sortorder":"0","configdata":"{\"backdrop\":\"1\"}"},{"title":"tour4_title_icon,tool_usertours","content":"tour4_content_icon,tool_usertours","targettype":"0","targetvalue":"[id^=message-drawer-toggle]","sortorder":"1","configdata":"{\"backdrop\":\"0\",\"reflex\":\"1\"}"},{"title":"tour4_title_groupconvo,tool_usertours","content":"tour4_content_groupconvo,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-region=\"view-overview-group-messages\"]","sortorder":"2","configdata":"{\"placement\":\"left\"}"},{"title":"tour4_title_starred,tool_usertours","content":"tour4_content_starred,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-region=\"view-overview-favourites\"]","sortorder":"3","configdata":"{\"placement\":\"left\"}"},{"title":"tour4_title_settings,tool_usertours","content":"tour4_content_settings,tool_usertours","targettype":"0","targetvalue":".message-drawer:not(.hidden) [data-route=\"view-settings\"]","sortorder":"4","configdata":"{\"reflex\":\"1\"}"}]} diff --git a/admin/tool/usertours/version.php b/admin/tool/usertours/version.php index b9aa86b6bcb..f2eb18338c5 100644 --- a/admin/tool/usertours/version.php +++ b/admin/tool/usertours/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2018051400; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2018113000; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2018050800; // Requires this Moodle version. $plugin->component = 'tool_usertours'; // Full name of the plugin (used for diagnostics).