Search in sources :

Example 81 with ContextEntry

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

the class EPArtefactViewController method createLinkToArtefactSource.

private String createLinkToArtefactSource(UserRequest ureq, String businessPath) {
    BusinessControlFactory bCF = BusinessControlFactory.getInstance();
    List<ContextEntry> ceList = bCF.createCEListFromString(businessPath);
    boolean valid = (ceList.size() > 0) && NewControllerFactory.getInstance().validateCEWithContextControllerCreator(ureq, getWindowControl(), ceList.get(0));
    String busLink = bCF.getAsURIString(ceList, true);
    if (valid && StringHelper.containsNonWhitespace(busLink)) {
        return "<a href=\"" + busLink + "\">" + translate("artefact.open.source") + "</a>";
    } else
        return translate("artefact.no.source");
}
Also used : BusinessControlFactory(org.olat.core.id.context.BusinessControlFactory) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 82 with ContextEntry

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

the class OverviewAuthoringController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (currentCtrl == null) {
            if (isGuestOnly) {
                doOpenMyEntries(ureq);
                segmentView.select(myEntriesLink);
            } else {
                boolean markEmpty = doOpenMark(ureq).isEmpty();
                if (markEmpty) {
                    doOpenMyEntries(ureq);
                    segmentView.select(myEntriesLink);
                } else {
                    segmentView.select(favoriteLink);
                }
            }
        }
        if (favoritDirty && markedCtrl != null) {
            markedCtrl.reloadRows();
        } else if (markedCtrl != null) {
            markedCtrl.reloadDirtyRows();
        }
        if (myDirty && myEntriesCtrl != null) {
            myEntriesCtrl.reloadRows();
        } else if (myEntriesCtrl != null) {
            myEntriesCtrl.reloadDirtyRows();
        }
        addToHistory(ureq, currentCtrl);
    } else {
        ContextEntry entry = entries.get(0);
        String segment = entry.getOLATResourceable().getResourceableTypeName();
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        if ("Favorits".equals(segment)) {
            if (isGuestOnly) {
                doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(myEntriesLink);
            } else {
                doOpenMark(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(favoriteLink);
            }
        } else if ("My".equals(segment)) {
            doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myEntriesLink);
        } else if ("Search".equals(segment)) {
            doSearchEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(searchLink);
        } else if ("Deleted".equals(segment)) {
            doOpenDeletedEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(deletedLink);
        } else {
            doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myEntriesLink);
        }
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry)

Example 83 with ContextEntry

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

the class PaypalTransactionsController method addSearchToHistory.

protected void addSearchToHistory(UserRequest ureq) {
    String transactionId = tableEl.getQuickSearchString();
    StateMapped state = new StateMapped();
    if (StringHelper.containsNonWhitespace(transactionId)) {
        state.getDelegate().put("transactionId", transactionId);
    }
    ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
    if (currentEntry != null) {
        currentEntry.setTransientState(state);
    }
    addToHistory(ureq, getWindowControl());
}
Also used : StateMapped(org.olat.core.id.context.StateMapped) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 84 with ContextEntry

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

the class ValidatingVisitor method handleBusinessPath.

public Command handleBusinessPath(UserRequest ureq) {
    HistoryPoint p = ureq.getUserSession().getLastHistoryPoint();
    if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
        StringBuilder sb = new StringBuilder();
        List<ContextEntry> ces = p.getEntries();
        String url = BusinessControlFactory.getInstance().getAsURIString(ces, true);
        sb.append("try { o_info.businessPath='").append(url).append("';");
        // Add analytics code
        if (analyticsSPI != null) {
            String serverUri = Settings.getServerContextPathURI();
            if (url != null && url.startsWith(serverUri)) {
                analyticsSPI.analyticsCountPageJavaScript(sb, getTitle(), url.substring(serverUri.length()));
            }
        }
        sb.append(" } catch(e) { }");
        return new JSCommand(sb.toString());
    }
    return null;
}
Also used : JSCommand(org.olat.core.gui.control.winmgr.JSCommand) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 85 with ContextEntry

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

the class AjaxController method appendBusinessPathInfos.

private void appendBusinessPathInfos(UserRequest ureq, Writer writer) throws IOException {
    ChiefController ctrl = wboImpl.getChiefController();
    String documentTitle = ctrl == null ? "" : ctrl.getWindow().getTitle();
    writer.append(",\"documentTitle\":").append(JSONObject.quote(documentTitle));
    StringBuilder bc = new StringBuilder(128);
    HistoryPoint p = ureq.getUserSession().getLastHistoryPoint();
    if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
        List<ContextEntry> ces = p.getEntries();
        String uriPrefix = wboImpl.getWindow().getUriPrefix();
        bc.append(uriPrefix).append(BusinessControlFactory.getInstance().getAsRestPart(ces, true));
        writer.append(",\"businessPath\":").append(JSONObject.quote(bc.toString()));
        writer.append(",\"historyPointId\":").append(JSONObject.quote(p.getUuid()));
    }
}
Also used : ChiefController(org.olat.core.gui.control.ChiefController) HistoryPoint(org.olat.core.id.context.HistoryPoint) 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