this.courseRepositoryEntry = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
this.offerBookmark = offerBookmark;
this.showCourseConfigLink = showCourseConfigLink;
this.courseRunOres = OresHelper.createOLATResourceableInstance(ORES_TYPE_COURSE_RUN, course.getResourceableId());
Identity identity = ureq.getIdentity();
// course and system logging
ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_ENTERING, getClass());
// log shows who entered which course, this can then be further used to jump
// to the courselog
Tracing.logAudit("Entering course: [[["+courseTitle+"]]]", course.getResourceableId().toString(), RunMainController.class);
// set up the components
all = new Panel("allofcourse");
luTree = new MenuTree("luTreeRun", this);
contentP = new Panel("building_block_content");
// get all group memberships for this course
initGroupMemberships(identity);
// Initialize the the users roles and right for this course
// 1) is guest flag
isGuest = ureq.getUserSession().getRoles().isGuestOnly();
// 2) all course internal rights
initUserRolesAndRights(identity);
// preload user assessment data in assessmnt properties cache to speed up
// course loading
course.getCourseEnvironment().getAssessmentManager().preloadCache(identity);
// build up the running structure for this user;
uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment());
// build score now
uce.getScoreAccounting().evaluateAll();
navHandler = new NavigationHandler(uce, false);
// jump to either the forum or the folder if the business-launch-path says
// so.
boolean showAssessmentTool = false;
BusinessControl bc = getWindowControl().getBusinessControl();
ContextEntry ce = bc.popLauncherContextEntry();
if (ce != null) {
logDebug("businesscontrol (for further jumps) would be:" + bc, null);
OLATResourceable ores = ce.getOLATResourceable();
logDebug("OLATResourceable=" + ores, null);
if (OresHelper.isOfType(ores, CourseNode.class)) {
// TODO, don't use CourseNode.class, but a lookup using the ClassToId
// class
// jump to the coursenode with id
Long nodeId = ores.getResourceableId();
String nodeIdS = nodeId.toString();
currentCourseNode = course.getRunStructure().getNode(nodeIdS);
if (currentCourseNode == null) {
// (e.g. a coursenode that no longer is accessible or existing)
// -> fallback to root node (automatically done later), and drop wrong
// remaining contexts
logDebug("currentCourseNode=null => dropLauncherEntries for nodeIdS=" + nodeIdS, null);
bc.dropLauncherEntries();
}
} else if ("assessmentTool".equals(ores.getResourceableTypeName())) {
showAssessmentTool = true;
}
}
/*
* ContextEntry curCe = bc.getCurrentEntryAndAdvance(); if (curCe != null) { //
* e.g something like FOCourseNode:3243 or AssementTool:0 or AssmentTool:1
* (0,1 must be dokumented) OLATResourceable ores =
* curCe.getOLATResourceable(); if (OresHelper.isOfType(ores,
* CourseNode.class)) { // TODO, don't use CourseNode.class, but a lookup
* using the ClassToId class // jump to the coursenode with id Long nodeId =
* ores.getResourceableId(); String nodeIdS = nodeId.toString();
* currentCourseNode = course.getRunStructure().getNode(nodeIdS); } else {
* //TODO assessment tool } }
*/
String subsubId = null;
String assessmentViewIdentifier = null;
// activate assessent tool or node as the first screen
if (initialViewIdentifier != null) {
if (initialViewIdentifier.equals("assessmentTool")) {
showAssessmentTool = true;
// assessmentViewIdentifier must be null
} else if (initialViewIdentifier.equals("assessmentTool:nodeChoose")) {
showAssessmentTool = true;
assessmentViewIdentifier = "node-choose";
} else {
// check for subsubIdent
if (initialViewIdentifier.indexOf(":") != -1) {
String[] viewIdentifier = initialViewIdentifier.split(":");
currentCourseNode = course.getRunStructure().getNode(viewIdentifier[0]);
subsubId = viewIdentifier[1];
} else {
currentCourseNode = course.getRunStructure().getNode(initialViewIdentifier);
}
}
}
updateTreeAndContent(ureq, currentCourseNode, subsubId);
if (courseRepositoryEntry != null && RepositoryManager.getInstance().createRepositoryEntryStatus(courseRepositoryEntry.getStatusCode()).isClosed()) {
wControl.setWarning(translate("course.closed"));
}
// instant messaging: send presence like "reading course: Biology I" as
// awareness info. Important: do this before initializing the toolbox
// controller!
if (InstantMessagingModule.isEnabled() && CourseModule.isCourseChatEnabled() && !isGuest) {
String intro = translate("course.presence.message.enter") + " " + getExtendedCourseTitle(ureq.getLocale());
InstantMessagingModule.getAdapter().sendStatus(identity.getName(), intro);
if (course.getCourseEnvironment().getCourseConfig().isChatEnabled()) {
// create groupchat room link only if course chat is enabled
createCourseGroupChatLink(ureq);
}