use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class PublishController method doAddAccessRights.
private void doAddAccessRights(UserRequest ureq) {
removeAsListenerAndDispose(addMembersWizard);
Step start = new AddMember_1_ChooseMemberStep(ureq, binder);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
AccessRightsContext rightsContext = (AccessRightsContext) runContext.get("rightsContext");
MailTemplate mailTemplate = (MailTemplate) runContext.get("mailTemplate");
addMembers(rightsContext, mailTemplate);
return StepsMainRunController.DONE_MODIFIED;
}
};
addMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_course_member_import_1_wizard");
listenTo(addMembersWizard);
getWindowControl().pushAsModalDialog(addMembersWizard.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class EditorMainController method launchPublishingWizard.
private void launchPublishingWizard(UserRequest ureq, ICourse course, boolean requestOnClose) {
// ignore enter
if (publishStepsController != null)
return;
/*
* start follwoing steps -> cancel wizardf does not touch data
* (M) Mandatory (O) Optional
* - (M)Step 00 -> show selection tree to choose changed nodes to be published
* ...........-> calculate errors & warnings
* ...........(next|finish) available if no errors or nothing to publish
* - (O)Step 00A -> review errors & warnings
* ...........(previous|next|finish) available
* - (O)Step 00B -> review publish changes that will happen
* ...........(previous|next|finish) available
* - (O)Step 01 -> change general access to course
* ...........(previous|finish) available
* - FinishCallback -> apply course nodes change set
* .................-> apply general access changes.
*/
Step start = new PublishStep00(ureq, cetm, course);
/*
* callback executed in case wizard is finished.
*/
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
// all information to do now is within the runContext saved
boolean hasChanges = false;
PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
PublishEvents publishEvents = publishManager.getPublishEvents();
if (runContext.containsKey("validPublish") && ((Boolean) runContext.get("validPublish")).booleanValue()) {
@SuppressWarnings("unchecked") Collection<String> selectedNodeIds = (Collection<String>) runContext.get("publishSetCreatedFor");
hasChanges = (selectedNodeIds != null) && (selectedNodeIds.size() > 0);
if (hasChanges) {
publishManager.applyPublishSet(ureq1.getIdentity(), ureq1.getLocale(), false);
}
}
if (runContext.containsKey("accessAndProperties")) {
CourseAccessAndProperties accessAndProperties = (CourseAccessAndProperties) runContext.get("accessAndProperties");
// fires an EntryChangedEvent for repository entry notifying
// about modification.
publishManager.changeAccessAndProperties(getIdentity(), accessAndProperties);
hasChanges = true;
}
CourseCatalog courseCatalog = (CourseCatalog) runContext.get("categories");
if (courseCatalog != null) {
publishManager.publishToCatalog(courseCatalog.getChoiceValue(), courseCatalog.getCategoryLabels());
}
if (publishEvents.getPostPublishingEvents().size() > 0) {
for (MultiUserEvent event : publishEvents.getPostPublishingEvents()) {
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, ores);
}
}
// signal correct completion and tell if changes were made or not.
return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
}
};
publishStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("publish.wizard.title"), "o_sel_course_publish_wizard");
listenTo(publishStepsController);
publishStepsController.getRunContext().put("requestOnClose", requestOnClose);
getWindowControl().pushAsModalDialog(publishStepsController.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class MessageListController method doExportForumItem.
private void doExportForumItem(UserRequest ureq, MessageView messageToMove) {
if (foCallback.mayEditMessageAsModerator()) {
StepRunnerCallback finish = new FinishCallback();
Translator trans = Util.createPackageTranslator(Step_1_SelectCourse.class, getLocale());
Step start = new Step_1_SelectCourse(ureq);
Message message = forumManager.getMessageById(messageToMove.getKey());
String wizardTitle = trans.translate("title.wizard.movethread", new String[] { message.getTitle() });
exportCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, wizardTitle, "o_sel_bulk_assessment_wizard");
StepsRunContext runContext = exportCtrl.getRunContext();
// can be threadtop message
runContext.put(SendMailStepForm.MESSAGE_TO_MOVE, message);
// starting thread
runContext.put(SendMailStepForm.START_THREADTOP, message.getThreadtop() == null ? message : message.getThreadtop());
// get start course
PropertyManager propertyManager = PropertyManager.getInstance();
Long forumResourceableId = forum.getResourceableId();
Property forumproperty = propertyManager.getPropertyByLongValue(forumResourceableId, FOCourseNode.FORUM_KEY);
if (forumproperty != null) {
Long resourcetypeId = forumproperty.getResourceTypeId();
String resourcetypeName = forumproperty.getResourceTypeName();
OLATResourceable olatResourceable = olatManager.findResourceable(resourcetypeId, resourcetypeName);
RepositoryEntry startCourse = repositoryManager.lookupRepositoryEntry(olatResourceable, false);
if (startCourse != null) {
runContext.put(SendMailStepForm.START_COURSE, startCourse);
}
}
listenTo(exportCtrl);
getWindowControl().pushAsModalDialog(exportCtrl.getInitialComponent());
} else {
showWarning("may.not.move.message");
}
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class CourseQTIArchiveController method doArchive.
private void doArchive(UserRequest ureq, boolean advanced) {
StepRunnerCallback finish = new FinishArchive();
Step start = new Archive_1_SelectNodeStep(ureq, courseOres, nodeList, advanced);
archiveWizardCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("archive.wizard.title"), "o_sel_test_archive_wizard");
listenTo(archiveWizardCtrl);
getWindowControl().pushAsModalDialog(archiveWizardCtrl.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class QuestionListController method doOpenExcelImportQTI21.
private void doOpenExcelImportQTI21(UserRequest ureq) {
removeAsListenerAndDispose(excelImportWizard);
Step additionalStep = null;
if (getSource().askEditable()) {
additionalStep = new EditableStep(ureq);
}
final AssessmentItemsPackage importPackage = new AssessmentItemsPackage();
final ImportOptions options = new ImportOptions();
options.setShuffle(true);
Step start = new QImport_1_InputStep(ureq, importPackage, options, additionalStep);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
QTI21QPoolServiceProvider spi = CoreSpringFactory.getImpl(QTI21QPoolServiceProvider.class);
List<AssessmentItemAndMetadata> items = importPackage.getItems();
List<QuestionItem> importItems = new ArrayList<>();
for (AssessmentItemAndMetadata item : items) {
QuestionItem importedItem = spi.importExcelItem(getIdentity(), item, getLocale());
if (importedItem != null) {
importItems.add(importedItem);
}
}
for (QuestionItem item : importItems) {
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.CREATE_QUESTION_ITEM_BY_IMPORT);
builder.withAfter(item);
qpoolService.persist(builder.create());
}
boolean editable = true;
if (getSource().askEditable()) {
Object editableCtx = runContext.get("editable");
editable = (editableCtx instanceof Boolean) ? ((Boolean) editableCtx).booleanValue() : false;
}
qpoolService.index(importItems);
int postImported = getSource().postImport(importItems, editable);
if (postImported > 0) {
getItemsTable().reset();
}
return StepsMainRunController.DONE_MODIFIED;
}
};
excelImportWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("import.excellike.21"), "o_sel_qpool_excel_import_wizard");
listenTo(excelImportWizard);
getWindowControl().pushAsModalDialog(excelImportWizard.getInitialComponent());
}
Aggregations