Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Blue Card scripts for assignments on Moodle
Many universities have a Blue Card scheme enabling students with specific learning difficulties (SpLDs) to flag their work with a blue card, so the tutor will mark it with due consideration.
We needed a way of making it easier for students to flag their work with a blue card, and I have come up with these scripts, which go into the Additional HTML section in Site Administration in Moodle, and work with the Moodle Assignment functionality and the Turnitin plugin.
First the student clicks the button to add the blue card, which inserts a comment with the words "Blue Card" in the submission comments field. When the form is submitted, the JavaScript looks for a comment in the grading table, and adds a flag in the status column to remind the tutor to review the comments.
In Moodle Assignments, blue cards are flagged up with "student has added comments, please review". The tutor can then display the comment and see the words "Blue Card" (which are a link to the dyslexia marking guidelines). There is also a custom spreadsheet for tutors to download so they can see which students have flagged their work with a blue card.
In Turnitin, blue card submissions are highlighted in the grading table, and each piece of work that has been flagged with a blue card will have the words Blue Card in the title.
Tutors also see a popup (which is hidden from students) to remind them to check for blue cards. The popup can be dragged out of the way, or closed.
BITS WHICH NEED TO BE DELETED IN MOODLE 3.2 are marked with a comment: /* delete in Moodle 3.2 */
<!-- this goes in the additional HTML for the Moodle page-->
<div id="overlay" class="overlay">&nbsp;</div>
<!-- student messages -->
<div class="bluecardadded bounce-top" id="tiipopup" style="display: none">
<button class="dismiss" onclick="dismiss(this);"><i class="fa fa-times fa-2x"></i></button>
<strong>"Blue Card"</strong> is now added to the title field of your assignment. Don't delete it!
</div>
<div class="bluecardadded bounce-top" id="mapopup" style="display: none">
<button class="dismiss" onclick="dismiss(this);"><i class="fa fa-times fa-2x"></i></button>
<strong>"Blue Card"</strong> is now added as a comment below.
</div>
<!-- tutor messages -->
<div class="bluecardadded bounce-top" id="tiitutormsg" style="display: none">
<button class="dismiss" onclick="dismiss(this);"><i class="fa fa-times fa-2x"></i></button>
<h4>Important message for tutors</h4>
Submissions highlighted in blue are from students with a <strong>Blue Card</strong>. <br/>
Please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.
</div>
<div class="bluecardadded bounce-top" id="tii-intromsg" style="display: none">
<button class="dismiss" onclick="dismiss(this);"><i class="fa fa-times fa-2x"></i></button>
<h4>Important message for tutors</h4>
<img src="https://1.bp.blogspot.com/-FmwX78jirYI/WVZme_qiNhI/AAAAAAAAAmA/KpMk-gcF01M6Ilv0P-G4Zpjn0BNVovjvgCLcBGAs/s1600/moodleExport.PNG" alt="Moodle export functionality" style="float: right"/>
<strong>Do you use the Export functionality?</strong><br/>
If yes, please download the Excel spreadsheet as well as the ZIP or PDF.<br/> If essay titles are prefixed with "Blue Card", please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.
</div>
<div class="bluecardadded bounce-top" id="matutormsg" style="display: none">
<button class="dismiss" onclick="dismiss(this);"><i class="fa fa-times fa-2x"></i></button>
<h4>Important - markers please check</h4>
<p>A blue box with "Student has added comments, please review" could indicate a <strong>Blue Card</strong> has been added.</p>
<p>Please check comments and if there is a card, please apply the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> accordingly.</p>
</div>
<script type="text/javascript">
function dismiss(el){
el.parentNode.style.display='none';
document.getElementById('overlay').style.display='none';
addJello();
};
function countItems(listClass){
var ul = document.getElementsByClassName(listClass)[0];
var i=0, itemCount =0;
while(ul.getElementsByTagName('li') [i++]) itemCount++;
return itemCount;
};
var TurnitinBlueCardButton = '<input type="button" class="bluecard bounce-top" id="tiibluecard" value="Add Blue Card" title="Adds the text \'Blue Card\' at the start of your assignment title" accesskey="b"/> <a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/support/blue-marking-cards/" target="_blank" title="What is the Blue Card scheme?" accesskey="?">What\'s this?</a><br/>';
/* TURNITIN BLUE CARD */
if (!document.getElementById('fitem_id_submissiontype')) {
/* do nothing */
} else {
var request = new XMLHttpRequest();
request.open("GET", "/local/obu_indicators/get.php?name=dyslexia_indicator", false);
request.send(null);
if (request.responseText == "Y") {
document.getElementById('fitem_id_submissiontype').insertAdjacentHTML('beforebegin', TurnitinBlueCardButton);
var d = document.getElementsByClassName("dndupload-arrow")[0];
d.className += " accessible";
}
}
/* EVENT LISTENER FOR TURNITIN BLUE CARD BUTTON */
if (!document.getElementById('tiibluecard')) {
/* do nothing */
} else {
document.getElementById("tiibluecard").addEventListener('click', function () {
var title = document.getElementById('id_submissiontitle');
title.removeAttribute('onchange');
if (!title.value) {
title.value = ('Blue Card: ');
} else {
title.value = ('Blue Card: ' + title.value);
}
var x = document.getElementById("tiipopup");
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
});
}
var TurnitinBlueCardIntro = '<div class="bcsteps"><h3>Important message for tutors</h3><img src="https://1.bp.blogspot.com/-FmwX78jirYI/WVZme_qiNhI/AAAAAAAAAmA/KpMk-gcF01M6Ilv0P-G4Zpjn0BNVovjvgCLcBGAs/s1600/moodleExport.PNG" alt="Moodle export functionality" style="float: right"/><strong>Do you use the Export functionality?</strong><br/>If yes, please download the Excel spreadsheet as well as the ZIP or PDF. If essay titles are prefixed with "Blue Card", please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</div>';
var TurnitinBlueCardInbox = '<div class="bcsteps"><h3>Important message for tutors</h3>Submissions highlighted in blue are from students with a <strong>Blue Card</strong>. <br/>Please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</div>';
/* show blue card message in intro tab */
if ((!document.getElementById('introduction')) || (countItems('nav-tabs') <= 2)) {
/* do nothing */
} else {
document.getElementById('overlay').style.display='block';
document.getElementById("tii-intromsg").style.display = 'block';
document.getElementById("turnitintool_style").insertAdjacentHTML('beforebegin', TurnitinBlueCardIntro);
};
/* display bouncy message to alert tutors re blue card */
if ((!document.getElementById('inboxTable')) || (countItems('nav-tabs') <= 2)) {
/* do nothing */
} else {
document.getElementById("tiitutormsg").style.display = 'block';
document.getElementById('overlay').style.display='block';
document.getElementById("turnitintool_style").insertAdjacentHTML('beforebegin', TurnitinBlueCardInbox);
};
/* highlight blue card in TURNITIN submission inbox table */
if (!document.getElementById('inboxTable')) {
/* do nothing */
} else {
var table = document.getElementById('inboxTable');
var tbody = table.getElementsByTagName('tbody')[0];
var cells = tbody.getElementsByTagName('td');
for (var i=0, len=cells.length; i<len; i++){
if (cells[i].innerText.search('Blue Card') > -1){
var tr = cells[i].parentNode;
tr.style.backgroundColor = '#b7dbff';
cells[i].getElementsByTagName('a')[0].insertAdjacentHTML('afterend', ' &nbsp; &nbsp; &nbsp; &nbsp; <a href="ttp://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" class="bc-info" target="_blank" title="What is the Blue Card scheme?">Blue Card</a>');
}
}
}
/*when student has submitted, you sometimes get an option to resubmit */
if (!document.getElementById('post_29_submission_form')) {
/* do nothing */
} else {
var table = document.getElementById('inboxTable');
var tbody = table.getElementsByTagName('tbody')[0];
var cells = tbody.getElementsByTagName('td');
for (var i=0, len=cells.length; i<len; i++){
if (cells[i].innerText.search('Blue Card') > -1){
var resubmitform = document.getElementById('post_29_submission_form');
resubmitform.insertAdjacentHTML('beforebegin', '<p class="bcsteps bounce-top"><strong>Submission successfully uploaded to Turnitin.</strong> Only use the form below if you need to resubmit.</p><br/><hr/><br/><h3>Resubmit</h3> ');
}
}
}
/* MOODLE ASSIGNMENT BLUE CARD */
var checkBlueCard = '<p class="bcsteps bluecardadded bounce-top"><strong>Assignment submitted</strong><br/>You can check that your blue card has been added by clicking on the comments link below. If you forgot to add it when you submitted, you can <a id="forgotmabluecard" href="#" title="Adds a comment of \'Blue Card\' to request your tutor to use the dyslexia marking scheme" accesskey="b">add it now</a>.</p>';
var MoodleAssignBlueCardButton = '<p class="bcsteps" id="mabcinstructions">Step 1. Add your Blue card. <input type="button" id="mabluecard" value="Add Blue Card" class="bluecard bounce-top" title="Adds a comment of \'Blue Card\' to request your tutor to use the dyslexia marking scheme" accesskey="b"/> <a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/support/blue-marking-cards/" target="_blank" title="What is the Blue Card scheme?" accesskey="?">What\'s this?</a><br/>&nbsp;<br/>Step 2. Click the add submission button below to submit your assignment</p>';
if (!document.getElementsByClassName('submissionstatustable')[0]) {
/* do nothing */
} else {
var request = new XMLHttpRequest();
request.open("GET", "/local/obu_indicators/get.php?name=dyslexia_indicator", false);
request.send(null);
if (request.responseText == "Y") {
var assignTable = document.getElementsByClassName('submissionstatustable')[0];
assignTable.insertAdjacentHTML('beforebegin', MoodleAssignBlueCardButton);
}
}
/* if it is the tutor's view and there is a blue card comment */
if (!document.getElementsByClassName('submissionstatussubmitted')[0]) {
/* do nothing */
} else {
if (!document.getElementById('mabcinstructions')) {
/* do nothing */
} else {
var bluecardinst = document.getElementById("mabcinstructions");
bluecardinst.style.display = 'none';
bluecardinst.insertAdjacentHTML('beforebegin', checkBlueCard);
}
var commentLink = document.getElementsByClassName("comment-link")[0];
var linkImg = commentLink.getElementsByTagName("img")[0];
if(linkImg.src.search('collapsed') > -1) {
commentLink.click();
}
document.getElementsByClassName('comment-link')[0].insertAdjacentHTML('afterend', '<p class="bluemsg"><strong>Message for tutors</strong>: Student has added comments, please review. If there is a <strong>Blue Card</strong>, please apply the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</p>');
}
/* EVENT LISTENER FOR MOODLE ASSIGNMENT BLUE CARD BUTTON */
if (!document.getElementById('mabluecard')) {
/* do nothing */
} else {
document.getElementById("mabluecard").addEventListener('click', function () {
addBlueCard();
});
}
if (!document.getElementById('forgotmabluecard')) {
/* do nothing */
} else {
document.getElementById("forgotmabluecard").addEventListener('click', function () {
addBlueCard();
});
}
if (!document.getElementsByClassName('resettable')[0]) {
/* do nothing */
} else {
var parentdiv = document.getElementsByClassName('resettable')[0];
var resetLink = parentdiv.getElementsByTagName('a')[0];
resetLink.click();
}
/* flag the Blue Card submission in the Grading Table */
if (!document.getElementsByClassName('gradingtable')[0]) {
/* do nothing */
} else {
document.getElementById("block-region-side-post").style.display = 'none';
document.getElementById("region-bs-main-and-pre").style.width = '100%';
document.getElementById("region-main").style.width = '84%';
document.getElementById("block-region-side-pre").style.width = '15%';
document.getElementById("matutormsg").style.display = 'block';
document.getElementById('overlay').style.display='block';
var table = document.getElementsByClassName('gradingtable')[0];
table.insertAdjacentHTML('beforebegin', ' <div class="addjello" style="background-color: #ccccff; width: 40%; margin: 0 auto; padding: 3px; text-align: center;"><p><button id="downloadbluecardcsv" class="bluebutton" onclick="exportTableToCSV(\'submissions.csv\')">Download list of all submissions including blue card submissions</button><br/><strong>Note:</strong> Comments could mean a Blue Card submission.</p><p>Please check comments and if there is a Blue Card, please apply the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> accordingly.</p>');
var tbody = table.getElementsByTagName('tbody')[0];
var comments = tbody.getElementsByClassName('c10');
for (var i=0, len=comments.length; i<len; i++){
if (comments[i].innerText.search('Comments') > -1){
// thisRow = comments[i].closest('tr');
thisRow = comments[i].parentNode;
thisRow.style.backgroundColor = '#ffffcc';
nameLink = thisRow.getElementsByTagName("a")[1];
nameLink.insertAdjacentHTML('afterend', ' <div style="background-color: #99bbff; cursor: pointer">Student has added comments, please review</div>');
var bluemsg = document.getElementsByClassName('bluemsg')[0];
bluemsg.style.display = 'none';
}
}
}
function addJello() {
if (!document.getElementsByClassName('gradingtable')[0]) {
/* do nothing */
} else {
var table = document.getElementsByClassName('gradingtable')[0];
var tbody = table.getElementsByTagName('tbody')[0];
var comments = tbody.getElementsByClassName('c10');
for (var i=0, len=comments.length; i<len; i++){
if (comments[i].innerText.search('Comments') > -1){
comments[i].className += ' jello';
}
}
}
}
function addBlueCard() {
var popup = document.getElementById("mapopup");
popup.classList.toggle("show");
var commentbox = document.getElementsByClassName('comment-area')[0];
var textarea = commentbox.getElementsByTagName('textarea')[0];
if (!textarea.value) {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>');
} else if (textarea.value == 'Add a comment...') {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>');
} else {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>: ' + textarea.value);
}
/* save the comment */
var commentLink = document.getElementsByClassName("comment-link")[0];
var linkImg = commentLink.getElementsByTagName("img")[0];
if(linkImg.src.search('collapsed') > -1) {
commentLink.click();
}
var saveLink = document.getElementsByClassName("fd")[0].getElementsByTagName("a")[0];
saveLink.click();
/* alert the user that something has happened */
var x = document.getElementById("mapopup");
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
// CSV file
csvFile = new Blob([csv], {type: "text/csv"});
// Download link
downloadLink = document.createElement("a");
// File name
downloadLink.download = filename;
// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);
// Hide download link
downloadLink.style.display = "none";
// Add the link to DOM
document.body.appendChild(downloadLink);
// Click download link
downloadLink.click();
}
function exportTableToCSV(filename) {
var csv = [];
var explanation = 'If the word *Comment* appears in the *Submission comments* or the *Feedback comments* column: the student MAY have added a blue card to their assignment \n \n';
csv.push(explanation);
var rows = document.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td, th");
for (var j = 0; j < cols.length; j++) {
if (cols[j].innerText.search('Comments') > -1){
row.push('"'+ cols[j].innerText + ' (likely to be a Blue Card, please check)"');
} else {
row.push('"'+ cols[j].innerText + '"');
}
}
csv.push(row.join(","));
}
// Download CSV file
downloadCSV(csv.join("\n"), filename);
}
</script>
/* included as a separate file in case you only want to do Moodle assignements blue card and not Turnitin */
function dismiss(el){
el.parentNode.style.display='none';
document.getElementById('overlay').style.display='none';
addJello();
};
/* MOODLE ASSIGNMENT BLUE CARD */
var checkBlueCard = '<p class="bcsteps bluecardadded bounce-top"><strong>Assignment submitted</strong><br/>You can check that your blue card has been added by clicking on the comments link below. If you forgot to add it when you submitted, you can <a id="forgotmabluecard" href="#" title="Adds a comment of \'Blue Card\' to request your tutor to use the dyslexia marking scheme" accesskey="b">add it now</a>.</p>';
var MoodleAssignBlueCardButton = '<p class="bcsteps" id="mabcinstructions">Step 1. Add your Blue card. <input type="button" id="mabluecard" value="Add Blue Card" class="bluecard bounce-top" title="Adds a comment of \'Blue Card\' to request your tutor to use the dyslexia marking scheme" accesskey="b"/> <a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/support/blue-marking-cards/" target="_blank" title="What is the Blue Card scheme?" accesskey="?">What\'s this?</a><br/>&nbsp;<br/>Step 2. Click the add submission button below to submit your assignment</p>';
if (!document.getElementsByClassName('submissionstatustable')[0]) {
/* do nothing */
} else {
var request = new XMLHttpRequest();
request.open("GET", "/local/obu_indicators/get.php?name=dyslexia_indicator", false);
request.send(null);
if (request.responseText == "Y") {
var assignTable = document.getElementsByClassName('submissionstatustable')[0];
assignTable.insertAdjacentHTML('beforebegin', MoodleAssignBlueCardButton);
}
}
/* if it is the tutor's view and there is a blue card comment */
if (!document.getElementsByClassName('submissionstatussubmitted')[0]) {
/* do nothing */
} else {
if (!document.getElementById('mabcinstructions')) {
/* do nothing */
} else {
var bluecardinst = document.getElementById("mabcinstructions");
bluecardinst.style.display = 'none';
bluecardinst.insertAdjacentHTML('beforebegin', checkBlueCard);
}
var commentLink = document.getElementsByClassName("comment-link")[0];
var linkImg = commentLink.getElementsByTagName("img")[0];
if(linkImg.src.search('collapsed') > -1) {
commentLink.click();
}
document.getElementsByClassName('comment-link')[0].insertAdjacentHTML('afterend', '<p class="bluemsg"><strong>Message for tutors</strong>: Student has added comments, please review. If there is a <strong>Blue Card</strong>, please apply the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</p>');
}
/* EVENT LISTENER FOR MOODLE ASSIGNMENT BLUE CARD BUTTON */
if (!document.getElementById('mabluecard')) {
/* do nothing */
} else {
document.getElementById("mabluecard").addEventListener('click', function () {
addBlueCard();
});
}
if (!document.getElementById('forgotmabluecard')) {
/* do nothing */
} else {
document.getElementById("forgotmabluecard").addEventListener('click', function () {
addBlueCard();
});
}
if (!document.getElementsByClassName('resettable')[0]) {
/* do nothing */
} else {
var parentdiv = document.getElementsByClassName('resettable')[0];
var resetLink = parentdiv.getElementsByTagName('a')[0];
resetLink.click();
}
/* flag the Blue Card submission in the Grading Table */
if (!document.getElementsByClassName('gradingtable')[0]) {
/* do nothing */
} else {
document.getElementById("block-region-side-post").style.display = 'none'; /* delete in Moodle 3.2 */
document.getElementById("region-bs-main-and-pre").style.width = '100%'; /* delete in Moodle 3.2 */
document.getElementById("region-main").style.width = '84%'; /* delete in Moodle 3.2 */
document.getElementById("block-region-side-pre").style.width = '15%'; /* delete in Moodle 3.2 */
document.getElementById("matutormsg").style.display = 'block';
document.getElementById('overlay').style.display='block';
var table = document.getElementsByClassName('gradingtable')[0];
table.insertAdjacentHTML('beforebegin', ' <div class="addjello" style="background-color: #ccccff; width: 40%; margin: 0 auto; padding: 3px; text-align: center;"><p><button id="downloadbluecardcsv" class="bluebutton" onclick="exportTableToCSV(\'submissions.csv\')">Download list of all submissions including blue card submissions</button><br/><strong>Note:</strong> Comments could mean a Blue Card submission.</p><p>Please check comments and if there is a Blue Card, please apply the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> accordingly.</p>');
var tbody = table.getElementsByTagName('tbody')[0];
var comments = tbody.getElementsByClassName('c10');
for (var i=0, len=comments.length; i<len; i++){
if (comments[i].innerText.search('Comments') > -1){
// thisRow = comments[i].closest('tr');
thisRow = comments[i].parentNode;
thisRow.style.backgroundColor = '#ffffcc';
nameLink = thisRow.getElementsByTagName("a")[1];
nameLink.insertAdjacentHTML('afterend', ' <div style="background-color: #99bbff; cursor: pointer">Student has added comments, please review</div>');
var bluemsg = document.getElementsByClassName('bluemsg')[0];
bluemsg.style.display = 'none';
}
}
}
function addJello() {
if (!document.getElementsByClassName('gradingtable')[0]) {
/* do nothing */
} else {
var table = document.getElementsByClassName('gradingtable')[0];
var tbody = table.getElementsByTagName('tbody')[0];
var comments = tbody.getElementsByClassName('c10');
for (var i=0, len=comments.length; i<len; i++){
if (comments[i].innerText.search('Comments') > -1){
comments[i].className += ' jello';
}
}
}
}
function addBlueCard() {
var popup = document.getElementById("mapopup");
popup.classList.toggle("show");
var commentbox = document.getElementsByClassName('comment-area')[0];
var textarea = commentbox.getElementsByTagName('textarea')[0];
if (!textarea.value) {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>');
} else if (textarea.value == 'Add a comment...') {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>');
} else {
textarea.value = ('<a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank" style="background-color: #99ccff; font-weight:bold;">Blue Card</a>: ' + textarea.value);
}
/* save the comment */
var commentLink = document.getElementsByClassName("comment-link")[0];
var linkImg = commentLink.getElementsByTagName("img")[0];
if(linkImg.src.search('collapsed') > -1) {
commentLink.click();
}
var saveLink = document.getElementsByClassName("fd")[0].getElementsByTagName("a")[0];
saveLink.click();
/* alert the user that something has happened */
var x = document.getElementById("mapopup");
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
// CSV file
csvFile = new Blob([csv], {type: "text/csv"});
// Download link
downloadLink = document.createElement("a");
// File name
downloadLink.download = filename;
// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);
// Hide download link
downloadLink.style.display = "none";
// Add the link to DOM
document.body.appendChild(downloadLink);
// Click download link
downloadLink.click();
}
function exportTableToCSV(filename) {
var csv = [];
var explanation = 'If the word *Comment* appears in the *Submission comments* or the *Feedback comments* column: the student MAY have added a blue card to their assignment \n \n';
csv.push(explanation);
var rows = document.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td, th");
for (var j = 0; j < cols.length; j++) {
if (cols[j].innerText.search('Comments') > -1){
row.push('"'+ cols[j].innerText + ' (likely to be a Blue Card, please check)"');
} else {
row.push('"'+ cols[j].innerText + '"');
}
}
csv.push(row.join(","));
}
// Download CSV file
downloadCSV(csv.join("\n"), filename);
}
/* put this in the additonal custom css for your Moodle theme */
/* this was created to work with Aardvark */
/*BLUE CARD*/
input.bluecard {
background-color: rgba(0, 0, 255, 1) !important;
color: #fff;
padding: 6px;
border-radius: 6px;
margin: 6px 0 0 45%;
}
.bcsteps .bluecard {
margin: 6px 0 0 33%;
}
.bluebutton {
background-color: rgba(0, 0, 255, 1) !important;
color: #fff;
padding: 6px;
border-radius: 6px;
margin: 6px !important;
}
.dndupload-arrow.accessible {
background: #669ed5 !important;
width: 35px;
height: 25px;
margin: 12px 48%;
}
.dndupload-arrow.accessible::after {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(102, 158, 213, 0);
border-top-color: #669ed5;
border-width: 45px;
margin-left: -45px;
}
a[title^="Blue Card:"] {
background-color: #b7dbff;
color: navy !important;
}
.bc-info {
background-color: #0066ff;
color: #fff !important;
padding: 3px;
}
#inboxTable .cell {
background-color: transparent !important;
}
#tiipopup, #tiitutormsg, #tii-intromsg {
left: 35%;
width: 25%;
top: 26%;
z-index: 20;
cursor: move;
}
#mapopup {
left: 45%;
width: 25%;
top: 26%;
cursor: move;
}
#matutormsg {
top: 40%;
left: 45%;
width: 25%;
cursor: move;
}
.bluecardadded {
z-index: 40;
position: absolute;
padding: 1em;
background-color: rgb(153, 204, 255);
color: #000;
border-radius: 6px;
min-height: 3em;
}
.bluemsg {
background-color: rgb(153, 204, 255);
color: #000;
padding: 6px;
}
div.no-overflow {
clear: left;
}
.bcsteps {
border: 1px solid #0000FF;
background-color: rgb(210, 234, 255);
margin: 6px;
padding: 6px;
border-radius: 6px;
width: 50%;
margin: 0 auto;
}
table.flexible th, .generaltable th, table.flexible td, .generaltable td {
max-width: 15em;
word-wrap: break-word;
}
.overlay {
opacity: 0.9;
z-index: 1;
position: absolute;
top: 0;
left: 0;
width: 100%;
background-color: #424a52;
height: 40em;
height: 200vh;
display: none;
}
.dismiss {
padding: 0.5em;
float: right;
margin: 0.5em;
background-color: #424a52 !important;
color: #fff !important;
}
p.footer-links {
background-color: #424a52;
color: #fff;
margin: 0;
padding: 6px;
}
p.footer-links a {
color: #fff !important;
}
/* animation classes */
.bounce-top {
-webkit-animation: bounce-top 0.9s both;
-moz-animation: bounce-top 0.9s both;
animation: bounce-top 0.9s both;
}
.fade-out {
-webkit-animation: fade-out 10s ease-out both;
-moz-animation: fade-out 10s ease-out both;
animation: fade-out 10s ease-out both;
}
.jello {
-webkit-animation: jello-horizontal 0.9s both;
animation: jello-horizontal 0.9s both;
}
/* ----------------------------------------------
* Generated by Animista
* http://animista.net
* T: @cssanimista
* ---------------------------------------------- */
/* ----------------------------------------------
fade-out-left
* ---------------------------------------------- */
@-webkit-keyframes fade-out-left{0%{-webkit-transform:translateX(0);transform:translateX(0);opacity:1}100%{-webkit-transform:translateX(-50px);transform:translateX(-50px);opacity:0}}@keyframes fade-out-left{0%{-webkit-transform:translateX(0);transform:translateX(0);opacity:1}100%{-webkit-transform:translateX(-50px);transform:translateX(-50px);opacity:0}}@-webkit-keyframes fade-out-bl{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(-50px) translateY(50px);transform:translateX(-50px) translateY(50px);opacity:0}}@keyframes fade-out-bl{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(-50px) translateY(50px);transform:translateX(-50px) translateY(50px);opacity:0}}@-webkit-keyframes fade-out-tl{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(-50px) translateY(-50px);transform:translateX(-50px) translateY(-50px);opacity:0}}@keyframes fade-out-tl{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(-50px) translateY(-50px);transform:translateX(-50px) translateY(-50px);opacity:0}}@-webkit-keyframes fade-out-bottom{0%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}100%{-webkit-transform:translateY(50px);transform:translateY(50px);opacity:0}}@keyframes fade-out-bottom{0%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}100%{-webkit-transform:translateY(50px);transform:translateY(50px);opacity:0}}@-webkit-keyframes fade-out-br{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(50px) translateY(50px);transform:translateX(50px) translateY(50px);opacity:0}}@keyframes fade-out-br{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(50px) translateY(50px);transform:translateX(50px) translateY(50px);opacity:0}}@-webkit-keyframes fade-out-right{0%{-webkit-transform:translateX(0);transform:translateX(0);opacity:1}100%{-webkit-transform:translateX(50px);transform:translateX(50px);opacity:0}}@keyframes fade-out-right{0%{-webkit-transform:translateX(0);transform:translateX(0);opacity:1}100%{-webkit-transform:translateX(50px);transform:translateX(50px);opacity:0}}@-webkit-keyframes fade-out-tr{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(50px) translateY(-50px);transform:translateX(50px) translateY(-50px);opacity:0}}@keyframes fade-out-tr{0%{-webkit-transform:translateX(0) translateY(0);transform:translateX(0) translateY(0);opacity:1}100%{-webkit-transform:translateX(50px) translateY(-50px);transform:translateX(50px) translateY(-50px);opacity:0}}@-webkit-keyframes fade-out-top{0%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}100%{-webkit-transform:translateY(-50px);transform:translateY(-50px);opacity:0}}@keyframes fade-out-top{0%{-webkit-transform:translateY(0);transform:translateY(0);opacity:1}100%{-webkit-transform:translateY(-50px);transform:translateY(-50px);opacity:0}}@-webkit-keyframes fade-out-fwd{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}100%{-webkit-transform:translateZ(80px);transform:translateZ(80px);opacity:0}}@keyframes fade-out-fwd{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}100%{-webkit-transform:translateZ(80px);transform:translateZ(80px);opacity:0}}@-webkit-keyframes fade-out-bck{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}100%{-webkit-transform:translateZ(-80px);transform:translateZ(-80px);opacity:0}}@keyframes fade-out-bck{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}100%{-webkit-transform:translateZ(-80px);transform:translateZ(-80px);opacity:0}}@-webkit-keyframes fade-out{0%{opacity:1}100%{opacity:0}}@keyframes fade-out{0%{opacity:1}100%{opacity:0}}
/* ----------------------------------------------
bounce-top
* ---------------------------------------------- */
@-webkit-keyframes bounce-top{0%{-webkit-transform:translateY(-45px);transform:translateY(-45px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;opacity:1}24%{opacity:1}40%{-webkit-transform:translateY(-24px);transform:translateY(-24px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}65%{-webkit-transform:translateY(-12px);transform:translateY(-12px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}82%{-webkit-transform:translateY(-6px);transform:translateY(-6px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}93%{-webkit-transform:translateY(-4px);transform:translateY(-4px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}25%,55%,75%,87%{-webkit-transform:translateY(0);transform:translateY(0);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:translateY(0);transform:translateY(0);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;opacity:1}}@keyframes bounce-top{0%{-webkit-transform:translateY(-45px);transform:translateY(-45px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;opacity:1}24%{opacity:1}40%{-webkit-transform:translateY(-24px);transform:translateY(-24px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}65%{-webkit-transform:translateY(-12px);transform:translateY(-12px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}82%{-webkit-transform:translateY(-6px);transform:translateY(-6px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}93%{-webkit-transform:translateY(-4px);transform:translateY(-4px);-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in}25%,55%,75%,87%{-webkit-transform:translateY(0);transform:translateY(0);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}100%{-webkit-transform:translateY(0);transform:translateY(0);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;opacity:1}}
/* ----------------------------------------------
jello
* ---------------------------------------------- */
@-webkit-keyframes jello-horizontal{0%{-webkit-transform:scale3d(1,1,1);transform:scale3d(1,1,1)}30%{-webkit-transform:scale3d(1.25,.75,1);transform:scale3d(1.25,.75,1)}40%{-webkit-transform:scale3d(.75,1.25,1);transform:scale3d(.75,1.25,1)}50%{-webkit-transform:scale3d(1.15,.85,1);transform:scale3d(1.15,.85,1)}65%{-webkit-transform:scale3d(.95,1.05,1);transform:scale3d(.95,1.05,1)}75%{-webkit-transform:scale3d(1.05,.95,1);transform:scale3d(1.05,.95,1)}100%{-webkit-transform:scale3d(1,1,1);transform:scale3d(1,1,1)}}@keyframes jello-horizontal{0%{-webkit-transform:scale3d(1,1,1);transform:scale3d(1,1,1)}30%{-webkit-transform:scale3d(1.25,.75,1);transform:scale3d(1.25,.75,1)}40%{-webkit-transform:scale3d(.75,1.25,1);transform:scale3d(.75,1.25,1)}50%{-webkit-transform:scale3d(1.15,.85,1);transform:scale3d(1.15,.85,1)}65%{-webkit-transform:scale3d(.95,1.05,1);transform:scale3d(.95,1.05,1)}75%{-webkit-transform:scale3d(1.05,.95,1);transform:scale3d(1.05,.95,1)}100%{-webkit-transform:scale3d(1,1,1);transform:scale3d(1,1,1)}}
function dismiss(el){
el.parentNode.style.display='none';
document.getElementById('overlay').style.display='none';
addJello();
};
function countItems(listClass){
var ul = document.getElementsByClassName(listClass)[0];
var i=0, itemCount =0;
while(ul.getElementsByTagName('li') [i++]) itemCount++;
return itemCount;
};
var TurnitinBlueCardButton = '<input type="button" class="bluecard bounce-top" id="tiibluecard" value="Add Blue Card" title="Adds the text \'Blue Card\' at the start of your assignment title" accesskey="b"/> <a href="http://www.brookes.ac.uk/students/wellbeing/dyslexia-spld/support/blue-marking-cards/" target="_blank" title="What is the Blue Card scheme?" accesskey="?">What\'s this?</a><br/>';
/* TURNITIN BLUE CARD */
if (!document.getElementById('fitem_id_submissiontype')) {
/* do nothing */
} else {
var request = new XMLHttpRequest();
request.open("GET", "/local/obu_indicators/get.php?name=dyslexia_indicator", false);
request.send(null);
if (request.responseText == "Y") {
document.getElementById('fitem_id_submissiontype').insertAdjacentHTML('beforebegin', TurnitinBlueCardButton);
var d = document.getElementsByClassName("dndupload-arrow")[0];
d.className += " accessible";
}
}
/* EVENT LISTENER FOR TURNITIN BLUE CARD BUTTON */
if (!document.getElementById('tiibluecard')) {
/* do nothing */
} else {
document.getElementById("tiibluecard").addEventListener('click', function () {
var title = document.getElementById('id_submissiontitle');
title.removeAttribute('onchange');
if (!title.value) {
title.value = ('Blue Card: ');
} else {
title.value = ('Blue Card: ' + title.value);
}
var x = document.getElementById("tiipopup");
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
});
}
var TurnitinBlueCardIntro = '<div class="bcsteps"><h3>Important message for tutors</h3><img src="https://1.bp.blogspot.com/-FmwX78jirYI/WVZme_qiNhI/AAAAAAAAAmA/KpMk-gcF01M6Ilv0P-G4Zpjn0BNVovjvgCLcBGAs/s1600/moodleExport.PNG" alt="Moodle export functionality" style="float: right"/><strong>Do you use the Export functionality?</strong><br/>If yes, please download the Excel spreadsheet as well as the ZIP or PDF. If essay titles are prefixed with "Blue Card", please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</div>';
var TurnitinBlueCardInbox = '<div class="bcsteps"><h3>Important message for tutors</h3>Submissions highlighted in blue are from students with a <strong>Blue Card</strong>. <br/>Please follow the <a href="http://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" target="_blank">Dyslexia/SpLD marking guidelines</a> when marking their work.</div>';
/* show blue card message in intro tab */
if ((!document.getElementById('introduction')) || (countItems('nav-tabs') <= 2)) {
/* do nothing */
} else {
document.getElementById('overlay').style.display='block';
document.getElementById("tii-intromsg").style.display = 'block';
document.getElementById("turnitintool_style").insertAdjacentHTML('beforebegin', TurnitinBlueCardIntro);
};
/* display bouncy message to alert tutors re blue card */
if ((!document.getElementById('inboxTable')) || (countItems('nav-tabs') <= 2)) {
/* do nothing */
} else {
document.getElementById("tiitutormsg").style.display = 'block';
document.getElementById('overlay').style.display='block';
document.getElementById("turnitintool_style").insertAdjacentHTML('beforebegin', TurnitinBlueCardInbox);
};
/* highlight blue card in TURNITIN submission inbox table */
if (!document.getElementById('inboxTable')) {
/* do nothing */
} else {
var table = document.getElementById('inboxTable');
var tbody = table.getElementsByTagName('tbody')[0];
var cells = tbody.getElementsByTagName('td');
for (var i=0, len=cells.length; i<len; i++){
if (cells[i].innerText.search('Blue Card') > -1){
var tr = cells[i].parentNode;
tr.style.backgroundColor = '#b7dbff';
cells[i].getElementsByTagName('a')[0].insertAdjacentHTML('afterend', ' &nbsp; &nbsp; &nbsp; &nbsp; <a href="ttp://www.brookes.ac.uk/staff/academic/dyslexia-spld-service/marking-work/" class="bc-info" target="_blank" title="What is the Blue Card scheme?">Blue Card</a>');
}
}
}
/*when student has submitted, you sometimes get an option to resubmit */
if (!document.getElementById('post_29_submission_form')) {
/* do nothing */
} else {
var table = document.getElementById('inboxTable');
var tbody = table.getElementsByTagName('tbody')[0];
var cells = tbody.getElementsByTagName('td');
for (var i=0, len=cells.length; i<len; i++){
if (cells[i].innerText.search('Blue Card') > -1){
var resubmitform = document.getElementById('post_29_submission_form');
resubmitform.insertAdjacentHTML('beforebegin', '<p class="bcsteps bounce-top"><strong>Submission successfully uploaded to Turnitin.</strong> Only use the form below if you need to resubmit.</p><br/><hr/><br/><h3>Resubmit</h3> ');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment