use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.
the class LectureRepositoryAdminController method doOpenParticipants.
private void doOpenParticipants(UserRequest ureq) {
if (participantsCtrl == null) {
OLATResourceable ores = OresHelper.createOLATResourceableType("Participants");
WindowControl swControl = addToHistory(ureq, ores, null);
participantsCtrl = new ParticipantListRepositoryController(ureq, swControl, entry, false, true);
listenTo(participantsCtrl);
} else {
addToHistory(ureq, participantsCtrl);
}
mainVC.put("segmentCmp", participantsCtrl.getInitialComponent());
}
use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.
the class WikiMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
Wiki wiki = getWiki();
if (wiki == null) {
return;
}
ContextEntry ce = entries.get(0);
String typ = ce.getOLATResourceable().getResourceableTypeName();
if ("az".equalsIgnoreCase(typ)) {
openAtoZPage(ureq, wiki);
} else if ("lastChanges".equalsIgnoreCase(typ)) {
openLastChangesPage(ureq, wiki);
} else if ("index".equalsIgnoreCase(typ)) {
WikiPage page = openIndexPage(ureq, wiki);
pageId = page.getPageId();
} else if ("Forum".equalsIgnoreCase(typ)) {
Long forumKey = ce.getOLATResourceable().getResourceableId();
for (WikiPage page : wiki.getAllPagesWithContent()) {
if (forumKey.longValue() == page.getForumKey()) {
if (page != null) {
this.pageId = page.getPageId();
}
updatePageContext(ureq, page);
OLATResourceable tabOres = OresHelper.createOLATResourceableInstance("tab", 1l);
ContextEntry tabCe = BusinessControlFactory.getInstance().createContextEntry(tabOres);
tabs.activate(ureq, Collections.singletonList(tabCe), null);
if (forumController != null && entries.size() > 1) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
forumController.activate(ureq, subEntries, null);
}
break;
}
}
} else {
String path = BusinessControlFactory.getInstance().getPath(ce);
if (path.startsWith("page=")) {
path = path.substring(5, path.length());
}
String activatePageId = WikiManager.generatePageId(FilterUtil.normalizeWikiLink(path));
if (wiki.pageExists(activatePageId)) {
WikiPage page = wiki.getPage(activatePageId, true);
if (page != null) {
this.pageId = page.getPageId();
}
updatePageContext(ureq, page);
if (entries.size() > 1) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
String subTyp = subEntries.get(0).getOLATResourceable().getResourceableTypeName();
if ("tab".equalsIgnoreCase(subTyp)) {
tabs.activate(ureq, subEntries, ce.getTransientState());
} else if ("message".equalsIgnoreCase(subTyp)) {
OLATResourceable tabOres = OresHelper.createOLATResourceableInstance("tab", 1l);
ContextEntry tabCe = BusinessControlFactory.getInstance().createContextEntry(tabOres);
tabs.activate(ureq, Collections.singletonList(tabCe), null);
forumController.activate(ureq, subEntries, null);
}
}
}
}
}
use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.
the class WikiMainController method updatePageContext.
/**
* update depended velocity contexts and componetens with latest globally
* used page
*/
private void updatePageContext(UserRequest ureq, WikiPage page) {
if (page.getPageName().equals(WikiPage.WIKI_ERROR)) {
wikiArticleComp.setWikiContent(translate(page.getContent()));
} else {
wikiArticleComp.setWikiContent(page.getContent());
}
wikiEditForm.setPage(page);
diffs.clear();
content.contextPut("page", page);
articleContent.contextPut("page", page);
discussionContent.contextPut("page", page);
editContent.remove(wikiVersionDisplayComp);
editContent.contextPut("page", page);
versioningContent.remove(wikiVersionDisplayComp);
versioningContent.contextPut("page", page);
boolean userIsPageCreator = getIdentity().getKey().equals(page.getInitalAuthor());
if (userIsPageCreator) {
String subPath = page.getPageName();
String businessPath = getWindowControl().getBusinessControl().getAsString();
businessPath += "[page=" + subPath + ":0]";
OLATResourceable wikiRes = OresHelper.createOLATResourceableInstance(WikiArtefact.ARTEFACT_TYPE, ores.getResourceableId());
if (portfolioModule.isEnabled()) {
MediaCollectorComponent collectorCmp = new MediaCollectorComponent("portfolio-link", getWindowControl(), page, wikiMediaHandler, businessPath);
navigationContent.put("portfolio-link", collectorCmp);
} else {
Controller ePFCollCtrl = EPUIFactory.createArtefactCollectWizzardController(ureq, getWindowControl(), wikiRes, businessPath);
if (ePFCollCtrl != null) {
navigationContent.put("portfolio-link", ePFCollCtrl.getInitialComponent());
}
}
} else {
clearPortfolioLink();
}
OLATResourceable pageRes = OresHelper.createOLATResourceableInstanceWithoutCheck("path=" + page.getPageName(), 0l);
addToHistory(ureq, pageRes, null);
}
use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.
the class NoteManager method fireBookmarkEvent.
/**
* Fire NoteEvent for a specific user after save/update/delete note.
* @param identity
*/
private void fireBookmarkEvent(Identity identity) {
// event this identity
NoteEvent noteEvent = new NoteEvent(identity.getKey());
OLATResourceable eventBusOres = OresHelper.createOLATResourceableInstance(Identity.class, identity.getKey());
// TODO: LD: use SingleUserEventCenter
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(noteEvent, eventBusOres);
}
use of org.olat.core.id.OLATResourceable in project OpenOLAT by OpenOLAT.
the class DialogCourseNodeIndexer method checkAccess.
@Override
public boolean checkAccess(ContextEntry contextEntry, BusinessControl businessControl, Identity identity, Roles roles) {
ContextEntry ce = businessControl.popLauncherContextEntry();
if (ce == null || ce.getOLATResourceable() == null || ce.getOLATResourceable().getResourceableId() == null) {
// it's the node itself
return true;
}
OLATResourceable ores = ce.getOLATResourceable();
if (isLogDebugEnabled())
logDebug("OLATResourceable=" + ores);
if (ores.getResourceableTypeName().startsWith("path=")) {
// => it is a file element, typeName format: 'path=/test1/test2/readme.txt'
return true;
} else if (ores.getResourceableTypeName().equals(OresHelper.calculateTypeName(Message.class))) {
// it is message => check message access
Long resourceableId = ores.getResourceableId();
Message message = ForumManager.getInstance().loadMessage(resourceableId);
Message threadtop = message.getThreadtop();
if (threadtop == null) {
threadtop = message;
}
boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
// TODO: (LD) fix this!!! - the contextEntry is not the right context for this check
if (isMessageHidden) {
boolean isOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable());
return isOwner;
}
return true;
} else {
logWarn("In DialogCourseNode unkown OLATResourceable=" + ores, null);
return false;
}
}
Aggregations