Index: assignment-bundles/resources/assignment.properties
===================================================================
--- assignment-bundles/resources/assignment.properties (revision 306387)
+++ assignment-bundles/resources/assignment.properties (working copy)
@@ -660,6 +660,9 @@
uploadall.alert.noGradeFile=Please ensure there is a grade file and correct folder structure.
downloadall.alert.choose.element=You must choose at lease one element in the download options.
uploadall.alert.zipFile=You have not selected a zip archive file. You must select either a .zip or a .sit archive file as the upload file.
+# SAK-19147 Assignments : Download All - flat file structure
+uploadall.folders.yes=Save submissions in separate user folders
+uploadall.folders.no=Save all selected download options in one folder (This CANNOT be loaded back into Assignments)
review.use = Use {0}
review.allow = Allow students to view report
Index: assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java
===================================================================
--- assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java (revision 306390)
+++ assignment-impl/impl/src/java/org/sakaiproject/assignment/impl/BaseAssignmentService.java (working copy)
@@ -5260,6 +5260,8 @@
boolean withFeedbackText = false;
boolean withFeedbackComment = false;
boolean withFeedbackAttachment = false;
+
+ boolean withoutFolders = false;
String viewString = "";
String contextString = "";
@@ -5305,6 +5307,11 @@
// feedback attachment
withFeedbackAttachment = true;
}
+ else if (token.contains("withoutFolders"))
+ {
+ // feedback attachment
+ withoutFolders = true;
+ }
else if (token.contains("contextString"))
{
// context
@@ -5397,7 +5404,7 @@
if (allowGradeSubmission(aRef))
{
zipSubmissions(aRef, a.getTitle(), a.getContent().getTypeOfGradeString(a.getContent().getTypeOfGrade()), a.getContent().getTypeOfSubmission(),
- new SortedIterator(submissions.iterator(), new AssignmentComparator("submitterName", "true")), out, exceptionMessage, withStudentSubmissionText, withStudentSubmissionAttachment, withGradeFile, withFeedbackText, withFeedbackComment, withFeedbackAttachment);
+ new SortedIterator(submissions.iterator(), new AssignmentComparator("submitterName", "true")), out, exceptionMessage, withStudentSubmissionText, withStudentSubmissionAttachment, withGradeFile, withFeedbackText, withFeedbackComment, withFeedbackAttachment, withoutFolders);
if (exceptionMessage.length() > 0)
{
@@ -5643,7 +5650,7 @@
}
}
- protected void zipSubmissions(String assignmentReference, String assignmentTitle, String gradeTypeString, int typeOfSubmission, Iterator submissions, OutputStream outputStream, StringBuilder exceptionMessage, boolean withStudentSubmissionText, boolean withStudentSubmissionAttachment, boolean withGradeFile, boolean withFeedbackText, boolean withFeedbackComment, boolean withFeedbackAttachment)
+ protected void zipSubmissions(String assignmentReference, String assignmentTitle, String gradeTypeString, int typeOfSubmission, Iterator submissions, OutputStream outputStream, StringBuilder exceptionMessage, boolean withStudentSubmissionText, boolean withStudentSubmissionAttachment, boolean withGradeFile, boolean withFeedbackText, boolean withFeedbackComment, boolean withFeedbackAttachment, boolean withoutFolders)
{
ZipOutputStream out = null;
try {
@@ -5728,17 +5735,27 @@
submittersName = submittersName.concat(StringUtils.trimToNull(submittersString));
submittedText = s.getSubmittedText();
- submittersName = submittersName.concat("/");
+ if (!withoutFolders)
+ {
+ submittersName = submittersName.concat("/");
+ }
+ else
+ {
+ submittersName = submittersName.concat("_");
+ }
// record submission timestamp
- if (s.getSubmitted() && s.getTimeSubmitted() != null)
+ if (!withoutFolders)
{
- ZipEntry textEntry = new ZipEntry(submittersName + "timestamp.txt");
- out.putNextEntry(textEntry);
- byte[] b = (s.getTimeSubmitted().toString()).getBytes();
- out.write(b);
- textEntry.setSize(b.length);
- out.closeEntry();
+ if (s.getSubmitted() && s.getTimeSubmitted() != null)
+ {
+ ZipEntry textEntry = new ZipEntry(submittersName + "timestamp.txt");
+ out.putNextEntry(textEntry);
+ byte[] b = (s.getTimeSubmitted().toString()).getBytes();
+ out.write(b);
+ textEntry.setSize(b.length);
+ out.closeEntry();
+ }
}
// create the folder structure - named after the submitter's name
@@ -5748,7 +5765,14 @@
if (withStudentSubmissionText)
{
// create the text file only when a text submission is allowed
- ZipEntry textEntry = new ZipEntry(submittersName + submittersString + "_submissionText" + ZIP_SUBMITTED_TEXT_FILE_TYPE);
+ String submittersNameString = submittersName + submittersString;
+
+ //remove folder name if Download All is without user folders
+ if (withoutFolders)
+ {
+ submittersNameString = submittersName;
+ }
+ ZipEntry textEntry = new ZipEntry(submittersNameString + "_submissionText" + ZIP_SUBMITTED_TEXT_FILE_TYPE);
out.putNextEntry(textEntry);
byte[] text = submittedText.getBytes();
out.write(text);
@@ -5774,11 +5798,23 @@
// include student submission attachment
if (withStudentSubmissionAttachment)
{
- // create a attachment folder for the submission attachments
- String sSubAttachmentFolder = submittersName + rb.getString("stuviewsubm.submissatt") + "/";
- sSubAttachmentFolder = escapeInvalidCharsEntry(sSubAttachmentFolder);
- ZipEntry sSubAttachmentFolderEntry = new ZipEntry(sSubAttachmentFolder);
- out.putNextEntry(sSubAttachmentFolderEntry);
+ //remove "/" that creates a folder if Download All is without user folders
+ String sSubAttachmentFolder = submittersName + rb.getString("stuviewsubm.submissatt");//jh + "/";
+ if (!withoutFolders)
+ {
+ // create a attachment folder for the submission attachments
+ sSubAttachmentFolder = submittersName + rb.getString("stuviewsubm.submissatt") + "/";
+ sSubAttachmentFolder = escapeInvalidCharsEntry(sSubAttachmentFolder);
+ ZipEntry sSubAttachmentFolderEntry = new ZipEntry(sSubAttachmentFolder);
+ out.putNextEntry(sSubAttachmentFolderEntry);
+
+ }
+ else
+ {
+ sSubAttachmentFolder = sSubAttachmentFolder + "_";
+ //submittersName = submittersName.concat("_");
+ }
+
// add all submission attachment into the submission attachment folder
zipAttachments(out, submittersName, sSubAttachmentFolder, s.getSubmittedAttachments());
out.closeEntry();
@@ -5799,10 +5835,18 @@
if (withFeedbackAttachment)
{
// create an attachment folder for the feedback attachments
- String feedbackSubAttachmentFolder = submittersName + rb.getString("download.feedback.attachment") + "/";
- feedbackSubAttachmentFolder = escapeInvalidCharsEntry(feedbackSubAttachmentFolder);
- ZipEntry feedbackSubAttachmentFolderEntry = new ZipEntry(feedbackSubAttachmentFolder);
- out.putNextEntry(feedbackSubAttachmentFolderEntry);
+ String feedbackSubAttachmentFolder = submittersName + rb.getString("download.feedback.attachment");
+ if (!withoutFolders)
+ {
+ feedbackSubAttachmentFolder = feedbackSubAttachmentFolder + "/";
+ ZipEntry feedbackSubAttachmentFolderEntry = new ZipEntry(feedbackSubAttachmentFolder);
+ out.putNextEntry(feedbackSubAttachmentFolderEntry);
+ }
+ else
+ {
+ submittersName = submittersName.concat("_");
+ }
+
// add all feedback attachment folder
zipAttachments(out, submittersName, feedbackSubAttachmentFolder, s.getFeedbackAttachments());
out.closeEntry();
@@ -12363,7 +12407,7 @@
try {
ContentResource cr = getFirstAcceptableAttachement(attachments);
Assignment ass = this.getAssignment();
- if (ass != null)
+ if (ass != null && cr != null)
{
contentReviewService.queueContent(null, null, ass.getReference(), cr.getId());
}
Index: assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java
===================================================================
--- assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java (revision 306387)
+++ assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java (working copy)
@@ -797,6 +797,7 @@
private static final String UPLOAD_ALL_HAS_COMMENTS= "upload_all_has_comments";
private static final String UPLOAD_ALL_HAS_FEEDBACK_TEXT= "upload_all_has_feedback_text";
private static final String UPLOAD_ALL_HAS_FEEDBACK_ATTACHMENT = "upload_all_has_feedback_attachment";
+ private static final String UPLOAD_ALL_WITHOUT_FOLDERS = "upload_all_without_folders";
private static final String UPLOAD_ALL_RELEASE_GRADES = "upload_all_release_grades";
// this is to track whether the site has multiple assignment, hence if true, show the reorder link
@@ -4192,6 +4193,9 @@
context.put("hasFeedbackText", state.getAttribute(UPLOAD_ALL_HAS_FEEDBACK_TEXT));
context.put("hasFeedbackAttachment", state.getAttribute(UPLOAD_ALL_HAS_FEEDBACK_ATTACHMENT));
context.put("releaseGrades", state.getAttribute(UPLOAD_ALL_RELEASE_GRADES));
+ // SAK-19147
+ context.put("withoutFolders", state.getAttribute(UPLOAD_ALL_WITHOUT_FOLDERS));
+ context.put("enableFlatDownload", ServerConfigurationService.getBoolean("assignment.download.flat", false));
String contextString = (String) state.getAttribute(STATE_CONTEXT_STRING);
context.put("contextString", contextString);
context.put("accessPointUrl", (ServerConfigurationService.getAccessUrl()).concat(AssignmentService.submissionsZipReference(
@@ -14099,6 +14103,7 @@
state.removeAttribute(UPLOAD_ALL_HAS_COMMENTS);
state.removeAttribute(UPLOAD_ALL_HAS_FEEDBACK_TEXT);
state.removeAttribute(UPLOAD_ALL_HAS_FEEDBACK_ATTACHMENT);
+ state.removeAttribute(UPLOAD_ALL_WITHOUT_FOLDERS);
state.removeAttribute(UPLOAD_ALL_RELEASE_GRADES);
}
else
@@ -14115,6 +14120,9 @@
boolean hasComment = uploadAll_readChoice(choices, "feedbackComments");
// feedback attachment
boolean hasFeedbackAttachment = uploadAll_readChoice(choices, "feedbackAttachments");
+ // folders
+ //boolean withoutFolders = params.getString("withoutFolders") != null ? params.getBoolean("withoutFolders") : false;
+ boolean withoutFolders = uploadAll_readChoice(choices, "withoutFolders"); // SAK-19147
// release
boolean releaseGrades = params.getString("release") != null ? params.getBoolean("release") : false;
@@ -14124,6 +14132,7 @@
state.setAttribute(UPLOAD_ALL_HAS_COMMENTS, Boolean.valueOf(hasComment));
state.setAttribute(UPLOAD_ALL_HAS_FEEDBACK_TEXT, Boolean.valueOf(hasFeedbackText));
state.setAttribute(UPLOAD_ALL_HAS_FEEDBACK_ATTACHMENT, Boolean.valueOf(hasFeedbackAttachment));
+ state.setAttribute(UPLOAD_ALL_WITHOUT_FOLDERS, Boolean.valueOf(withoutFolders));
state.setAttribute(UPLOAD_ALL_RELEASE_GRADES, Boolean.valueOf(releaseGrades));
// constructor the hashmap for all submission objects
@@ -14819,6 +14828,7 @@
state.removeAttribute(UPLOAD_ALL_HAS_FEEDBACK_TEXT);
state.removeAttribute(UPLOAD_ALL_HAS_GRADEFILE);
state.removeAttribute(UPLOAD_ALL_HAS_COMMENTS);
+ state.removeAttribute(UPLOAD_ALL_WITHOUT_FOLDERS);
state.removeAttribute(UPLOAD_ALL_RELEASE_GRADES);
}
Index: assignment-tool/tool/src/webapp/vm/assignment/chef_assignments_instructor_uploadAll.vm
===================================================================
--- assignment-tool/tool/src/webapp/vm/assignment/chef_assignments_instructor_uploadAll.vm (revision 306387)
+++ assignment-tool/tool/src/webapp/vm/assignment/chef_assignments_instructor_uploadAll.vm (working copy)
@@ -49,6 +49,10 @@
}
else
{
+ if (document.getElementById('withoutFolders') && document.getElementById('withoutFolders').checked)
+ {
+ extraInfoArray[extraInfoArray.length]="withoutFolders=true";
+ }
accessPointUrl = accessPointUrl + "?";
for(i=0; i
+
+ ## SAK-19147 output without folders
+ #if ($!download && $enableFlatDownload)
+
+
+ #end
+