diff --git a/action.php b/action.php index 32708d8f5f99315381716ccfc9bf789701ecc9b2..a9d8b83f36e5b42a14857878d70a766db308f8ea 100644 --- a/action.php +++ b/action.php @@ -127,7 +127,11 @@ if ($action === 'create') { $annotation = json_decode($annotationjs, true); // 1.2 Determine the type of the annotation. $type = $annotation['type']; - $typeid = pdfannotator_get_annotationtype_id($type); + $typeid = pdfannotator_get_annotationtype_id($type); + if ($typeid == null) { + echo json_encode(['status' => 'error', 'log' => get_string('error:missingAnnotationtype', 'pdfannotator')]); + return; + } // 1.3 Set the type-specific data of the annotation. $data = []; switch ($type) { diff --git a/lang/de/pdfannotator.php b/lang/de/pdfannotator.php index 54cd7ffc23d0d1aefb5f3372067f8c0086efc4f6..9b6843b57b59fe6d43b90a5357959393dcf68227 100644 --- a/lang/de/pdfannotator.php +++ b/lang/de/pdfannotator.php @@ -244,6 +244,7 @@ $string['missingAnnotation'] = 'Die zugehörige Annotation konnte nicht gefunden $string['error'] = 'Fehler!'; $string['error:openingPDF'] = 'Beim Öffnen der PDF-Datei ist ein Fehler aufgetreten'; $string['error:addAnnotation'] = 'Beim Hinzufügen einer Annotation ist ein Fehler aufgetreten.'; +$string['error:missingAnnotationtype'] = 'Annotationstyp nicht vorhanden. Möglicherweise fehlt der Eintrag in der Tabelle pdfannotator_annotationtypes.'; $string['error:editAnnotation'] = 'Beim Ändern einer Annotation ist ein Fehler aufgetreten.'; $string['error:deleteAnnotation'] = 'Beim Löschen der Annotation ist ein Fehler aufgetreten.'; $string['error:getAnnotation'] = 'Beim Auslesen der Annotation ist ein Fehler aufgetreten.'; diff --git a/lang/en/pdfannotator.php b/lang/en/pdfannotator.php index b1b8d8aefa5af7dfe21a6cfe7d625362dc3bf6f7..1325170052a033b73775251b408dddb181c23ec8 100644 --- a/lang/en/pdfannotator.php +++ b/lang/en/pdfannotator.php @@ -323,6 +323,7 @@ $string['missingAnnotation'] = 'The corresponding annotation could not be found! $string['error'] = 'Error!'; $string['error:openingPDF'] = 'An error occurred while opening the PDF file.'; $string['error:addAnnotation'] = 'An error has occurred while adding an annotation.'; +$string['error:missingAnnotationtype'] = 'Annotationtype does not exists. Possibly the entry in table pdfannotator_annotationtypes is missing.'; $string['error:editAnnotation'] = 'An error has occurred while editing an annotation.'; $string['error:deleteAnnotation'] = 'An error has occured while deleting an annotation.'; $string['error:getAnnotation'] = 'An error has occured while getting the annotation.'; diff --git a/shared/index.js b/shared/index.js index 0bf3baa8d68971c75057d3ed4d60c27488b0d1aa..47196d6ae0d66190104e51c7788341b46269d25d 100644 --- a/shared/index.js +++ b/shared/index.js @@ -185,6 +185,9 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting message: data.reason, type: "error" }); + if (data.log){ + console.error(data.log); + } setTimeout(function(){ let notificationpanel = document.getElementById("user-notifications"); while (notificationpanel.hasChildNodes()) {