Search in sources :

Example 1 with SearchServiceUIFactory

use of org.olat.search.SearchServiceUIFactory in project OpenOLAT by OpenOLAT.

the class SearchInputController method getContextTokens.

protected ContextTokens getContextTokens(String resourceURL) {
    SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
    List<String> tokens = getResourceUrlTokenized(resourceURL);
    String[] keys = new String[tokens.size() + 1];
    String[] values = new String[tokens.size() + 1];
    keys[0] = "";
    values[0] = translate("search.context.all");
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < tokens.size(); i++) {
        String token = tokens.get(i);
        keys[i + 1] = sb.append('[').append(token).append(']').toString();
        values[i + 1] = searchUIFactory.getBusinessPathLabel(token, tokens, getLocale());
    }
    return new ContextTokens(keys, values);
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory)

Example 2 with SearchServiceUIFactory

use of org.olat.search.SearchServiceUIFactory in project OpenOLAT by OpenOLAT.

the class EPMapRunController method init.

private VelocityContainer init(UserRequest ureq) {
    vC = createVelocityContainer("mymapsmain");
    vC.contextPut("overview", Boolean.TRUE);
    if (create) {
        createMapLink = LinkFactory.createButton("create.map", vC, this);
        createMapLink.setElementCssClass("o_sel_create_map");
    }
    String documentType;
    switch(option) {
        case MY_DEFAULTS_MAPS:
            documentType = "type.d*." + EPDefaultMap.class.getSimpleName();
            break;
        case MY_EXERCISES_MAPS:
            documentType = "type.*." + EPStructuredMap.class.getSimpleName();
            break;
        default:
            documentType = null;
            break;
    }
    if (documentType != null) {
        SearchServiceUIFactory searchServiceUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
        searchController = searchServiceUIFactory.createInputController(ureq, getWindowControl(), DisplayOption.STANDARD, null);
        listenTo(searchController);
        vC.put("search_input", searchController.getInitialComponent());
        searchController.setDocumentType(documentType);
        searchController.setResourceContextEnable(true);
        searchController.setResourceUrl(null);
    }
    initTitle(vC);
    removeAsListenerAndDispose(multiMapCtrl);
    multiMapCtrl = new EPMultipleMapController(ureq, getWindowControl(), option, choosenOwner);
    listenTo(multiMapCtrl);
    vC.put("mapCtrl", multiMapCtrl.getInitialComponent());
    return vC;
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) EPMultipleMapController(org.olat.portfolio.ui.structel.EPMultipleMapController)

Example 3 with SearchServiceUIFactory

use of org.olat.search.SearchServiceUIFactory in project openolat by klemens.

the class EPMapRunController method init.

private VelocityContainer init(UserRequest ureq) {
    vC = createVelocityContainer("mymapsmain");
    vC.contextPut("overview", Boolean.TRUE);
    if (create) {
        createMapLink = LinkFactory.createButton("create.map", vC, this);
        createMapLink.setElementCssClass("o_sel_create_map");
    }
    String documentType;
    switch(option) {
        case MY_DEFAULTS_MAPS:
            documentType = "type.d*." + EPDefaultMap.class.getSimpleName();
            break;
        case MY_EXERCISES_MAPS:
            documentType = "type.*." + EPStructuredMap.class.getSimpleName();
            break;
        default:
            documentType = null;
            break;
    }
    if (documentType != null) {
        SearchServiceUIFactory searchServiceUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
        searchController = searchServiceUIFactory.createInputController(ureq, getWindowControl(), DisplayOption.STANDARD, null);
        listenTo(searchController);
        vC.put("search_input", searchController.getInitialComponent());
        searchController.setDocumentType(documentType);
        searchController.setResourceContextEnable(true);
        searchController.setResourceUrl(null);
    }
    initTitle(vC);
    removeAsListenerAndDispose(multiMapCtrl);
    multiMapCtrl = new EPMultipleMapController(ureq, getWindowControl(), option, choosenOwner);
    listenTo(multiMapCtrl);
    vC.put("mapCtrl", multiMapCtrl.getInitialComponent());
    return vC;
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) EPMultipleMapController(org.olat.portfolio.ui.structel.EPMultipleMapController)

