use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class MapsTreeModel method loadStructure.
private void loadStructure(PortfolioStructure struct, GenericTreeNode parentNode) {
String ident = struct.getKey().toString();
GenericTreeNode structureNode = new GenericTreeNode(ident, struct.getTitle(), struct);
structureNode.setIconCssClass(struct.getIcon());
parentNode.addChild(structureNode);
List<PortfolioStructure> structs = ePFMgr.loadStructureChildren(struct);
for (PortfolioStructure childStruct : structs) {
loadStructure(childStruct, structureNode);
}
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPArtefactViewController method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
* org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (detailsLinkEnabled && !artefactChooseMode) {
detailsLink = uifactory.addFormLink("details.link", formLayout, Link.BUTTON);
detailsLink.setElementCssClass("o_sel_artefact_details");
}
title = uifactory.addInlineTextElement("title", artefact.getTitle(), formLayout, this);
flc.contextPut("cssClosed", artefactInClosedMap ? "o_artefact_closed" : "");
flc.contextPut("viewOnly", viewOnlyMode);
if (viewOnlyMode || artefactInClosedMap)
title.setEnabled(false);
// get tags and prepare textboxlist-component
List<String> tagL = ePFMgr.getArtefactTags(artefact);
Map<String, String> tagLM = new HashMap<String, String>();
for (String tag : tagL) {
tagLM.put(tag, tag);
}
tblE = uifactory.addTextBoxListElement("tagTextbox", null, "tag.textboxlist.hint", tagLM, formLayout, getTranslator());
if (viewOnlyMode || artefactInClosedMap) {
tblE.setEnabled(false);
} else {
Map<String, String> allUsersTags = ePFMgr.getUsersMostUsedTags(getIdentity(), -1);
tblE.setAutoCompleteContent(allUsersTags);
}
// get maps wherein this artefact is linked and create links to them
List<PortfolioStructure> linkedMaps = ePFMgr.getReferencedMapsForArtefact(artefact);
if (linkedMaps != null && linkedMaps.size() != 0) {
List<FormLink> selectMapNames = new ArrayList<FormLink>(linkedMaps.size());
int count = 0;
for (PortfolioStructure ePMap : linkedMaps) {
String mapTitle = StringHelper.escapeHtml(ePMap.getTitle());
FormLink selectMap = uifactory.addFormLink("map-" + count++, "map", mapTitle, null, formLayout, Link.NONTRANSLATED);
selectMap.setUserObject(ePMap.getOlatResource());
selectMap.setEnabled(!viewOnlyMode && !artefactChooseMode);
selectMapNames.add(selectMap);
}
flc.contextPut("maps", selectMapNames);
}
// build link to original source
if (StringHelper.containsNonWhitespace(artefact.getBusinessPath())) {
String sourceLink = createLinkToArtefactSource(ureq, artefact.getBusinessPath());
flc.contextPut("artefactSourceLink", sourceLink);
}
// create a delete button
deleteBtn = uifactory.addFormLink("delete.artefact", formLayout, Link.BUTTON);
deleteBtn.setIconLeftCSS("o_icon o_icon_delete");
deleteBtn.addActionListener(FormEvent.ONCLICK);
if (viewOnlyMode || artefactChooseMode || artefactInClosedMap)
deleteBtn.setVisible(false);
// let the artefact-handler paint what is special for this kind of artefact
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(artefact.getResourceableTypeName());
Controller detCtrl = artHandler.createDetailsController(ureq, getWindowControl(), artefact, viewOnlyMode || artefactInClosedMap);
if (detCtrl != null) {
flc.put("detailsController", detCtrl.getInitialComponent());
}
// create edit buttons the adapt meta-data
if (!(viewOnlyMode || artefactChooseMode || artefactInClosedMap)) {
String reflexion = artefact.getReflexion();
reflexion = FilterFactory.getHtmlTagAndDescapingFilter().filter(reflexion);
reflexion = StringHelper.xssScan(reflexion);
reflexion = Formatter.truncate(reflexion, 50);
if (!StringHelper.containsNonWhitespace(reflexion)) {
// show a link even if empty
reflexion = " ";
}
reflexionBtn = uifactory.addFormLink("reflexionBtn", reflexion, null, formLayout, Link.NONTRANSLATED);
reflexionBtn.setIconLeftCSS("o_icon o_icon_inline_editable");
String description = artefact.getDescription();
description = FilterFactory.getHtmlTagAndDescapingFilter().filter(description);
description = Formatter.truncate(description, 50);
description = StringHelper.xssScan(description);
if (!StringHelper.containsNonWhitespace(description)) {
// show a link even if empty
description = " ";
}
descriptionBtn = uifactory.addFormLink("descriptionBtn", description, null, formLayout, Link.NONTRANSLATED);
descriptionBtn.setIconLeftCSS("o_icon o_icon_inline_editable");
}
// if in artefactChooseMode, add an "choose this" button
if (artefactChooseMode) {
chooseBtn = uifactory.addFormLink("choose.artefact", formLayout, Link.BUTTON);
chooseBtn.addActionListener(FormEvent.ONCLICK);
}
flc.contextPut("artefact", artefact);
setArtAttribConfig(artAttribConfig);
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPAddElementsController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == linkArtefactLink) {
popUpAddArtefactBox(ureq);
} else if (source == addStructLink) {
if (ADD_PAGE.equals(activeType)) {
String title = translate("new.page.title");
String description = translate("new.page.desc");
PortfolioStructure newPage = ePFMgr.createAndPersistPortfolioPage(portfolioStructure, title, description);
DBFactory.getInstance().commit();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, newPage));
} else if (ADD_STRUCTUREELEMENT.equals(activeType)) {
String title = translate("new.structure.title");
String description = translate("new.structure.desc");
PortfolioStructure newStruct = ePFMgr.createAndPersistPortfolioStructureElement(portfolioStructure, title, description);
DBFactory.getInstance().commit();
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, newStruct));
} else if (ADD_PORTFOLIOSTRUCTURE.equals(activeType)) {
// show tree-with maps to choose from
}
}
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPTOCTreeModel method loadChildNode.
protected void loadChildNode(PortfolioStructure structure, TreeNode structureNode) {
structureNode.removeAllChildren();
List<PortfolioStructure> structs = ePFMgr.loadStructureChildren(structure);
for (PortfolioStructure portfolioStructure : structs) {
loadNode(portfolioStructure, structureNode);
}
List<AbstractArtefact> artList = ePFMgr.getArtefacts(structure);
for (AbstractArtefact artefact : artList) {
String artefactIdent = structureNode.getIdent() + artefact.getKey().toString();
GenericTreeNode artefactNode = new GenericTreeNode(artefactIdent, artefact.getTitle(), artefact);
artefactNode.setIconCssClass("o_icon o_ep_artefact " + artefact.getIcon());
structureNode.addChild(artefactNode);
}
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPTOCReadOnlyController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == artOnOffLink) {
displayArtefactsInTOC = !displayArtefactsInTOC;
artOnOffLink.setCustomDisplayText(translate("artOnOffLink." + !displayArtefactsInTOC));
refreshTOC(ureq);
} else if (source instanceof Link) {
// could be a TOC-Link
Link link = (Link) source;
String cmd = link.getCommand();
PortfolioStructure parentStruct = (PortfolioStructure) link.getUserObject();
if (cmd.equals(LINK_CMD_OPEN_STRUCT)) {
fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
} else if (cmd.equals(LINK_CMD_OPEN_ARTEFACT)) {
// open the parent structure
fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT, parentStruct));
} else if (cmd.equals(LINK_CMD_OPEN_COMMENTS)) {
fireEvent(ureq, new EPStructureEvent(EPStructureEvent.SELECT_WITH_COMMENTS, parentStruct));
}
}
}
Aggregations