Search in sources :

Example 26 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class MySharedItemsController method doSelectBinder.

private BinderController doSelectBinder(UserRequest ureq, MySharedItemRow row) {
    Binder binder = portfolioService.getBinderByKey(row.getBinderKey());
    if (binder == null) {
        showWarning("warning.portfolio.not.found");
        return null;
    } else {
        removeAsListenerAndDispose(binderCtrl);
        portfolioService.updateBinderUserInformations(binder, getIdentity());
        OLATResourceable binderOres = OresHelper.createOLATResourceableInstance("Binder", binder.getKey());
        WindowControl swControl = addToHistory(ureq, binderOres, null);
        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForOwnedBinder(binder);
        BinderConfiguration config = BinderConfiguration.createConfig(binder);
        binderCtrl = new BinderController(ureq, swControl, stackPanel, secCallback, binder, config);
        String displayName = StringHelper.escapeHtml(binder.getTitle());
        stackPanel.pushController(displayName, binderCtrl);
        return binderCtrl;
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) OLATResourceable(org.olat.core.id.OLATResourceable) BinderController(org.olat.modules.portfolio.ui.BinderController) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WindowControl(org.olat.core.gui.control.WindowControl) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration)

Example 27 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class MySharedItemsController method loadModel.

private void loadModel(String searchString) {
    List<Binder> portfolios = portfolioService.searchSharedBindersBy(getIdentity(), searchString);
    List<MySharedItemRow> rows = new ArrayList<>(portfolios.size());
    for (Binder binder : portfolios) {
        MySharedItemRow row = new MySharedItemRow();
        row.setBinderKey(binder.getKey());
        row.setBinderTitle(binder.getTitle());
        // TODO max()
        row.setLastModified(binder.getLastModified());
        if (binder.getEntry() != null) {
            row.setCourseDisplayName(binder.getEntry().getDisplayname());
        }
        rows.add(row);
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Binder(org.olat.modules.portfolio.Binder) ArrayList(java.util.ArrayList)

Example 28 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class ExportBinderAsCPResource method prepare.

@Override
public void prepare(HttpServletResponse hres) {
    try {
        hres.setCharacterEncoding("UTF-8");
    } catch (Exception e) {
        log.error("", e);
    }
    try (ZipOutputStream zout = new ZipOutputStream(hres.getOutputStream())) {
        Binder binder = portfolioService.getBinderByKey(binderRef.getKey());
        String label = binder.getTitle();
        String secureLabel = StringHelper.transformDisplayNameToFileSystemName(label);
        String file = secureLabel + ".zip";
        hres.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + StringHelper.urlEncodeUTF8(file));
        hres.setHeader("Content-Description", StringHelper.urlEncodeUTF8(label));
        // load pages
        List<Section> sections = portfolioService.getSections(binder);
        List<Page> pages = portfolioService.getPages(binder, null);
        // manifest
        ManifestType manifest = createImsManifest(binder, sections, pages);
        zout.putNextEntry(new ZipEntry("imsmanifest.xml"));
        write(manifest, new ShieldOutputStream(zout));
        zout.closeEntry();
        // write pages
        for (Section section : sections) {
            exportSection(section, zout);
        }
        // write pages
        for (Page page : pages) {
            exportPage(page, zout);
        }
        // theme and javascripts
        exportCSSAndJs(zout);
        // make it readable offline
        ByteArrayOutputStream manifestOut = new ByteArrayOutputStream();
        write(manifest, manifestOut);
        String manifestXml = new String(manifestOut.toByteArray());
        String indexSrc = sectionFilename(sections.get(0));
        CPOfflineReadableManager.getInstance().makeCPOfflineReadable(manifestXml, indexSrc, zout);
    } catch (Exception e) {
        log.error("", e);
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) ManifestType(org.olat.imscp.xml.manifest.ManifestType) ShieldOutputStream(org.olat.core.util.io.ShieldOutputStream) ZipOutputStream(java.util.zip.ZipOutputStream) ZipEntry(java.util.zip.ZipEntry) Page(org.olat.modules.portfolio.Page) ByteArrayOutputStream(java.io.ByteArrayOutputStream) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) JAXBException(javax.xml.bind.JAXBException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException)

Example 29 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class ExportBinderAsPDFResource method prepare.

@Override
public void prepare(HttpServletResponse hres) {
    try {
        hres.setCharacterEncoding("UTF-8");
    } catch (Exception e) {
        log.error("", e);
    }
    htmlDir = prepareHtml();
    pdfFile = renderPdf(htmlDir);
    String label;
    if (selectedPage != null) {
        label = selectedPage.getTitle();
    } else {
        Binder binder = portfolioService.getBinderByKey(binderRef.getKey());
        label = binder.getTitle();
    }
    String secureLabel = StringHelper.transformDisplayNameToFileSystemName(label);
    String file = secureLabel + ".pdf";
    hres.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + StringHelper.urlEncodeUTF8(file));
    hres.setHeader("Content-Description", StringHelper.urlEncodeUTF8(label));
}
Also used : Binder(org.olat.modules.portfolio.Binder) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException)

Example 30 with Binder

use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.

the class RestorePageController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_pf_edit_entry_form");
    String title = page == null ? null : page.getTitle();
    titleEl = uifactory.addTextElement("title", "page.title", 255, title, formLayout);
    titleEl.setElementCssClass("o_sel_pf_edit_entry_title");
    titleEl.setEnabled(false);
    titleEl.setMandatory(true);
    List<Binder> binders = portfolioService.getOwnedBinders(getIdentity());
    String[] theKeys = new String[binders.size() + 1];
    String[] theValues = new String[binders.size() + 1];
    theKeys[0] = "none";
    theValues[0] = translate("binder.none");
    for (int i = 0; i < binders.size(); ++i) {
        Binder binder = binders.get(i);
        theKeys[i + 1] = binder.getKey().toString();
        theValues[i + 1] = StringHelper.escapeHtml(binder.getTitle());
    }
    bindersEl = uifactory.addDropdownSingleselect("binders", "page.binders", formLayout, theKeys, theValues, null);
    bindersEl.addActionListener(FormEvent.ONCHANGE);
    bindersEl.select(theKeys[0], true);
    sectionsEl = uifactory.addDropdownSingleselect("sections", "page.sections", formLayout, new String[] { "" }, new String[] { "" }, null);
    sectionsEl.setVisible(false);
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonsCont.setRootForm(mainForm);
    formLayout.add(buttonsCont);
    uifactory.addFormSubmitButton("restore.page", buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Also used : Binder(org.olat.modules.portfolio.Binder) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

Binder (org.olat.modules.portfolio.Binder)144 Section (org.olat.modules.portfolio.Section)72 Identity (org.olat.core.id.Identity)70 Test (org.junit.Test)68 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)58 Page (org.olat.modules.portfolio.Page)44 RepositoryEntry (org.olat.repository.RepositoryEntry)34 Assignment (org.olat.modules.portfolio.Assignment)30 ArrayList (java.util.ArrayList)22 SectionRef (org.olat.modules.portfolio.SectionRef)22 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)20 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)16 OLATResourceable (org.olat.core.id.OLATResourceable)14 BinderSecurityCallback (org.olat.modules.portfolio.BinderSecurityCallback)14 PortfolioService (org.olat.modules.portfolio.PortfolioService)14 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)14 AccessRights (org.olat.modules.portfolio.model.AccessRights)12 Date (java.util.Date)10 WindowControl (org.olat.core.gui.control.WindowControl)10 AssessmentSectionImpl (org.olat.modules.portfolio.model.AssessmentSectionImpl)8