Index: lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java (.../GradebookServlet.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ lams_central/src/java/org/lamsfoundation/lams/web/GradebookServlet.java (.../GradebookServlet.java) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -62,8 +62,8 @@
private static IUserManagementService userManagementService;
private static final String GRADEBOOK_MONITOR_LESSON_URL = "gradebook/gradebookMonitoring.do?lessonID=";
- private static final String GRADEBOOK_MONITOR_ORGANISATION_URL = "gradebook/gradebookMonitoring.do?dispatch=courseMonitor&organisationID=";
- private static final String GRADEBOOK_LEARNER_ORGANISATION_URL = "gradebook/gradebookLearning.do?dispatch=courseLearner&organisationID=";
+ private static final String GRADEBOOK_MONITOR_ORGANISATION_URL = "gradebook/gradebookMonitoring/courseMonitor.do?organisationID=";
+ private static final String GRADEBOOK_LEARNER_ORGANISATION_URL = "gradebook/gradebookLearning/courseLearner.do?organisationID=";
/**
* The doGet method of the servlet.
Index: lams_central/src/java/org/lamsfoundation/lams/web/LAMSConnectorServlet.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/src/java/org/lamsfoundation/lams/web/LAMSConnectorServlet.java (.../LAMSConnectorServlet.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ lams_central/src/java/org/lamsfoundation/lams/web/LAMSConnectorServlet.java (.../LAMSConnectorServlet.java) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -34,18 +34,18 @@
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
-import org.apache.struts.action.ActionMessage;
import org.lamsfoundation.lams.authoring.web.AuthoringConstants;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.util.Configuration;
import org.lamsfoundation.lams.util.ConfigurationKeys;
import org.lamsfoundation.lams.util.FileUtil;
-import org.lamsfoundation.lams.util.FileValidatorUtil;
+import org.lamsfoundation.lams.util.FileValidatorSpringUtil;
import org.lamsfoundation.lams.util.MessageService;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -80,9 +80,9 @@
private String realBaseDir;
private String lamsContextPath;
-
+
private static MessageService messageService;
-
+
/**
* Initialize the servlet.
* Retrieve from the servlet configuration the "baseDir" which is the root of the file repository:
@@ -321,30 +321,30 @@
}
}
- FileItem uplFile = (FileItem) fields.get("NewFile");
+ MultipartFile uplFile = (MultipartFile) fields.get("NewFile");
String fileNameLong = uplFile.getName();
fileNameLong = fileNameLong.replace('\\', '/');
String[] pathParts = fileNameLong.split("/");
String fileName = pathParts[pathParts.length - 1];
-
+
// validate file size
- ActionMessage maxFilesizeExceededMessage = FileValidatorUtil.validateFileSize(uplFile, true);
- if (maxFilesizeExceededMessage != null) {
+ boolean maxFilesizeExceededMessage = FileValidatorSpringUtil.validateFileSize(uplFile, true);
+ if (!maxFilesizeExceededMessage) {
//assign fileName an error message to be shown on a client side
- fileName = messageService.getMessage(maxFilesizeExceededMessage.getKey(),
- maxFilesizeExceededMessage.getValues());
+ fileName = messageService.getMessage("errors.maxfilesize",
+ new Object[] { Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE) });
retVal.append("1");
- // validate file extension
+ // validate file extension
} else if (!FileUtil.isExtensionAllowed(fileType, fileName)) {
if (LAMSConnectorServlet.debug) {
log.debug("File extension is prohibited for upload " + fileName);
}
//will generate client-side alert message 'Invalid file type'
retVal.append("204");
-
- } else {
+
+ } else {
File pathToSave = new File(validCurrentDirPath, fileName);
int counter = 1;
@@ -356,7 +356,7 @@
counter++;
}
- uplFile.write(pathToSave);
+ uplFile.transferTo(pathToSave);
if (counter > 1) {
retVal.append("201");
Index: lams_central/src/java/org/lamsfoundation/lams/web/LAMSUploadServlet.java
===================================================================
diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/src/java/org/lamsfoundation/lams/web/LAMSUploadServlet.java (.../LAMSUploadServlet.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80)
+++ lams_central/src/java/org/lamsfoundation/lams/web/LAMSUploadServlet.java (.../LAMSUploadServlet.java) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -22,12 +22,16 @@
import org.apache.commons.fileupload.FileItem;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionMessage;
+import org.lamsfoundation.lams.util.Configuration;
+import org.lamsfoundation.lams.util.ConfigurationKeys;
import org.lamsfoundation.lams.util.FileUtil;
+import org.lamsfoundation.lams.util.FileValidatorSpringUtil;
import org.lamsfoundation.lams.util.FileValidatorUtil;
import org.lamsfoundation.lams.util.MessageService;
import org.lamsfoundation.lams.util.UploadFileUtil;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.multipart.MultipartFile;
/**
* Servlet to upload files.
@@ -99,10 +103,10 @@
fields.put(item.getFieldName(), item);
}
}
- FileItem uplFile = (FileItem) fields.get("NewFile");
+ MultipartFile uplFile = (MultipartFile) fields.get("NewFile");
if (uplFile == null) {
// form field name used by CKEditor 3.x
- uplFile = (FileItem) fields.get("upload");
+ uplFile = (MultipartFile) fields.get("upload");
}
String fileNameLong = uplFile.getName();
@@ -111,10 +115,10 @@
String fileName = pathParts[pathParts.length - 1];
// validate file size
- ActionMessage maxFilesizeExceededMessage = FileValidatorUtil.validateFileSize(uplFile, true);
- if (maxFilesizeExceededMessage != null) {
- returnMessage = messageService.getMessage(maxFilesizeExceededMessage.getKey(),
- maxFilesizeExceededMessage.getValues());
+ boolean maxFilesizeExceededMessage = FileValidatorSpringUtil.validateFileSize(uplFile, true);
+ if (!maxFilesizeExceededMessage) {
+ fileName = messageService.getMessage("errors.maxfilesize",
+ new Object[] { Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE) });
// validate file extension
} else if (!FileUtil.isExtensionAllowed(fileType, fileName)) {
@@ -129,7 +133,7 @@
String currentWebPath = UploadFileUtil.getUploadWebPath(currentFolderStr, fileType);
fileUrl = currentWebPath + '/' + fileName;
- uplFile.write(destinationFile);
+ uplFile.transferTo(destinationFile);
if (LAMSUploadServlet.log.isDebugEnabled()) {
LAMSUploadServlet.log.debug("Uploaded file to " + destinationFile.getAbsolutePath());
}
Index: lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupController.java
===================================================================
diff -u -r792f30e164500b758d9eeac2dcf19853be4dfd9f -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupController.java (.../OrganisationGroupController.java) (revision 792f30e164500b758d9eeac2dcf19853be4dfd9f)
+++ lams_central/src/java/org/lamsfoundation/lams/web/OrganisationGroupController.java (.../OrganisationGroupController.java) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -40,8 +40,6 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionMapping;
import org.lamsfoundation.lams.contentrepository.exception.InvalidParameterException;
import org.lamsfoundation.lams.integration.dto.ExtGroupDTO;
import org.lamsfoundation.lams.integration.service.IIntegrationService;
@@ -370,7 +368,7 @@
*/
@ResponseBody
@RequestMapping(path = "/save", method = RequestMethod.POST)
- public void save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ public void save(HttpServletRequest request, HttpServletResponse response)
throws InvalidParameterException, IOException {
// check if user is allowed to edit groups
Integer userId = getUserDTO().getUserID();
@@ -511,8 +509,7 @@
*/
@ResponseBody
@RequestMapping(path = "/save", method = RequestMethod.POST)
- public void saveGroupMappings(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ public void saveGroupMappings(HttpServletRequest request, HttpServletResponse response) throws IOException {
ArrayNode groupMapping = JsonUtil.readArray(request.getParameter("mapping"));
for (JsonNode entryNode : groupMapping) {
ObjectNode entry = (ObjectNode) entryNode;
Index: lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveController.java
===================================================================
diff -u -r52f09d3d3dd6998ff9cb9e7377c7501341ad7a23 -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveController.java (.../PortraitSaveController.java) (revision 52f09d3d3dd6998ff9cb9e7377c7501341ad7a23)
+++ lams_central/src/java/org/lamsfoundation/lams/web/PortraitSaveController.java (.../PortraitSaveController.java) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -182,7 +182,7 @@
/** Called from sysadmin to delete an inappropriate portrait */
@RequestMapping("/deletePortrait")
- public String deletePortrait(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ public String deletePortrait(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Integer userId = WebUtil.readIntParam(request, "userId", true);
Index: lams_central/web/includes/javascript/authoring/authoringMenu.js
===================================================================
diff -u -r0e9eca8da006863730e793b75a47803bc6142c67 -r1c001afed4496daabc08f0b83a4118458d400e5a
--- lams_central/web/includes/javascript/authoring/authoringMenu.js (.../authoringMenu.js) (revision 0e9eca8da006863730e793b75a47803bc6142c67)
+++ lams_central/web/includes/javascript/authoring/authoringMenu.js (.../authoringMenu.js) (revision 1c001afed4496daabc08f0b83a4118458d400e5a)
@@ -537,9 +537,8 @@
}
$.ajax({
- url : LAMS_URL + 'monitoring/monitoring.do',
+ url : LAMS_URL + 'monitoring/monitoring/startPreviewLesson.do',
data : {
- 'method' : 'startPreviewLesson',
'lessonID' : lessonID
},
cache : false,