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;
}
}
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();
}
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);
}
}
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));
}
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());
}
Aggregations