diff --git a/classes/output/comment.php b/classes/output/comment.php index 6066cc8aec2170988a91a3c89864e7f2daf1495d..26bb275673e28db94c18973d24543dc8361b0dd8 100644 --- a/classes/output/comment.php +++ b/classes/output/comment.php @@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die(); class comment implements \renderable, \templatable { private $comments = []; + private $questionvisibility; /** * Constructor of renderable for comments. @@ -55,6 +56,7 @@ class comment implements \renderable, \templatable { $forwardquestions = has_capability('mod/pdfannotator:forwardquestions', $context); $solve = has_capability('mod/pdfannotator:markcorrectanswer', $context); + $this->questionvisibility = $data[0]->visibility; foreach ($data as $comment) { $comment->buttons = []; @@ -193,7 +195,7 @@ class comment implements \renderable, \templatable { private function addcloseopenbutton($comment, $closequestion, $closeanyquestion) { if (!isset($comment->type) && $comment->isquestion // Only set for textbox and drawing. - && (($comment->owner && $closequestion) || $closeanyquestion)) { + && (($comment->owner && $closequestion) || $closeanyquestion) && $comment->visibility != 'private') { if ($comment->solved) { $comment->buttons[] = ["classes" => "comment-solve-a", "faicon" => ["class" => "fa-unlock"], @@ -220,6 +222,10 @@ class comment implements \renderable, \templatable { } private function addhidebutton($comment, $seehiddencomments, $hidecomments) { + // Don't need to hide personal notes. + if ($this->questionvisibility == 'private') { + return; + } if (!empty($comment->ishidden) && !isset($comment->type)) { if ($seehiddencomments) { $comment->content = $comment->content; @@ -256,7 +262,7 @@ class comment implements \renderable, \templatable { } private function addsubscribebutton($comment, $subscribe) { - if (!isset($comment->type) && $comment->isquestion && $subscribe) { // Only set for textbox and drawing. + if (!isset($comment->type) && $comment->isquestion && $subscribe && $comment->visibility != 'private') { // Only set for textbox and drawing. if (!empty($comment->issubscribed)) { $comment->buttons[] = ["classes" => "comment-subscribe-a", "faicon" => ["class" => "fa-bell-slash"], "text" => get_string('unsubscribeQuestion', 'pdfannotator')]; @@ -268,7 +274,7 @@ class comment implements \renderable, \templatable { } private function addforwardbutton($comment, $forwardquestions, $cm) { - if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions) { + if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions && $comment->visibility != 'private') { global $CFG; $urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid, 'sesskey' => sesskey()]; $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); @@ -279,7 +285,7 @@ class comment implements \renderable, \templatable { } private function addmarksolvedbutton($comment, $solve) { - if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type)) { + if ($solve && !$comment->isquestion && !$comment->isdeleted && !isset($comment->type) && $this->questionvisibility != 'private') { if ($comment->solved) { $comment->buttons[] = ["classes" => "comment-solve-a", "text" => get_string('removeCorrect', 'pdfannotator'), "moodleicon" => ["key" => "i/completion-manual-n", "component" => "core", "title" => get_string('removeCorrect', 'pdfannotator')]]; diff --git a/classes/output/index.php b/classes/output/index.php index 4b0c276ec0aecb747be5023c3194c1ada57058ee..fc391ca0c111a32294f6acb247813dffdde203c9 100644 --- a/classes/output/index.php +++ b/classes/output/index.php @@ -77,6 +77,9 @@ class index implements renderable, templatable { // Class should be placed elsew if ($data->useprotectedcomments) { $data->protectedhelpicon = $OUTPUT->help_icon('protected_comments', 'mod_pdfannotator'); } + if ($data->useprivatecomments) { + $data->privatehelpicon = $OUTPUT->help_icon('private_comments', 'mod_pdfannotator'); + } $data->printlink = $this->printurl; $data->pixprintdoc = $OUTPUT->image_url('download', 'mod_pdfannotator'); $data->pixprintcomments = $OUTPUT->image_url('print_comments', 'mod_pdfannotator'); diff --git a/lang/en/pdfannotator.php b/lang/en/pdfannotator.php index b9b693277fe9d4869aca6d9be823180055dba9fd..7f796c2cccb9429bae2683c254cb64eb5c598be5 100644 --- a/lang/en/pdfannotator.php +++ b/lang/en/pdfannotator.php @@ -61,7 +61,6 @@ $string['colorPicker'] = 'Pick a color'; $string['comment'] = 'Comment'; $string['commentDeleted'] = 'Comment has been deleted'; $string['comments'] = 'Comments'; -$string['continueDiscussion'] = 'Add a comment'; $string['correct'] = 'correct'; $string['count'] = 'count'; $string['createAnnotation'] = 'Create Annotation'; @@ -333,9 +332,10 @@ $string['privacy:metadata:pdfannotator_votes:commentid'] = "The ID of the commen $string['privacy:metadata:pdfannotator_votes:userid'] = "The ID of the user who marked the comment as interesting or helpful. It is saved in order to prevent users from voting for the same comment repeatedly."; $string['privacy:metadata:pdfannotator_votes'] = "Information about questions and comments that were marked as interesting or helpful."; $string['private_comments'] = "Personal notes"; +$string['private_comments_help'] = 'Visible only for you.'; $string['protected_answers'] = 'Private answers'; $string['protected_comments'] = "Private comments"; -$string['protected_comments_help'] = 'Visible only for you and managers.'; +$string['protected_comments_help'] = 'Visible only for you and teachers.'; $string['protected_questions'] = 'Private questions'; $string['public_comments'] = 'Public comments'; $string['question'] = 'Question'; @@ -401,7 +401,7 @@ $string['setting_useprint_help'] = "Please note that drawings are not anonymous $string['setting_use_private_comments'] = "Allow personal notes"; $string['setting_use_private_comments_help'] = "Allow participants to write personal notes. Other person cannot see this comment."; $string['setting_use_protected_comments'] = "Allow private comments"; -$string['setting_use_protected_comments_help'] = "Allow participants to write private comments. Only author and manager can see this comment."; +$string['setting_use_protected_comments_help'] = "Allow participants to write private comments. Only the author and teachers can see this comment."; $string['setting_usevotes'] = "Votes/Likes"; $string['setting_usevotes_help'] = "With this option enabled, users can like / vote for posts other than their own."; $string['show'] = 'Show'; diff --git a/model/comment.class.php b/model/comment.class.php index a24eb4d336cceb105be232fe6cdd8727fce3318f..df8b26c4aa8e6c3b9c93153137ce2ea27b4ef781 100644 --- a/model/comment.class.php +++ b/model/comment.class.php @@ -192,7 +192,6 @@ class pdfannotator_comment { } if ($data->isdeleted) { - $comment->visibility = 'deleted'; $comment->content = get_string('deletedComment', 'pdfannotator'); } else { $comment->content = $data->content; diff --git a/model/statistics.class.php b/model/statistics.class.php index be58107b8a056d96382da1cc0f221bf49fbfd195..c77dc47c073f0cabcd186704762feecf37ce7169 100644 --- a/model/statistics.class.php +++ b/model/statistics.class.php @@ -194,11 +194,11 @@ class pdfannotator_statistics { $myprivate[] = $countmyprivateanswers + $countmyprivatequestions; $myquestions[] = $countmyquestions - $countmyprotectedquestions - $countmyprivatequestions; - $otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedanswers - $countprivatequestions; + $otherquestions[] = $countquestions - $myquestions[$index] - $countprotectedquestions - $countprivatequestions; $myanswers[] = $countmyanswers - $countmyprotectedanswers - $countmyprivateanswers; - $otheranswers[] = $countanswers - $myanswers[$index] - $countprotectedanswers - $countprivateanswers; - + $otheranswers[] = $countanswers - $myanswers[$index] - $countprotectedanswers - $countprivateanswers; + $names[] = $pdfannotator->get_name(); } @@ -207,7 +207,7 @@ class pdfannotator_statistics { } /** - * Returns the number of questions/answers in one PDF-Annotator by one/all users + * Returns the number of all questions/answers in one PDF-Annotator by one/all users * @global type $DB * @param type $annotatorid * @param type $isquestion '1' for questions, '0' for answers diff --git a/shared/index.js b/shared/index.js index b44bc2cbe37a569a88f119c459492b3eb8024e63..37b28ef285aa6562c40b84b7c590e3440803e6cd 100644 --- a/shared/index.js +++ b/shared/index.js @@ -1913,6 +1913,7 @@ function startIndex(Y,_cm,_documentObject,_userid,_capabilities, _toolbarSetting $("#privateDiv").hide(); $("#protectedDiv").hide(); $("#anonymousDiv").show(); + $("#myarea").attr("placeholder", M.util.get_string('addAComment', 'pdfannotator')); } $('#comment-wrapper h4')[0].innerHTML = title; diff --git a/shared/statistic.js b/shared/statistic.js index c561eb85c47d064a97c7406868951b8e800d538f..c2c757c629e31cb0dcbc647be691a68bc86dda06 100644 --- a/shared/statistic.js +++ b/shared/statistic.js @@ -17,6 +17,7 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer var maxValue = calculateMax(otherquestions, myquestions, otheranswers, myanswers, otherprivate, myprivate, otherprotectedquestions, myprotectedquestions, otherprotectedanswers, myprotectedanswers); + var borderCol = 'rgb(250, 245, 235)'; var ctx = document.getElementById('myChart').getContext('2d'); var myChart = new Chart(ctx, { type: 'bar', @@ -27,56 +28,80 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer stack: 'questions', data: myquestions, backgroundColor: 'rgb(0,84,159)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), stack: 'questions', data: otherquestions, backgroundColor: 'rgb(142,186,229)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('myprotectedquestions', 'pdfannotator'), stack: 'questions', data: myprotectedquestions, - backgroundColor: 'rgb(137, 204, 207)', + backgroundColor: 'rgb(0, 152, 161)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('protected_questions', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), stack: 'questions', data: otherprotectedquestions, - backgroundColor: 'rgb(0, 152, 161)', + backgroundColor: 'rgb(137, 204, 207)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('myanswers', 'pdfannotator'), stack: 'answers', data: myanswers, backgroundColor: 'rgb(87, 171, 39)', + borderColor: 'rgb(0, 0, 0)', + borderWidth: 1, + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), stack: 'answers', data: otheranswers, backgroundColor: 'rgb(184, 214, 152)', + borderColor: 'rgb(0, 0, 0)', + borderWidth: 1, + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('myprotectedanswers', 'pdfannotator'), stack: 'answers', data: myprotectedanswers, - backgroundColor: 'rgb(224, 230, 154)', + backgroundColor: 'rgb(189, 205, 0)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('protected_answers', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), stack: 'answers', data: otherprotectedanswers, - backgroundColor: 'rgb(189, 205, 0)', + backgroundColor: 'rgb(224, 230, 154)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('myprivate', 'pdfannotator'), stack: 'private', data: myprivate, backgroundColor: 'rgb(246, 168, 0)', + borderColor: borderCol, + borderWidth: 1, }, { label: M.util.get_string('private_comments', 'pdfannotator') + ' ' + M.util.get_string('by_other_users', 'pdfannotator'), stack: 'private', data: otherprivate, backgroundColor: 'rgb(253, 212, 143)', + borderColor: borderCol, + borderWidth: 1, }] }, options: { @@ -91,9 +116,11 @@ function setCharts(Y, names, otherquestions, myquestions, otheranswers, myanswer position: 'bottom' }, scales: { - xAxes: [{ - stacked: true + stacked: true, + ticks: { + autoSkip: false + } }], yAxes: [{ ticks: { diff --git a/styles.css b/styles.css index c47122067bd9d26071dfc84d2c87d13c1399f09c..482396d52229abb6a7bda7f417b0fc6c1e72a657 100644 --- a/styles.css +++ b/styles.css @@ -527,8 +527,13 @@ body { margin-bottom: 0; } -.path-mod-pdfannotator #anonymousDiv, .path-mod-pdfannotator #privateDiv, .path-mod-pdfannotator #protectedDiv { +.path-mod-pdfannotator #comment-list-form > div { margin: 5px 0px; + display: block; +} + +.path-mod-pdfannotator #comment-list-form > div > * { + vertical-align: middle; } .path-mod-pdfannotator .helperLayer { diff --git a/templates/index.mustache b/templates/index.mustache index 13190d46adea4bf4f9d3e7f30d92c0346e88349a..3f6117a8c68fee2b0f837f495b498b79a83efa0d 100644 --- a/templates/index.mustache +++ b/templates/index.mustache @@ -137,12 +137,14 @@ </div> {{# useprivatecomments }} <div id="privateDiv" class="row-fluid row"> - <input type="checkbox" name="visibility" value="private" id="privateCheckbox" class="pdfannotator-radio" style="width:auto;"><label id="privateLabel" for="privateCheckbox">{{# str }} sendPrivate, pdfannotator {{/ str }}</label> + <input type="checkbox" name="visibility" value="private" id="privateCheckbox" class="pdfannotator-radio" style="width:auto;"> + <label id="privateLabel" for="privateCheckbox">{{# str }} sendPrivate, pdfannotator {{/ str }}</label> {{{privatehelpicon}}} </div> {{/ useprivatecomments }} {{# useprotectedcomments }} <div id="protectedDiv" class="row-fluid row"> - <input type="checkbox" name="visibility" value="protected" id="protectedCheckbox" class="pdfannotator-radio" style="width:auto;"><label id="protectedLabel" for="protectedCheckbox">{{# str }} sendProtected, pdfannotator {{/ str }} {{{protectedhelpicon}}} </label> + <input type="checkbox" name="visibility" value="protected" id="protectedCheckbox" class="pdfannotator-radio" style="width:auto;"> + <label id="protectedLabel" for="protectedCheckbox">{{# str }} sendProtected, pdfannotator {{/ str }} </label> {{{protectedhelpicon}}} </div> {{/ useprotectedcomments }}