use of org.olat.modules.webFeed.FeedSecurityCallback in project openolat by klemens.
the class BlogCourseNode method createPeekViewRunController.
/**
* @see org.olat.course.nodes.GenericCourseNode#createPeekViewRunController(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.WindowControl,
* org.olat.course.run.userview.UserCourseEnvironment,
* org.olat.course.run.userview.NodeEvaluation)
*/
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
if (ne.isAtLeastOneAccessible()) {
// Create a feed peekview controller that shows the latest two entries
RepositoryEntry entry = getReferencedRepositoryEntry();
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
String nodeId = this.getIdent();
boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
// fxdiff BAKS-18
boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
FeedSecurityCallback callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
FeedUIFactory uiFactory = BlogUIFactory.getInstance(ureq.getLocale());
Controller peekViewController = new FeedPeekviewController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId, uiFactory, 2, "o_blog_peekview");
return peekViewController;
} else {
// use standard peekview
return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
}
}
use of org.olat.modules.webFeed.FeedSecurityCallback in project OpenOLAT by OpenOLAT.
the class LiveBlogArtefactHandler method getSpecialMapViewController.
/**
* @see org.olat.portfolio.EPAbstractHandler#getSpecialMapViewController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
*/
@Override
public Controller getSpecialMapViewController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact) {
boolean isOwner = ureq.getIdentity().equalsByPersistableKey(artefact.getAuthor());
FeedSecurityCallback callback = new FeedResourceSecurityCallback(ureq.getUserSession().getRoles().isOLATAdmin(), isOwner);
String businessPath = artefact.getBusinessPath();
Long resid = Long.parseLong(businessPath.substring(10, businessPath.length() - 1));
OLATResource ores = OLATResourceManager.getInstance().findResourceable(resid, BlogFileResource.TYPE_NAME);
FeedItemDisplayConfig displayConfig = new FeedItemDisplayConfig(false, true, true);
return BlogUIFactory.getInstance(ureq.getLocale()).createMainController(ores, ureq, wControl, callback, displayConfig);
}
use of org.olat.modules.webFeed.FeedSecurityCallback in project OpenOLAT by OpenOLAT.
the class LiveBlogArtefactHandler method createDetailsController.
@Override
public Controller createDetailsController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact, boolean readOnlyMode) {
FeedSecurityCallback callback = new FeedResourceSecurityCallback(false, false);
String businessPath = artefact.getBusinessPath();
Long resid = Long.parseLong(businessPath.substring(10, businessPath.length() - 1));
OLATResource ores = OLATResourceManager.getInstance().findResourceable(resid, BlogFileResource.TYPE_NAME);
FeedItemDisplayConfig displayConfig = new FeedItemDisplayConfig(false, false, readOnlyMode);
FeedMainController detailsController = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(ores, ureq, wControl, callback, displayConfig);
return detailsController;
}
use of org.olat.modules.webFeed.FeedSecurityCallback in project OpenOLAT by OpenOLAT.
the class FeedNodeEditController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == chooseButton || source == changeButton) {
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, resourceTypeName, translate(BUTTON_CHOOSE_FEED));
listenTo(searchController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(BUTTON_CREATE_FEED));
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue only if the config is valid
RepositoryEntry re = node.getReferencedRepositoryEntry();
if (re == null) {
// The repository entry has been deleted meanwhile.
showError("error.repoentrymissing");
} else {
FeedSecurityCallback callback = new FeedPreviewSecurityCallback();
feedController = uiFactory.createMainController(re.getOlatResource(), ureq, getWindowControl(), callback, course.getResourceableId(), node.getIdent());
cmcFeedCtr = new CloseableModalController(getWindowControl(), translate("command.close"), feedController.getInitialComponent());
listenTo(cmcFeedCtr);
cmcFeedCtr.activate();
}
} else if (source == editLink) {
boolean launched = CourseNodeFactory.getInstance().launchReferencedRepoEntryEditor(ureq, getWindowControl(), node);
if (!launched) {
RepositoryEntry re = node.getReferencedRepositoryEntry();
if (re == null) {
showError("error.repoentrymissing");
} else {
showError("error.wrongtype");
}
}
}
}
use of org.olat.modules.webFeed.FeedSecurityCallback in project OpenOLAT by OpenOLAT.
the class BlogCourseNode method createNodeRunConstructionResult.
/**
* @see org.olat.course.nodes.AbstractAccessableCourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.WindowControl,
* org.olat.course.run.userview.UserCourseEnvironment,
* org.olat.course.run.userview.NodeEvaluation, java.lang.String)
*/
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
RepositoryEntry entry = getReferencedRepositoryEntry();
// create business path courseID:nodeID
// userCourseEnv.getCourseEnvironment().getCourseResourceableId();
// getIdent();
Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
String nodeId = this.getIdent();
boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
FeedSecurityCallback callback;
if (userCourseEnv.isCourseReadOnly()) {
callback = new FeedReadOnlySecurityCallback();
} else {
callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
}
SubscriptionContext subsContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
callback.setSubscriptionContext(subsContext);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
FeedMainController blogCtr = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId);
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(nodecmd);
blogCtr.activate(ureq, entries, null);
Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, blogCtr, this, "o_blog_icon");
NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
return result;
}
Aggregations