Skip to content

Commit

Permalink
Make the rich text editor uneditable after the student submits and locks
Browse files Browse the repository at this point in the history
their work.
  • Loading branch information
geoffreykwan committed Jun 13, 2013
1 parent 609aea8 commit c5c2768
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/webapp/vle/node/openresponse/openresponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -945,13 +945,22 @@ OPENRESPONSE.prototype.displayRegular = function() {
var loc = window.location.toString();
var vleLoc = loc.substring(0, loc.indexOf('/vle/')) + '/vle/';

//set the text editor to be editable by default
var readOnly = 0;

if(this.locked) {
//the text editor should be locked so we will make it read only
readOnly = 1;
}

$('#responseBox').tinymce({
// Location of TinyMCE script
script_url : '/vlewrapper/vle/jquery/tinymce/jscripts/tiny_mce/tiny_mce.js',

// General options
theme : "advanced",
plugins : "emotions",
readonly:readOnly,

// Theme options
theme_advanced_buttons1: 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,emotions,|,forecolor,backcolor,|,formatselect,fontselect,fontsizeselect',
Expand Down Expand Up @@ -1589,7 +1598,13 @@ OPENRESPONSE.prototype.getPeerReviewOtherStudentWork = function(otherStudentWork
* Disables the response box
*/
OPENRESPONSE.prototype.lockResponseBox = function() {
document.getElementById('responseBox').disabled = true;
document.getElementById('responseBox').disabled = true;

//check if this step uses the tinymce editor
if(tinymce != null && tinymce.activeEditor != null && tinymce.activeEditor.getBody() != null) {
//make the tinymce editor uneditable
tinymce.activeEditor.getBody().setAttribute('contenteditable', false);
}
};

/**
Expand Down

0 comments on commit c5c2768

Please sign in to comment.