Skip to content
Snippets Groups Projects
Commit feb8b6e8 authored by srosse's avatar srosse
Browse files

OO-332: fix double import with import references without asking, fix export of portfolio

parent ea264fb4
No related branches found
No related tags found
No related merge requests found
......@@ -249,6 +249,7 @@ public class ImportCourseController extends BasicController implements IAddContr
logError("Directory "+exportDir.getAbsolutePath()+" not found", new FileNotFoundException());
}
// collect all nodes
nodeList.clear();
collectNodesAsList((CourseEditorTreeNode)course.getEditorTreeModel().getRootNode(), nodeList);
nodeListPos = 0;
boolean finished = processNodeList(ureq);
......@@ -397,7 +398,7 @@ public class ImportCourseController extends BasicController implements IAddContr
*/
private boolean processNodeList(UserRequest ureq) {
while (nodeListPos < nodeList.size()) {
CourseEditorTreeNode nextNode = (CourseEditorTreeNode)nodeList.get(nodeListPos);
CourseEditorTreeNode nextNode = nodeList.get(nodeListPos);
nodeListPos++;
Controller ctrl = nextNode.getCourseNode().importNode(getExportDataDir(course), course, false, ureq, getWindowControl());
if (ctrl != null) {
......
......@@ -126,21 +126,18 @@ public class EPXStreamHandler {
public static final InputStream toStream(PortfolioStructure structure)
throws IOException {
String xmlStructure = myStream.toXML(structure);
try {
//prepare a zip
ByteArrayOutputStream out = new ByteArrayOutputStream();
ZipOutputStream zipOut = new ZipOutputStream(out);
zipOut.putNextEntry(new ZipEntry("map.xml"));
InputStream in = new ByteArrayInputStream(xmlStructure.getBytes("UTF8"));
IOUtils.copy(in, out);
myStream.toXML(structure, zipOut);
zipOut.closeEntry();
zipOut.close();
//prepare media resource
byte[] outArray = out.toByteArray();
IOUtils.closeQuietly(out);
IOUtils.closeQuietly(in);
return new ByteArrayInputStream(outArray);
} catch (IOException e) {
log.error("Cannot export this map: " + structure, e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment