From eeaf0202f8e2b445a7b0cd6531f8441985d3c809 Mon Sep 17 00:00:00 2001
From: Friederike Schwager <schwager@cil.rwth-aachen.de>
Date: Mon, 7 Oct 2019 11:17:29 +0200
Subject: [PATCH] bugfixes download: download PDF-Files with special char in
name, don't print html-tags in comments
---
lang/en/pdfannotator.php | 4 ++--
shared/index.js | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lang/en/pdfannotator.php b/lang/en/pdfannotator.php
index baf47ef..c7359d7 100644
--- a/lang/en/pdfannotator.php
+++ b/lang/en/pdfannotator.php
@@ -317,8 +317,8 @@ $string['pdfannotator:forwardquestions'] = 'Forward questions';
$string['pdfannotator:getforwardedquestions'] = 'Receive forwarded questions';
$string['pdfannotator:hidecomments'] = 'Hide comments for participants';
$string['pdfannotator:markcorrectanswer'] = 'Mark answers as correct';
-$string['pdfannotator:printcomments'] = 'Download the comments';
-$string['pdfannotator:printdocument'] = 'Download the document';
+$string['pdfannotator:printcomments'] = 'Download the comments (even if the option is disabled for a PDF-Annotator)';
+$string['pdfannotator:printdocument'] = 'Download the document (even if the option is disabled for a PDF-Annotator)';
$string['pdfannotator:recievenewquestionnotifications'] = 'Recieve notifications about new questions';
$string['pdfannotator:report'] = 'Report inappropriate comments to the course manager';
$string['pdfannotator:seehiddencomments'] = 'See hidden comments';
diff --git a/shared/index.js b/shared/index.js
index 1f24eee..9800b5f 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -702,6 +702,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
function openDocumentCallback() {
var url = document.getElementById('myprinturl').innerHTML;
+ url = url.replace(/%/g, "%25");
+ url = url.replace(/#/g, "%23");
location.href = url;
}
}
@@ -827,6 +829,8 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
// jsPDF needs \n-linebreaks so we replace <br \> with \n. But first we remove all \n that already exist.
text = text.replace(/\n/g, "");
text = text.replace(/<br \/>/g, "\n");
+ // Remove all other HTML-Tags.
+ text = $("<div>").html(text).text();
if (author !== null) {
printAuthor(author, timemodified);
}
@@ -6966,7 +6970,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting
exists = false;
}
//call this function to repeat in 5 secs
- setTimeout(loadNewAnnotations, 5000);
+ // setTimeout(loadNewAnnotations, 5000);
}, function (err){
notification.addNotification({
message: M.util.get_string('error:getAnnotations', 'pdfannotator'),
--
GitLab