Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r427b1699f540858bcf2d07288f0f5be431e8881b -raa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 427b1699f540858bcf2d07288f0f5be431e8881b)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision aa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d)
@@ -85,6 +85,7 @@
title.import.result =Import tool content result
title.import =Import tool content
title.import.instruction =Please choose LAMS sequence to import.
+title.import.instruction.antivirus =An antivirus scan will be performed. It can take a while.
title.export.loading =Export tool content loading
label.ld.zip.file =Learning design import file
msg.import.success =Learning design and activities imported successfully.
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/web/ImportToolContentController.java
===================================================================
diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -raa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d
--- lams_central/src/java/org/lamsfoundation/lams/authoring/web/ImportToolContentController.java (.../ImportToolContentController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/web/ImportToolContentController.java (.../ImportToolContentController.java) (revision aa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d)
@@ -41,7 +41,6 @@
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -121,7 +120,7 @@
} catch (Exception e) {
log.error("Error occured during import", e);
- ldErrorMsgs.add(e.getClass().getName() + " " + e.getMessage());
+ ldErrorMsgs.add(e.getCause().getMessage());
}
request.setAttribute(ATTR_LD_ID, ldId);
Index: lams_central/web/toolcontent/import.jsp
===================================================================
diff -u -r30a950cbc2f449d2f3ab2e7e16b2423703f4b7f8 -raa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d
--- lams_central/web/toolcontent/import.jsp (.../import.jsp) (revision 30a950cbc2f449d2f3ab2e7e16b2423703f4b7f8)
+++ lams_central/web/toolcontent/import.jsp (.../import.jsp) (revision aa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d)
@@ -8,6 +8,7 @@
<%=Configuration.get(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE)%>
<%=FileValidatorUtil.formatSize(Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE))%>
<%=Configuration.get(ConfigurationKeys.EXE_EXTENSIONS)%>
+<%=Configuration.get(ConfigurationKeys.ANTIVIRUS_ENABLE)%>
@@ -60,6 +61,10 @@
+
+
+
+
" method="post" enctype="multipart/form-data" id="importForm">
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java
===================================================================
diff -u -r47043f84205046a23497bf8c57060e2dcadf0c9a -raa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision 47043f84205046a23497bf8c57060e2dcadf0c9a)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision aa5d6d2ab7a3d3b7b9fe4e910578c1393bf5ed3d)
@@ -159,7 +159,7 @@
public class ExportToolContentService implements IExportToolContentService, ApplicationContextAware {
private Logger log = Logger.getLogger(ExportToolContentService.class);
- // export tool content zip file prefix
+ // export tool content zip file prefix
public static final String EXPORT_TOOLCONTNET_ZIP_PREFIX = "lams_toolcontent_";
public static final String EXPORT_LDCONTENT_ZIP_PREFIX = "lams_ldcontent_";
@@ -206,7 +206,6 @@
private ILearningDesignService learningDesignService;
private ApplicationContext applicationContext;
-
// save list of all tool file node class information. One tool may have
// over one file node, such as
@@ -637,6 +636,10 @@
try {
if (extension.equalsIgnoreCase(".zip")) {
+ if (!FileUtil.isVirusFree(new FileInputStream(designFile))) {
+ throw new ImportToolContentException("Virus found in imported design file");
+ }
+
String ldPath = ZipFileUtil.expandZip(new FileInputStream(designFile), filename);
File fullFilePath = new File(
@@ -1165,7 +1168,7 @@
idx++;
}
}
- Set actList = new TreeSet(new ActivityOrderComparator());
+ Set actList = new TreeSet<>(new ActivityOrderComparator());
Map activityMapper = new HashMap<>();
Map activityByUIIDMapper = new HashMap<>();
@@ -1211,7 +1214,7 @@
if (parent.isComplexActivity()) {
Set set = ((ComplexActivity) parent).getActivities();
if (set == null) {
- set = new TreeSet(new ActivityOrderComparator());
+ set = new TreeSet<>(new ActivityOrderComparator());
((ComplexActivity) parent).setActivities(set);
}
if (!removedActMap.containsKey(actDto.getActivityID())) {
@@ -1407,9 +1410,11 @@
String addSuffix = Configuration.get(ConfigurationKeys.SUFFIX_IMPORTED_LD);
if ((addSuffix == null) || Boolean.valueOf(addSuffix)) {
String title = ld.getTitle();
- if (title == null || title.trim().length() == 0)
+ if (title == null || title.trim().length() == 0) {
title = "unknown";
- ld.setTitle(learningDesignService.getUniqueNameForLearningDesign(ld.getTitle(), folder.getWorkspaceFolderId()));
+ }
+ ld.setTitle(
+ learningDesignService.getUniqueNameForLearningDesign(ld.getTitle(), folder.getWorkspaceFolderId()));
learningDesignDAO.update(ld);
// persist
}
@@ -2017,18 +2022,18 @@
}
public MessageService getMessageService() {
- return messageService;
+ return messageService;
}
public void setMessageService(MessageService messageService) {
- this.messageService = messageService;
+ this.messageService = messageService;
}
public ILearningDesignService getLearningDesignService() {
- return learningDesignService;
+ return learningDesignService;
}
public void setLearningDesignService(ILearningDesignService learningDesignService) {
- this.learningDesignService = learningDesignService;
+ this.learningDesignService = learningDesignService;
}
}
\ No newline at end of file