use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class HomeMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
String navKey = entry.getOLATResourceable().getResourceableTypeName();
if ("HomeSite".equals(navKey)) {
entries = entries.subList(1, entries.size());
if (entries.size() > 0) {
entry = entries.get(0);
navKey = entry.getOLATResourceable().getResourceableTypeName();
}
}
if (navKey.equals(currentNavKey) && currentCtr instanceof ReusableHomeController) {
if (currentCtr instanceof Activateable2) {
((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
}
} else {
GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(HomeMainController.class.getName(), navKey);
if (gAE != null) {
currentNavKey = navKey;
stackPanel.popUpToRootController(ureq);
currentCtr = createController(gAE, ureq);
contentCtr = new LayoutMain3ColsController(ureq, getWindowControl(), currentCtr);
listenTo(contentCtr);
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
String actionText = gAE.getActionText(getLocale());
stackPanel.rootController(actionText, contentCtr);
if (currentCtr instanceof Activateable2) {
((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
}
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class CourseRuntimeController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
if (currentToolCtr != null) {
addToHistory(ureq, currentToolCtr);
} else {
Controller runtimeCtrl = getRuntimeController();
if (runtimeCtrl instanceof Activateable2) {
((Activateable2) runtimeCtrl).activate(ureq, entries, state);
} else {
addToHistory(ureq, runtimeCtrl);
}
}
return;
}
entries = removeRepositoryEntry(entries);
if (entries != null && entries.size() > 0) {
String type = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Payment".equalsIgnoreCase(type)) {
doPostSuccessfullAccess(ureq);
} else if ("Editor".equalsIgnoreCase(type)) {
if (!isInEditor() && !RepositoryEntryManagedFlag.isManaged(getRepositoryEntry(), RepositoryEntryManagedFlag.editcontent)) {
doEdit(ureq);
}
} else if ("Catalog".equalsIgnoreCase(type)) {
doCatalog(ureq);
} else if ("Infos".equalsIgnoreCase(type)) {
doDetails(ureq);
} else if ("EditDescription".equalsIgnoreCase(type) || "Settings".equalsIgnoreCase(type)) {
doEditSettings(ureq);
} else if ("Settings".equalsIgnoreCase(type)) {
doOptions(ureq);
} else if ("CertificationSettings".equalsIgnoreCase(type)) {
doCertificatesOptions(ureq);
} else if ("Certification".equalsIgnoreCase(type)) {
doEfficiencyStatements(ureq);
} else if ("Reminders".equalsIgnoreCase(type) || "RemindersLogs".equalsIgnoreCase(type)) {
doReminders(ureq);
} else if ("Lectures".equalsIgnoreCase(type)) {
Activateable2 lectures = doLectures(ureq);
if (lectures != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
lectures.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} else if ("LectureBlock".equalsIgnoreCase(type)) {
Activateable2 lectures = doLectures(ureq);
if (lectures != null) {
lectures.activate(ureq, entries, state);
}
} else if ("LecturesAdmin".equalsIgnoreCase(type)) {
Activateable2 lecturesAdmin = doLecturesAdmin(ureq);
if (lecturesAdmin != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
lecturesAdmin.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} else if ("MembersMgmt".equalsIgnoreCase(type)) {
Activateable2 members = doMembers(ureq);
if (members != null) {
try {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
members.activate(ureq, subEntries, entries.get(0).getTransientState());
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if ("assessmentTool".equalsIgnoreCase(type) || "assessmentToolv2".equalsIgnoreCase(type)) {
// check the security before, the link is perhaps in the wrong hands
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
try {
Activateable2 assessmentCtrl = doAssessmentTool(ureq);
if (assessmentCtrl != null) {
List<ContextEntry> subEntries;
if (entries.size() > 1 && entries.get(1).getOLATResourceable().getResourceableTypeName().equals(type)) {
subEntries = entries.subList(2, entries.size());
} else {
subEntries = entries.subList(1, entries.size());
}
assessmentCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
}
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if ("TestStatistics".equalsIgnoreCase(type) || "SurveyStatistics".equalsIgnoreCase(type)) {
// check the security before, the link is perhaps in the wrong hands
if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
try {
Activateable2 assessmentCtrl = null;
if ("TestStatistics".equalsIgnoreCase(type)) {
assessmentCtrl = doAssessmentTestStatistics(ureq);
} else {
assessmentCtrl = doAssessmentSurveyStatistics(ureq);
}
List<ContextEntry> subEntries;
if (entries.size() > 1 && entries.get(1).getOLATResourceable().getResourceableTypeName().equals(type)) {
subEntries = entries.subList(2, entries.size());
} else {
subEntries = entries.subList(1, entries.size());
}
assessmentCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
} catch (OLATSecurityException e) {
// the wrong link to the wrong person
}
}
} else if (type != null && type.startsWith("path=")) {
if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) {
String path = BusinessControlFactory.getInstance().getPath(entries.get(0));
FolderRunController folderCtrl = doCourseFolder(ureq);
if (folderCtrl != null) {
folderCtrl.activatePath(ureq, path);
}
}
}
}
if (getRunMainController() != null) {
getRunMainController().activate(ureq, entries, state);
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class RunMainController method updateTreeAndContent.
private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
// might be used in both controllers with the same ID (e.g. the course folder)
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
contentP.setContent(msgController.getInitialComponent());
luTree.setTreeModel(new GenericTreeModel());
return null;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// get new run controller.
currentNodeController = nclr.getRunController();
addToHistory(ureq, currentNodeController);
if (currentNodeController instanceof TitledWrapperController) {
Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
addToHistory(ureq, contentcontroller);
if (contentcontroller instanceof Activateable2) {
((Activateable2) contentcontroller).activate(ureq, entries, state);
}
} else if (currentNodeController instanceof Activateable2) {
((Activateable2) currentNodeController).activate(ureq, entries, state);
}
if (currentNodeController != null) {
contentP.setContent(currentNodeController.getInitialComponent());
} else {
MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
listenTo(msgCtrl);
contentP.setContent(msgCtrl.getInitialComponent());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
updateLastUsage(nclr.getCalledCourseNode());
return nclr.getCalledCourseNode();
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class SharedBindersController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
SharedItemRow row = model.getObject(se.getIndex());
if ("select".equals(cmd)) {
Activateable2 activeateable = doSelectBinder(ureq, row);
if (activeateable != null) {
activeateable.activate(ureq, null, null);
}
} else if ("leave".equals(cmd)) {
doConfirmLeaveBinder(ureq, row);
}
} else if (event instanceof FlexiTableSearchEvent) {
FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
loadModel(se.getSearch());
} else if ("ONCLICK".equals(event.getCommand())) {
String row = ureq.getParameter("select-section");
String expand = ureq.getParameter("expand-section");
if (StringHelper.isLong(row)) {
doSelectSection(ureq);
} else if (StringHelper.containsNonWhitespace(expand)) {
doExpandSections(ureq);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class UserAdminMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
GenericTreeModel tm = (GenericTreeModel) olatMenuTree.getTreeModel();
ContextEntry entry = entries.get(0);
String entryPoint = entry.getOLATResourceable().getResourceableTypeName();
if (entryPoint.startsWith("notifications") || entryPoint.startsWith("NewIdentityCreated")) {
TreeNode node = tm.findNodeByUserObject("created.newUsersNotification");
selectNode(ureq, node);
} else if (entryPoint.startsWith("AE")) {
TreeNode node = tm.findNodeByUserObject("menuqueries");
int pos = entries.get(0).getOLATResourceable().getResourceableId().intValue();
if (pos >= 0 && pos < node.getChildCount()) {
TreeNode childNode = (TreeNode) node.getChildAt(pos);
selectNode(ureq, childNode);
}
} else {
TreeNode node = tm.findNodeByUserObject(entryPoint);
if (node != null) {
selectNode(ureq, node);
entries = entries.subList(1, entries.size());
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
if (!entries.isEmpty() && userAdminCtr != null) {
userAdminCtr.activate(ureq, entries, null);
}
}
}
}
Aggregations