use of org.olat.core.id.context.StateSite in project openolat by klemens.
the class MyCoursesSite method createController.
@Override
protected Controller createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(MyCoursesSite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
return new OverviewRepositoryListController(ureq, bwControl);
}
use of org.olat.core.id.context.StateSite in project openolat by klemens.
the class RepositorySite method createController.
@Override
protected Controller createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(RepositorySite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
return new OverviewAuthoringController(ureq, bwControl);
}
use of org.olat.core.id.context.StateSite in project openolat by klemens.
the class DocumentPoolSite method createController.
@Override
protected MainLayoutController createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(DocumentPoolSite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
return new DocumentPoolMainController(ureq, bwControl);
}
use of org.olat.core.id.context.StateSite in project openolat by klemens.
the class CourseSite method createController.
@Override
protected MainLayoutController createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
RepositoryManager rm = RepositoryManager.getInstance();
RepositoryService rs = CoreSpringFactory.getImpl(RepositoryService.class);
RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
if (entry == null) {
return getAlternativeController(ureq, wControl, config);
}
MainLayoutController c;
ICourse course = CourseFactory.loadCourse(entry);
UserSession usess = ureq.getUserSession();
// course-launch-state depending course-settings
RepositoryEntrySecurity reSecurity = rm.isAllowed(ureq, entry);
boolean isAllowedToLaunch = reSecurity.canLaunch();
boolean hasAccess = false;
if (isAllowedToLaunch) {
// either check with securityCallback or use access-settings from course-nodes
if (siteSecCallback != null) {
hasAccess = siteSecCallback.isAllowedToLaunchSite(ureq);
} else if (usess.isInAssessmentModeProcess() && !usess.matchLockResource(course)) {
hasAccess = false;
} else {
// check within course: accessibility of course root node
CourseNode rootNode = course.getRunStructure().getRootNode();
UserCourseEnvironmentImpl uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment());
NodeEvaluation nodeEval = rootNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
boolean mayAccessWholeTreeUp = NavigationHandler.mayAccessWholeTreeUp(nodeEval);
hasAccess = mayAccessWholeTreeUp && nodeEval.isVisible();
}
}
// load course (admins always see content) or alternative controller if course is not launchable
if (hasAccess || usess.getRoles().isOLATAdmin()) {
rs.incrementLaunchCounter(entry);
// build up the context path for linked course
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, entry, new StateSite(this), wControl, true);
CourseRuntimeController runCtr = new CourseRuntimeController(ureq, bwControl, entry, reSecurity, new RuntimeControllerCreator() {
@Override
public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry re, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
return new RunMainController(uureq, wwControl, toolbarPanel, CourseFactory.loadCourse(re), re, security, assessmentMode);
}
}, false, true);
// Configure run controller
// a: don't show close link, is opened as site not tab
runCtr.setCourseCloseEnabled(false);
// b: don't show toolbar
if (!showToolController) {
runCtr.setToolControllerEnabled(false);
}
c = runCtr;
} else {
// access restricted (not in group / author) -> show controller
// defined in olat_extensions (type autoCreator)
c = getAlternativeController(ureq, wControl, config);
}
return c;
}
use of org.olat.core.id.context.StateSite in project openolat by klemens.
the class HomeSite method createController.
@Override
protected MainLayoutController createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(HomeSite.class, ureq.getIdentity().getKey());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
return new HomeMainController(ureq, bwControl);
}
Aggregations