Search in sources :

Example 6 with SearchServiceUIFactory

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

the class ResultsController method updateUI.

private void updateUI(UserRequest ureq) {
    removeResultsController();
    int start = currentPage * RESULT_PER_PAGE;
    SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
    int count = 0;
    for (int i = start; (count < RESULT_PER_PAGE) && (i < documents.size()); i++) {
        ResultDocument document = documents.get(i);
        ResultController ctrl = searchUIFactory.createController(ureq, getWindowControl(), mainForm, document);
        ctrl.setHighlight(highlight);
        listenTo(ctrl);
        flc.add("result_" + (++count), ctrl.getInitialFormItem());
        resultsCtrl.add(ctrl);
    }
    flc.contextPut("numOfPages", getMaxPage() + 1);
    flc.contextPut("numOfResults", getNumOfResults());
    flc.contextPut("results", resultsCtrl);
    flc.contextPut("hasResult", searchResults != null);
    flc.contextPut("emptyResult", documents.isEmpty());
    flc.contextPut("searchResults", searchResults);
    flc.contextPut("currentPage", currentPage + 1);
    previousLink.setEnabled(currentPage != 0);
    nextLink.setEnabled(currentPage != getMaxPage());
    String[] args = { Integer.toString(getStartResult()), Integer.toString(getEndResult()), Integer.toString(getNumOfResults()) };
    flc.contextPut("resultTitle", getTranslator().translate("search.result.title", args));
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) ResultDocument(org.olat.search.model.ResultDocument)

Example 7 with SearchServiceUIFactory

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

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)

Example 8 with SearchServiceUIFactory

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

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 9 with SearchServiceUIFactory

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

the class ResultsController method updateUI.

private void updateUI(UserRequest ureq) {
    removeResultsController();
    int start = currentPage * RESULT_PER_PAGE;
    SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
    int count = 0;
    for (int i = start; (count < RESULT_PER_PAGE) && (i < documents.size()); i++) {
        ResultDocument document = documents.get(i);
        ResultController ctrl = searchUIFactory.createController(ureq, getWindowControl(), mainForm, document);
        ctrl.setHighlight(highlight);
        listenTo(ctrl);
        flc.add("result_" + (++count), ctrl.getInitialFormItem());
        resultsCtrl.add(ctrl);
    }
    flc.contextPut("numOfPages", getMaxPage() + 1);
    flc.contextPut("numOfResults", getNumOfResults());
    flc.contextPut("results", resultsCtrl);
    flc.contextPut("hasResult", searchResults != null);
    flc.contextPut("emptyResult", documents.isEmpty());
    flc.contextPut("searchResults", searchResults);
    flc.contextPut("currentPage", currentPage + 1);
    previousLink.setEnabled(currentPage != 0);
    nextLink.setEnabled(currentPage != getMaxPage());
    String[] args = { Integer.toString(getStartResult()), Integer.toString(getEndResult()), Integer.toString(getNumOfResults()) };
    flc.contextPut("resultTitle", getTranslator().translate("search.result.title", args));
}
Also used : SearchServiceUIFactory(org.olat.search.SearchServiceUIFactory) ResultDocument(org.olat.search.model.ResultDocument)

Example 10 with SearchServiceUIFactory

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

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)

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