diff --git a/src/main/java/de/bps/onyx/plugin/OnyxExportManager.java b/src/main/java/de/bps/onyx/plugin/OnyxExportManager.java index 9c5568d5087c6cd9df77f43bf02b907fdd6b88e1..ea4b86e1d155f28a29aae01f6686ac790734af7a 100644 --- a/src/main/java/de/bps/onyx/plugin/OnyxExportManager.java +++ b/src/main/java/de/bps/onyx/plugin/OnyxExportManager.java @@ -180,7 +180,6 @@ public class OnyxExportManager { private String createTargetFilename(final String shortTitle, final String type) { final StringBuilder tf = new StringBuilder(); - tf.append(type); tf.append(Formatter.makeStringFilesystemSave(shortTitle)); tf.append("_"); final DateFormat myformat = new SimpleDateFormat("yyyy-MM-dd__hh-mm-ss__SSS"); diff --git a/src/main/java/org/olat/core/util/Formatter.java b/src/main/java/org/olat/core/util/Formatter.java index 5b7edfafa83f159c47f7a25b2b52eefd419aa6c2..16eedd7e8dcfc68430d5d3ff4db11aa70faafc8f 100644 --- a/src/main/java/org/olat/core/util/Formatter.java +++ b/src/main/java/org/olat/core/util/Formatter.java @@ -60,6 +60,7 @@ import org.olat.core.helpers.Settings; public class Formatter { private static final DateFormat formatterDatetimeFilesystem = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss_SSS"); + private static final DateFormat formatterDatetime = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm"); private static final DateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); private static final DateFormat shortFormatDateFileSystem = new SimpleDateFormat("yyyyMMdd"); @@ -303,6 +304,19 @@ public class Formatter { } } + /** + * Use this for naming files or directories with a timestamp. No Seconds and millis! + * As windows does not like ":" in filenames formatDateAndTime(d) does not work + * + * @param d the date to be formatted + * @return a String with the formatted date and time + */ + public static String formatDatetimeSave(Date d) { + synchronized (formatterDatetime) { + return formatterDatetime.format(d); + } + } + public static Date parseDatetimeFilesystemSave(String d) throws ParseException { synchronized (formatterDatetimeFilesystem) { return formatterDatetimeFilesystem.parse(d); diff --git a/src/main/java/org/olat/course/archiver/ArchiveResource.java b/src/main/java/org/olat/course/archiver/ArchiveResource.java index 997e84792e2405f0600954c2cd847c928929468b..dbb323b8c3b43e264dc2b4b6c7896f28ad8d8727 100644 --- a/src/main/java/org/olat/course/archiver/ArchiveResource.java +++ b/src/main/java/org/olat/course/archiver/ArchiveResource.java @@ -94,9 +94,9 @@ public class ArchiveResource implements MediaResource { log.error("", e); } - String label = courseNode.getType() + "_" - + StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) - + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + String label = //courseNode.getType() + "_" + + StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + + "_" + Formatter.formatDatetimeSave(new Date(System.currentTimeMillis())) + ".zip"; String urlEncodedLabel = StringHelper.urlEncodeUTF8(label); hres.setHeader("Content-Disposition","attachment; filename*=UTF-8''" + urlEncodedLabel); diff --git a/src/main/java/org/olat/course/archiver/ArchiverMainController.java b/src/main/java/org/olat/course/archiver/ArchiverMainController.java index 994230984f5886853038208799c8f87f8eac4d67..5c08e6b0e9f6d616b603cb2da085a256ecd02fd0 100644 --- a/src/main/java/org/olat/course/archiver/ArchiverMainController.java +++ b/src/main/java/org/olat/course/archiver/ArchiverMainController.java @@ -52,13 +52,14 @@ import org.olat.course.nodes.CheckListCourseNode; import org.olat.course.nodes.DialogCourseNode; import org.olat.course.nodes.FOCourseNode; import org.olat.course.nodes.GTACourseNode; +import org.olat.course.nodes.IQSELFCourseNode; +import org.olat.course.nodes.IQSURVCourseNode; import org.olat.course.nodes.IQTESTCourseNode; import org.olat.course.nodes.PFCourseNode; import org.olat.course.nodes.ProjectBrokerCourseNode; import org.olat.course.nodes.ScormCourseNode; import org.olat.course.nodes.TACourseNode; import org.olat.course.nodes.WikiCourseNode; -import org.olat.ims.qti.export.CourseQTIArchiveController; /** * Initial Date: May 26, 2004 @@ -69,7 +70,8 @@ public class ArchiverMainController extends MainLayoutBasicController { private static boolean extensionLogged = false; private static final String CMD_INDEX = "index"; - private static final String CMD_QTIRESULTS = "qtiresults"; + private static final String CMD_QTISURVRESULTS = "qtisurvresults"; + private static final String CMD_QTITESTRESULTS = "qtitestresults"; private static final String CMD_SCOREACCOUNTING = "scoreaccounting"; private static final String CMD_ARCHIVELOGFILES = "archivelogfiles"; private static final String CMD_HANDEDINTASKS = "handedintasks"; @@ -179,10 +181,17 @@ public class ArchiverMainController extends MainLayoutBasicController { if (archiverCallback.mayArchiveQtiResults()) { gtn = new GenericTreeNode(); gtn.setTitle(translate("menu.qtiresults")); - gtn.setUserObject(CMD_QTIRESULTS); + gtn.setUserObject(CMD_QTISURVRESULTS); gtn.setAltText(translate("menu.qtiresults.alt")); root.addChild(gtn); } + if (archiverCallback.mayArchiveQtiTestResults()) { + gtn = new GenericTreeNode(); + gtn.setTitle(translate("menu.qtitestresults")); + gtn.setUserObject(CMD_QTITESTRESULTS); + gtn.setAltText("menu.qtitestresults.alt"); + root.addChild(gtn); + } if (archiverCallback.mayArchiveProperties()) { gtn = new GenericTreeNode(); gtn.setTitle(translate("menu.scoreaccounting")); @@ -292,12 +301,15 @@ public class ArchiverMainController extends MainLayoutBasicController { main.setContent(intro); } else { removeAsListenerAndDispose(contentCtr); - if (menuCommand.equals(CMD_QTIRESULTS)) { - contentCtr = new CourseQTIArchiveController(ureq, getWindowControl(), ores); + if (menuCommand.equals(CMD_QTISURVRESULTS)) { + contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new IQSURVCourseNode()); main.setContent(contentCtr.getInitialComponent()); - } else if (menuCommand.equals(CMD_SCOREACCOUNTING)) { - contentCtr = new ScoreAccountingArchiveController(ureq, getWindowControl(), ores, new IQTESTCourseNode()); + } else if (menuCommand.equals(CMD_QTITESTRESULTS)) { + contentCtr = new GenericArchiveController(ureq, getWindowControl(), ores, new IQTESTCourseNode(), new IQSELFCourseNode()); main.setContent(contentCtr.getInitialComponent()); + } else if (menuCommand.equals(CMD_SCOREACCOUNTING)) { + contentCtr = new ScoreAccountingArchiveController(ureq, getWindowControl(), ores); + main.setContent(contentCtr.getInitialComponent()); } else if (menuCommand.equals(CMD_ARCHIVELOGFILES)) { contentCtr = new CourseLogsArchiveController(ureq, getWindowControl(), ores); main.setContent(contentCtr.getInitialComponent()); diff --git a/src/main/java/org/olat/course/archiver/FullAccessArchiverCallback.java b/src/main/java/org/olat/course/archiver/FullAccessArchiverCallback.java index 82ee1c57c35ad9e23874ba69bbe70cf129960b4a..5cf70717e04717dd052269467c19976fdcdaf790 100644 --- a/src/main/java/org/olat/course/archiver/FullAccessArchiverCallback.java +++ b/src/main/java/org/olat/course/archiver/FullAccessArchiverCallback.java @@ -31,6 +31,11 @@ public class FullAccessArchiverCallback implements IArchiverCallback { public boolean mayArchiveQtiResults() { return true; } + + @Override + public boolean mayArchiveQtiTestResults() { + return true; + } @Override public boolean mayArchiveLogfiles() { diff --git a/src/main/java/org/olat/course/archiver/IArchiverCallback.java b/src/main/java/org/olat/course/archiver/IArchiverCallback.java index 22557ec956ff696f1c0d8c759490d6d760144bf0..54fcf691b6741f4449e667baf6ef465109806619 100644 --- a/src/main/java/org/olat/course/archiver/IArchiverCallback.java +++ b/src/main/java/org/olat/course/archiver/IArchiverCallback.java @@ -34,6 +34,11 @@ public interface IArchiverCallback { * @return true if user has rights to archive course qti results, false otherwhise */ public boolean mayArchiveQtiResults(); + + /** + * @return true if user has rights to archive course qti test results, false otherwhise + */ + public boolean mayArchiveQtiTestResults(); /** * @return true if user has rights to archive logfiles, false otherwhise */ diff --git a/src/main/java/org/olat/course/archiver/ScoreAccountingArchiveController.java b/src/main/java/org/olat/course/archiver/ScoreAccountingArchiveController.java index 018b3f9bc90a0a9717b65e5a387eda79de96865e..86af172184011f37e884d09fd331296857e93308 100644 --- a/src/main/java/org/olat/course/archiver/ScoreAccountingArchiveController.java +++ b/src/main/java/org/olat/course/archiver/ScoreAccountingArchiveController.java @@ -48,7 +48,6 @@ import org.olat.core.util.ExportUtil; import org.olat.course.CourseFactory; import org.olat.course.ICourse; import org.olat.course.nodes.AssessableCourseNode; -import org.olat.course.nodes.CourseNode; /** * Description: Course-Results-Archiver using ScoreAccountingHelper.class @@ -64,7 +63,6 @@ public class ScoreAccountingArchiveController extends BasicController { private VelocityContainer vcFeedback; private Link startButton, downloadButton; - private GenericArchiveController genericArchiveController; /** * Constructor for the score accounting archive controller @@ -72,15 +70,13 @@ public class ScoreAccountingArchiveController extends BasicController { * @param course */ public ScoreAccountingArchiveController(UserRequest ureq, WindowControl wControl, - OLATResourceable ores, CourseNode... nodeTypes) { + OLATResourceable ores) { super(ureq, wControl); this.ores = ores; myPanel = putInitialPanel(myPanel); myContent = createVelocityContainer("start"); startButton = LinkFactory.createButtonSmall("cmd.start", myContent, this); - genericArchiveController = new GenericArchiveController(ureq, wControl, ores, nodeTypes); - myContent.put("genericarchive", genericArchiveController.getInitialComponent()); myPanel.setContent(myContent); } @@ -120,7 +116,6 @@ public class ScoreAccountingArchiveController extends BasicController { vcFeedback.contextPut("body", translate("course.res.feedback", new String[] { downloadFile.getName() })); downloadButton = LinkFactory.createButtonSmall("cmd.download", vcFeedback, this); downloadButton.setUserObject(downloadFile); - vcFeedback.put("genericarchive", genericArchiveController.getInitialComponent()); myPanel.setContent(vcFeedback); } diff --git a/src/main/java/org/olat/course/archiver/_content/feedback.html b/src/main/java/org/olat/course/archiver/_content/feedback.html index 48f7962f3ac580d5260e50528eed2bbc0ace607a..a6cc7d703eedec302bbc866563fe2c3a755534f7 100644 --- a/src/main/java/org/olat/course/archiver/_content/feedback.html +++ b/src/main/java/org/olat/course/archiver/_content/feedback.html @@ -3,7 +3,4 @@ $body </p> <p>$r.render("cmd.download")</p> -<div class="o_block_bottom"> - $r.render("genericarchive") -</div> diff --git a/src/main/java/org/olat/course/archiver/_content/start.html b/src/main/java/org/olat/course/archiver/_content/start.html index d0afe420424aa583a4566687ba797da588291a82..2795af9092a9bd6584ecf6729f782f7b2d60216d 100644 --- a/src/main/java/org/olat/course/archiver/_content/start.html +++ b/src/main/java/org/olat/course/archiver/_content/start.html @@ -5,6 +5,3 @@ <p> $r.render("cmd.start") </p> -<div class="o_block_bottom"> - $r.render("genericarchive") -</div> \ No newline at end of file diff --git a/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_de.properties index 7ba7306c49c331637f9c65c5a28e61e5efb1a08e..fb1019b6e7b7c488c7971394a59a9160f35dce1c 100644 --- a/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_de.properties @@ -34,6 +34,7 @@ course.res.intro=Klicken Sie den untenstehenden 'Start'-Knopf um Endresultate vo course.res.title=Kursresultate dialog=Dateidiskussionen iqtest=Testergebnisse +iqsurv=Ergebnisse des Fragebogens pf=Teilnehmer Ordner fo=Forums gta=Aufgaben und Gruppenaufgaben @@ -66,8 +67,10 @@ menu.index=Archivierung menu.index.alt=Datenarchivierung eines OLAT-Kurses menu.projectbroker=Themenvergabe menu.projectbroker.alt=Daten der Bausteine "Themenvergabe" archivieren -menu.qtiresults=Test und Fragebogen -menu.qtiresults.alt=Daten von Tests und Fragebogen archivieren +menu.qtiresults=Fragebogen +menu.qtiresults.alt=Daten von Fragebogen archivieren +menu.qtitestresults=Tests +menu.qtitestresults.alt=Daten von Tests archivieren menu.scoreaccounting=Kursresultate menu.scoreaccounting.alt=Endresultate von Tests, Bewertungen und Aufgaben archivieren menu.scorm=SCORM Resultate @@ -77,6 +80,7 @@ menu.wikis.alt=Wikis archivieren nodechoose.intro.pf=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Ordnerinhalte zu archivieren. nodechoose.intro.cl=W\u00E4hlen Sie im folgenden Dialog den Checklisten Baustein aus, der ausgewertet werden soll nodechoose.intro.iqtest=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Testergebnisse zu archivieren. +nodechoose.intro.iqsurv=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Testergebnisse zu archivieren. nodechoose.intro.dialog=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Dateidiskussion zu archivieren. nodechoose.intro.fo=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Forum zu archivieren. nodechoose.intro.gta=W\u00E4hlen Sie einen Kursbaustein aus, um dessen Gruppenaufgaben zu archivieren. diff --git a/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_en.properties index 2d44657ca3986a39cdfe671620bf5cf71b6006ec..c1c95f8d686777ba9903305795a0491cb1d5d3ff 100644 --- a/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/archiver/_i18n/LocalStrings_en.properties @@ -34,7 +34,8 @@ course.res.intro=Click the 'Start' button below in order to archive final result course.res.title=Course results pf=Participant Folder dialog=File dialogs -iqtest=Test results +iqtest=Test and self-test results +iqsurv=Questionnaire results fo=Forums gta=Tasks and group tasks index.intro=By means of this tool you can archive various data from your OLAT course.<p> Choose a topic from the menu on the left to start. @@ -66,8 +67,10 @@ menu.index=Archiving menu.index.alt=Archive data from your OLAT course menu.projectbroker=Topic assignment menu.projectbroker.alt=Archive data of topic assignment -menu.qtiresults=Tests and questionnaires -menu.qtiresults.alt=Archive data from tests and questionnaires +menu.qtiresults=Questionnaires +menu.qtiresults.alt=Archive data from questionnaires +menu.qtitestresults=Tests +menu.qtitestresults.alt=Archive data from tests menu.scoreaccounting=Course results menu.scoreaccounting.alt=Archive final results from tests, assessments and tasks menu.scorm=SCORM results @@ -77,6 +80,7 @@ menu.wikis.alt=Archive Wikis nodechoose.intro.pf=Choose a course element to archive the content of the participant folder. nodechoose.intro.cl=Please select the checklist element you wish to archive. nodechoose.intro.iqtest=Select a course element to archive its test results. +nodechoose.intro.iqsurv=Select a course element to archive its test results. nodechoose.intro.dialog=Select a course element to archive its file dialog. nodechoose.intro.fo=Select a course element to archive its forum. nodechoose.intro.gta=Choose a course element to archive the group tasks. diff --git a/src/main/java/org/olat/ims/qti/export/CourseQTIArchiveController.java b/src/main/java/org/olat/ims/qti/export/CourseQTIArchiveController.java index 85896b43849c62fc2ddf36492ffad24bb0ce1963..5c5904b2fd02d7c1f84a03c89b76067274c4d138 100644 --- a/src/main/java/org/olat/ims/qti/export/CourseQTIArchiveController.java +++ b/src/main/java/org/olat/ims/qti/export/CourseQTIArchiveController.java @@ -49,9 +49,7 @@ import org.olat.course.CourseFactory; import org.olat.course.ICourse; import org.olat.course.assessment.model.AssessmentNodeData; import org.olat.course.nodes.CourseNode; -import org.olat.course.nodes.IQSELFCourseNode; import org.olat.course.nodes.IQSURVCourseNode; -import org.olat.course.nodes.IQTESTCourseNode; /** * @@ -180,17 +178,12 @@ public class CourseQTIArchiveController extends BasicController { } } - if (childrenData.size() > 0 - || courseNode instanceof IQTESTCourseNode - || courseNode instanceof IQSELFCourseNode - || courseNode instanceof IQSURVCourseNode) { + if (childrenData.size() > 0 || courseNode instanceof IQSURVCourseNode) { // Store node data in hash map. This hash map serves as data model for // the tasks overview table. Leave user data empty since not used in // this table. (use only node data) AssessmentNodeData nodeData = new AssessmentNodeData(recursionLevel, courseNode); - if (courseNode instanceof IQTESTCourseNode - || courseNode instanceof IQSELFCourseNode - || courseNode instanceof IQSURVCourseNode){ + if (courseNode instanceof IQSURVCourseNode) { nodeData.setSelectable(true); } else { nodeData.setSelectable(false); diff --git a/src/main/java/org/olat/ims/qti/export/QTIExportManager.java b/src/main/java/org/olat/ims/qti/export/QTIExportManager.java index 3f7766eb1fd965a6b0eb9467bf331b4a43f8c9b9..f4206c314a0ba513a8d930a8ca67dc2eda96b6b1 100644 --- a/src/main/java/org/olat/ims/qti/export/QTIExportManager.java +++ b/src/main/java/org/olat/ims/qti/export/QTIExportManager.java @@ -116,7 +116,7 @@ public class QTIExportManager extends BasicManager{ qef.setQTIItemObjectList(qtiItemObjectList); if (results.size() > 0) { createContentOfExportFile(results, qtiItemObjectList, qef); - String targetFileName = getFilename(shortTitle, qef, fileNameSuffix); + String targetFileName = getFilename(shortTitle, fileNameSuffix); exportStream.putNextEntry(new ZipEntry(targetFileName)); IOUtils.write(qef.getReport(), exportStream); @@ -191,17 +191,16 @@ public class QTIExportManager extends BasicManager{ */ private String writeContentToFile(String shortTitle, File exportDirectory, String charset, QTIExportFormatter qef, String fileNameSuffix) { // defining target filename - String targetFileName = getFilename(shortTitle, qef, fileNameSuffix); + String targetFileName = getFilename(shortTitle, fileNameSuffix); File savedFile = ExportUtil.writeContentToFile(targetFileName, qef.getReport(), exportDirectory, charset); return savedFile.getName(); } - private String getFilename(String shortTitle, QTIExportFormatter qef, String fileNameSuffix) { + private String getFilename(String shortTitle, String fileNameSuffix) { StringBuilder tf = new StringBuilder(); - tf.append(qef.getFileNamePrefix()); tf.append(Formatter.makeStringFilesystemSave(shortTitle)); tf.append("_"); - DateFormat myformat = new SimpleDateFormat("yyyy-MM-dd__hh-mm-ss__SSS"); + DateFormat myformat = new SimpleDateFormat("yyyy-MM-dd__hh-mm"); String timestamp = myformat.format(new Date()); tf.append(timestamp); tf.append(fileNameSuffix); diff --git a/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java b/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java index 047273ce9900fa46db364784e46f0cc1a7fb04cc..c9651d798abea829938dd5c8d3ca5d1b5e0029dc 100644 --- a/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java +++ b/src/main/java/org/olat/ims/qti21/manager/archive/QTI21ArchiveFormat.java @@ -198,8 +198,7 @@ public class QTI21ArchiveFormat { ICourse course = CourseFactory.loadCourse(courseEntry); CourseNode courseNode = course.getRunStructure().getNode(subIdent); - String label = courseNode.getType() + "_" - + StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + String label = StringHelper.transformDisplayNameToFileSystemName(courseNode.getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())) + ".xlsx";