Skip to content
Snippets Groups Projects
Commit b6dd18a4 authored by Hendrik Donath's avatar Hendrik Donath
Browse files

Merge branch 'fix80' into 'testing4'

moved the query for comments into a section that is always about a comment,...

See merge request moodle_l2p/moodle-mod_pdfannotator!212
parents 9d66aa23 9476dcb8
No related branches found
No related tags found
No related merge requests found
...@@ -396,19 +396,10 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc ...@@ -396,19 +396,10 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc
// Intro is handled automatically in pluginfile.php. // Intro is handled automatically in pluginfile.php.
return false; return false;
} }
$commentid = 0;
foreach ($args as $param) {
if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) {
$commentid = $param;
break;
}
}
array_shift($args); // Ignore revision - designed to prevent caching problems only.
$fs = get_file_storage(); $fs = get_file_storage();
$relativepath = implode('/', $args);
if ($filearea === 'content') { if ($filearea === 'content') {
array_shift($args); // Ignore revision - designed to prevent caching problems only.
$relativepath = implode('/', $args);
$fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/0/$relativepath", '/'); $fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/0/$relativepath", '/');
do { do {
if (!$file = $fs->get_file_by_hash(sha1($fullpath))) { if (!$file = $fs->get_file_by_hash(sha1($fullpath))) {
...@@ -444,6 +435,15 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc ...@@ -444,6 +435,15 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc
} }
if ($filearea === 'post') { if ($filearea === 'post') {
$commentid = 0;
foreach ($args as $param) {
if (filter_var($param, FILTER_VALIDATE_INT) && $DB->record_exists('pdfannotator_comments', ['id' => $param])) {
$commentid = $param;
break;
}
}
array_shift($args);
$relativepath = implode('/', $args);
$fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/'); $fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/');
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
//Annotations from other documents might have another contextid. //Annotations from other documents might have another contextid.
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator'; $plugin->component = 'mod_pdfannotator';
$plugin->version = 2023041100; $plugin->version = 2023041400;
$plugin->release = 'PDF Annotator v1.5 release 3'; $plugin->release = 'PDF Annotator v1.5 release 3';
$plugin->requires = 2021051700; $plugin->requires = 2021051700;
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment