Skip to content

Commit

Permalink
Merge pull request #49 from integral-learning/dev
Browse files Browse the repository at this point in the history
Prepare release v1.4.9
  • Loading branch information
jtgoltz authored Jan 11, 2023
2 parents ada7729 + 8d627bf commit 3390873
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# MumieTask - Changelog

All important changes to this plugin will be documented in this file.
## [v1.4.9] - 2023-01-11

### Fixed
- Fixed a caching issue that caused inconsistent behaviour whenever the MUMIE Task was clicked on in course view

## [v1.4.8] - 2022-07-08

Expand Down
24 changes: 19 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function mumie_delete_instance($id) {
* @param stdClass $coursemodule
*/
function mumie_get_coursemodule_info($coursemodule) {
global $DB, $USER, $CFG;
global $DB;

if (!$mumie = $DB->get_record("mumie", array("id" => $coursemodule->instance))) {
return null;
Expand All @@ -121,15 +121,29 @@ function mumie_get_coursemodule_info($coursemodule) {
// Convert intro to html. Do not filter cached version, filters run at display time.
$info->content = format_module_intro('mumie', $mumie, $coursemodule->id, false);
}
return $info;
}

/**
* Set onclick listener that makes sure the activity is opened in a new tab, if needed.
*
* @param cm_info $cm
* @return void|null
* @throws coding_exception
* @throws dml_exception
*/
function mumie_cm_info_dynamic(cm_info $cm) {
global $DB, $USER, $CFG;
if (!$mumie = $DB->get_record("mumie", array("id" => $cm->instance))) {
return null;
}
$context = context_module::instance($cm->id);

$context = context_module::instance($coursemodule->id);
$openinnewtab = $mumie->launchcontainer == MUMIE_LAUNCH_CONTAINER_WINDOW && !has_capability("mod/mumie:viewgrades", $context, $USER);
// If the activity is supposed to open in a new tab, we need to do this right here or moodle won't let us.
if ($openinnewtab) {
$info->onclick = "window.open('{$CFG->wwwroot}/mod/mumie/view.php?id={$coursemodule->id}'); return false;";
$cm->set_on_click("window.open('{$CFG->wwwroot}/mod/mumie/view.php?id={$cm->id}'); return false;");
}

return $info;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2022070800; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2023011100; // The current module version (Date: YYYYMMDDXX).
$plugin->component = 'mod_mumie'; // Full name of the plugin (used for diagnostics).
$plugin->requires = 2020061500;
$plugin->release = "v1.4.8";
$plugin->release = "v1.4.9";
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array(
'auth_mumie' => 2021031200,
Expand Down
17 changes: 11 additions & 6 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,21 @@
$redirecturl = new moodle_url('/mod/mumie/view.php', array('id' => $id, 'action' => 'open'));
echo $OUTPUT->header();
echo $grader->view_grading_table();
echo html_writer::tag(
"a",
"Open MUMIE Task",
array(
$buttonattributes = array(
"class" => "btn btn-primary",
"href" => $redirecturl,
"target" => "_blank",
"style" => "margin:10px auto; display: table;"
)
);
if ($mumietask->launchcontainer == MUMIE_LAUNCH_CONTAINER_WINDOW) {
$buttonattributes["target"] = "_blank";
}

echo html_writer::tag(
"a",
"Open MUMIE Task",
$buttonattributes
);

echo $OUTPUT->footer();
} else if ($action == "open") {

Expand Down

0 comments on commit 3390873

Please sign in to comment.