use of org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback in project openolat by klemens.
the class RepositoryEntryDetailsController method doOpenComments.
protected void doOpenComments(UserRequest ureq) {
if (commentsCtrl != null)
return;
boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
CommentAndRatingSecurityCallback secCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
OLATResourceable ores = OresHelper.createOLATResourceableInstance("RepositoryEntry", entry.getKey());
commentsCtrl = new UserCommentsController(ureq, getWindowControl(), ores, null, secCallback);
listenTo(commentsCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", commentsCtrl.getInitialComponent(), true, translate("comments"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback in project openolat by klemens.
the class ExportBinderAsCPResource method exportPage.
private void exportPage(Page page, ZipOutputStream zout) throws IOException {
WindowControl mockwControl = new WindowControlMocker();
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getReadOnlyCallback();
PageMetadataController metadatCtrl = new PageMetadataController(ureq, mockwControl, secCallback, page);
PageController pageCtrl = new PageController(ureq, mockwControl, new PortfolioPageProvider(page), ExtendedMediaRenderingHints.toPrint());
pageCtrl.loadElements(ureq);
CommentAndRatingSecurityCallback commentSecCallback = new ReadOnlyCommentsSecurityCallback();
OLATResourceable ores = OresHelper.createOLATResourceableInstance(Page.class, page.getKey());
UserCommentsController commentsCtrl = new UserCommentsController(ureq, mockwControl, ores, null, commentSecCallback);
Component metadata = metadatCtrl.getInitialComponent();
Component component = pageCtrl.getInitialComponent();
Component comments = commentsCtrl.getNumOfComments() > 0 ? commentsCtrl.getInitialComponent() : null;
String html = createResultHTML(metadata, component, comments, "o_page_export");
html = exportMedia(html, zout);
convertToZipEntry(zout, pageFilename(page), html);
pageCtrl.dispose();
metadatCtrl.dispose();
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback in project OpenOLAT by OpenOLAT.
the class EPPageViewController method init.
private void init(UserRequest ureq) {
vC.contextPut("page", page);
PortfolioStructureMap parentOfPage = (PortfolioStructureMap) ePFMgr.loadStructureParent(page);
boolean parentMapClosed = StructureStatusEnum.CLOSED.equals(parentOfPage.getStatus());
vC.remove(vC.getComponent("checkResults"));
if (secCallback.isRestrictionsEnabled()) {
removeAsListenerAndDispose(resultCtrl);
List<CollectRestriction> restrictions = page.getCollectRestrictions();
if (!restrictions.isEmpty()) {
boolean check = ePFMgr.checkCollectRestriction(page);
resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
resultCtrl.setMessage(restrictions, check);
vC.put("checkResults", resultCtrl.getInitialComponent());
listenTo(resultCtrl);
}
}
vC.remove(vC.getComponent("artefacts"));
List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(page);
if (artefacts.size() != 0) {
EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, page, secCallback);
vC.put("artefacts", artefactCtrl.getInitialComponent());
listenTo(artefactCtrl);
}
vC.remove(vC.getComponent("structElements"));
List<PortfolioStructure> structElements = ePFMgr.loadStructureChildren(page);
if (structElements.size() != 0) {
EPStructureElementsController structElCtrl = new EPStructureElementsController(ureq, getWindowControl(), structElements, secCallback, parentMapClosed);
vC.put("structElements", structElCtrl.getInitialComponent());
listenTo(structElCtrl);
}
vC.remove(vC.getComponent("addButton"));
if (!parentMapClosed && (secCallback.canAddArtefact() || secCallback.canAddStructure())) {
addButtonCtrl = new EPAddElementsController(ureq, getWindowControl(), page);
listenTo(addButtonCtrl);
if (secCallback.canAddArtefact()) {
addButtonCtrl.setShowLink(EPAddElementsController.ADD_ARTEFACT);
}
if (secCallback.canAddStructure()) {
addButtonCtrl.setShowLink(EPAddElementsController.ADD_STRUCTUREELEMENT);
}
vC.put("addButton", addButtonCtrl.getInitialComponent());
}
vC.remove(vC.getComponent("commentCtrl"));
if (secCallback.canCommentAndRate()) {
removeAsListenerAndDispose(commentsAndRatingCtr);
boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
CommentAndRatingSecurityCallback ratingSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
commentsAndRatingCtr = new UserCommentsAndRatingsController(ureq, getWindowControl(), map.getOlatResource(), page.getKey().toString(), ratingSecCallback, true, true, true);
listenTo(commentsAndRatingCtr);
vC.put("commentCtrl", commentsAndRatingCtr.getInitialComponent());
}
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback in project OpenOLAT by OpenOLAT.
the class EPTOCReadOnlyController method refreshTOC.
public void refreshTOC(UserRequest ureq) {
// do recursively
int level = 0;
List<TOCElement> tocList = new ArrayList<TOCElement>();
buildTOCModel(map, tocList, level);
vC.contextPut("tocList", tocList);
if (secCallback.canCommentAndRate()) {
removeAsListenerAndDispose(commentsAndRatingCtr);
boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
CommentAndRatingSecurityCallback callback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
commentsAndRatingCtr = new UserCommentsAndRatingsController(ureq, getWindowControl(), map.getOlatResource(), null, callback, true, true, true);
listenTo(commentsAndRatingCtr);
vC.put("commentCtrl", commentsAndRatingCtr.getInitialComponent());
}
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback in project OpenOLAT by OpenOLAT.
the class RepositoryEntryListController method doOpenComments.
protected void doOpenComments(UserRequest ureq, RepositoryEntryRow row) {
if (commentsCtrl != null)
return;
boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
CommentAndRatingSecurityCallback secCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
commentsCtrl = new UserCommentsController(ureq, getWindowControl(), row.getRepositoryEntryResourceable(), null, secCallback);
commentsCtrl.setUserObject(row);
listenTo(commentsCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", commentsCtrl.getInitialComponent(), true, translate("comments"));
listenTo(cmc);
cmc.activate();
}
Aggregations