Search in sources :

Example 41 with BusinessControl

use of org.olat.core.id.context.BusinessControl in project OpenOLAT by OpenOLAT.

the class EventsModel method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableController) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            if (actionid.equals(CMD_LAUNCH)) {
                int rowid = te.getRowId();
                KalendarEvent kalendarEvent = ((EventsModel) tableController.getTableDataModel()).getObject(rowid);
                String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][calendar:0]" + BusinessControlFactory.getInstance().getContextEntryStringForDate(kalendarEvent.getBegin());
                BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
                WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
                NewControllerFactory.getInstance().launch(ureq, bwControl);
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) BusinessControl(org.olat.core.id.context.BusinessControl) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) WindowControl(org.olat.core.gui.control.WindowControl)

Example 42 with BusinessControl

use of org.olat.core.id.context.BusinessControl in project OpenOLAT by OpenOLAT.

the class SearchUserTool method getMenuComponent.

@Override
public Component getMenuComponent(UserRequest ureq, VelocityContainer container) {
    if (searchC == null) {
        String resourceUrl = null;
        BusinessControl bc = wControl.getBusinessControl();
        if (bc != null) {
            resourceUrl = bc.getAsString();
        }
        searchC = new SearchInputController(ureq, wControl, resourceUrl, DisplayOption.STANDARD);
        searchC.setResourceContextEnable(false);
        searchC.setAssessmentListener(ureq);
    }
    String componentName = "search-menu-" + CodeHelper.getRAMUniqueID();
    String velocity_root = Util.getPackageVelocityRoot(SearchControllerFactory.class);
    String pagePath = velocity_root + "/search_tool.html";
    VelocityContainer search = new VelocityContainer(componentName, pagePath, container.getTranslator(), this);
    search.setDomReplacementWrapperRequired(false);
    search.put("search_input", searchC.getInitialComponent());
    container.put(componentName, search);
    return search;
}
Also used : SearchInputController(org.olat.search.ui.SearchInputController) BusinessControl(org.olat.core.id.context.BusinessControl) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 43 with BusinessControl

use of org.olat.core.id.context.BusinessControl in project OpenOLAT by OpenOLAT.

the class SearchControllerFactory method createInputController.

@Override
public SearchInputController createInputController(UserRequest ureq, WindowControl wControl, DisplayOption displayOption, Form mainForm) {
    String resourceUrl = null;
    BusinessControl bc = wControl.getBusinessControl();
    if (bc != null) {
        resourceUrl = bc.getAsString();
    }
    SearchInputController searchCtrl;
    if (mainForm == null) {
        searchCtrl = new SearchInputController(ureq, wControl, resourceUrl, displayOption);
    } else {
        searchCtrl = new SearchInputController(ureq, wControl, resourceUrl, displayOption, mainForm);
    }
    return searchCtrl;
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl)

Example 44 with BusinessControl

use of org.olat.core.id.context.BusinessControl in project OpenOLAT by OpenOLAT.

the class SearchInputController method gotoSearchResult.

/**
 * @param ureq
 * @param command
 */
public void gotoSearchResult(UserRequest ureq, ResultDocument document) {
    try {
        // attach the launcher data
        closeSearchDialogBox();
        String url = document.getResourceUrl();
        if (!StringHelper.containsNonWhitespace(url)) {
            // no url, no document
            getWindowControl().setWarning(getTranslator().translate("error.resource.could.not.found"));
        } else {
            BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
            WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
            NewControllerFactory.getInstance().launch(ureq, bwControl);
        }
    } catch (Exception ex) {
        log.debug("Document not found");
        getWindowControl().setWarning(getTranslator().translate("error.resource.could.not.found"));
    }
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl) ParseException(org.apache.lucene.queryparser.classic.ParseException) QueryException(org.olat.search.QueryException) ServiceNotAvailableException(org.olat.search.ServiceNotAvailableException)

Example 45 with BusinessControl

use of org.olat.core.id.context.BusinessControl in project OpenOLAT by OpenOLAT.

the class SearchResultsImpl method createResultDocument.

/**
 * Create a result document. Return null if the identity has not enough privileges to see the document.
 * @param doc
 * @param query
 * @param analyzer
 * @param doHighlight
 * @param identity
 * @param roles
 * @return
 * @throws IOException
 */
private ResultDocument createResultDocument(Document doc, int pos, Query query, Analyzer analyzer, boolean doHighlight, Identity identity, Roles roles) throws IOException {
    boolean hasAccess = false;
    if (roles.isOLATAdmin()) {
        hasAccess = true;
    } else {
        String resourceUrl = doc.get(AbstractOlatDocument.RESOURCEURL_FIELD_NAME);
        if (resourceUrl == null) {
            resourceUrl = "";
        }
        BusinessControl businessControl = BusinessControlFactory.getInstance().createFromString(resourceUrl);
        hasAccess = mainIndexer.checkAccess(null, businessControl, identity, roles);
    }
    ResultDocument resultDoc;
    if (hasAccess) {
        resultDoc = new ResultDocument(doc, pos);
        if (doHighlight) {
            doHighlight(query, analyzer, doc, resultDoc);
        }
    } else {
        resultDoc = null;
    }
    return resultDoc;
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) ResultDocument(org.olat.search.model.ResultDocument)

Aggregations

BusinessControl (org.olat.core.id.context.BusinessControl)80 WindowControl (org.olat.core.gui.control.WindowControl)56 OLATResourceable (org.olat.core.id.OLATResourceable)24 ContextEntry (org.olat.core.id.context.ContextEntry)22 RepositoryEntry (org.olat.repository.RepositoryEntry)16 ArrayList (java.util.ArrayList)14 Controller (org.olat.core.gui.control.Controller)8 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)6 Window (org.olat.core.gui.components.Window)6 HistoryPoint (org.olat.core.id.context.HistoryPoint)6 CourseNode (org.olat.course.nodes.CourseNode)6 Date (java.util.Date)4 UserRequest (org.olat.core.gui.UserRequest)4 DTab (org.olat.core.gui.control.generic.dtabs.DTab)4 DTabs (org.olat.core.gui.control.generic.dtabs.DTabs)4 Identity (org.olat.core.id.Identity)4 Roles (org.olat.core.id.Roles)4 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)4 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)4 IOException (java.io.IOException)3