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);
}
}
}
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);
}
}
}
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;
}
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;
}
Aggregations