Index: lams_central/web/orgGroup.jsp
===================================================================
diff -u -r0e9eca8da006863730e793b75a47803bc6142c67 -r087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c
--- lams_central/web/orgGroup.jsp (.../orgGroup.jsp) (revision 0e9eca8da006863730e793b75a47803bc6142c67)
+++ lams_central/web/orgGroup.jsp (.../orgGroup.jsp) (revision 087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c)
@@ -1,3 +1,5 @@
+
+
<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib uri="tags-lams" prefix="lams"%>
<%@ taglib uri="tags-fmt" prefix="fmt"%>
@@ -11,7 +13,6 @@
<%=Configuration.get(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE)%>
<%=FileValidatorUtil.formatSize(Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE))%>
-
@@ -235,7 +236,7 @@
-
+
<%-- Value is set in Javascript as it comes in the JSON --%>
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GroupingUploadAJAXController.java
===================================================================
diff -u -rd662ddfeccbdb0b0449031cf7496c36f64155b52 -r087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GroupingUploadAJAXController.java (.../GroupingUploadAJAXController.java) (revision d662ddfeccbdb0b0449031cf7496c36f64155b52)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/GroupingUploadAJAXController.java (.../GroupingUploadAJAXController.java) (revision 087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c)
@@ -257,8 +257,8 @@
*/
@RequestMapping("/importLearnersForGrouping")
@ResponseBody
- public String importLearnersForGrouping(@ModelAttribute FileUploadForm form, HttpServletRequest request,
- HttpServletResponse response) throws InvalidParameterException, IOException {
+ public String importLearnersForGrouping(@ModelAttribute("uploadForm") FileUploadForm uploadForm,
+ HttpServletRequest request, HttpServletResponse response) throws InvalidParameterException, IOException {
Integer userId = getUserDTO().getUserID();
Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, true);
@@ -299,11 +299,10 @@
return null;
}
- Hashtable fileElements = null; // null because there are commented lines
-// form.getMultipartRequestHandler().getFileElements();
-// if (fileElements.size() == 0) {
-// response.sendError(HttpServletResponse.SC_FORBIDDEN, "No file provided");
-// }
+ MultipartFile fileElements = uploadForm.getAttachmentFile();
+ if (fileElements.getSize() == 0) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN, "No file provided");
+ }
if (log.isDebugEnabled()) {
log.debug("Saving course groups from spreadsheet for user " + userId + " and organisation " + organisationId
+ " filename " + fileElements);
@@ -317,7 +316,7 @@
/** Create the new course grouping */
private ObjectNode saveCourseGrouping(Organisation organisation, Long orgGroupingId, String name,
- Hashtable fileElements) throws IOException {
+ MultipartFile fileElements) throws IOException {
OrganisationGrouping orgGrouping = null;
if (orgGroupingId != null) {
@@ -338,8 +337,7 @@
}
Map> groups = new HashMap<>();
- int totalUsersSkipped = parseGroupSpreadsheet((MultipartFile) fileElements.elements().nextElement(),
- orgGroupingId, groups);
+ int totalUsersSkipped = parseGroupSpreadsheet(fileElements, orgGroupingId, groups);
int totalUsersAdded = 0;
List orgGroups = new LinkedList<>();
@@ -383,7 +381,8 @@
}
/** Clean out and reuse any existing groups */
- private ObjectNode saveLessonGrouping(Long lessonId, Long activityId, Hashtable fileElements) throws IOException {
+ private ObjectNode saveLessonGrouping(Long lessonId, Long activityId, MultipartFile fileElements)
+ throws IOException {
int totalUsersSkipped = 0;
int totalUsersAdded = 0;
@@ -404,8 +403,7 @@
}
Map> groups = new HashMap<>();
- totalUsersSkipped = parseGroupSpreadsheet((MultipartFile) fileElements.elements().nextElement(),
- grouping.getGroupingId(), groups);
+ totalUsersSkipped = parseGroupSpreadsheet(fileElements, grouping.getGroupingId(), groups);
// if branching must use the already specified groups or cannot match to a branch!
if (activity.isChosenBranchingActivity()) {
Index: lams_monitoring/web/grouping/chosenGrouping.jsp
===================================================================
diff -u -re962cd60c6fc58a68e93516844801045ed956870 -r087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c
--- lams_monitoring/web/grouping/chosenGrouping.jsp (.../chosenGrouping.jsp) (revision e962cd60c6fc58a68e93516844801045ed956870)
+++ lams_monitoring/web/grouping/chosenGrouping.jsp (.../chosenGrouping.jsp) (revision 087362663a394cc3ccf54d6a6a8c1f7e2d06fe4c)
@@ -60,7 +60,7 @@
-
+