Skip to content

Commit

Permalink
SAK-32405 - Content Review - VeriCite - Student Preview of plag score (
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdietz authored and ottenhoff committed Apr 14, 2017
1 parent a109cc9 commit 306424a
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ public interface AssignmentContent extends Entity, AttachmentContainer
public boolean isStoreInstIndex();

public void setStoreInstIndex(boolean m_storeInstIndex);

public boolean isStudentPreview();

public void setStudentPreview(boolean m_studentPreview);

/**
* Exclude type options:
Expand Down
3 changes: 3 additions & 0 deletions assignment/assignment-bundles/resources/assignment.properties
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ gen.thearecur2 = There are currently no submissions at this location.
gen.theassall4 = This assignment allows submissions using both the text box below and attached documents. Type your submission in the box below and/or use the Browse button or the "select files" button to include other documents. <b>Save frequently while working</b>.
gen.theassall6 = This assignment allows submissions using the text box below only. Type in your submission. <b>Save frequently while working</b>.
gen.yoursubwill = Your submission will be sent to {0} to be electronically reviewed for plagiarism.
gen.subStudentPreview = This assignment has enabled student preview which allows students to submit as many papers as a draft as they wish. A draft paper report is only visible to the owner of the paper, however instructors will be able to see the number of draft submissions and the report scores of each draft. Also, if there is a due date, the most recent draft will automatically be submitted if the student has no other submissions. Students can submit a draft paper as their final submission at any time within the plagiarism report.
gen.onlythefoll = Only the following file types will be accepted: {0}
gen.theassinf = The assignment info
gen.title = Title
Expand Down Expand Up @@ -722,6 +723,8 @@ review.exclude.bibliographic=Exclude bibliographic materials from Similarity Ind
review.exclude.quoted=Exclude quoted materials from Similarity Index for all papers in this assignment
review.exclude.self.plag=Exclude self plagiarism within course
review.store.inst.index=Store paper in institutional index
review.studentPreview=Enable Student Preview
review.studentPreview.help=If you choose to enable student preview, users will be able to review and re-submit their papers until the due date. Instructors will only be able to see the final submission but a record of the scores for each paper will show in the report logs. If the assignment has a due date, the student's most recent draft will automatically be submitted if there are no submissions from a student. It is recommended that you set a due date for this assignment and allow the students to view their reports.
review.exclude.smallMatches=Exclude small matches
review.exclude.matches.by=Exclude matches by:
review.exclude.matches.wordmax=Up to a Word Count of:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8720,6 +8720,7 @@ public class BaseAssignmentContent implements AssignmentContent
boolean m_excludeQuoted = true;
boolean m_excludeSelfPlag = true;
boolean m_storeInstIndex = true;
boolean m_studentPreview = false;
int m_excludeType = 0;
int m_excludeValue = 1;

Expand Down Expand Up @@ -8800,6 +8801,7 @@ public BaseAssignmentContent(Element el)
m_excludeQuoted = getBool(el.getAttribute("excludeQuoted"));
m_excludeSelfPlag = getBool(el.getAttribute("excludeSelfPlag"));
m_storeInstIndex = getBool(el.getAttribute("storeInstIndex"));
m_studentPreview = getBool(el.getAttribute("studentPreview"));
String excludeTypeStr = el.getAttribute("excludeType");
try{
m_excludeType = Integer.parseInt(excludeTypeStr);
Expand Down Expand Up @@ -9014,6 +9016,7 @@ public void startElement(String uri, String localName, String qName,
m_excludeQuoted = getBool(attributes.getValue("excludeQuoted"));
m_excludeSelfPlag = getBool(attributes.getValue("excludeSelfPlag"));
m_storeInstIndex = getBool(attributes.getValue("storeInstIndex"));
m_studentPreview = getBool(attributes.getValue("studentPreview"));
String excludeTypeStr = attributes.getValue("excludeType");
try{
m_excludeType = Integer.parseInt(excludeTypeStr);
Expand Down Expand Up @@ -9197,6 +9200,7 @@ public Element toXml(Document doc, Stack stack)
content.setAttribute("excludeQuoted", getBoolString(m_excludeQuoted));
content.setAttribute("excludeSelfPlag", getBoolString(m_excludeSelfPlag));
content.setAttribute("storeInstIndex", getBoolString(m_storeInstIndex));
content.setAttribute("studentPreview", getBoolString(m_studentPreview));
content.setAttribute("excludeType", Integer.toString(m_excludeType));
content.setAttribute("excludeValue", Integer.toString(m_excludeValue));

Expand Down Expand Up @@ -9280,6 +9284,7 @@ protected void setAll(AssignmentContent content)
m_excludeQuoted = content.isExcludeQuoted();
m_excludeSelfPlag = content.isExcludeSelfPlag();
m_storeInstIndex = content.isStoreInstIndex();
m_studentPreview = content.isStudentPreview();
m_excludeType = content.getExcludeType();
m_excludeValue = content.getExcludeValue();
m_timeCreated = content.getTimeCreated();
Expand Down Expand Up @@ -9800,6 +9805,14 @@ public boolean isStoreInstIndex() {
public void setStoreInstIndex(boolean m_storeInstIndex) {
this.m_storeInstIndex = m_storeInstIndex;
}

public boolean isStudentPreview() {
return m_studentPreview;
}

public void setStudentPreview(boolean m_studentPreview) {
this.m_studentPreview = m_studentPreview;
}

public int getExcludeType(){
return m_excludeType;
Expand Down Expand Up @@ -10744,7 +10757,7 @@ private String getReviewIconCssClass(ContentResource cr, int reviewScore) {
String iconCssClass = null;

if (!"Error".equals(reviewReport)) {
iconCssClass = contentReviewService.getIconCssClassforScore(reviewScore);
iconCssClass = contentReviewService.getIconCssClassforScore(reviewScore, contentId);
} else {
iconCssClass = "contentReviewIconWarn";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public class AssignmentAction extends PagedResourceActionII
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_QUOTED = "exclude_quoted";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SELF_PLAG = "exclude_self_plag";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX = "store_inst_index";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW = "student_preview";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES = "exclude_smallmatches";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE = "exclude_type";
private static final String NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE = "exclude_value";
Expand Down Expand Up @@ -1476,6 +1477,16 @@ protected String build_student_view_submission_context(VelocityPortlet portlet,
// ubiquitous across browsers, we can re-enable this feature.
//context.put("content_review_acceptedMimeTypes", getContentReviewAcceptedMimeTypes());
}

try {
AssignmentContent assignmentContent = assignmentService.getAssignmentContent(assignment.getContentReference());
if(assignmentContent.isStudentPreview()) {
context.put("plagiarismStudentPreview", rb.getString("gen.subStudentPreview"));
}
} catch (Exception e) {
M_log.error(e.getMessage(), e);
}

}
if (assignment.getContent().getTypeOfSubmission() == Assignment.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION)
{
Expand Down Expand Up @@ -2511,6 +2522,7 @@ protected void setAssignmentFormContext(SessionState state, Context context)
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_QUOTED", NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_QUOTED);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SELF_PLAG", NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SELF_PLAG);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX", NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW", NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES", NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE", NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE);
context.put("name_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE", NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE);
Expand Down Expand Up @@ -2673,7 +2685,11 @@ protected void setAssignmentFormContext(SessionState state, Context context)
//Rely on the deprecated "turnitin.option.store_inst_index.default" setting if set, otherwise use "contentreview.option.store_inst_index.default"
boolean defaultStoreInstIndex = serverConfigurationService.getBoolean("contentreview.option.store_inst_index.default", showStoreInstIndex);
context.put("value_NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX", (state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX) == null) ? Boolean.toString(defaultStoreInstIndex) : state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX));

//Use Student Preview
boolean showStudentPreview = serverConfigurationService.getBoolean("contentreview.option.student_preview", Boolean.FALSE);
context.put("show_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW", showStudentPreview);
boolean defaultStudentPreview = serverConfigurationService.getBoolean("contentreview.option.student_preview.default", Boolean.FALSE);
context.put("value_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW", (state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW) == null) ? Boolean.toString(defaultStudentPreview) : state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW));
//exclude small matches
boolean displayExcludeType = serverConfigurationService.getBoolean("turnitin.option.exclude_smallmatches", true);
context.put("show_NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES", displayExcludeType);
Expand Down Expand Up @@ -7470,6 +7486,11 @@ else if (sameAssignmentTitleInContext(assignmentRef, title, (String) state.getAt
else b = Boolean.TRUE.toString();
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX, b);

//student preview
r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW);
b = (r == null) ? Boolean.FALSE.toString() : Boolean.TRUE.toString();
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW, b);

//exclude small matches
r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES);
if (r == null) b = Boolean.FALSE.toString();
Expand Down Expand Up @@ -8431,6 +8452,8 @@ private void post_save_assignment(RunData data, String postOrSave)
boolean excludeSelfPlag = "true".equalsIgnoreCase((String) state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SELF_PLAG));
//store inst index
boolean storeInstIndex = "true".equalsIgnoreCase((String) state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX));
//student preview
boolean studentPreview = "true".equalsIgnoreCase((String) state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW));
//exclude small matches
boolean excludeSmallMatches = "true".equalsIgnoreCase((String) state.getAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES));
//exclude type 0=none, 1=words, 2=percentages
Expand Down Expand Up @@ -8510,7 +8533,7 @@ else if (groupChoice != null)
state.setAttribute("contentReviewSuccess", Boolean.TRUE);

// commit the changes to AssignmentContent object
commitAssignmentContentEdit(state, ac, a.getReference(), title, submissionType,useReviewService,allowStudentViewReport, gradeType, gradePoints, description, checkAddHonorPledge, attachments, submitReviewRepo, generateOriginalityReport, checkTurnitin, checkInternet, checkPublications, checkInstitution, excludeBibliographic, excludeQuoted, excludeSelfPlag, storeInstIndex, excludeType, excludeValue, openTime, dueTime, closeTime, hideDueDate);
commitAssignmentContentEdit(state, ac, a.getReference(), title, submissionType,useReviewService,allowStudentViewReport, gradeType, gradePoints, description, checkAddHonorPledge, attachments, submitReviewRepo, generateOriginalityReport, checkTurnitin, checkInternet, checkPublications, checkInstitution, excludeBibliographic, excludeQuoted, excludeSelfPlag, storeInstIndex, studentPreview, excludeType, excludeValue, openTime, dueTime, closeTime, hideDueDate);

// set the Assignment Properties object
ResourcePropertiesEdit aPropertiesEdit = a.getPropertiesEdit();
Expand Down Expand Up @@ -9678,7 +9701,7 @@ else if (allowResubmitNumber == null || allowResubmitNumber.length() == 0 || "0"
}
}

private void commitAssignmentContentEdit(SessionState state, AssignmentContentEdit ac, String assignmentRef, String title, int submissionType,boolean useReviewService, boolean allowStudentViewReport, int gradeType, String gradePoints, String description, String checkAddHonorPledge, List attachments, String submitReviewRepo, String generateOriginalityReport, boolean checkTurnitin, boolean checkInternet, boolean checkPublications, boolean checkInstitution, boolean excludeBibliographic, boolean excludeQuoted, boolean excludeSelfPlag, boolean storeInstIndex, int excludeType, int excludeValue, Time openTime, Time dueTime, Time closeTime, boolean hideDueDate)
private void commitAssignmentContentEdit(SessionState state, AssignmentContentEdit ac, String assignmentRef, String title, int submissionType,boolean useReviewService, boolean allowStudentViewReport, int gradeType, String gradePoints, String description, String checkAddHonorPledge, List attachments, String submitReviewRepo, String generateOriginalityReport, boolean checkTurnitin, boolean checkInternet, boolean checkPublications, boolean checkInstitution, boolean excludeBibliographic, boolean excludeQuoted, boolean excludeSelfPlag, boolean storeInstIndex, boolean studentPreview, int excludeType, int excludeValue, Time openTime, Time dueTime, Time closeTime, boolean hideDueDate)
{
ac.setTitle(title);
ac.setInstructions(description);
Expand All @@ -9697,6 +9720,7 @@ private void commitAssignmentContentEdit(SessionState state, AssignmentContentEd
ac.setExcludeQuoted(excludeQuoted);
ac.setExcludeSelfPlag(excludeSelfPlag);
ac.setStoreInstIndex(storeInstIndex);
ac.setStudentPreview(studentPreview);
ac.setExcludeType(excludeType);
ac.setExcludeValue(excludeValue);
ac.setTypeOfGrade(gradeType);
Expand Down Expand Up @@ -9789,6 +9813,14 @@ public boolean createTIIAssignment(AssignmentContentEdit assign, String assignme
Boolean defaultStoreInstIndex = serverConfigurationService.getBoolean("contentreview.option.store_inst_index.default", true);
opts.put("store_inst_index", defaultStoreInstIndex ? "1" : "0");
}

//Student preview
if(serverConfigurationService.getBoolean("contentreview.option.student_preview", false)){
opts.put("student_preview", assign.isStudentPreview() ? "1" : "0");
} else {
Boolean defaultStudentPreview = serverConfigurationService.getBoolean("contentreview.option.student_preview.default", false);
opts.put("student_preview", defaultStudentPreview ? "1" : "0");
}

if((assign.getExcludeType() == 1 || assign.getExcludeType() == 2)
&& assign.getExcludeValue() >= 0 && assign.getExcludeValue() <= 100){
Expand Down Expand Up @@ -10334,6 +10366,8 @@ else if (defaultNotification.equalsIgnoreCase("o")) {
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SELF_PLAG, Boolean.valueOf(a.getContent().isExcludeSelfPlag()).toString());
//store inst index
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STORE_INST_INDEX, Boolean.valueOf(a.getContent().isStoreInstIndex()).toString());
//student preview
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW, Boolean.valueOf(a.getContent().isStudentPreview()).toString());
//exclude type
state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE, a.getContent().getExcludeType());
//exclude value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,22 @@
</label>
</div>
#end

<!-- Student Preview -->
#if($show_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW)
<div class="checkbox">
<label for="$name_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW">
<input id="$name_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW" name="$name_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW" type="checkbox" value="true"
#if ($!value_NEW_ASSIGNMENT_REVIEW_SERVICE_STUDENT_PREVIEW.equals("true"))
checked="checked"
#end
/>
$tlang.getString("review.studentPreview")
</label>
<div class="info-text help-block small">$tlang.getString("review.studentPreview.help")</div>
</div>
#end

<!-- End VeriCite custom options -->
#elseif($reviewServiceName.equals("Compilatio"))
#if ($content_review_note)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ $(document).ready(function(){
#if ($plagiarismFileTypes)
$plagiarismFileTypes
#end
#if ($plagiarismStudentPreview)
$plagiarismStudentPreview
#end
</em>
</p>
#end
Expand Down Expand Up @@ -752,6 +755,9 @@ $(document).ready(function(){
#if ($plagiarismFileTypes)
$plagiarismFileTypes
#end
#if ($plagiarismStudentPreview)
$plagiarismStudentPreview
#end
</em>
</p>
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,14 @@
# Default: true
# contentreview.config.show_preliminary_score=false

# Show student preview option, to view report of draft submission, in the GUI
# Default: false
# contentreview.option.student_preview=true

# The default check mark in the Show student preview option in the GUI
# Default: false
# contentreview.option.student_preview.default=true

# SAK-31923
# Sets the separation char on exporting to CSV
# Default: ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ public List<ContentReviewItem> getAllContentReviewItems(String siteId, String ta
/**
* Get a icon URL that for a specific score
* @param score
* @param contentId
* @return
*/
public String getIconCssClassforScore(int score);
public String getIconCssClassforScore(int score, String contentId);

/**
* Does the service support resubmissions?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ public boolean isSiteAcceptable(Site site) {
}

@Override
public String getIconCssClassforScore(int score) {
public String getIconCssClassforScore(int score, String contentId) {
if (score == 0) {
return "contentReviewIconThreshold-5";
} else if (score < 25) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public Date getDateSubmitted(String arg0) throws QueueException, SubmissionExcep
return getSelectedProvider().getDateSubmitted(arg0);
}

public String getIconCssClassforScore(int score) {
return getSelectedProvider().getIconCssClassforScore(score);
public String getIconCssClassforScore(int score, String contentId) {
return getSelectedProvider().getIconCssClassforScore(score, contentId);
}

public String getLocalizedStatusMessage(String arg0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public boolean isSiteAcceptable(Site site) {
}

@Override
public String getIconCssClassforScore(int score) {
public String getIconCssClassforScore(int score, String contentId) {
return "contentReviewIconNoService";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public boolean isSiteAcceptable(Site s) {
return true;
}

public String getIconCssClassforScore(int score) {
public String getIconCssClassforScore(int score, String contentId) {
if (score == 0) {
return "contentReviewIconThreshold-5";
} else if (score < 25) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public boolean isSiteAcceptable(Site site) {
}

@Override
public String getIconCssClassforScore(int score) {
public String getIconCssClassforScore(int score, String contentId) {
if (score == 0) {
return "contentReviewIconThreshold-4";
} else if (score <= 39) {
Expand Down
Loading

0 comments on commit 306424a

Please sign in to comment.