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