Search in sources :

Example 1 with CatalogNodeController

use of org.olat.repository.ui.catalog.CatalogNodeController in project openolat by klemens.

the class OverviewRepositoryListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (currentCtrl == null) {
            if (isGuestOnly) {
                doOpenMyCourses(ureq);
                segmentView.select(myCourseLink);
            } else {
                boolean markEmpty = doOpenMark(ureq).isEmpty();
                if (markEmpty) {
                    doOpenMyCourses(ureq);
                    segmentView.select(myCourseLink);
                } else {
                    segmentView.select(favoriteLink);
                }
            }
        }
        if (favoritDirty && markedCtrl != null) {
            markedCtrl.reloadRows();
        }
        if (myDirty && myCoursesCtrl != null) {
            myCoursesCtrl.reloadRows();
        }
        addToHistory(ureq, this);
    } else {
        ContextEntry entry = entries.get(0);
        String segment = entry.getOLATResourceable().getResourceableTypeName();
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        if ("Favorits".equalsIgnoreCase(segment)) {
            if (isGuestOnly) {
                doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(myCourseLink);
            } else {
                doOpenMark(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(favoriteLink);
            }
        } else if ("My".equalsIgnoreCase(segment)) {
            doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myCourseLink);
        } else if (("Catalog".equalsIgnoreCase(segment) || "CatalogEntry".equalsIgnoreCase(segment)) && catalogLink != null) {
            CatalogNodeController ctrl = doOpenCatalog(ureq);
            if (ctrl != null) {
                ctrl.activate(ureq, entries, entry.getTransientState());
                segmentView.select(catalogLink);
            }
        } else if ("Search".equalsIgnoreCase(segment) && searchCourseLink != null) {
            doOpenSearchCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(searchCourseLink);
        } else if ("Closed".equalsIgnoreCase(segment) && closedCourseLink != null) {
            doOpenClosedCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(closedCourseLink);
        } else {
            // default if the others fail
            doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myCourseLink);
        }
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry) CatalogNodeController(org.olat.repository.ui.catalog.CatalogNodeController)

Example 2 with CatalogNodeController

use of org.olat.repository.ui.catalog.CatalogNodeController in project OpenOLAT by OpenOLAT.

the class OverviewRepositoryListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (currentCtrl == null) {
            if (isGuestOnly) {
                doOpenMyCourses(ureq);
                segmentView.select(myCourseLink);
            } else {
                boolean markEmpty = doOpenMark(ureq).isEmpty();
                if (markEmpty) {
                    doOpenMyCourses(ureq);
                    segmentView.select(myCourseLink);
                } else {
                    segmentView.select(favoriteLink);
                }
            }
        }
        if (favoritDirty && markedCtrl != null) {
            markedCtrl.reloadRows();
        }
        if (myDirty && myCoursesCtrl != null) {
            myCoursesCtrl.reloadRows();
        }
        addToHistory(ureq, this);
    } else {
        ContextEntry entry = entries.get(0);
        String segment = entry.getOLATResourceable().getResourceableTypeName();
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        if ("Favorits".equalsIgnoreCase(segment)) {
            if (isGuestOnly) {
                doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(myCourseLink);
            } else {
                doOpenMark(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(favoriteLink);
            }
        } else if ("My".equalsIgnoreCase(segment)) {
            doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myCourseLink);
        } else if (("Catalog".equalsIgnoreCase(segment) || "CatalogEntry".equalsIgnoreCase(segment)) && catalogLink != null) {
            CatalogNodeController ctrl = doOpenCatalog(ureq);
            if (ctrl != null) {
                ctrl.activate(ureq, entries, entry.getTransientState());
                segmentView.select(catalogLink);
            }
        } else if ("Search".equalsIgnoreCase(segment) && searchCourseLink != null) {
            doOpenSearchCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(searchCourseLink);
        } else if ("Closed".equalsIgnoreCase(segment) && closedCourseLink != null) {
            doOpenClosedCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(closedCourseLink);
        } else {
            // default if the others fail
            doOpenMyCourses(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(myCourseLink);
        }
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry) CatalogNodeController(org.olat.repository.ui.catalog.CatalogNodeController)

Example 3 with CatalogNodeController

use of org.olat.repository.ui.catalog.CatalogNodeController in project OpenOLAT by OpenOLAT.

the class OverviewRepositoryListController method doOpenCatalog.

private CatalogNodeController doOpenCatalog(UserRequest ureq) {
    if (!repositoryModule.isCatalogEnabled() || !repositoryModule.isCatalogBrowsingEnabled()) {
        return null;
    }
    cleanUp();
    List<CatalogEntry> entries = catalogManager.getRootCatalogEntries();
    CatalogEntry rootEntry = null;
    if (entries.size() > 0) {
        rootEntry = entries.get(0);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Catalog", 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    catalogStackPanel = new BreadcrumbedStackedPanel("catstack", getTranslator(), this);
    catalogCtrl = new CatalogNodeController(ureq, bwControl, getWindowControl(), rootEntry, catalogStackPanel, false);
    catalogStackPanel.pushController(translate("search.catalog"), catalogCtrl);
    listenTo(catalogCtrl);
    currentCtrl = catalogCtrl;
    addToHistory(ureq, catalogCtrl);
    mainVC.put("segmentCmp", catalogStackPanel);
    return catalogCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) CatalogEntry(org.olat.repository.CatalogEntry) WindowControl(org.olat.core.gui.control.WindowControl) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel) CatalogNodeController(org.olat.repository.ui.catalog.CatalogNodeController)

Example 4 with CatalogNodeController

use of org.olat.repository.ui.catalog.CatalogNodeController in project openolat by klemens.

the class OverviewRepositoryListController method doOpenCatalog.

private CatalogNodeController doOpenCatalog(UserRequest ureq) {
    if (!repositoryModule.isCatalogEnabled() || !repositoryModule.isCatalogBrowsingEnabled()) {
        return null;
    }
    cleanUp();
    List<CatalogEntry> entries = catalogManager.getRootCatalogEntries();
    CatalogEntry rootEntry = null;
    if (entries.size() > 0) {
        rootEntry = entries.get(0);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Catalog", 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    catalogStackPanel = new BreadcrumbedStackedPanel("catstack", getTranslator(), this);
    catalogCtrl = new CatalogNodeController(ureq, bwControl, getWindowControl(), rootEntry, catalogStackPanel, false);
    catalogStackPanel.pushController(translate("search.catalog"), catalogCtrl);
    listenTo(catalogCtrl);
    currentCtrl = catalogCtrl;
    addToHistory(ureq, catalogCtrl);
    mainVC.put("segmentCmp", catalogStackPanel);
    return catalogCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) CatalogEntry(org.olat.repository.CatalogEntry) WindowControl(org.olat.core.gui.control.WindowControl) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel) CatalogNodeController(org.olat.repository.ui.catalog.CatalogNodeController)

Aggregations

CatalogNodeController (org.olat.repository.ui.catalog.CatalogNodeController)4 BreadcrumbedStackedPanel (org.olat.core.gui.components.stack.BreadcrumbedStackedPanel)2 WindowControl (org.olat.core.gui.control.WindowControl)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 CatalogEntry (org.olat.repository.CatalogEntry)2