use of org.olat.core.gui.control.generic.wizard.StepRunnerCallback in project openolat by klemens.
the class BulkAssessmentToolController method doOpen.
private void doOpen(UserRequest ureq) {
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl bwControl, StepsRunContext runContext) {
Date scheduledDate = (Date) runContext.get("scheduledDate");
BulkAssessmentDatas datas = (BulkAssessmentDatas) runContext.get("datas");
Feedback feedback = doBulkAssessment(scheduledDate, datas);
runContext.put("feedback", feedback);
return StepsMainRunController.DONE_MODIFIED;
}
};
Step start = new BulkAssessment_2_DatasStep(ureq, courseNode);
bulkAssessmentCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("bulk.wizard.title"), "o_sel_bulk_assessment_wizard");
listenTo(bulkAssessmentCtrl);
getWindowControl().pushAsModalDialog(bulkAssessmentCtrl.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepRunnerCallback in project openolat by klemens.
the class AbstractBusinessGroupListController method doConfiguration.
/**
* @param ureq
* @param items
*/
private void doConfiguration(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(businessGroupWizard);
if (selectedItems == null || selectedItems.isEmpty()) {
showWarning("error.select.one");
return;
}
final 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;
}
if (CollaborationToolsFactory.getInstance().getAvailableTools() == null) {
// init the available tools
CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(groups.get(0));
}
StringBuilder managedNames = new StringBuilder();
for (BusinessGroup group : groups) {
String gname = group.getName() == null ? "???" : group.getName();
if (BusinessGroupManagedFlag.isManaged(group, BusinessGroupManagedFlag.resources) || BusinessGroupManagedFlag.isManaged(group, BusinessGroupManagedFlag.tools)) {
if (managedNames.length() > 0)
managedNames.append(", ");
managedNames.append(gname);
}
}
if (managedNames.length() > 0) {
showWarning("error.managed.group", managedNames.toString());
return;
}
boolean isAuthor = ureq.getUserSession().getRoles().isAuthor() || ureq.getUserSession().getRoles().isInstitutionalResourceManager();
Step start = new BGConfigToolsStep(ureq, isAuthor);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
// configuration
BGConfigBusinessGroup configuration = (BGConfigBusinessGroup) runContext.get("configuration");
if (!configuration.getToolsToEnable().isEmpty() || !configuration.getToolsToDisable().isEmpty()) {
for (BusinessGroup group : groups) {
CollaborationTools tools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
for (String enabledTool : configuration.getToolsToEnable()) {
tools.setToolEnabled(enabledTool, true);
if (CollaborationTools.TOOL_FOLDER.equals(enabledTool)) {
tools.saveFolderAccess(new Long(configuration.getFolderAccess()));
Quota quota = configuration.getQuota();
if (quota != null) {
String path = tools.getFolderRelPath();
Quota fQuota = QuotaManager.getInstance().createQuota(path, quota.getQuotaKB(), quota.getUlLimitKB());
QuotaManager.getInstance().setCustomQuotaKB(fQuota);
}
} else if (CollaborationTools.TOOL_CALENDAR.equals(enabledTool)) {
tools.saveCalendarAccess(new Long(configuration.getCalendarAccess()));
}
}
for (String disabledTool : configuration.getToolsToDisable()) {
tools.setToolEnabled(disabledTool, false);
}
}
}
if (configuration.getResources() != null && !configuration.getResources().isEmpty()) {
businessGroupService.addResourcesTo(groups, configuration.getResources());
}
return StepsMainRunController.DONE_MODIFIED;
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("config.group"), "o_sel_groups_config_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
use of org.olat.core.gui.control.generic.wizard.StepRunnerCallback in project openolat by klemens.
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.StepRunnerCallback in project openolat by klemens.
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.StepRunnerCallback in project openolat by klemens.
the class GuiDemoStepsRunner 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 == startLink) {
/*
* start step which spawns the whole wizard
*/
Step start = new StartStepImpl(ureq);
/*
* wizard finish callback called after "finish" is called
*/
StepRunnerCallback finishCallback = new StepRunnerCallback() {
public Step execute(UserRequest ureq2, WindowControl control, StepsRunContext runContext) {
// finishing
return StepsMainRunController.DONE_UNCHANGED;
}
};
smrc = new StepsMainRunController(ureq, getWindowControl(), start, finishCallback, null, "A Workflow", "o_sel_demo_wizard");
listenTo(smrc);
getWindowControl().pushAsModalDialog(smrc.getInitialComponent());
}
}
Aggregations