Skip to content
Snippets Groups Projects
Commit 6c17eede authored by Matthai Kurian's avatar Matthai Kurian
Browse files

OO-314: Added "import all resources without asking" to course import

parent 9fa510b9
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,8 @@ public class ImportCourseController extends BasicController implements IAddContr
private Panel myPanel;
private static final VFSItemFileTypeFilter zipTypeFilter = new VFSItemFileTypeFilter(new String[] { "zip" });
private boolean importYesMode = false;
/**
* Import a course from a previous export.
*
......@@ -290,6 +292,9 @@ public class ImportCourseController extends BasicController implements IAddContr
callback.canceled(ureq);
showError("add.failed");
return;
} else if (event.getCommand().equals("importYesMode")) {
importYesMode = true;
event (ureq, cfc, Event.DONE_EVENT);
}
} else if (source == sharedFolderImportController) {
if (event == Event.DONE_EVENT) {
......@@ -399,6 +404,18 @@ public class ImportCourseController extends BasicController implements IAddContr
activeImportController = ctrl;
listenTo(activeImportController);
while (importYesMode) {
if (ctrl instanceof ImportReferencesController) {
((ImportReferencesController) ctrl).importWithoutAsking (ureq);
break;
}
if (ctrl instanceof ImportPortfolioReferencesController) {
((ImportPortfolioReferencesController) ctrl).importWithoutAsking (ureq);
break;
}
break;
}
myPanel.setContent(activeImportController.getInitialComponent());
return false;
}
......
......@@ -87,6 +87,7 @@ public class ImportPortfolioReferencesController extends BasicController {
private Link noopButton;
private Link cancelButton;
private Link continueButton;
private Link importYesModeButton;
private RepositorySearchController searchController;
private RepositoryEntryImportExport importExport;
private DetailsReadOnlyForm repoDetailsForm;
......@@ -103,7 +104,7 @@ public class ImportPortfolioReferencesController extends BasicController {
reattachButton = LinkFactory.createButton("import.reattach.action", main, this);
noopButton = LinkFactory.createButton("import.noop.action", main, this);
cancelButton = LinkFactory.createButton("cancel", main, this);
importYesModeButton = LinkFactory.createButton("import.yesmode.action", main, this);
main.contextPut("nodename", node.getShortTitle());
main.contextPut("type", translate("node." + node.getType()));
main.contextPut("displayname", importExport.getDisplayName());
......@@ -115,6 +116,11 @@ public class ImportPortfolioReferencesController extends BasicController {
putInitialPanel(mainPanel);
}
protected void importWithoutAsking (UserRequest ureq) {
event (ureq, importButton, Event.DONE_EVENT);
fireEvent(ureq, Event.DONE_EVENT);
}
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
......@@ -151,6 +157,8 @@ public class ImportPortfolioReferencesController extends BasicController {
fireEvent(ureq, Event.CANCELLED_EVENT);
} else if (source == continueButton){
fireEvent(ureq, Event.DONE_EVENT);
} else if (source == importYesModeButton) {
fireEvent(ureq, new Event("importYesMode"));
}
}
......
......@@ -122,6 +122,7 @@ public class ImportReferencesController extends BasicController {
private Link reattachButton;
private Link noopButton;
private Link continueButton;
private Link importYesModeButton;
private RepositorySearchController searchController;
private RepositoryEntryImportExport importExport;
private DetailsReadOnlyForm repoDetailsForm;
......@@ -138,6 +139,7 @@ public class ImportReferencesController extends BasicController {
importButton = LinkFactory.createButton("import.import.action", main, this);
reattachButton = LinkFactory.createButton("import.reattach.action", main, this);
noopButton = LinkFactory.createButton("import.noop.action", main, this);
importYesModeButton = LinkFactory.createButton("import.yesmode.action", main, this);
main.contextPut("nodename", node.getShortTitle());
main.contextPut("type", translator.translate("node." + node.getType()));
......@@ -149,6 +151,11 @@ public class ImportReferencesController extends BasicController {
putInitialPanel(mainPanel);
}
protected void importWithoutAsking (UserRequest ureq) {
event (ureq, importButton, Event.DONE_EVENT);
fireEvent(ureq, Event.DONE_EVENT);
}
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
......@@ -262,6 +269,8 @@ public class ImportReferencesController extends BasicController {
fireEvent(ureq, Event.DONE_EVENT);
} else if (source == continueButton){
fireEvent(ureq, Event.DONE_EVENT);
} else if (source == importYesModeButton) {
fireEvent(ureq, new Event("importYesMode"));
}
}
......
......@@ -20,6 +20,7 @@
$r.translate("import.import.desc")
<br/>
$r.render("import.import.action")
$r.render("import.yesmode.action")
</li>
<li>
<strong>$r.translate("import.reattach.title")</strong>
......
......@@ -9,6 +9,7 @@ import.action.title=Wie m\u00F6chten Sie weiterfahren?
import.desc=Beschreibung der Lernressource
import.displayname=Name der Lernressourcen
import.import.action=Importieren
import.yesmode.action=Alle Lernressourcen importieren ohne weitere Fragen
import.import.desc=Sie k\u00F6nnen die referenzierte Lernressource in OLAT importieren. Die Lernressource wird mit dem importierten Kurs verkn\u00FCpft.
import.import.title=Lernressource mit Referenz importieren
import.intro=Der folgende Kursbaustein hat eine Referenz auf eine Lernressource.
......
......@@ -17,6 +17,7 @@ import.nodetype=Type of element
import.noop.action=Remove
import.noop.desc=If you remove a reference, you will have to set the reference manually within the course editor.
import.noop.title=Remove reference
import.yesmode.action=Import all resources without asking
import.reattach.action=Update link
import.reattach.desc=You can update the link of a learning resource already existing with another course element.
import.reattach.success=Link successfully updated
......
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