private ToolController initToolController(Identity identity, UserRequest ureq) {
// guest never have a tool controller
if (isGuest) return null;
ToolController myTool = ToolFactory.createToolController(getWindowControl());
CourseConfig cc = uce.getCourseEnvironment().getCourseConfig();
// 1) administrative tools
if (isCourseAdmin || isCourseCoach || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)
|| hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || hasCourseRight(CourseRights.RIGHT_ARCHIVING)
|| hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
myTool.addHeader(translate("header.tools"));
if (hasCourseRight(CourseRights.RIGHT_COURSEEDITOR) || isCourseAdmin) {
myTool.addLink(COMMAND_EDIT, translate("command.openeditor"));
}
if (hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || isCourseAdmin) {
myTool.addLink("groupmngt", translate("command.opengroupmngt"));
}
if (isCourseAdmin) {
myTool.addLink("rightmngt", translate("command.openrightmngt"));
}
if (hasCourseRight(CourseRights.RIGHT_ARCHIVING) || isCourseAdmin) {
myTool.addLink("archiver", translate("command.openarchiver"));
}
if (hasCourseRight(CourseRights.RIGHT_ASSESSMENT) || isCourseCoach || isCourseAdmin) {
myTool.addLink("assessment", translate("command.openassessment"));
}
/*
* http://bugs.olat.org/jira/browse/OLAT-4928
*/
if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) {
myTool.addLink("statistic", translate("command.openstatistic"));
}
//
/*
* if (isCourseAdmin) { myTool.addLink(TOOLBOX_LINK_COURSECONFIG,
* translate("command.courseconfig")); }
*/
//
}
// 2) add coached groups
if (ownedGroups.size() > 0) {
myTool.addHeader(translate("header.tools.ownerGroups"));
Iterator iter = ownedGroups.iterator();
while (iter.hasNext()) {
BusinessGroup group = (BusinessGroup) iter.next();
myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
}
}
// 3) add participating groups
if (participatedGroups.size() > 0) {
myTool.addHeader(translate("header.tools.participatedGroups"));
Iterator iter = participatedGroups.iterator();
while (iter.hasNext()) {
BusinessGroup group = (BusinessGroup) iter.next();
myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
}
}
// 4) add right groups
if (rightGroups.size() > 0) {
myTool.addHeader(translate("header.tools.rightGroups"));
Iterator iter = rightGroups.iterator();
while (iter.hasNext()) {
BusinessGroup group = (BusinessGroup) iter.next();
myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
}
}
// 5) add waiting-list groups
if (waitingListGroups.size() > 0) {
myTool.addHeader(translate("header.tools.waitingListGroups"));
Iterator iter = waitingListGroups.iterator();
while (iter.hasNext()) {
BusinessGroup group = (BusinessGroup) iter.next();
BusinessGroupManager businessGroupManager = BusinessGroupManagerImpl.getInstance();
int pos = businessGroupManager.getPositionInWaitingListFor(identity, group);
myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName() + "(" + pos + ")", group
.getKey().toString(), null);
myTool.setEnabled(group.getKey().toString(), false);
}
}
// new toolbox 'general'
myTool.addHeader(translate("header.tools.general"));
if (cc.isCalendarEnabled()) {
myTool.addPopUpLink(ACTION_CALENDAR, translate("command.calendar"), null, null, "950", "750", false);
}
if (cc.hasGlossary()) {
myTool.addComponent(glossaryToolCtr.getInitialComponent());
}
if (showCourseConfigLink) {
myTool.addLink(TOOLBOX_LINK_COURSECONFIG, translate("command.courseconfig"));
}
myTool.addPopUpLink("personalnote", translate("command.personalnote"), null, null, "750", "550", false);
if (offerBookmark && !isGuest) {
myTool.addLink(ACTION_BOOKMARK, translate("command.bookmark"), TOOL_BOOKMARK, null);
BookmarkManager bm = BookmarkManager.getInstance();
if (bm.isResourceableBookmarked(identity, courseRepositoryEntry)) myTool.setEnabled(TOOL_BOOKMARK, false);
}
if (cc.isEfficencyStatementEnabled() && course.hasAssessableNodes()) {
// link to efficiency statements should
// - not appear when not configured in course configuration
// - not appear when configured in course configuration but no assessable
// node exist
// - appear but dimmed when configured, assessable node exist but no
// assessment data exists for user
// - appear as link when configured, assessable node exist and assessment
// data exists for user
myTool.addPopUpLink("efficiencystatement", translate("command.efficiencystatement"), "command.efficiencystatement", null,
"750", "800", false);
EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance();
EfficiencyStatement es = esm.getUserEfficiencyStatement(courseRepositoryEntry.getKey(), identity);
if (es == null) {
myTool.setEnabled("command.efficiencystatement", false);
}
}
//add group chat to toolbox
boolean instantMsgYes = InstantMessagingModule.isEnabled();
boolean chatIsEnabled = CourseModule.isCourseChatEnabled() && cc.isChatEnabled();
if (instantMsgYes && chatIsEnabled) {
// we add the course chat link controller to the toolbox
if (courseChatManagerCtr == null && ureq != null) createCourseGroupChatLink(ureq);
if (courseChatManagerCtr != null){
Controller groupChatController = courseChatManagerCtr.getGroupChatController(course);