use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.
the class TranslationToolLauncherController method event.
/*
* (non-Javadoc)
*
* @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 == startTranslationToolLink) {
// wrap the content controller into a full header layout
ControllerCreator controllerCreator = new ControllerCreator() {
@Override
public Controller createController(UserRequest uureq, WindowControl wControl) {
return new TranslationToolMainController(uureq, wControl, !i18nModule.isTransToolEnabled());
}
};
// no need for later disposal, opens in popup window and will be disposed
// by window manager
ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, controllerCreator);
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq);
} else if (source == enableInlineTranslationLink) {
setNewInlineStatus(ureq, true);
} else if (source == disableInlineTranslationLink) {
setNewInlineStatus(ureq, false);
} else if (source == cacheFlushLink) {
// clear i18n cache
i18nModule.reInitializeAndFlushCache();
showInfo("cache.flush.ok");
}
}
use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.
the class StepsMainRunController method event.
@Override
protected /*
* (non-Javadoc)
*
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
void event(final UserRequest ureq, Controller source, Event event) {
/*
* FIXME:pb:
*/
if (source == stepPagesController.peek()) {
if (event == StepsEvent.ACTIVATE_NEXT && !finishCycle) {
// intermediate steps wants to proceed - and next link was clicked
lastEvent = event;
doAfterDispatch = true;
// activate next event on source
Step current = steps.peek();
// TODO:pb detach previous from "submit" cycle
nextStep = current.nextStep();
if (nextStep == Step.NOSTEP) {
// next but no more step -> finish
finishWizard(ureq);
} else {
nextChildCreator = new ControllerCreator() {
private final UserRequest ureqForAfterDispatch = ureq;
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
// taken
return nextStep.getStepController(ureqForAfterDispatch, lwControl, stepsContext, mainForm);
}
};
}
// creation of controller and setting the controller is deferred to
// the afterDispatch Cycle
//
} else if (event == StepsEvent.ACTIVATE_NEXT && finishCycle) {
// intermediate step wants to proceed - but finish link was clicked
// this means current step validated and we are ready to terminate
// the wizard.
finishWizard(ureq);
} else if (event == StepsEvent.INFORM_FINISHED) {
// finish link was clicked -> step form controller has valid data ->
// fires
// FINISH EVENT
// all relevant data for finishing the wizards work must now be
// present in the stepsContext
finishWizard(ureq);
}
}
}
use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.
the class STCourseNode method createNodeRunConstructionResult.
/**
* @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.WindowControl,
* org.olat.course.run.userview.UserCourseEnvironment,
* org.olat.course.run.userview.NodeEvaluation)
*/
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, final UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
Controller cont;
String displayType = getModuleConfiguration().getStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE);
String relPath = STCourseNodeEditController.getFileName(getModuleConfiguration());
if (relPath != null && displayType.equals(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE)) {
// we want a user chosen overview, so display the chosen file from the
// material folder, otherwise display the normal overview
// reuse the Run controller from the "Single Page" building block, since
// we need to do exactly the same task
Boolean allowRelativeLinks = getModuleConfiguration().getBooleanEntry(STCourseNodeEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS);
if (allowRelativeLinks == null) {
allowRelativeLinks = Boolean.FALSE;
}
DeliveryOptions deliveryOptions = (DeliveryOptions) getModuleConfiguration().get(SPEditController.CONFIG_KEY_DELIVERYOPTIONS);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseModule.class, userCourseEnv.getCourseEnvironment().getCourseResourceableId());
SinglePageController spCtr = new SinglePageController(ureq, wControl, userCourseEnv.getCourseEnvironment().getCourseFolderContainer(), relPath, allowRelativeLinks.booleanValue(), null, ores, deliveryOptions, userCourseEnv.getCourseEnvironment().isPreview());
// check if user is allowed to edit the page in the run view
CourseGroupManager cgm = userCourseEnv.getCourseEnvironment().getCourseGroupManager();
boolean hasEditRights = (cgm.isIdentityCourseAdministrator(ureq.getIdentity()) || cgm.hasRight(ureq.getIdentity(), CourseRights.RIGHT_COURSEEDITOR)) || (getModuleConfiguration().getBooleanSafe(SPEditController.CONFIG_KEY_ALLOW_COACH_EDIT, false) && cgm.isIdentityCourseCoach(ureq.getIdentity()));
if (hasEditRights) {
spCtr.allowPageEditing();
// set the link tree model to internal for the HTML editor
CustomLinkTreeModel linkTreeModel = new CourseInternalLinkTreeModel(userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode());
spCtr.setInternalLinkTreeModel(linkTreeModel);
}
spCtr.addLoggingResourceable(LoggingResourceable.wrap(this));
// create clone wrapper layout, allow popping into second window
CloneLayoutControllerCreatorCallback clccc = new CloneLayoutControllerCreatorCallback() {
@Override
public ControllerCreator createLayoutControllerCreator(final UserRequest uureq, final ControllerCreator contentControllerCreator) {
return BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(uureq, new ControllerCreator() {
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
// wrap in column layout, popup window needs a layout controller
Controller ctr = contentControllerCreator.createController(lureq, lwControl);
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), userCourseEnv.getCourseEnvironment()));
Controller wrappedCtrl = TitledWrapperHelper.getWrapper(lureq, lwControl, ctr, STCourseNode.this, ICON_CSS_CLASS);
layoutCtr.addDisposableChildController(wrappedCtrl);
return layoutCtr;
}
});
}
};
Controller wrappedCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, spCtr, this, ICON_CSS_CLASS);
if (wrappedCtrl instanceof CloneableController) {
cont = new CloneController(ureq, wControl, (CloneableController) wrappedCtrl, clccc);
} else {
throw new AssertException("Need to be a cloneable");
}
} else {
// evaluate the score accounting for this node. this uses the score accountings local
// cache hash map to reduce unnecessary calculations
ScoreEvaluation se = userCourseEnv.getScoreAccounting().evalCourseNode(this);
cont = TitledWrapperHelper.getWrapper(ureq, wControl, new STCourseNodeRunController(ureq, wControl, userCourseEnv, this, se, ne), this, ICON_CSS_CLASS);
}
// displayed in the ST-Runcontroller
return new NodeRunConstructionResult(cont);
}
use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.
the class CourseRuntimeController method launchCalendar.
private void launchCalendar(UserRequest ureq) {
ControllerCreator ctrlCreator = new ControllerCreator() {
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(getRepositoryEntry());
WindowControl llwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, lwControl);
CourseCalendarController calendarController = new CourseCalendarController(lureq, llwControl, getUserCourseEnvironment());
// use a one-column main layout
LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, llwControl, calendarController);
layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), course.getCourseEnvironment()));
// dispose calendar on layout dispose
layoutCtr.addDisposableChildController(calendarController);
return layoutCtr;
}
};
// wrap the content controller into a full header layout
ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
// open in new browser window
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq);
}
use of org.olat.core.gui.control.creator.ControllerCreator in project openolat by klemens.
the class OlatDmzTopNavController method doImpressum.
private void doImpressum(UserRequest ureq) {
ControllerCreator impressumControllerCreator = new ControllerCreator() {
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new ImpressumDmzMainController(lureq, lwControl);
}
};
PopupBrowserWindow popupBrowserWindow = Windows.getWindows(ureq).getWindowManager().createNewUnauthenticatedPopupWindowFor(ureq, impressumControllerCreator);
popupBrowserWindow.open(ureq);
}
Aggregations