Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2025070803 v1.5.9
* fix images not being displayed in comments
* remove explicit mathjax calls for rendering
* download comment as CSV feature
* mathjax3 and php84 changes
* Incorrect display of checkbox under editor for Moodle 5
* Annotation separation: Public Private and All comments

## 2025032500 v1.5.8
* Hotfix: correct further trailing junk after parameter
* Versioning error fix
Expand Down
4 changes: 4 additions & 0 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,20 +614,24 @@
$count = 0;
foreach ($conversations as $conversation) {
$post = new stdClass();
$post->rawAnsweredquestion = $conversation->answeredquestion;
$post->answeredquestion = pdfannotator_handle_latex($context, $conversation->answeredquestion);
$post->answeredquestion = pdfannotator_extract_images($post->answeredquestion, $conversation->id, $context);
$post->page = $conversation->page;
$post->annotationtypeid = $conversation->annotationtypeid;
$post->author = $conversation->author;
$post->id = $conversation->id;
$post->timemodified = $conversation->timemodified;
$post->answers = [];

$answercount = 0;
foreach ($conversation->answers as $ca) {
$answer = new stdClass();
$answer->rawAnswer = $ca->answer;
$answer->answer = pdfannotator_handle_latex($context, $ca->answer);
$answer->answer = pdfannotator_extract_images($answer->answer, $ca->id, $context);
$answer->author = $ca->author;
$answer->id = $ca->id;
$answer->timemodified = $ca->timemodified;
$post->answers[$answercount] = $answer;
$answercount++;
Expand Down
3 changes: 3 additions & 0 deletions classes/output/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ private function addcssclasses($comment, $owner) {
$comment->wrapperClass = 'chat-message comment-list-item';
if ($comment->isquestion) {
$comment->wrapperClass .= ' questioncomment';
if($comment->visibility == 'private' || $comment->visibility == 'protected') {
$comment->wrapperClass .= ' questions-private';
}
} else if ($comment->solved) {
$comment->wrapperClass .= ' correct';
}
Expand Down
5 changes: 4 additions & 1 deletion classes/output/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

defined('MOODLE_INTERNAL') || die();

class index implements \renderable, \templatable { // Class should be placed elsewhere.
class index implements \renderable, \templatable {
// Class should be placed elsewhere.

private $usestudenttextbox;
private $usestudentdrawing;
Expand Down Expand Up @@ -81,6 +82,8 @@ public function export_for_template(\renderer_base $output) {
$data->printlink = $this->printurl;
$data->pixprintdoc = $OUTPUT->image_url('download', 'mod_pdfannotator');
$data->pixprintcomments = $OUTPUT->image_url('print_comments', 'mod_pdfannotator');
$data->pixexportpdf = $OUTPUT->image_url('export_pdf', 'mod_pdfannotator');
$data->pixexportcsv = $OUTPUT->image_url('export_csv', 'mod_pdfannotator');

return $data;
}
Expand Down
2 changes: 1 addition & 1 deletion controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
$stringman = get_string_manager();
$strings = $stringman->load_component_strings('pdfannotator', 'en'); // Method gets the strings of the language files.
$PAGE->requires->strings_for_js(array_keys($strings), 'pdfannotator'); // Method to use the language-strings in javascript.
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00002"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00008"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/statistic.js?ver=0004"));
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
$capabilities = new stdClass();
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Ahmad Obeid
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
//require_once('../../config.php');
require_once('locallib.php');

$id = required_param('id', PARAM_INT); // Course ID.
Expand Down
11 changes: 10 additions & 1 deletion lang/en/pdfannotator.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
$string['comment'] = 'Comment';
$string['commentDeleted'] = 'Comment has been deleted';
$string['comments'] = 'Comments';
// Annotation separation.
$string['comments_icon_private'] = 'This comment is private';
$string['comments_icon_public'] = 'This comment is public';
$string['comments_text_all'] = 'Show all comments';
$string['comments_text_private'] = 'Only show private comments (orange)';
$string['comments_text_public'] = 'Only show public comments (blue)';
$string['configmaxbytes'] = 'Maximum file size';
$string['correct'] = 'correct';
$string['count'] = 'count';
Expand Down Expand Up @@ -138,7 +144,10 @@
$string['error:voteComment'] = 'An error has occurred while saving the vote.';
$string['error'] = 'Error!';
$string['eventreport_added'] = 'A comment was reported';

$string['export_comments_csv'] = 'Export as CSV';
$string['export_comments_csv_tooltip'] = 'Download comments as CSV file';
$string['export_comments_pdf'] = 'Export as PDF';
$string['export_comments_pdf_tooltip'] = 'Download comments as PDF file';
$string['filenotfound'] = 'File not found, sorry.';
$string['forward'] = 'Forward';
$string['forwardedquestionhtml'] = '{$a->sender} forwarded the following question to you: <br /> <br />
Expand Down
3 changes: 2 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc
array_shift($args);
$relativepath = implode('/', $args);
$fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/');
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) {
$file = $fs->get_file_by_hash(sha1($fullpath));
if (!$file || $file->is_directory()) {
// Annotations from other documents might have another contextid.
$pdfid = $DB->get_record('pdfannotator_comments', ['id' => $commentid], 'pdfannotatorid');
if ($pdfid) {
Expand Down
12 changes: 6 additions & 6 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
// Load and execute the javascript files.
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/pdf.js?ver=00002"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/textclipper.js"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00039"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00006"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00043"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00008"));

// Pass parameters from PHP to JavaScript.

Expand Down Expand Up @@ -328,7 +328,7 @@ function pdfannotator_data_preprocessing($context, $textarea, $draftitemid = 0)
* Same function as core, however we need to add files into the existing draft area!
* Copied from hsuforum.
*/
function pdfannotator_file_prepare_draft_area(&$draftitemid, $contextid, $component, $filearea, $itemid, array $options=null, $text=null) {
function pdfannotator_file_prepare_draft_area(&$draftitemid, $contextid, $component, $filearea, $itemid, ?array $options=null, ?string $text=null) {
global $CFG, $USER, $CFG, $DB;

$options = (array)$options;
Expand Down Expand Up @@ -869,7 +869,7 @@ function pdfannotator_set_mainfile($data) {
}
}

function pdfannotator_render_listitem_actions(array $actions = null) {
function pdfannotator_render_listitem_actions(?array $actions = null) {
$menu = new action_menu();
$menu->attributes['class'] .= ' course-item-actions item-actions';
$hasitems = false;
Expand Down Expand Up @@ -984,8 +984,8 @@ function pdfannotator_prepare_overviewpage($cmid, $myrenderer, $taburl, $action,
$strings = $stringman->load_component_strings('pdfannotator', 'en'); // Method gets the strings of the language files.
$PAGE->requires->strings_for_js(array_keys($strings), 'pdfannotator'); // Method to use the language-strings in javascript.
// 1.3 Add the javascript file that determines the dynamic behaviour of the page.
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00002"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/overview.js?ver=00002"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00008"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/overview.js?ver=00004"));

// 1.4 Check user capabilities to view the different categories.
// The argument 'false' disregards administrator's magical 'doanything' power.
Expand Down
23 changes: 23 additions & 0 deletions pix/comments_all.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions pix/comments_private.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/comments_private_indicator.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions pix/comments_public.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/comments_public_indicator.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/export_csv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pix/export_pdf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading