use of org.olat.core.id.context.BusinessControl in project openolat by klemens.
the class ViteroBookingsAdminController method openResource.
protected void openResource(UserRequest ureq, ViteroBooking booking) {
Property prop = booking.getProperty();
if (prop != null) {
String url;
if (prop.getGrp() != null) {
url = "[BusinessGroup:" + prop.getGrp().getKey() + "]";
} else {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(prop.getResourceTypeName(), prop.getResourceTypeId());
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
if (re != null) {
url = "[RepositoryEntry:" + re.getKey() + "]";
} else {
showWarning("resource.dont.exist");
return;
}
}
BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
NewControllerFactory.getInstance().launch(ureq, bwControl);
}
}
use of org.olat.core.id.context.BusinessControl in project openolat by klemens.
the class BlogArtefactHandler method prefillBlogArtefact.
private void prefillBlogArtefact(AbstractArtefact artefact, Feed feed, Item item) {
VFSContainer itemContainer = FeedManager.getInstance().getItemContainer(item);
artefact.setFileSourceContainer(itemContainer);
artefact.setTitle(item.getTitle());
artefact.setDescription(item.getDescription());
VFSLeaf itemXml = (VFSLeaf) itemContainer.resolve(BlogArtefact.BLOG_FILE_NAME);
if (itemXml != null) {
InputStream in = itemXml.getInputStream();
String xml = FileUtils.load(in, "UTF-8");
artefact.setFulltextContent(xml);
FileUtils.closeSafely(in);
}
String origBPath = artefact.getBusinessPath();
String artSource = "";
BusinessControl bc = BusinessControlFactory.getInstance().createFromString(origBPath);
if (origBPath.contains(CourseNode.class.getSimpleName())) {
// blog-post from inside a course, rebuild "course-name - feed-name"
OLATResourceable ores = bc.popLauncherContextEntry().getOLATResourceable();
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(ores.getResourceableId());
artSource = repoEntry.getDisplayname();
if (feed != null) {
artSource += " - " + feed.getTitle();
}
} else if (origBPath.contains(RepositoryEntry.class.getSimpleName())) {
// blog-post from blog-LR, only get name itself
if (feed != null) {
artSource = feed.getTitle();
}
} else {
// collecting a post from live-blog, [Identity:xy]
if (feed != null) {
artSource = feed.getTitle();
}
}
artefact.setSource(artSource);
}
use of org.olat.core.id.context.BusinessControl in project openolat by klemens.
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 klemens.
the class NotesPortletRunController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == showAllLink) {
// fxdiff: activate homes tab in top navigation and activate correct menu item
String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][notelist:0]";
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 klemens.
the class WikiHandler method createLaunchController.
@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
// first handle special case: disabled wiki for security (XSS Attacks) reasons
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
if (!securityModule.isWikiEnabled()) {
return RepositoyUIFactory.createRepoEntryDisabledDueToSecurityMessageController(ureq, wControl);
}
// check role
boolean isOLatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
boolean isResourceOwner = false;
if (isOLatAdmin) {
isResourceOwner = true;
} else {
isResourceOwner = reSecurity.isOwner();
}
OLATResource res = re.getOlatResource();
BusinessControl bc = wControl.getBusinessControl();
final ContextEntry ce = bc.popLauncherContextEntry();
SubscriptionContext subsContext = new SubscriptionContext(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
final WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOLatAdmin, isGuestOnly, false, isResourceOwner, subsContext);
RepositoryEntryRuntimeController runtime = new RepositoryEntryRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {
@Override
public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
Controller controller;
if (ce != null) {
// jump to a certain context
OLATResourceable ores = ce.getOLATResourceable();
String typeName = ores.getResourceableTypeName();
String page = typeName.substring("page=".length());
controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, page);
} else {
controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, null);
}
return new OLATResourceableListeningWrapperController(uureq, wwControl, entry.getOlatResource(), controller, null, uureq.getIdentity());
}
});
return runtime;
}
Aggregations