use of org.olat.core.id.context.BusinessControl in project openolat by klemens.
the class BlogArtefactHandler method prefillArtefactAccordingToSource.
/**
* @see org.olat.portfolio.EPAbstractHandler#prefillArtefactAccordingToSource(org.olat.portfolio.model.artefacts.AbstractArtefact, java.lang.Object)
*/
@Override
public void prefillArtefactAccordingToSource(AbstractArtefact artefact, Object source) {
super.prefillArtefactAccordingToSource(artefact, source);
Feed feed = null;
if (source instanceof Feed) {
feed = (Feed) source;
String subPath = getItemUUID(artefact.getBusinessPath());
for (Item item : FeedManager.getInstance().loadItems(feed)) {
if (subPath.equals(item.getGuid())) {
prefillBlogArtefact(artefact, feed, item);
}
}
artefact.setSignature(70);
}
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 OpenMeetingsAdminRoomsController method openResource.
protected void openResource(UserRequest ureq, OpenMeetingsRoom room) {
OpenMeetingsRoomReference prop = room.getReference();
if (prop != null) {
String url;
if (prop.getGroup() != null) {
url = "[BusinessGroup:" + prop.getGroup().getKey() + "]";
} else {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(prop.getResourceTypeName(), prop.getResourceTypeId());
RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
if (re != null) {
url = "[RepositoryEntry:" + re.getKey() + "]";
if (StringHelper.containsNonWhitespace(prop.getSubIdentifier()) && "CourseModule".equals(ores.getResourceableTypeName())) {
url += "[CourseNode:" + prop.getSubIdentifier() + "]";
}
} 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 MembersTableController method doOpenHomePage.
private void doOpenHomePage(MemberView member, UserRequest ureq) {
String url = "[HomePage:" + member.getIdentityKey() + "]";
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 InfoMessagePortletRunController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == showAllLink) {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
// fxdiff activate homes tab in top navigation and activate the correct
// menu item
String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][notifications:0][type=" + InfoMessage.class.getSimpleName() + ":0]" + BusinessControlFactory.getInstance().getContextEntryStringForDate(cal.getTime());
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 CollaborationTools method createWikiController.
/**
* return an controller for the wiki tool
* @param ureq
* @param wControl
* @return
*/
public Controller createWikiController(UserRequest ureq, WindowControl wControl) {
// Check for jumping to certain wiki page
BusinessControl bc = wControl.getBusinessControl();
ContextEntry ce = bc.popLauncherContextEntry();
SubscriptionContext subContext = new SubscriptionContext(ores, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
boolean isResourceOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(ureq.getIdentity(), Constants.PERMISSION_ACCESS, ores);
WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOlatAdmin, isGuestOnly, true, isResourceOwner, subContext);
if (ce != null) {
// jump to a certain context
OLATResourceable ceOres = ce.getOLATResourceable();
String typeName = ceOres.getResourceableTypeName();
String page = typeName.substring("page=".length());
if (page != null && page.endsWith(":0")) {
page = page.substring(0, page.length() - 2);
}
return WikiManager.getInstance().createWikiMainController(ureq, wControl, ores, callback, page);
} else {
return WikiManager.getInstance().createWikiMainController(ureq, wControl, ores, callback, null);
}
}
Aggregations