Search in sources :

Example 91 with ContextEntry

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

the class StudentCoursesController method openHome.

private void openHome(UserRequest ureq) {
    List<ContextEntry> ces = new ArrayList<ContextEntry>(4);
    ces.add(BusinessControlFactory.getInstance().createContextEntry(student));
    BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(ces);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
    NewControllerFactory.getInstance().launch(ureq, bwControl);
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) ArrayList(java.util.ArrayList) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 92 with ContextEntry

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

the class DocumentPoolMainController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (taxonomyTree.getTreeModel().getRootNode().getChildCount() > 0) {
            doSelectTaxonomy(ureq);
        }
    } else {
        String resourceName = entries.get(0).getOLATResourceable().getResourceableTypeName();
        if ("Templates".equals(resourceName) || resourceName.startsWith("path=")) {
            TreeNode rootNode = taxonomyTree.getTreeModel().getRootNode();
            if (rootNode.getChildCount() > 0) {
                TaxonomyTreeNode node = (TaxonomyTreeNode) rootNode.getChildAt(0);
                if (node.getType() == TaxonomyTreeNodeType.templates) {
                    DocumentDirectoryController directoryCtrl = doSelectTemplatesDirectory(ureq, node);
                    if (directoryCtrl != null) {
                        taxonomyTree.setSelectedNode(node);
                        List<ContextEntry> subEntries = entries.subList(1, entries.size());
                        directoryCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
                    }
                }
            }
        } else if ("TaxonomyLevel".equalsIgnoreCase(resourceName)) {
            String levelKey = entries.get(0).getOLATResourceable().getResourceableId().toString();
            TaxonomyTreeNode node = (TaxonomyTreeNode) taxonomyTree.getTreeModel().getNodeById(levelKey);
            if (node != null) {
                DocumentPoolLevelController levelCtrl = doSelectTaxonomyLevel(ureq, node);
                if (levelCtrl != null) {
                    taxonomyTree.setSelectedNode(node);
                    List<ContextEntry> subEntries = entries.subList(1, entries.size());
                    levelCtrl.activate(ureq, subEntries, entries.get(0).getTransientState());
                }
            }
        }
    }
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyTreeNode(org.olat.modules.taxonomy.model.TaxonomyTreeNode) TaxonomyTreeNode(org.olat.modules.taxonomy.model.TaxonomyTreeNode) List(java.util.List) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 93 with ContextEntry

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

the class CourseController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry ce = entries.get(0);
    OLATResourceable ores = ce.getOLATResourceable();
    if ("Identity".equals(ores.getResourceableTypeName())) {
        Long identityKey = ores.getResourceableId();
        for (EfficiencyStatementEntry entry : model.getObjects()) {
            if (identityKey.equals(entry.getIdentityKey())) {
                doSelectDetails(ureq, entry);
                statementCtrl.activate(ureq, entries.subList(1, entries.size()), ce.getTransientState());
                break;
            }
        }
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) EfficiencyStatementEntry(org.olat.modules.coach.model.EfficiencyStatementEntry) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 94 with ContextEntry

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

the class LecturesToolController 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 ("coach".equalsIgnoreCase(type)) {
        if (segmentView != null) {
            segmentView.select(teacherLink);
        }
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        doOpenTeacherView(ureq).activate(ureq, subEntries, entry.getTransientState());
    } else if ("attendee".equalsIgnoreCase(type)) {
        if (segmentView != null) {
            segmentView.select(participantLink);
        }
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        doOpenParticipantView(ureq).activate(ureq, subEntries, entry.getTransientState());
    }
}
Also used : List(java.util.List) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 95 with ContextEntry

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

the class BaseFullWebappController method updateBusinessPath.

private String updateBusinessPath(UserRequest ureq, SiteInstance site) {
    if (site == null)
        return null;
    try {
        String businessPath = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getAsString();
        HistoryPoint point = ureq.getUserSession().getLastHistoryPoint();
        int index = businessPath.indexOf(':');
        if (index > 0 && point != null && point.getBusinessPath() != null) {
            String start = businessPath.substring(0, index);
            if (!point.getBusinessPath().startsWith(start)) {
                // if a controller has not set its business path, don't pollute the mapping
                List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
                siteToBusinessPath.put(site, new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
                return BusinessControlFactory.getInstance().getAsRestPart(entries, true);
            }
            List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
            businessPath = BusinessControlFactory.getInstance().getAsRestPart(entries, true);
        }
        siteToBusinessPath.put(site, point);
        return businessPath;
    } catch (Exception e) {
        logError("", e);
        return null;
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) AssertException(org.olat.core.logging.AssertException)

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