Skip to content
Snippets Groups Projects
Commit b557e0f8 authored by srosse's avatar srosse
Browse files

OO-748: fix the RS at the end of the close wizard, remove unintialized wControl variable

parent 9240dc4f
No related branches found
No related tags found
No related merge requests found
......@@ -157,7 +157,8 @@ public class IQEditReplaceWizard extends WizardController {
recipientsCC.add(ureq.getIdentity());
}
//fxdiff VCRP-16: intern mail system
MailContext context = new MailContextImpl(wControl.getBusinessControl().getAsString());
String businessPath = getWindowControl().getBusinessControl().getAsString();
MailContext context = new MailContextImpl(businessPath);
MailerWithTemplate.getInstance().sendMailAsSeparateMails(context, learners, recipientsCC, mailCtr.getMailTemplate(), ureq.getIdentity());
}
fireEvent(ureq, Event.DONE_EVENT);
......
......@@ -45,7 +45,6 @@ import org.olat.core.gui.control.controller.BasicController;
public class WizardController extends BasicController {
protected WindowControl wControl;
private VelocityContainer wizardVC;
private WizardInfoController wic;
......@@ -66,16 +65,14 @@ public class WizardController extends BasicController {
this.steps = steps;
wizardVC = createVelocityContainer("wizard");
finishButton = LinkFactory.createCustomLink("finish", "cmd.wizard.cancel", "cmd.wizard.finished", Link.BUTTON, this.wizardVC, this);
cancelButton = LinkFactory.createCustomLink("cancel", "cmd.wizard.cancel", "cmd.wizard.cancel", Link.BUTTON, this.wizardVC, this);
this.wic = new WizardInfoController(ureq, this.steps);
wic = new WizardInfoController(ureq, this.steps);
listenTo(wic);
this.wizardVC.put("wic", wic.getInitialComponent());
wizardVC.put("wic", wic.getInitialComponent());
putInitialPanel(wizardVC);
}
......
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
* <hr>
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* This file has been modified by the OpenOLAT community. Changes are licensed
* under the Apache 2.0 license as the original file.
*/
package org.olat.group.ui.wizard;
import java.util.List;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.wizard.WizardController;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupService;
import org.olat.group.GroupLoggingAction;
import org.olat.util.logging.activity.LoggingResourceable;
/**
* Description: <BR>
* Two step wizard to generate multiple groups as a copy of a given business
* group. In the first step the user is asked about what should be copied, in
* the second step the usr is asked for a list of groupnames.
* <P>
* Initial Date: Sep 11, 2004
*
* @author Florian Gnägi
*/
public class BGMultipleCopyWizardController extends WizardController {
private BGCopyWizardCopyForm copyForm;
private BusinessGroup originalGroup;
private GroupNamesForm groupNamesForm;
private final BusinessGroupService businessGroupService;
/**
* Constructor fot the business group multiple copy wizard
*
* @param ureq
* @param wControl
* @param originalGroup original business group: master that should be copied
* @param flags
*/
public BGMultipleCopyWizardController(UserRequest ureq, WindowControl wControl, BusinessGroup originalGroup) {
super(ureq, wControl, 2);
businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class);
this.originalGroup = originalGroup;
// init wizard step 1
boolean enableCourse = true;
boolean enableAreas = true;
boolean enableRights = true;
copyForm = new BGCopyWizardCopyForm(ureq, wControl, enableCourse, enableAreas, enableRights);
copyForm.addControllerListener(this);
// init wizard title and set step 1
setWizardTitle(translate("bgcopywizard.multiple.title"));
setNextWizardStep(translate("bgcopywizard.copyform.title"), copyForm.getInitialComponent());
}
/**
* @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)
*/
public void event(UserRequest ureq, Component source, Event event) {
// default wizard will listen to cancel wizard event
super.event(ureq, source, event);
}
public void event(UserRequest ureq, Controller source, Event event) {
if (source == copyForm) {
if (event == Event.DONE_EVENT) {
groupNamesForm = new GroupNamesForm(ureq, wControl, this.originalGroup.getMaxParticipants());
groupNamesForm.addControllerListener(this);
setNextWizardStep(translate("bgcopywizard.multiple.groupnames.title"), groupNamesForm.getInitialComponent());
}
}
else if (source == groupNamesForm) {
if (event == Event.DONE_EVENT) {
List<String> groupNames = groupNamesForm.getGroupNamesList();
StringBuilder okGroups = new StringBuilder();
StringBuilder nokGroups = new StringBuilder();
Integer max = groupNamesForm.getGroupMax();
for (String groupName: groupNames) {
BusinessGroup newGroup = doCopyGroup(groupName, max);
if (newGroup == null) {
nokGroups.append("<li>");
nokGroups.append(groupName);
nokGroups.append("</li>");
} else {
okGroups.append("<li>");
okGroups.append(groupName);
okGroups.append("</li>");
// do logging
ThreadLocalUserActivityLogger.log(GroupLoggingAction.BG_GROUP_COPIED, getClass(),
LoggingResourceable.wrap(originalGroup), LoggingResourceable.wrap(newGroup));
}
}
if (nokGroups.length() > 0) {
String warning = translate("bgcopywizard.multiple.groupnames.douplicates", new String[] { okGroups.toString(),
nokGroups.toString() });
getWindowControl().setWarning(warning);
}
// in all cases quit workflow
fireEvent(ureq, Event.DONE_EVENT);
}
}
}
private BusinessGroup doCopyGroup(String newGroupName, Integer max) {
// reload original group to prevent context proxy problems
originalGroup = businessGroupService.loadBusinessGroup(originalGroup);
BusinessGroup newGroup = businessGroupService.copyBusinessGroup(getIdentity(), originalGroup, newGroupName, originalGroup.getDescription(),
null, max,
copyForm.isCopyAreas(), copyForm.isCopyTools(), copyForm.isCopyRights(), copyForm.isCopyOwners(),
copyForm.isCopyParticipants(), copyForm.isCopyMembersVisibility(), copyForm.isCopyWaitingList(),
true /*copy relations*/);
return newGroup;
}
}
......@@ -103,16 +103,16 @@ public class WizardCloseCourseController extends WizardController implements Wiz
this.repositoryEntry = repositoryEntry;
businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class);
this.mainVc = createVelocityContainer("wizard");
this.panel = new Panel("panel");
mainVc = createVelocityContainer("wizard");
panel = new Panel("panel");
}
public void startWorkflow() {
buildStep1();
mainVc.put("panel", panel);
this.setWizardTitle(translate("wizard.closecourse.title"));
this.setNextWizardStep(translate("close.ressource.step1"), mainVc);
setWizardTitle(translate("wizard.closecourse.title"));
setNextWizardStep(translate("close.ressource.step1"), mainVc);
}
/**
......@@ -178,7 +178,7 @@ public class WizardCloseCourseController extends WizardController implements Wiz
//forward to step 2
if ( source == nextStep1 ) {
buildStep2(ureq);
this.setNextWizardStep(translate("close.ressource.step2"), mainVc);
setNextWizardStep(translate("close.ressource.step2"), mainVc);
}
}
......@@ -200,7 +200,8 @@ public class WizardCloseCourseController extends WizardController implements Wiz
ccIdentities = null;
}
//fxdiff VCRP-16: intern mail system
MailContext context = new MailContextImpl(wControl.getBusinessControl().getAsString());
String businessPath = getWindowControl().getBusinessControl().getAsString();
MailContext context = new MailContextImpl(businessPath);
MailerResult mailerResult = MailerWithTemplate.getInstance().sendMailAsSeparateMails(context, ownerList, ccIdentities,
mailNotificationCtr.getMailTemplate(), ureq.getIdentity());
StringBuilder errorMessage = new StringBuilder();
......
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