use of org.olat.course.run.navigation.NodeRunConstructionResult in project OpenOLAT by OpenOLAT.
the class IQSURVCourseNode 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, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
Controller controller;
// Do not allow guests to start questionnaires
Roles roles = ureq.getUserSession().getRoles();
if (roles.isGuestOnly()) {
Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
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 trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
} else {
RepositoryEntry repositoryEntry = getReferencedRepositoryEntry();
OLATResourceable ores = repositoryEntry.getOlatResource();
Long resId = ores.getResourceableId();
SurveyFileResource fr = new SurveyFileResource();
fr.overrideResourceableId(resId);
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);
} else {
Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
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_iqsurv_icon");
return new NodeRunConstructionResult(ctrl);
}
use of org.olat.course.run.navigation.NodeRunConstructionResult in project OpenOLAT by OpenOLAT.
the class BCCourseNode 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, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
BCCourseNodeRunController bcCtrl = new BCCourseNodeRunController(ureq, wControl, userCourseEnv, this, ne);
if (StringHelper.containsNonWhitespace(nodecmd)) {
bcCtrl.activatePath(ureq, nodecmd);
}
Controller titledCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, bcCtrl, this, "o_bc_icon");
return new NodeRunConstructionResult(titledCtrl);
}
use of org.olat.course.run.navigation.NodeRunConstructionResult in project OpenOLAT by OpenOLAT.
the class BlogCourseNode method createNodeRunConstructionResult.
/**
* @see org.olat.course.nodes.AbstractAccessableCourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.WindowControl,
* org.olat.course.run.userview.UserCourseEnvironment,
* org.olat.course.run.userview.NodeEvaluation, java.lang.String)
*/
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
RepositoryEntry entry = getReferencedRepositoryEntry();
// create business path courseID:nodeID
// userCourseEnv.getCourseEnvironment().getCourseResourceableId();
// getIdent();
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
String nodeId = this.getIdent();
boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
FeedSecurityCallback callback;
if (userCourseEnv.isCourseReadOnly()) {
callback = new FeedReadOnlySecurityCallback();
} else {
callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
}
SubscriptionContext subsContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
callback.setSubscriptionContext(subsContext);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
FeedMainController blogCtr = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId);
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(nodecmd);
blogCtr.activate(ureq, entries, null);
Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, blogCtr, this, "o_blog_icon");
NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
return result;
}
use of org.olat.course.run.navigation.NodeRunConstructionResult in project OpenOLAT by OpenOLAT.
the class CheckListCourseNode 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 ctrl;
OLATResourceable ores = OresHelper.createOLATResourceableInstance("CourseModule", userCourseEnv.getCourseEnvironment().getCourseResourceableId());
Roles roles = ureq.getUserSession().getRoles();
if (roles.isGuestOnly()) {
Translator trans = Util.createPackageTranslator(CheckListCourseNode.class, ureq.getLocale());
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
ctrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else if (userCourseEnv.isCoach() || userCourseEnv.isAdmin()) {
ctrl = new CheckListRunForCoachController(ureq, wControl, userCourseEnv, ores, this);
} else {
ctrl = new CheckListRunController(ureq, wControl, userCourseEnv, ores, this);
}
Controller cont = TitledWrapperHelper.getWrapper(ureq, wControl, ctrl, this, ICON_CSS_CLASS);
return new NodeRunConstructionResult(cont);
}
use of org.olat.course.run.navigation.NodeRunConstructionResult in project OpenOLAT by OpenOLAT.
the class BasicLTICourseNode 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, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
updateModuleConfigDefaults(false);
Controller runCtrl;
if (userCourseEnv.isCourseReadOnly()) {
Translator trans = Util.createPackageTranslator(BasicLTICourseNode.class, ureq.getLocale());
String title = trans.translate("freezenoaccess.title");
String message = trans.translate("freezenoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else {
Roles roles = ureq.getUserSession().getRoles();
if (roles.isGuestOnly()) {
if (isGuestAllowed()) {
Translator trans = Util.createPackageTranslator(BasicLTICourseNode.class, ureq.getLocale());
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else {
runCtrl = new LTIRunController(wControl, getModuleConfiguration(), ureq, this, userCourseEnv);
}
} else {
runCtrl = new LTIRunController(wControl, getModuleConfiguration(), ureq, this, userCourseEnv);
}
}
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runCtrl, this, "o_lti_icon");
return new NodeRunConstructionResult(ctrl);
}
Aggregations