Search in sources :

Example 41 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeManagerController 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 type = entry.getOLATResourceable().getResourceableTypeName();
    if ("CatalogEntry".equalsIgnoreCase(type)) {
        Long entryKey = entry.getOLATResourceable().getResourceableId();
        if (entryKey != null && entryKey.longValue() > 0) {
            activateRoot(ureq, entryKey);
        }
    } else if ("Node".equalsIgnoreCase(type)) {
        // the "Node" is only for internal usage
        StateEntry stateEntry = entry.getTransientState();
        if (stateEntry instanceof CatalogStateEntry) {
            CatalogEntry catEntry = ((CatalogStateEntry) stateEntry).getEntry();
            CatalogNodeManagerController nextCtrl = selectCatalogEntry(ureq, catEntry);
            if (nextCtrl != null && entries.size() > 1) {
                nextCtrl.activate(ureq, entries.subList(1, entries.size()), null);
            }
        }
    }
}
Also used : StateEntry(org.olat.core.id.context.StateEntry) CatalogEntry(org.olat.repository.CatalogEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 42 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeManagerController method activateRoot.

/**
 * Build an internal business path made of "Node" with the category
 * as state entry to prevent loading several times the same entries.
 *
 * @param ureq
 * @param entryKey
 */
private void activateRoot(UserRequest ureq, Long entryKey) {
    List<ContextEntry> parentLine = new ArrayList<>();
    for (CatalogEntry node = catalogManager.getCatalogEntryByKey(entryKey); node.getParent() != null; node = node.getParent()) {
        OLATResourceable nodeRes = OresHelper.createOLATResourceableInstance("Node", node.getKey());
        ContextEntry ctxEntry = BusinessControlFactory.getInstance().createContextEntry(nodeRes);
        ctxEntry.setTransientState(new CatalogStateEntry(node));
        parentLine.add(ctxEntry);
    }
    Collections.reverse(parentLine);
    activate(ureq, parentLine, null);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) CatalogEntry(org.olat.repository.CatalogEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 43 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeController method activateRoot.

/**
 * Build an internal business path made of "Node" with the category
 * as state entry to prevent loading several times the same entries.
 *
 * @param ureq
 * @param entryKey
 */
private void activateRoot(UserRequest ureq, Long entryKey) {
    List<ContextEntry> parentLine = new ArrayList<>();
    for (CatalogEntry node = catalogManager.getCatalogEntryByKey(entryKey); node != null && node.getParent() != null; node = node.getParent()) {
        OLATResourceable nodeRes = OresHelper.createOLATResourceableInstance("Node", node.getKey());
        ContextEntry ctxEntry = BusinessControlFactory.getInstance().createContextEntry(nodeRes);
        ctxEntry.setTransientState(new CatalogStateEntry(node));
        parentLine.add(ctxEntry);
    }
    Collections.reverse(parentLine);
    activate(ureq, parentLine, null);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) CatalogEntry(org.olat.repository.CatalogEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 44 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeController 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 type = entry.getOLATResourceable().getResourceableTypeName();
    if ("CatalogEntry".equalsIgnoreCase(type)) {
        Long entryKey = entry.getOLATResourceable().getResourceableId();
        if (entryKey != null && entryKey.longValue() > 0) {
            activateRoot(ureq, entryKey);
        }
    } else if ("Node".equalsIgnoreCase(type)) {
        // the "Node" is only for internal usage
        StateEntry stateEntry = entry.getTransientState();
        if (stateEntry instanceof CatalogStateEntry) {
            CatalogEntry catalogEntry = ((CatalogStateEntry) stateEntry).getEntry();
            CatalogNodeController nextCtrl = selectCatalogEntry(ureq, catalogEntry);
            if (nextCtrl != null && entries.size() > 1) {
                nextCtrl.activate(ureq, entries.subList(1, entries.size()), null);
            }
        }
    }
}
Also used : StateEntry(org.olat.core.id.context.StateEntry) CatalogEntry(org.olat.repository.CatalogEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 45 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

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);
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) OLATSecurityException(org.olat.core.logging.OLATSecurityException) List(java.util.List) LeavingStatusList(org.olat.repository.LeavingStatusList) StatisticCourseNodesController(org.olat.course.statistic.StatisticCourseNodesController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) StatisticMainController(org.olat.course.statistic.StatisticMainController) CustomDBMainController(org.olat.course.db.CustomDBMainController) SearchInputController(org.olat.search.ui.SearchInputController) LectureRepositoryAdminController(org.olat.modules.lecture.ui.LectureRepositoryAdminController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) MembersManagementMainController(org.olat.course.member.MembersManagementMainController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) GlossaryMainController(org.olat.core.commons.modules.glossary.GlossaryMainController) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) AssessmentToolController(org.olat.course.assessment.ui.tool.AssessmentToolController) TeacherOverviewController(org.olat.modules.lecture.ui.TeacherOverviewController) CourseAreasController(org.olat.course.area.CourseAreasController) CourseOptionsController(org.olat.course.config.ui.CourseOptionsController) EditorMainController(org.olat.course.editor.EditorMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) CertificatesOptionsController(org.olat.course.certificate.ui.CertificatesOptionsController) CourseGlossaryToolLinkController(org.olat.course.run.glossary.CourseGlossaryToolLinkController) NoteController(org.olat.note.NoteController) ChiefController(org.olat.core.gui.control.ChiefController) ArchiverMainController(org.olat.course.archiver.ArchiverMainController) AssessmentModeListController(org.olat.course.assessment.ui.mode.AssessmentModeListController) CourseCalendarController(org.olat.course.run.calendar.CourseCalendarController) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) RepositoryEntryLifeCycleChangeController(org.olat.repository.ui.RepositoryEntryLifeCycleChangeController) CourseRemindersController(org.olat.course.reminder.ui.CourseRemindersController) Controller(org.olat.core.gui.control.Controller) CourseLayoutGeneratorController(org.olat.course.config.ui.courselayout.CourseLayoutGeneratorController) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

ContextEntry (org.olat.core.id.context.ContextEntry)270 OLATResourceable (org.olat.core.id.OLATResourceable)78 WindowControl (org.olat.core.gui.control.WindowControl)58 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)44 ArrayList (java.util.ArrayList)42 TreeNode (org.olat.core.gui.components.tree.TreeNode)30 Controller (org.olat.core.gui.control.Controller)26 RepositoryEntry (org.olat.repository.RepositoryEntry)24 List (java.util.List)22 Identity (org.olat.core.id.Identity)22 BusinessControl (org.olat.core.id.context.BusinessControl)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)18 HistoryPoint (org.olat.core.id.context.HistoryPoint)18 CollaborationTools (org.olat.collaboration.CollaborationTools)16 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)14 UserSession (org.olat.core.util.UserSession)14 CourseNode (org.olat.course.nodes.CourseNode)14 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)12 Translator (org.olat.core.gui.translator.Translator)12