use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method createNodeRunConstructionResult.
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
Controller controller;
// Do not allow guests to start tests
Roles roles = ureq.getUserSession().getRoles();
Translator trans = Util.createPackageTranslator(IQTESTCourseNode.class, ureq.getLocale());
if (roles.isGuestOnly()) {
if (isGuestAllowedForQTI21(getReferencedRepositoryEntry())) {
controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
} else {
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
}
} else {
ModuleConfiguration config = getModuleConfiguration();
boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
if (onyx) {
Translator transe = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", transe.translate("error.onyx"));
} else {
RepositoryEntry testEntry = getReferencedRepositoryEntry();
OLATResource ores = testEntry.getOlatResource();
if (ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName())) {
// QTI 2.1
controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
} else {
// QTI 1.2
TestFileResource fr = new TestFileResource();
fr.overrideResourceableId(ores.getResourceableId());
if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this, testEntry);
} else {
String title = trans.translate("editor.lock.title");
String message = trans.translate("editor.lock.message");
controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
}
}
}
}
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqtest_icon");
return new NodeRunConstructionResult(ctrl);
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class IQTESTCourseNode method createPreviewController.
/**
* @see org.olat.course.nodes.CourseNode#createPreviewController(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 Controller createPreviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
Controller controller;
ModuleConfiguration config = getModuleConfiguration();
boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
if (onyx) {
Translator trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
} else {
controller = new IQPreviewController(ureq, wControl, userCourseEnv, this);
}
return controller;
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class TUEditController 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)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == previewButton) {
// those must be links
Controller tunnelRunCtr;
if (config.getBooleanSafe(TUConfigForm.CONFIG_IFRAME)) {
tunnelRunCtr = new IframeTunnelController(ureq, getWindowControl(), config);
} else {
tunnelRunCtr = new TURunController(getWindowControl(), config, ureq, courseNode, PreviewConfigHelper.getPreviewCourseEnvironment(true, true, course));
}
if (previewLayoutCtr != null)
previewLayoutCtr.dispose();
// preview layout: only center column (col3) used
previewLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), tunnelRunCtr);
stackPanel.pushController(translate("preview"), previewLayoutCtr);
}
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class TURunController method doStartPage.
private void doStartPage(UserRequest ureq) {
Controller startPageInner = new TUStartController(ureq, getWindowControl(), config);
startPage = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), startPageInner, courseNode, "o_tu_icon");
listenTo(startPage);
main.setContent(startPage.getInitialComponent());
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class ProfileAndHomePageEditController method event.
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == segmentView) {
if (event instanceof SegmentViewEvent) {
SegmentViewEvent sve = (SegmentViewEvent) event;
String segmentCName = sve.getComponentName();
Component clickedLink = myContent.getComponent(segmentCName);
Controller selectedController = null;
if (clickedLink == profilLink) {
selectedController = doOpenProfile(ureq);
} else if (clickedLink == homePageLink) {
selectedController = doOpenHomePageSettings(ureq);
}
addToHistory(ureq, selectedController);
}
}
}
Aggregations