Search in sources :

Example 1 with PageMetadataController

use of org.olat.modules.portfolio.ui.PageMetadataController in project OpenOLAT by OpenOLAT.

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();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) PageController(org.olat.modules.portfolio.ui.editor.PageController) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) Component(org.olat.core.gui.components.Component) WindowControlMocker(org.olat.core.gui.util.WindowControlMocker) PageMetadataController(org.olat.modules.portfolio.ui.PageMetadataController)

Example 2 with PageMetadataController

use of org.olat.modules.portfolio.ui.PageMetadataController 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();
}
Also used : CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) PageController(org.olat.modules.portfolio.ui.editor.PageController) OLATResourceable(org.olat.core.id.OLATResourceable) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) Component(org.olat.core.gui.components.Component) WindowControlMocker(org.olat.core.gui.util.WindowControlMocker) PageMetadataController(org.olat.modules.portfolio.ui.PageMetadataController)

Aggregations

CommentAndRatingSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback)2 UserCommentsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsController)2 Component (org.olat.core.gui.components.Component)2 WindowControl (org.olat.core.gui.control.WindowControl)2 WindowControlMocker (org.olat.core.gui.util.WindowControlMocker)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)2 PageMetadataController (org.olat.modules.portfolio.ui.PageMetadataController)2 PageController (org.olat.modules.portfolio.ui.editor.PageController)2 ReadOnlyCommentsSecurityCallback (org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback)2