use of org.olat.core.gui.control.generic.wizard.StepRunnerCallback in project openolat by klemens.
the class LDAPAdminController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == syncStartLink) {
// Start sync job
// Disable start link during sync
syncStartLink.setEnabled(false);
LDAPEvent ldapEvent = new LDAPEvent(LDAPEvent.DO_SYNCHING);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ldapEvent, LDAPLoginManager.ldapSyncLockOres);
showInfo("admin.synchronize.started");
} else if (source == syncOneUserLink) {
userSearchCtrl = new UserSearchController(ureq, getWindowControl(), false);
listenTo(userSearchCtrl);
calloutCtr = new CloseableCalloutWindowController(ureq, getWindowControl(), userSearchCtrl.getInitialComponent(), syncOneUserLink, null, true, null);
calloutCtr.addDisposableChildController(userSearchCtrl);
calloutCtr.activate();
listenTo(calloutCtr);
} else if (source == deletStartLink) {
// cancel if some one else is making sync or delete job
if (!ldapLoginManager.acquireSyncLock()) {
showError("delete.error.lock");
} else {
deletStartLink.setEnabled(false);
// check and get LDAP connection
LdapContext ctx = ldapLoginManager.bindSystem();
if (ctx == null) {
showError("delete.error.connection");
return;
}
// get deleted users
identitiesToDelete = ldapLoginManager.getIdentitysDeletedInLdap(ctx);
try {
ctx.close();
} catch (NamingException e) {
showError("delete.error.connection.close");
logError("Could not close LDAP connection on manual delete sync", e);
}
if (identitiesToDelete != null && identitiesToDelete.size() != 0) {
hasIdentitiesToDelete = true;
/*
* start step which spawns the whole wizard
*/
Step start = new DeletStep00(ureq, hasIdentitiesToDelete, identitiesToDelete);
/*
* wizard finish callback called after "finish" is called
*/
StepRunnerCallback finishCallback = new StepRunnerCallback() {
public Step execute(UserRequest uureq, WindowControl control, StepsRunContext runContext) {
hasIdentitiesToDeleteAfterRun = ((Boolean) runContext.get("hasIdentitiesToDelete")).booleanValue();
if (hasIdentitiesToDeleteAfterRun) {
@SuppressWarnings("unchecked") List<Identity> idToDelete = (List<Identity>) runContext.get("identitiesToDelete");
amountUsersToDelete = idToDelete.size();
// Delete all identities now and tell everybody that
// we are finished
ldapLoginManager.deletIdentities(idToDelete);
return StepsMainRunController.DONE_MODIFIED;
} else {
return StepsMainRunController.DONE_UNCHANGED;
}
// otherwise return without deleting anything
}
};
deleteStepController = new StepsMainRunController(ureq, getWindowControl(), start, finishCallback, null, translate("admin.deleteUser.title"), "o_sel_ldap_delete_user_wizard");
listenTo(deleteStepController);
getWindowControl().pushAsModalDialog(deleteStepController.getInitialComponent());
} else {
hasIdentitiesToDelete = false;
showInfo("delete.step.noUsers");
deletStartLink.setEnabled(true);
ldapLoginManager.freeSyncLock();
}
}
} else if (source == removeFallBackAuthsLink) {
removeFallBackAuthsLink.setEnabled(false);
ldapLoginManager.removeFallBackAuthentications();
showInfo("opsuccess");
}
}
use of org.olat.core.gui.control.generic.wizard.StepRunnerCallback in project openolat by klemens.
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.StepRunnerCallback in project openolat by klemens.
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.StepRunnerCallback in project openolat by klemens.
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.StepRunnerCallback in project OpenOLAT by OpenOLAT.
the class EPAddArtefactController method prepareNewLiveBlogArtefactWizzard.
private void prepareNewLiveBlogArtefactWizzard(UserRequest ureq) {
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(LiveBlogArtefact.TYPE);
AbstractArtefact artefact1 = artHandler.createArtefact();
artefact1.setAuthor(getIdentity());
artefact1.setCollectionDate(new Date());
// preset as signed by 60%
artefact1.setSignature(60);
Step start = new EPCreateLiveBlogArtefactStep00(ureq, preSelectedStruct, artefact1);
// no vfsTemp!, blog doesn't need a directory
StepRunnerCallback finish = new EPArtefactWizzardStepCallback();
collectStepsCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("create.blog.artefact.wizzard.title"), "o_sel_artefact_add_wizard o_sel_artefact_add_blog_wizard");
listenTo(collectStepsCtrl);
getWindowControl().pushAsModalDialog(collectStepsCtrl.getInitialComponent());
}
Aggregations