use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class CourseHandler method createWizardController.
@Override
public StepsMainRunController createWizardController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
// load the course structure
final RepositoryEntry repoEntry = (RepositoryEntry) res;
ICourse course = CourseFactory.loadCourse(repoEntry);
Translator cceTranslator = Util.createPackageTranslator(CourseCreationHelper.class, ureq.getLocale());
final CourseCreationConfiguration courseConfig = new CourseCreationConfiguration(course.getCourseTitle(), Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + repoEntry.getKey());
// wizard finish callback called after "finish" is called
final CourseCreationHelper ccHelper = new CourseCreationHelper(ureq.getLocale(), repoEntry, courseConfig, course);
StepRunnerCallback finishCallback = new StepRunnerCallback() {
public Step execute(UserRequest uureq, WindowControl control, StepsRunContext runContext) {
// retrieve access and properties
CourseAccessAndProperties accessAndProps = (CourseAccessAndProperties) runContext.get("accessAndProperties");
courseConfig.setAccessAndProperties(accessAndProps);
// here goes the code which reads out the wizards data from the runContext and then does some wizardry
ccHelper.finalizeWorkflow(uureq);
control.setInfo(CourseCreationMailHelper.getSuccessMessageString(uureq));
// send notification mail
final MailerResult mr = CourseCreationMailHelper.sentNotificationMail(uureq, ccHelper.getConfiguration());
MailHelper.printErrorsAndWarnings(mr, control, uureq.getUserSession().getRoles().isOLATAdmin(), uureq.getLocale());
return StepsMainRunController.DONE_MODIFIED;
}
};
Step start = new CcStep00(ureq, courseConfig, repoEntry);
StepsMainRunController ccSMRC = new StepsMainRunController(ureq, wControl, start, finishCallback, null, cceTranslator.translate("coursecreation.title"), "o_sel_course_create_wizard");
return ccSMRC;
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method doEmails.
/**
* @param ureq
* @param items
*/
private void doEmails(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(emailWizard);
if (selectedItems == null || selectedItems.isEmpty()) {
showWarning("error.select.one");
return;
}
List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
if (groups.isEmpty()) {
showWarning("msg.alleastone.editable.group");
return;
}
if (selectedItems.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
Step start = new BGEmailSelectReceiversStep(ureq, groups);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
// mails are send by the last controller of the wizard
return StepsMainRunController.DONE_MODIFIED;
}
};
emailWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("email.group"), "o_sel_groups_email_wizard");
listenTo(emailWizard);
getWindowControl().pushAsModalDialog(emailWizard.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method doCopy.
/**
* Make copies of a list of business groups
* @param ureq
* @param items
*/
private void doCopy(UserRequest ureq, List<? extends BusinessGroupRef> items) {
removeAsListenerAndDispose(businessGroupWizard);
if (items == null || items.isEmpty()) {
showWarning("error.select.one");
return;
}
List<BusinessGroup> groups = toBusinessGroups(ureq, items, true);
if (groups.isEmpty()) {
showWarning("msg.alleastone.editable.group");
return;
}
if (items.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
boolean enableCoursesCopy = businessGroupService.hasResources(groups);
boolean enableAreasCopy = areaManager.countBGAreasOfBusinessGroups(groups) > 0;
boolean enableRightsCopy = rightManager.hasBGRight(groups);
Step start = new BGCopyPreparationStep(ureq, groups, enableCoursesCopy, enableAreasCopy, enableRightsCopy);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
@SuppressWarnings("unchecked") List<BGCopyBusinessGroup> copies = (List<BGCopyBusinessGroup>) runContext.get("groupsCopy");
if (copies != null && !copies.isEmpty()) {
boolean copyAreas = convertToBoolean(runContext, "areas");
boolean copyCollabToolConfig = convertToBoolean(runContext, "tools");
boolean copyRights = convertToBoolean(runContext, "rights");
boolean copyOwners = convertToBoolean(runContext, "owners");
boolean copyParticipants = convertToBoolean(runContext, "participants");
boolean copyMemberVisibility = convertToBoolean(runContext, "membersvisibility");
boolean copyWaitingList = convertToBoolean(runContext, "waitingList");
boolean copyRelations = convertToBoolean(runContext, "resources");
for (BGCopyBusinessGroup copy : copies) {
businessGroupService.copyBusinessGroup(getIdentity(), copy.getOriginal(), copy.getName(), copy.getDescription(), copy.getMinParticipants(), copy.getMaxParticipants(), copyAreas, copyCollabToolConfig, copyRights, copyOwners, copyParticipants, copyMemberVisibility, copyWaitingList, copyRelations);
}
return StepsMainRunController.DONE_MODIFIED;
} else {
return StepsMainRunController.DONE_UNCHANGED;
}
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("copy.group"), "o_sel_group_copy_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method doMerge.
/**
* @param ureq
* @param items
*/
private void doMerge(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(businessGroupWizard);
if (selectedItems == null || selectedItems.size() < 2) {
showWarning("error.select.one");
return;
}
final List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
if (groups.size() < 2) {
showWarning("msg.alleasttwo.editable.group");
return;
}
if (selectedItems.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
StringBuilder managedNames = new StringBuilder();
for (BusinessGroup group : groups) {
String gname = group.getName() == null ? "???" : StringHelper.escapeHtml(group.getName());
if (StringHelper.containsNonWhitespace(group.getManagedFlagsString())) {
if (managedNames.length() > 0)
managedNames.append(", ");
managedNames.append(gname);
}
}
if (managedNames.length() > 0) {
showWarning("error.managed.group", managedNames.toString());
return;
}
Step start = new BGMergeStep(ureq, groups);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
BusinessGroup targetGroup = (BusinessGroup) runContext.get("targetGroup");
groups.remove(targetGroup);
businessGroupService.mergeBusinessGroups(getIdentity(), targetGroup, groups, null);
return StepsMainRunController.DONE_MODIFIED;
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("merge.group"), "o_sel_groups_merge_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepsMainRunController in project OpenOLAT by OpenOLAT.
the class BusinessGroupMembersController method doChooseMembers.
private void doChooseMembers(UserRequest ureq) {
removeAsListenerAndDispose(importMembersWizard);
Step start = new ImportMember_1b_ChooseMemberStep(ureq, null, businessGroup, false);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
addMembers(runContext);
return StepsMainRunController.DONE_MODIFIED;
}
};
importMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_group_import_1_wizard");
listenTo(importMembersWizard);
getWindowControl().pushAsModalDialog(importMembersWizard.getInitialComponent());
}
Aggregations