Search in sources :

Example 61 with ContextEntry

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

the class GenericMainController method activate.

protected void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry entry = entries.get(0);
    TreeNode selectedNode = getMenuTree().getSelectedNode();
    String node = entry.getOLATResourceable().getResourceableTypeName();
    if (node != null && node.startsWith(GMCMT)) {
        activate(ureq, node + ":" + entries.get(0).getOLATResourceable().getResourceableId());
        if (entries.size() >= 1) {
            entries = entries.subList(1, entries.size());
        }
        if (contentCtr instanceof Activateable2) {
            ((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
        }
    } else {
        // maybe the node is a GAE-NavigationKey ?
        GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(className, node);
        if (gAE != null) {
            // if the controller is already selected, only activate it, don't reinstanciate it
            if (selectedNode != null && selectedNode.getUserObject() != gAE) {
                activateTreeNodeByActionExtension(ureq, gAE);
            }
            if (entries.size() >= 1) {
                entries = entries.subList(1, entries.size());
            }
            if (contentCtr instanceof Activateable2) {
                ((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericActionExtension(org.olat.core.extensions.action.GenericActionExtension) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 62 with ContextEntry

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

the class AssessmentTestDisplayController method computeTestAssessmentResult.

private AssessmentResult computeTestAssessmentResult(Date requestTimestamp, AssessmentTestSession testSession) {
    List<ContextEntry> entries = getWindowControl().getBusinessControl().getEntries();
    OLATResourceable testSessionOres = OresHelper.createOLATResourceableInstance("TestSession", testSession.getKey());
    entries.add(BusinessControlFactory.getInstance().createContextEntry(testSessionOres));
    String url = BusinessControlFactory.getInstance().getAsAuthURIString(entries, true);
    URI sessionIdentifierSourceId = URI.create(url);
    String sessionIdentifier = "testsession/" + testSession.getKey();
    return testSessionController.computeAssessmentResult(requestTimestamp, sessionIdentifier, sessionIdentifierSourceId);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) URI(java.net.URI) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 63 with ContextEntry

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

the class BinderListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
        Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
        if (activateable != null) {
            List<ContextEntry> subEntries = entries.subList(1, entries.size());
            activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 64 with ContextEntry

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

the class QuestionListController 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 ("QuestionItem".equals(type)) {
        Long itemKey = entry.getOLATResourceable().getResourceableId();
        ItemRow row = getModel().getObjectByKey(itemKey);
        if (row == null) {
            getModel().load(null, null, null, 0, -1);
            row = getModel().getObjectByKey(itemKey);
            if (row != null) {
                doOpenDetails(ureq, row);
                int index = getModel().getObjects().indexOf(row);
                if (index >= 1 && getItemsTable().getPageSize() > 1) {
                    int page = index / getItemsTable().getPageSize();
                    getItemsTable().setPage(page);
                }
            }
        } else {
            doOpenDetails(ureq, row);
        }
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry)

Example 65 with ContextEntry

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

the class FeedViewHelper method getJumpInLink.

/**
 * @param feed
 *            the target feed for the jumpInLink
 * @param item
 *            the target item for the jumpInLink or null if not want to
 *            refer to a specific item
 * @return the jump in link
 */
public String getJumpInLink(Feed feed, Item item) {
    String jumpInLink = null;
    RepositoryManager resMgr = RepositoryManager.getInstance();
    if (courseId != null && nodeId != null) {
        OLATResourceable oresCourse = OLATResourceManager.getInstance().findResourceable(courseId, CourseModule.getCourseTypeName());
        OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("CourseNode", Long.valueOf(nodeId));
        RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(oresCourse, false);
        List<ContextEntry> ces = new ArrayList<>();
        ces.add(BusinessControlFactory.getInstance().createContextEntry(repositoryEntry));
        ces.add(BusinessControlFactory.getInstance().createContextEntry(oresNode));
        jumpInLink = BusinessControlFactory.getInstance().getAsURIString(ces, false);
    } else {
        RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(feed, false);
        if (repositoryEntry != null) {
            ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(repositoryEntry);
            jumpInLink = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
        } else {
            // its a liveblog-helperFeed
            final BusinessControlFactory bCF = BusinessControlFactory.getInstance();
            String feedBP = LiveBlogArtefactHandler.LIVEBLOG + feed.getResourceableId() + "]";
            final List<ContextEntry> ceList = bCF.createCEListFromString(feedBP);
            jumpInLink = bCF.getAsURIString(ceList, true);
        }
    }
    if (item != null && jumpInLink != null) {
        jumpInLink += "/item=" + item.getKey() + "/0";
    }
    return jumpInLink;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) ArrayList(java.util.ArrayList) RepositoryManager(org.olat.repository.RepositoryManager) BusinessControlFactory(org.olat.core.id.context.BusinessControlFactory) RepositoryEntry(org.olat.repository.RepositoryEntry) 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