Example 4 with SearchServiceUIFactory

use of org.olat.search.SearchServiceUIFactory in project openolat by klemens.

the class ThreadListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (foCallback.mayOpenNewThread()) {
        newThreadButton = uifactory.addFormLink("msg.create", formLayout, Link.BUTTON_SMALL);
        newThreadButton.setIconLeftCSS("o_icon o_icon-fw o_forum_status_thread_icon");
        newThreadButton.setElementCssClass("o_sel_forum_thread_new");
    }
    if (foCallback.mayArchiveForum()) {
        archiveForumButton = uifactory.addFormLink("archive.forum", formLayout, Link.BUTTON_SMALL);
        archiveForumButton.setIconLeftCSS("o_icon o_icon-fw o_icon_archive_tool");
        archiveForumButton.setElementCssClass("o_sel_forum_archive");
    }
    if (securityModule.isUserAllowedAutoComplete(ureq.getUserSession().getRoles()) && foCallback.mayFilterForUser()) {
        userListButton = uifactory.addFormLink("filter", formLayout, Link.BUTTON_SMALL);
        userListButton.setIconLeftCSS("o_icon o_icon-fw o_icon_user");
        userListButton.setElementCssClass("o_sel_forum_filter");
    }
    if (formLayout instanceof FormLayoutContainer) {
        SearchServiceUIFactory searchServiceUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
        searchController = searchServiceUIFactory.createInputController(ureq, getWindowControl(), DisplayOption.STANDARD, mainForm);
        if (guestOnly && !searchModule.isGuestEnabled()) {
            searchController.setResourceContextEnable(false);
        }
        listenTo(searchController);
        ((FormLayoutContainer) formLayout).add("search_input", searchController.getFormItem());
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.type, new StatusTypeCellRenderer()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.thread, "select", new StaticFlexiCellRenderer("select", new StickyCellRenderer())));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.creator));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.lastModified));
    if (!guestOnly) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.markedMessages, "marked", new StaticFlexiCellRenderer("marked", new TextFlexiCellRenderer())));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.unreadMessages, "unread", new StaticFlexiCellRenderer("unread", new TextFlexiCellRenderer())));
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ThreadListCols.totalMessages));
    threadTableModel = new ThreadListDataModel(columnsModel, getTranslator());
    threadTable = uifactory.addTableElement(getWindowControl(), "threads", threadTableModel, getTranslator(), formLayout);
    threadTable.setCustomizeColumns(false);
    threadTable.setElementCssClass("o_forum");
    threadTable.setEmtpyTableMessageKey("forum.emtpy");
    FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
    sortOptions.setDefaultOrderBy(new SortKey(ThreadListCols.lastModified.name(), false));
    threadTable.setSortSettings(sortOptions);
}
Also used : FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) SortKey(org.olat.core.commons.persistence.SortKey) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 5 with SearchServiceUIFactory

use of org.olat.search.SearchServiceUIFactory in project openolat by klemens.

the class CourseRuntimeController method launchCourseSearch.

private void launchCourseSearch(UserRequest ureq) {
    // do not dispose SearchInputController after search to remain able to listen to its events
    removeAsListenerAndDispose(courseSearchCalloutCtr);
    courseSearchCalloutCtr = null;
    removeAsListenerAndDispose(searchController);
    searchController = null;
    SearchServiceUIFactory searchServiceUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
    searchController = searchServiceUIFactory.createInputController(ureq, getWindowControl(), DisplayOption.STANDARD, null);
    listenTo(searchController);
    courseSearchCalloutCtr = new CloseableCalloutWindowController(ureq, getWindowControl(), searchController.getInitialComponent(), searchLink.getDispatchID(), null, true, null);
    courseSearchCalloutCtr.addDisposableChildController(searchController);
    courseSearchCalloutCtr.activate();
    listenTo(courseSearchCalloutCtr);
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)

Aggregations

SearchServiceUIFactory (org.olat.search.SearchServiceUIFactory)10 SortKey (org.olat.core.commons.persistence.SortKey)2 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)2 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)2 EPMultipleMapController (org.olat.portfolio.ui.structel.EPMultipleMapController)2 ResultDocument (org.olat.search.model.ResultDocument)2