From b245b26cfb77e1f081b027abef0df8c26ab6b0a0 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 15 Dec 2022 14:36:35 +0000 Subject: [PATCH 1/8] mod_leganto: Fix show/hide icon positioning and code checker issues --- README.md | 11 ++++++++--- locallib.php | 6 +++--- renderer.php | 2 +- styles.css | 5 +++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6a36301..3f25e62 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Moodle. If not, see . -copyright 2017 Lancaster University (http://www.lancaster.ac.uk/) -license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later -author Tony Butler + copyright 2017 Lancaster University (http://www.lancaster.ac.uk/) + license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + author Tony Butler Leganto reading list module for Moodle @@ -34,27 +34,32 @@ Changelog --------- 2022-06-01 v4.0.0 + * Fix JS selectors and make transitions less jarring * Various fixes to improve support for Moodle 4.0 * Address issues identified by Moodle Plugin CI tests 2020-10-27 v3.5.1 + * Tell set_content() that list content is already formatted * Reset cached list data when loading course module config 2018-09-07 v3.5.0 + * Add option to display list content inline and auto-expanded * Redirect to the list rather than just the course section * Add null privacy provider for GDPR support * Add support for new chapter metadata attributes in API 2018-01-30 v3.1.1, v3.3.1 + * Display chapter titles for citations of type 'Book Chapter' * Support course/list/section/citation ids of > 16 characters * Add option to include public notes in citation display * Expand list fieldset if it contains pre-selected citations 2017-09-29 v3.1.0, v3.3.0 + * Initial stable release diff --git a/locallib.php b/locallib.php index 5d46d64..e8a4530 100644 --- a/locallib.php +++ b/locallib.php @@ -479,7 +479,7 @@ private function call_api($method, $q = '', $courseid = '', $listid = '', $citat } } - if ($cached and $json = $cache->get($cachedid)) { + if ($cached && ($json = $cache->get($cachedid))) { return $json; } @@ -651,7 +651,7 @@ public function get_lists($course, $resetcache = false) { if (!empty($year)) { $query .= '%20AND%20year~' . $year; } - if (!$courses = $this->call_api(ALMA_GET_COURSES, $query) or $courses->total_record_count == 0) { + if (!($courses = $this->call_api(ALMA_GET_COURSES, $query)) || $courses->total_record_count == 0) { continue; } @@ -903,7 +903,7 @@ public function get_selected_citations() { * @return string The final HTML output to display the custom reading list. */ public function get_list_html($citations, $display) { - if (empty($citations) or !$tree = json_decode($citations)) { + if (empty($citations) || !($tree = json_decode($citations))) { return ''; } diff --git a/renderer.php b/renderer.php index 784b4c8..7d5a803 100644 --- a/renderer.php +++ b/renderer.php @@ -76,7 +76,7 @@ public function display_leganto(stdClass $leganto) { /** * Render the HTML for the customised reading list. * - * @param \leganto_list $list The list renderable. + * @param leganto_list $list The list renderable. * @return string The HTML to render the list. */ public function render_leganto_list(leganto_list $list) { diff --git a/styles.css b/styles.css index 679ceb9..5489e14 100644 --- a/styles.css +++ b/styles.css @@ -211,6 +211,11 @@ div.legantobox ul.citations li.citation a.citationsource:active { transform: rotate(-90deg); } +.section .activity.leganto .afterlink { + margin-top: 25px; + margin-left: 5px; +} + .section .activity.leganto .contentafterlink { margin-top: 0; } From 2fbee871bcf2379e4aa855308e8749cd3887392f Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 5 May 2023 11:17:38 +0100 Subject: [PATCH 2/8] mod_leganto: Fix show/hide icon positioning (again, due to upstream fix) --- styles.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/styles.css b/styles.css index 5489e14..b0f9e43 100644 --- a/styles.css +++ b/styles.css @@ -212,8 +212,7 @@ div.legantobox ul.citations li.citation a.citationsource:active { } .section .activity.leganto .afterlink { - margin-top: 25px; - margin-left: 5px; + margin-left: 5px !important; } .section .activity.leganto .contentafterlink { From c900b72a98e9680ac4146bdc274574b92684127f Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Mon, 18 Dec 2023 19:02:58 +0000 Subject: [PATCH 3/8] mod_leganto: Address new issues identified by codechecker --- backup/moodle2/backup_leganto_stepslib.php | 6 +- .../restore_leganto_activity_task.class.php | 10 +-- backup/moodle2/restore_leganto_stepslib.php | 2 +- db/access.php | 26 +++--- db/caches.php | 10 +-- db/log.php | 28 +++--- index.php | 23 ++--- lib.php | 24 ++--- locallib.php | 87 +++++++++---------- mod_form.php | 18 ++-- renderer.php | 2 +- settings.php | 4 +- view.php | 14 +-- 13 files changed, 127 insertions(+), 127 deletions(-) diff --git a/backup/moodle2/backup_leganto_stepslib.php b/backup/moodle2/backup_leganto_stepslib.php index 1bd7895..e587193 100644 --- a/backup/moodle2/backup_leganto_stepslib.php +++ b/backup/moodle2/backup_leganto_stepslib.php @@ -45,14 +45,14 @@ protected function define_structure() { $userinfo = $this->get_setting_value('userinfo'); // Define each element separated. - $leganto = new backup_nested_element('leganto', array('id'), array('name', 'intro', 'introformat', 'timemodified', - 'display', 'citations', 'displaynotes')); + $leganto = new backup_nested_element('leganto', ['id'], ['name', 'intro', 'introformat', 'timemodified', + 'display', 'citations', 'displaynotes']); // Build the tree. // (nice mono-tree, lol). // Define sources. - $leganto->set_source_table('leganto', array('id' => backup::VAR_ACTIVITYID)); + $leganto->set_source_table('leganto', ['id' => backup::VAR_ACTIVITYID]); // Define id annotations. // (none). diff --git a/backup/moodle2/restore_leganto_activity_task.class.php b/backup/moodle2/restore_leganto_activity_task.class.php index a61f6b9..f7f52f8 100644 --- a/backup/moodle2/restore_leganto_activity_task.class.php +++ b/backup/moodle2/restore_leganto_activity_task.class.php @@ -60,9 +60,9 @@ protected function define_my_steps() { * @return array */ public static function define_decode_contents() { - $contents = array(); + $contents = []; - $contents[] = new restore_decode_content('leganto', array('intro'), 'leganto'); + $contents[] = new restore_decode_content('leganto', ['intro'], 'leganto'); return $contents; } @@ -73,7 +73,7 @@ public static function define_decode_contents() { * @return array */ public static function define_decode_rules() { - $rules = array(); + $rules = []; $rules[] = new restore_decode_rule('LEGANTOVIEWBYID', '/mod/leganto/view.php?id=$1', 'course_module'); $rules[] = new restore_decode_rule('LEGANTOINDEX', '/mod/leganto/index.php?id=$1', 'course'); @@ -88,7 +88,7 @@ public static function define_decode_rules() { * @return array */ public static function define_restore_log_rules() { - $rules = array(); + $rules = []; $rules[] = new restore_log_rule('leganto', 'add', 'view.php?id={course_module}', '{leganto}'); $rules[] = new restore_log_rule('leganto', 'edit', 'edit.php?id={course_module}', '{leganto}'); @@ -107,7 +107,7 @@ public static function define_restore_log_rules() { * @return array */ public static function define_restore_log_rules_for_course() { - $rules = array(); + $rules = []; $rules[] = new restore_log_rule('leganto', 'view all', 'index.php?id={course}', null); diff --git a/backup/moodle2/restore_leganto_stepslib.php b/backup/moodle2/restore_leganto_stepslib.php index 7ed501e..493027b 100644 --- a/backup/moodle2/restore_leganto_stepslib.php +++ b/backup/moodle2/restore_leganto_stepslib.php @@ -41,7 +41,7 @@ class restore_leganto_activity_structure_step extends restore_activity_structure * @return array */ protected function define_structure() { - $paths = array(); + $paths = []; $paths[] = new restore_path_element('leganto', '/activity/leganto'); // Return the paths wrapped into standard activity structure. diff --git a/db/access.php b/db/access.php index 63d159e..3524f9f 100644 --- a/db/access.php +++ b/db/access.php @@ -25,25 +25,25 @@ defined('MOODLE_INTERNAL') || die(); -$capabilities = array( +$capabilities = [ - 'mod/leganto:addinstance' => array( + 'mod/leganto:addinstance' => [ 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - 'clonepermissionsfrom' => 'moodle/course:manageactivities' - ), + 'manager' => CAP_ALLOW, + ], + 'clonepermissionsfrom' => 'moodle/course:manageactivities', + ], - 'mod/leganto:view' => array( + 'mod/leganto:view' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( + 'archetypes' => [ 'guest' => CAP_ALLOW, - 'user' => CAP_ALLOW - ) - ) -); + 'user' => CAP_ALLOW, + ], + ], +]; diff --git a/db/caches.php b/db/caches.php index 307ff19..8d6e30a 100644 --- a/db/caches.php +++ b/db/caches.php @@ -26,10 +26,10 @@ defined('MOODLE_INTERNAL') || die(); -$definitions = array( - 'listdata' => array( +$definitions = [ + 'listdata' => [ 'mode' => cache_store::MODE_APPLICATION, 'simplekeys' => false, - 'simpledata' => false - ) -); + 'simpledata' => false, + ], +]; diff --git a/db/log.php b/db/log.php index d10d61b..464a3c5 100644 --- a/db/log.php +++ b/db/log.php @@ -26,29 +26,29 @@ defined('MOODLE_INTERNAL') || die(); -$logs = array( - array( +$logs = [ + [ 'module' => 'leganto', 'action' => 'view', 'mtable' => 'leganto', - 'field' => 'name' - ), - array( + 'field' => 'name', + ], + [ 'module' => 'leganto', 'action' => 'view all', 'mtable' => 'leganto', - 'field' => 'name' - ), - array( + 'field' => 'name', + ], + [ 'module' => 'leganto', 'action' => 'update', 'mtable' => 'leganto', - 'field' => 'name' - ), - array( + 'field' => 'name', + ], + [ 'module' => 'leganto', 'action' => 'add', 'mtable' => 'leganto', - 'field' => 'name' - ) -); + 'field' => 'name', + ], +]; diff --git a/index.php b/index.php index 3b87d00..4013f6c 100644 --- a/index.php +++ b/index.php @@ -27,14 +27,14 @@ $id = required_param('id', PARAM_INT); // Course id. -$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST); +$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST); require_course_login($course, true); $PAGE->set_pagelayout('incourse'); -$params = array( - 'context' => context_course::instance($course->id) -); +$params = [ + 'context' => context_course::instance($course->id), +]; $event = \mod_leganto\event\course_module_instance_list_viewed::create($params); $event->add_record_snapshot('course', $course); $event->trigger(); @@ -45,7 +45,7 @@ $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); -$PAGE->set_url('/mod/leganto/index.php', array('id' => $course->id)); +$PAGE->set_url('/mod/leganto/index.php', ['id' => $course->id]); $PAGE->set_title($course->shortname.': '.$strlegantos); $PAGE->set_heading($course->fullname); $PAGE->navbar->add($strlegantos); @@ -63,11 +63,11 @@ if ($usesections) { $strsectionname = get_string('sectionname', 'format_'.$course->format); - $table->head = array ($strsectionname, $strname, $strintro); - $table->align = array ('center', 'left', 'left'); + $table->head = [$strsectionname, $strname, $strintro]; + $table->align = ['center', 'left', 'left']; } else { - $table->head = array ($strlastmodified, $strname, $strintro); - $table->align = array ('left', 'left', 'left'); + $table->head = [$strlastmodified, $strname, $strintro]; + $table->align = ['left', 'left', 'left']; } $modinfo = get_fast_modinfo($course); @@ -90,10 +90,11 @@ } $class = $leganto->visible ? '' : 'class="dimmed"'; // Hidden modules are dimmed. - $table->data[] = array ( + $table->data[] = [ $printsection, "id\">".format_string($leganto->name)."", - format_module_intro('leganto', $leganto, $cm->id)); + format_module_intro('leganto', $leganto, $cm->id), + ]; } echo html_writer::table($table); diff --git a/lib.php b/lib.php index 9625a06..0380fc2 100644 --- a/lib.php +++ b/lib.php @@ -69,7 +69,7 @@ function leganto_supports($feature) { * @return array */ function leganto_get_extra_capabilities() { - return array('moodle/site:accessallgroups'); + return ['moodle/site:accessallgroups']; } /** @@ -79,7 +79,7 @@ function leganto_get_extra_capabilities() { * @return array Status array. */ function leganto_reset_userdata($data) { - return array(); + return []; } /** @@ -88,7 +88,7 @@ function leganto_reset_userdata($data) { * @return array */ function leganto_get_view_actions() { - return array('view', 'view all'); + return ['view', 'view all']; } /** @@ -97,7 +97,7 @@ function leganto_get_view_actions() { * @return array */ function leganto_get_post_actions() { - return array('update', 'add'); + return ['update', 'add']; } /** @@ -117,7 +117,7 @@ function leganto_add_instance($data, $mform) { $data->citations = $leganto->get_citations($data); $data->id = $DB->insert_record('leganto', $data); - $DB->set_field('course_modules', 'instance', $data->id, array('id' => $cmid)); + $DB->set_field('course_modules', 'instance', $data->id, ['id' => $cmid]); return $data->id; } @@ -153,12 +153,12 @@ function leganto_update_instance($data, $mform) { function leganto_delete_instance($id) { global $DB; - if (!$leganto = $DB->get_record('leganto', array('id' => $id))) { + if (!$leganto = $DB->get_record('leganto', ['id' => $id])) { return false; } // Note: all context files are deleted automatically. - $DB->delete_records('leganto', array('id' => $leganto->id)); + $DB->delete_records('leganto', ['id' => $leganto->id]); return true; } @@ -172,7 +172,7 @@ function leganto_delete_instance($id) { * @return array Page types. */ function leganto_page_type_list($pagetype, $parentcontext, $currentcontext) { - $modulepagetype = array('mod-leganto-*' => get_string('page-mod-leganto-x', 'leganto')); + $modulepagetype = ['mod-leganto-*' => get_string('page-mod-leganto-x', 'leganto')]; return $modulepagetype; } @@ -191,7 +191,7 @@ function leganto_page_type_list($pagetype, $parentcontext, $currentcontext) { function leganto_get_coursemodule_info($cm) { global $DB; - if (!($leganto = $DB->get_record('leganto', array('id' => $cm->instance), + if (!($leganto = $DB->get_record('leganto', ['id' => $cm->instance], 'id, name, intro, introformat, display, citations'))) { return null; } @@ -233,9 +233,9 @@ function leganto_cm_info_dynamic(cm_info $cm) { $cm->set_on_click('return false;'); // Display a visual cue to users that clicking the link toggles visibility. - $showhidearrow = html_writer::div('', 'showhidearrow', array('id' => 'showhide-' . $cm->id, - 'title' => get_string('showhide', 'leganto'))); - $showhidelink = html_writer::link($cm->url, $showhidearrow, array('onclick' => 'return false;')); + $showhidearrow = html_writer::div('', 'showhidearrow', + ['id' => 'showhide-' . $cm->id, 'title' => get_string('showhide', 'leganto')]); + $showhidelink = html_writer::link($cm->url, $showhidearrow, ['onclick' => 'return false;']); $cm->set_after_link($showhidelink); } } diff --git a/locallib.php b/locallib.php index e8a4530..91568d6 100644 --- a/locallib.php +++ b/locallib.php @@ -69,7 +69,7 @@ class leganto { private $returnaction = 'view'; /** @var array Params to be used to return to this page. */ - private $returnparams = array(); + private $returnparams = []; /** @var string modulename Prevents excessive calls to get_string. */ private static $modulename = null; @@ -106,7 +106,7 @@ public function __construct($coursemodulecontext, $coursemodule, $course) { $this->course = $course; // Temporary cache only lives for a single request - used to reduce db lookups. - $this->cache = array(); + $this->cache = []; } /** @@ -206,7 +206,7 @@ public function get_instance() { return $this->instance; } if ($this->get_course_module()) { - $params = array('id' => $this->get_course_module()->instance); + $params = ['id' => $this->get_course_module()->instance]; $this->instance = $DB->get_record('leganto', $params, '*', MUST_EXIST); } if (!$this->instance) { @@ -278,7 +278,7 @@ public function get_course() { if (!$this->context) { return null; } - $params = array('id' => $this->get_course_context()->instanceid); + $params = ['id' => $this->get_course_context()->instanceid]; $this->course = $DB->get_record('course', $params, '*', MUST_EXIST); return $this->course; @@ -321,10 +321,10 @@ protected function view_return_links() { $returnaction = optional_param('returnaction', '', PARAM_ALPHA); $returnparams = optional_param('returnparams', '', PARAM_TEXT); - $params = array(); + $params = []; $returnparams = str_replace('&', '&', $returnparams); parse_str($returnparams, $params); - $newparams = array('id' => $this->get_course_module()->id, 'action' => $returnaction); + $newparams = ['id' => $this->get_course_module()->id, 'action' => $returnaction]; $params = array_merge($newparams, $params); $url = new moodle_url('/mod/leganto/view.php', $params); @@ -347,7 +347,7 @@ public function get_admin_config() { $this->adminconfig = get_config('leganto'); // Clean up Alma API URL if necessary. - $search = array('http://', 'https://', get_string('apiurl_default', 'leganto')); + $search = ['http://', 'https://', get_string('apiurl_default', 'leganto')]; $baseurl = trim(str_ireplace($search, '', $this->adminconfig->apiurl), '/'); if (!empty($baseurl)) { $slashpos = strpos($baseurl, '/'); @@ -379,11 +379,11 @@ private function is_api_configured() { $adminconfig = $this->get_admin_config(); - $settings = array( - 'apiurl', - 'apikey' - ); - $message = array(); + $settings = [ + 'apiurl', + 'apikey', + ]; + $message = []; foreach ($settings as $setting) { if (empty($adminconfig->$setting)) { @@ -412,15 +412,14 @@ private function is_api_configured() { * @param bool $cached Whether to return cached data instead (if available). * @return stdClass|bool The decoded JSON response, or false. */ - private function call_api($method, $q = '', $courseid = '', $listid = '', $citationid = '', $params = array(), - $cached = false) { + private function call_api($method, $q = '', $courseid = '', $listid = '', $citationid = '', $params = [], $cached = false) { // Start by checking that the API is configured. if (!$this->is_api_configured()) { return false; } // Make sure we have all the required data. - $debugdata = array(); + $debugdata = []; if ($method == ALMA_GET_COURSES) { if (empty($q)) { $debugdata['method'] = 'Retrieve courses'; @@ -485,13 +484,13 @@ private function call_api($method, $q = '', $courseid = '', $listid = '', $citat // Prepare cURL request data. $curl = new curl; - $header = array( + $header = [ 'Accept: application/json', - 'Authorization: apikey ' . $adminconfig->apikey - ); - $options = array( - 'CURLOPT_TIMEOUT' => 30 - ); + 'Authorization: apikey ' . $adminconfig->apikey, + ]; + $options = [ + 'CURLOPT_TIMEOUT' => 30, + ]; $curl->setHeader($header); $curl->setopt($options); $url = new moodle_url($adminconfig->apiurl . $path); @@ -550,8 +549,8 @@ private function get_codes($course, $child = false) { $coursecolumn = $adminconfig->coursecolumn; $courseattribute = $course->{$adminconfig->courseattribute}; - $codes = array(); - if ($records = $DB->get_records($codetable, array($coursecolumn => $courseattribute))) { + $codes = []; + if ($records = $DB->get_records($codetable, [$coursecolumn => $courseattribute])) { foreach ($records as $record) { $codes[] = $record->$codecolumn; } @@ -590,7 +589,7 @@ private function extract_codes($source) { preg_match_all($coderegex, $source, $codes, PREG_PATTERN_ORDER); $codes = (!empty($codes[1])) ? $codes[1] : $codes[0]; } else { - $codes = array($source); + $codes = [$source]; } $codes = array_unique($codes); @@ -607,7 +606,7 @@ private function extract_codes($source) { private function get_child_courses($courseid) { global $DB; - $childcourses = array(); + $childcourses = []; $select = "enrol = 'meta' AND status = 0 AND courseid = $courseid"; if ($childcourseids = $DB->get_fieldset_select('enrol', 'customint1', $select)) { @@ -643,7 +642,7 @@ public function get_lists($course, $resetcache = false) { $cache = cache::make('mod_leganto', 'listdata'); } - $lists = array(); + $lists = []; foreach ($codes as $code) { // Build the course search query string for the Alma API request. @@ -657,7 +656,7 @@ public function get_lists($course, $resetcache = false) { foreach ($courses->course as $almacourse) { $courseid = $almacourse->id; - if (!$coursedata = $this->call_api(ALMA_GET_COURSE, '', $courseid, '', '', array('view' => 'full'))) { + if (!$coursedata = $this->call_api(ALMA_GET_COURSE, '', $courseid, '', '', ['view' => 'full'])) { continue; } @@ -693,7 +692,7 @@ public function get_lists($course, $resetcache = false) { * @return stdClass|bool A JSON object containing the data, or false. */ private function get_list_data($courseid, $listid, $cached = false) { - if (!$list = $this->call_api(ALMA_GET_LIST, '', $courseid, $listid, '', array('view' => 'full'), $cached)) { + if (!$list = $this->call_api(ALMA_GET_LIST, '', $courseid, $listid, '', ['view' => 'full'], $cached)) { return false; } @@ -776,11 +775,11 @@ public function get_citation_data($list, $citationid, $parentpath = '', $display $citation->title = $OUTPUT->heading($title, $headinglevel, 'citationtitle h' . ($headinglevel + 1)); if (!empty($citation->leganto_permalink)) { $permalink = str_replace('auth=local', 'auth=SAML', $citation->leganto_permalink); - $linkaction = new popup_action('click', $permalink, 'popup', array('width' => 1024, 'height' => 768)); + $linkaction = new popup_action('click', $permalink, 'popup', ['width' => 1024, 'height' => 768]); $linktitle = get_string('viewcitation', 'leganto'); $linkclass = !is_null($display) && $display == LEGANTO_DISPLAY_PAGE ? ' fa-lg' : ''; $citation->permalink = $OUTPUT->action_link($permalink, ' ', $linkaction, - array('class' => 'fa fa-external-link citationlink' . $linkclass, 'title' => $linktitle)); + ['class' => 'fa fa-external-link citationlink' . $linkclass, 'title' => $linktitle]); } if (empty($citation->author) && !empty($citation->metadata->author)) { @@ -808,7 +807,7 @@ public function get_citation_data($list, $citationid, $parentpath = '', $display } if (!empty($citation->citation_tags->citation_tag)) { - $citation->tags = array(); + $citation->tags = []; foreach ($citation->citation_tags->citation_tag as $tag) { if (!empty($tag->type->value) && $tag->type->value == 'PUBLIC' && !empty($tag->value->desc)) { $citation->tags[] = html_writer::span($tag->value->desc, 'citationtag'); @@ -823,12 +822,12 @@ public function get_citation_data($list, $citationid, $parentpath = '', $display if (!empty($citation->metadata->source)) { $buttonhref = $citation->metadata->source; $buttonlabel = get_string('viewonline', 'leganto'); - $buttonaction = new popup_action('click', $buttonhref, 'popup', array('width' => 1024, 'height' => 768)); + $buttonaction = new popup_action('click', $buttonhref, 'popup', ['width' => 1024, 'height' => 768]); // The URL in the popup_action object is encoded, but needs to be un-encoded! $buttonaction->jsfunctionargs['url'] = $buttonhref; $buttontitle = $title; $citation->source = $OUTPUT->action_link($buttonhref, $buttonlabel, $buttonaction, - array('class' => 'citationsource', 'title' => $buttontitle)); + ['class' => 'citationsource', 'title' => $buttontitle]); } if (!empty($parentpath)) { @@ -850,7 +849,7 @@ public function get_citation_data($list, $citationid, $parentpath = '', $display public function get_citations($formdata) { $citationpathregex = '/^course-[0-9]{16,}_list-[0-9]{16,}_section-[0-9]{16,}_citation-[0-9]{16,}$/'; - $selected = array(); + $selected = []; foreach ($formdata as $name => $value) { if (preg_match($citationpathregex, $name) && $value == 1) { $path = $this->explode_citation_path($name); @@ -871,16 +870,16 @@ public function get_citations($formdata) { */ public function get_selected_citations() { if (!$this->has_instance()) { - return array(); + return []; } if (!$config = $this->get_instance()->citations) { - return array(); + return []; } if (!$tree = json_decode($config)) { - return array(); + return []; } - $paths = array(); + $paths = []; foreach ($tree as $coursekey => $coursetree) { foreach ($coursetree as $listkey => $listtree) { foreach ($listtree as $sectionkey => $citations) { @@ -932,10 +931,10 @@ private function explode_citation_path($citationpath) { $parts = explode('_', $citationpath); $partscount = count($parts); - $path = array($parts[$partscount - 1]); + $path = [$parts[$partscount - 1]]; for ($i = $partscount - 2; $i >= 0; $i--) { - $path = array($parts[$i] => $path); + $path = [$parts[$i] => $path]; } return $path; @@ -963,7 +962,7 @@ private function build_list_elements($list, $elements, $display, &$html = '', $w } // Open a section container and output the heading details. - $html .= html_writer::start_div('listsection', array('id' => $sectionid)); + $html .= html_writer::start_div('listsection', ['id' => $sectionid]); $html .= $this->get_section_html($list, $sectionid, $display, count($element)); // Remember that this was a section heading. @@ -981,7 +980,7 @@ private function build_list_elements($list, $elements, $display, &$html = '', $w $citationid = str_replace('citation-', '', $element); if (!$wascitation) { // If previous element was a section heading, open an unordered list. - $html .= html_writer::start_tag('ul', array('class' => 'citations')); + $html .= html_writer::start_tag('ul', ['class' => 'citations']); } // Output the citation details. @@ -1027,7 +1026,7 @@ public function get_section_html($list, $sectionid, $display = null, $citationco $countspan = ''; } - $headingstr = get_string('sectionheading', 'leganto', array('name' => $section->name, 'count' => $countspan)); + $headingstr = get_string('sectionheading', 'leganto', ['name' => $section->name, 'count' => $countspan]); $headinglevel = !is_null($display) && $display == LEGANTO_DISPLAY_PAGE ? 2 : 4; $heading = $OUTPUT->heading($headingstr, $headinglevel, 'sectionheading h' . ($headinglevel + 1)); $description = !empty($section->description) ? $section->description : ''; @@ -1049,7 +1048,7 @@ private function get_citation_html($list, $citationid, $display) { return ''; } - $html = html_writer::start_tag('li', array('id' => $citation->id, 'class' => 'citation')); + $html = html_writer::start_tag('li', ['id' => $citation->id, 'class' => 'citation']); if (!empty($citation->source)) { $html .= $citation->source; } diff --git a/mod_form.php b/mod_form.php index b130e32..581c40c 100644 --- a/mod_form.php +++ b/mod_form.php @@ -60,14 +60,14 @@ public function definition() { if (!$ctx) { $ctx = context_course::instance($this->current->course); } - $course = $DB->get_record('course', array('id' => $this->current->course), '*', MUST_EXIST); + $course = $DB->get_record('course', ['id' => $this->current->course], '*', MUST_EXIST); $this->leganto->set_course($course); } // General section. $mform->addElement('header', 'general', get_string('general', 'form')); - $mform->addElement('text', 'name', get_string('listname', 'leganto'), array('size' => '64')); + $mform->addElement('text', 'name', get_string('listname', 'leganto'), ['size' => '64']); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { @@ -93,12 +93,12 @@ public function definition() { $mform->addElement('header', 'appearance', get_string('appearance')); $mform->setExpanded('appearance', true); - $mform->addElement('select', 'display', get_string('display', 'leganto'), - array( - LEGANTO_DISPLAY_PAGE => get_string('displaypage', 'leganto'), - LEGANTO_DISPLAY_INLINE_COLLAPSED => get_string('displayinlinecollapsed', 'leganto'), - LEGANTO_DISPLAY_INLINE_EXPANDED => get_string('displayinlineexpanded', 'leganto') - )); + $mform->addElement('select', 'display', get_string('display', 'leganto'), [ + LEGANTO_DISPLAY_PAGE => get_string('displaypage', 'leganto'), + LEGANTO_DISPLAY_INLINE_COLLAPSED => get_string('displayinlinecollapsed', 'leganto'), + LEGANTO_DISPLAY_INLINE_EXPANDED => get_string('displayinlineexpanded', 'leganto'), + ] + ); $mform->addHelpButton('display', 'display', 'leganto'); $mform->setDefault('display', $adminconfig->defaultdisplay); @@ -186,7 +186,7 @@ private function setup_citation_elements(&$mform, $checkboxgrp, $citation, $sele if (!empty($adminconfig->authorsinconfig) && !empty($citation->author)) { $label .= html_writer::empty_tag('br') . $citation->author; } - $mform->addElement('advcheckbox', $citation->path, null, $label, array('group' => $checkboxgrp - 1)); + $mform->addElement('advcheckbox', $citation->path, null, $label, ['group' => $checkboxgrp - 1]); $mform->setDefault($citation->path, $default); return !empty($default); diff --git a/renderer.php b/renderer.php index 7d5a803..3930195 100644 --- a/renderer.php +++ b/renderer.php @@ -64,7 +64,7 @@ public function display_leganto(stdClass $leganto) { $listid = $cm->modname . '-' . $cm->id; // YUI function to hide inline reading list until user clicks 'view' link. - $this->page->requires->js_init_call('M.mod_leganto.initList', array($cm->id, $viewlink, $expanded, !empty($desc))); + $this->page->requires->js_init_call('M.mod_leganto.initList', [$cm->id, $viewlink, $expanded, !empty($desc)]); $output .= $this->output->container($this->render($legantolist), 'legantobox', $listid); } else { $output .= $this->output->container($this->render($legantolist), '', 'leganto'); diff --git a/settings.php b/settings.php index ce43cc8..5dcf9ad 100644 --- a/settings.php +++ b/settings.php @@ -35,7 +35,7 @@ get_string('requiremodintro_desc', 'leganto'), 0)); // Display settings. - $optionsdd = array(); + $optionsdd = []; $optionsdd[0] = get_string('displaypage', 'leganto'); $optionsdd[1] = get_string('displayinlinecollapsed', 'leganto'); $optionsdd[2] = get_string('displayinlineexpanded', 'leganto'); @@ -57,7 +57,7 @@ $settings->add(new admin_setting_heading('leganto/codesettings', get_string('codesettings', 'leganto'), '')); // Code source. - $optionscs = array(); + $optionscs = []; $optionscs['idnumber'] = get_string('idnumbercourse'); $optionscs['shortname'] = get_string('shortnamecourse'); $optionscs['codetable'] = get_string('codetable', 'leganto'); diff --git a/view.php b/view.php index 0eba0cc..efd4eec 100644 --- a/view.php +++ b/view.php @@ -46,14 +46,14 @@ // Two ways to specify the module. if ($a) { - $leganto = $DB->get_record('leganto', array('id' => $a), '*', MUST_EXIST); + $leganto = $DB->get_record('leganto', ['id' => $a], '*', MUST_EXIST); $cm = get_coursemodule_from_instance('leganto', $leganto->id, $leganto->course, true, MUST_EXIST); } else { $cm = get_coursemodule_from_id('leganto', $id, 0, true, MUST_EXIST); - $leganto = $DB->get_record('leganto', array('id' => $cm->instance), '*', MUST_EXIST); + $leganto = $DB->get_record('leganto', ['id' => $cm->instance], '*', MUST_EXIST); } -$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); +$course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST); require_course_login($course, true, $cm); $context = context_module::instance($cm->id); @@ -64,10 +64,10 @@ redirect(course_get_url($leganto->course)->out() . '#module-' . $cm->id); } -$params = array( +$params = [ 'context' => $context, - 'objectid' => $leganto->id -); + 'objectid' => $leganto->id, +]; $event = \mod_leganto\event\course_module_viewed::create($params); $event->add_record_snapshot('course_modules', $cm); $event->add_record_snapshot('course', $course); @@ -87,7 +87,7 @@ die(); } -$PAGE->set_url('/mod/leganto/view.php', array('id' => $cm->id)); +$PAGE->set_url('/mod/leganto/view.php', ['id' => $cm->id]); $PAGE->set_title($course->shortname . ': ' . $leganto->name); $PAGE->set_heading($course->fullname); From fde3b52b299e6f99f5bde1b19341d71e34ac7979 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Wed, 20 Dec 2023 15:02:59 +0000 Subject: [PATCH 4/8] mod_leganto: Update to latest Moodle Plugin CI test config --- .github/workflows/moodle-ci.yml | 51 +++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 337f610..e9145af 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -4,17 +4,18 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 services: postgres: - image: postgres:10 + image: postgres:13 env: POSTGRES_USER: 'postgres' POSTGRES_HOST_AUTH_METHOD: 'trust' ports: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 + mariadb: image: mariadb:10 env: @@ -22,7 +23,6 @@ jobs: MYSQL_ALLOW_EMPTY_PASSWORD: "true" MYSQL_CHARACTER_SET_SERVER: "utf8mb4" MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" - ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 @@ -30,13 +30,13 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.3', '7.4', '8.0'] - moodle-branch: ['MOODLE_400_STABLE'] + php: ['7.4', '8.0', '8.1'] + moodle-branch: ['MOODLE_401_STABLE'] database: [pgsql, mariadb] steps: - name: Check out repository code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: plugin @@ -46,65 +46,72 @@ jobs: php-version: ${{ matrix.php }} extensions: ${{ matrix.extensions }} ini-values: max_input_vars=5000 + # If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug". + # If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems). coverage: none - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV - name: Install moodle-plugin-ci - run: | - moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 env: DB: ${{ matrix.database }} MOODLE_BRANCH: ${{ matrix.moodle-branch }} + # Uncomment this to run Behat tests using the Moodle App. + # MOODLE_APP: 'true' - name: PHP Lint - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci phplint - name: PHP Copy/Paste Detector continue-on-error: true # This step will show errors but will not fail - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci phpcpd - name: PHP Mess Detector continue-on-error: true # This step will show errors but will not fail - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci phpmd - name: Moodle Code Checker - if: ${{ always() }} - run: moodle-plugin-ci codechecker --max-warnings 0 + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpcs --max-warnings 0 - name: Moodle PHPDoc Checker - if: ${{ always() }} - run: moodle-plugin-ci phpdoc + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpdoc --max-warnings 0 - name: Validating - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci validate - name: Check upgrade savepoints - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci savepoints - name: Mustache Lint - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci mustache - name: Grunt - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci grunt --max-lint-warnings 0 - name: PHPUnit tests - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci phpunit --fail-on-warning - name: Behat features - if: ${{ always() }} + if: ${{ !cancelled() }} run: moodle-plugin-ci behat --profile chrome + + - name: Mark cancelled jobs as failed. + if: ${{ cancelled() }} + run: exit 1 From 94af677213dcf1755d83b01f060e0dec880c5512 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 4 Jan 2024 14:57:38 +0000 Subject: [PATCH 5/8] mod_leganto: Fix inline list display for latest Moodle releases --- module.js | 21 ++++++++++++++++----- styles.css | 4 +++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/module.js b/module.js index f9b8c72..8e2c4da 100644 --- a/module.js +++ b/module.js @@ -62,16 +62,27 @@ M.mod_leganto.initList = function(Y, cmid, url, expanded, desc) { Y.one(arrowid).addClass('collapsed'); } - // Move list node out of 'activity-altcontent' div and remove if no description. - var listNode = document.getElementById('leganto-' + cmid), - altNode = listNode.parentNode.parentNode; - altNode.parentNode.parentNode.appendChild(listNode); + var activityNode = document.getElementById('module-' + cmid), + itemNode = activityNode.querySelector('.activity-item'), + titleNode = activityNode.querySelector('.activitytitle'), + afterlinkNode = activityNode.querySelector('.activity-afterlink'), + altcontentNode = activityNode.querySelector('.activity-altcontent'), + listNode = document.getElementById('leganto-' + cmid); + + // Move show/hide toggle node into the 'activity title' div if it's in the wrong place. + if (afterlinkNode) { + titleNode.append(afterlinkNode); + } + + // Move list node out of the 'alt content' div, then remove it if there's no description. + itemNode.append(listNode); if (desc === false) { - altNode.remove(); + altcontentNode.remove(); } Y.delegate('click', function(e) { if (e.currentTarget.getAttribute('href') === url) { + e.preventDefault(); var list = Y.one(listid), arrow = Y.one(arrowid); diff --git a/styles.css b/styles.css index b0f9e43..47153e6 100644 --- a/styles.css +++ b/styles.css @@ -212,7 +212,9 @@ div.legantobox ul.citations li.citation a.citationsource:active { } .section .activity.leganto .afterlink { - margin-left: 5px !important; + margin: 0 !important; + padding: 0.25rem; + border: none; } .section .activity.leganto .contentafterlink { From 67b62988f220283ea5aa3666d7960934fdafcfd3 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 5 Jan 2024 10:23:39 +0000 Subject: [PATCH 6/8] mod_leganto: Refactor output classes, plus more coding standards fixes --- classes/output/leganto_list.php | 55 +++++++++++++++++++++ renderer.php => classes/output/renderer.php | 48 +++--------------- lib.php | 16 +++--- locallib.php | 5 +- module.js | 10 ++-- 5 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 classes/output/leganto_list.php rename renderer.php => classes/output/renderer.php (70%) diff --git a/classes/output/leganto_list.php b/classes/output/leganto_list.php new file mode 100644 index 0000000..b6a5699 --- /dev/null +++ b/classes/output/leganto_list.php @@ -0,0 +1,55 @@ +. + +namespace mod_leganto\output; + +use cm_info; +use context; +use context_module; +use renderable; +use stdClass; + +/** + * Leganto list renderable class. + * + * @package mod_leganto + * @copyright 2017 Lancaster University {@link http://www.lancaster.ac.uk/} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author Tony Butler + */ +class leganto_list implements renderable { + + /** @var context The context of the course module for this leganto_list instance. */ + public $context; + + /** @var stdClass The leganto database record for this leganto_list instance. */ + public $leganto; + + /** @var cm_info The course module info object for this leganto_list instance. */ + public $cm; + + /** + * Constructor for the leganto_list class. + * + * @param stdClass $leganto The leganto record. + * @param cm_info $cm The course module info. + */ + public function __construct($leganto, $cm) { + $this->leganto = $leganto; + $this->cm = $cm; + $this->context = context_module::instance($cm->id); + } +} diff --git a/renderer.php b/classes/output/renderer.php similarity index 70% rename from renderer.php rename to classes/output/renderer.php index 3930195..206cbd5 100644 --- a/renderer.php +++ b/classes/output/renderer.php @@ -14,16 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Leganto module renderer. - * - * @package mod_leganto - * @copyright 2017 Lancaster University {@link http://www.lancaster.ac.uk/} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @author Tony Butler - */ +namespace mod_leganto\output; -defined('MOODLE_INTERNAL') || die(); +use context_module; +use leganto; +use plugin_renderer_base; +use stdClass; /** * Leganto module renderer class. @@ -33,7 +29,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Tony Butler */ -class mod_leganto_renderer extends plugin_renderer_base { +class renderer extends plugin_renderer_base { /** * Return the HTML to display the content of the customised reading list. @@ -90,35 +86,3 @@ public function render_leganto_list(leganto_list $list) { return $output; } } - -/** - * Leganto list renderable class. - * - * @package mod_leganto - * @copyright 2017 Lancaster University {@link http://www.lancaster.ac.uk/} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @author Tony Butler - */ -class leganto_list implements renderable { - - /** @var context The context of the course module for this leganto_list instance. */ - public $context; - - /** @var stdClass The leganto database record for this leganto_list instance. */ - public $leganto; - - /** @var cm_info The course module info object for this leganto_list instance. */ - public $cm; - - /** - * Constructor for the leganto_list class. - * - * @param stdClass $leganto The leganto record. - * @param cm_info $cm The course module info. - */ - public function __construct($leganto, $cm) { - $this->leganto = $leganto; - $this->cm = $cm; - $this->context = context_module::instance($cm->id); - } -} diff --git a/lib.php b/lib.php index 0380fc2..c0d2b9f 100644 --- a/lib.php +++ b/lib.php @@ -36,7 +36,7 @@ * @return mixed True if module supports feature, false if not, null if doesn't know. */ function leganto_supports($feature) { - switch($feature) { + switch ($feature) { case FEATURE_MOD_ARCHETYPE: return MOD_ARCHETYPE_RESOURCE; case FEATURE_MOD_PURPOSE: @@ -191,8 +191,7 @@ function leganto_page_type_list($pagetype, $parentcontext, $currentcontext) { function leganto_get_coursemodule_info($cm) { global $DB; - if (!($leganto = $DB->get_record('leganto', ['id' => $cm->instance], - 'id, name, intro, introformat, display, citations'))) { + if (!($leganto = $DB->get_record('leganto', ['id' => $cm->instance], 'id, name, intro, introformat, display, citations'))) { return null; } $cminfo = new cached_cm_info(); @@ -228,14 +227,17 @@ function leganto_get_coursemodule_info($cm) { * @param cm_info $cm */ function leganto_cm_info_dynamic(cm_info $cm) { - if ($cm->customdata) { + if ($cm->get_custom_data()) { // The field 'customdata' is not empty IF AND ONLY IF we display contents inline. $cm->set_on_click('return false;'); // Display a visual cue to users that clicking the link toggles visibility. - $showhidearrow = html_writer::div('', 'showhidearrow', - ['id' => 'showhide-' . $cm->id, 'title' => get_string('showhide', 'leganto')]); - $showhidelink = html_writer::link($cm->url, $showhidearrow, ['onclick' => 'return false;']); + $showhidearrow = html_writer::div('', 'showhidearrow', ['id' => 'showhide-' . $cm->id]); + $linkattributes = [ + 'onclick' => 'return false;', + 'title' => get_string('showhide', 'leganto'), + ]; + $showhidelink = html_writer::link($cm->url, $showhidearrow, $linkattributes); $cm->set_after_link($showhidelink); } } diff --git a/locallib.php b/locallib.php index 91568d6..04130f0 100644 --- a/locallib.php +++ b/locallib.php @@ -825,9 +825,8 @@ public function get_citation_data($list, $citationid, $parentpath = '', $display $buttonaction = new popup_action('click', $buttonhref, 'popup', ['width' => 1024, 'height' => 768]); // The URL in the popup_action object is encoded, but needs to be un-encoded! $buttonaction->jsfunctionargs['url'] = $buttonhref; - $buttontitle = $title; - $citation->source = $OUTPUT->action_link($buttonhref, $buttonlabel, $buttonaction, - ['class' => 'citationsource', 'title' => $buttontitle]); + $buttonattributes = ['class' => 'citationsource', 'title' => $title]; + $citation->source = $OUTPUT->action_link($buttonhref, $buttonlabel, $buttonaction, $buttonattributes); } if (!empty($parentpath)) { diff --git a/module.js b/module.js index 8e2c4da..6ddbf49 100644 --- a/module.js +++ b/module.js @@ -24,8 +24,8 @@ M.mod_leganto = {}; -M.mod_leganto.initList = function(Y, cmid, url, expanded, desc) { - Y.use('node', 'transition', function(Y) { +M.mod_leganto.initList = function (Y, cmid, url, expanded, desc) { + Y.use('node', 'transition', function (Y) { /** * Set relative position style for a list node. * @@ -80,7 +80,7 @@ M.mod_leganto.initList = function(Y, cmid, url, expanded, desc) { altcontentNode.remove(); } - Y.delegate('click', function(e) { + Y.delegate('click', function (e) { if (e.currentTarget.getAttribute('href') === url) { e.preventDefault(); var list = Y.one(listid), @@ -99,12 +99,12 @@ M.mod_leganto.initList = function(Y, cmid, url, expanded, desc) { var httpRequest = new XMLHttpRequest(); // Parse the response and check for errors. - httpRequest.onreadystatechange = function() { + httpRequest.onreadystatechange = function () { if (httpRequest.readyState === 4) { var data = Y.JSON.parse(httpRequest.responseText); if (data.hasOwnProperty('error')) { // Alert user if an error has occurred. - require(['core/notification'], function(notification) { + require(['core/notification'], function (notification) { notification.alert('', data.error); }); window.location.href = url; From bd5390bf17851870e36ef1e9464a638b3abbaf11 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 5 Jan 2024 11:50:42 +0000 Subject: [PATCH 7/8] mod_leganto: Minor style fix to avoid use of '!important' --- styles.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/styles.css b/styles.css index 47153e6..e561ee1 100644 --- a/styles.css +++ b/styles.css @@ -212,11 +212,15 @@ div.legantobox ul.citations li.citation a.citationsource:active { } .section .activity.leganto .afterlink { - margin: 0 !important; + margin: 0; padding: 0.25rem; border: none; } +.section .activity.leganto .afterlink.ml-3 a { + margin-left: -1rem; +} + .section .activity.leganto .contentafterlink { margin-top: 0; } From 25401be24d443cce3a8fdf8e268e05ae697b5ccb Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 5 Jan 2024 15:07:01 +0000 Subject: [PATCH 8/8] mod_leganto: Bump version number and update changelog for v4.1.0 --- README.md | 14 ++++++++++---- version.php | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3f25e62..f211dea 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ visibility). Changelog --------- +2024-01-05 v4.1.0 + + * Fix inline list display inconsistencies in Moodle 4.1+ + * Refactor output renderer and renderable classes + * Address new issues identified by code checker and CI tests + 2022-06-01 v4.0.0 * Fix JS selectors and make transitions less jarring @@ -70,14 +76,14 @@ Installing from the Git repository (recommended if you installed Moodle from Git): Follow the instructions at -https://docs.moodle.org/400/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository, -e.g. for the Moodle 4.0.x code: +https://docs.moodle.org/401/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository, +e.g. for the Moodle 4.1.x code: $ cd /path/to/your/moodle/ $ cd mod/ $ git clone https://github.com/tonyjbutler/moodle-mod_leganto.git leganto $ cd leganto/ - $ git checkout -b MOODLE_400_STABLE origin/MOODLE_400_STABLE + $ git checkout -b MOODLE_401_STABLE origin/MOODLE_401_STABLE $ git branch -d master $ cd /path/to/your/moodle/ $ echo /mod/leganto/ >> .git/info/exclude @@ -98,7 +104,7 @@ Updating Moodle --------------- If you installed Moodle and the Leganto reading list module from Git you can run the following commands to update both (see -https://docs.moodle.org/400/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository): +https://docs.moodle.org/401/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository): $ cd /path/to/your/moodle/ $ git pull diff --git a/version.php b/version.php index b52f8e0..8735dd0 100644 --- a/version.php +++ b/version.php @@ -25,9 +25,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2022060100; // The current module version (Date: YYYYMMDDXX). -$plugin->requires = 2022041900; // Requires this Moodle version. +$plugin->version = 2024010500; // The current module version (Date: YYYYMMDDXX). +$plugin->requires = 2022112800; // Requires this Moodle version. $plugin->component = 'mod_leganto'; // Full name of the plugin (used for diagnostics). $plugin->cron = 0; $plugin->maturity = MATURITY_STABLE; -$plugin->release = 'v4.0.0 (Build: 20220601)'; +$plugin->release = 'v4.1.0 (Build: 20240105)';