use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPAddArtefactController method prepareNewTextArtefactWizzard.
/**
* prepare a new text artefact and open with wizzard initialized with a
* special first step for text-artefacts
*
* @param ureq
*/
private void prepareNewTextArtefactWizzard(UserRequest ureq) {
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(EPTextArtefact.TEXT_ARTEFACT_TYPE);
AbstractArtefact artefact1 = artHandler.createArtefact();
artefact1.setAuthor(getIdentity());
artefact1.setSource(translate("text.artefact.source.info"));
artefact1.setCollectionDate(new Date());
artefact1.setSignature(-20);
vfsTemp = ePFMgr.getArtefactsTempContainer(getIdentity());
Step start = new EPCreateTextArtefactStep00(ureq, artefact1, preSelectedStruct, vfsTemp);
StepRunnerCallback finish = new EPArtefactWizzardStepCallback(vfsTemp);
collectStepsCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("create.text.artefact.wizzard.title"), "o_sel_artefact_add_wizard o_sel_artefact_add_text_wizard");
listenTo(collectStepsCtrl);
getWindowControl().pushAsModalDialog(collectStepsCtrl.getInitialComponent());
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPMultipleArtefactSmallReadOnlyPreviewController method init.
private void init(UserRequest ureq) {
if (artefactCtrls != null)
disposeArtefactControllers();
if (optionLinkCtrls != null)
disposeOptionLinkControllers();
optionLinkCtrls = new ArrayList<Controller>();
artefactCtrls = new ArrayList<Controller>();
List<List<Panel>> artefactCtrlCompLines = new ArrayList<List<Panel>>();
List<Panel> artefactCtrlCompLine = new ArrayList<Panel>();
int i = 1;
for (AbstractArtefact artefact : artefacts) {
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(artefact.getResourceableTypeName());
Controller artCtrl;
// check for special art-display:
boolean special = artHandler.isProvidingSpecialMapViewController();
if (special) {
artCtrl = artHandler.getSpecialMapViewController(ureq, getWindowControl(), artefact);
if (artCtrl != null) {
// add the optionsLink to the artefact
EPArtefactViewOptionsLinkController optionsLinkCtrl = new EPArtefactViewOptionsLinkController(ureq, getWindowControl(), artefact, secCallback, struct);
vC.put("optionsLink" + i, optionsLinkCtrl.getInitialComponent());
listenTo(optionsLinkCtrl);
optionLinkCtrls.add(optionsLinkCtrl);
}
} else {
artCtrl = new EPArtefactViewReadOnlyController(ureq, getWindowControl(), artefact, struct, secCallback, true);
}
if (artCtrl != null) {
artefactCtrls.add(artCtrl);
Component artefactCtrlComponent = artCtrl.getInitialComponent();
listenTo(artCtrl);
Panel namedPanel = new Panel("artCtrl" + i);
namedPanel.setContent(artefactCtrlComponent);
if (special) {
if (!artefactCtrlCompLine.isEmpty()) {
artefactCtrlCompLines.add(artefactCtrlCompLine);
}
artefactCtrlCompLines.add(Collections.singletonList(namedPanel));
artefactCtrlCompLine = new ArrayList<Panel>();
} else {
if (artefactCtrlCompLine.size() == 3) {
if (!artefactCtrlCompLine.isEmpty()) {
artefactCtrlCompLines.add(artefactCtrlCompLine);
}
artefactCtrlCompLine = new ArrayList<Panel>();
}
artefactCtrlCompLine.add(namedPanel);
}
vC.put("artCtrl" + i, namedPanel);
if (special) {
// need a flag in a lopp for the velociy template
vC.put("specialartCtrl" + i, artefactCtrlComponent);
}
i++;
}
}
if (!artefactCtrlCompLine.isEmpty()) {
artefactCtrlCompLines.add(artefactCtrlCompLine);
}
vC.contextPut("artefactCtrlCompLines", artefactCtrlCompLines);
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPMultipleArtefactsAsTableController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
OLATResourceable ores = entries.get(0).getOLATResourceable();
if ("AbstractArtefact".equals(ores.getResourceableTypeName())) {
Long resId = ores.getResourceableId();
ArtefactTableDataModel model = (ArtefactTableDataModel) artefactListTblCtrl.getTableDataModel();
for (int i = 0; i < model.getRowCount(); i++) {
AbstractArtefact artefact = model.getObject(i);
if (artefact.getKey().equals(resId)) {
int artefactsPerPage = artefactListTblCtrl.getPageSize();
int rest = (i % artefactsPerPage);
int page = (i - rest) / artefactsPerPage;
artefactListTblCtrl.setPage(new Integer(page + 1));
break;
}
}
}
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPTagBrowseController 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) {
// nothing
if (tagLinks.contains(source)) {
Link tagLink = (Link) source;
TagWrapper tagWrapper = (TagWrapper) tagLink.getUserObject();
if (TagState.possible.equals(tagWrapper.getState())) {
tagWrapper.setState(TagState.selected);
List<AbstractArtefact> artefacts = recalculateTagCloud();
fireEvent(ureq, new EPTagBrowseEvent(artefacts));
} else if (TagState.selected.equals(tagWrapper.getState())) {
tagWrapper.setState(TagState.possible);
List<AbstractArtefact> artefacts = recalculateTagCloud();
fireEvent(ureq, new EPTagBrowseEvent(artefacts));
}
}
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPStructureElementsController 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)
*/
protected void initForm(UserRequest ureq) {
flc.contextPut("structElements", structElements);
tableCtrls = new ArrayList<Controller>();
addBtnCtrls = new ArrayList<Controller>();
int i = 1;
removeComponents();
for (PortfolioStructure portStruct : structElements) {
if (secCallback.isRestrictionsEnabled()) {
List<CollectRestriction> restrictions = portStruct.getCollectRestrictions();
if (!restrictions.isEmpty()) {
boolean check = ePFMgr.checkCollectRestriction(portStruct);
EPCollectRestrictionResultController resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
resultCtrl.setMessage(portStruct.getCollectRestrictions(), check);
flc.put("checkResults" + i, resultCtrl.getInitialComponent());
listenTo(resultCtrl);
}
}
// get artefacts for this structure
List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(portStruct);
if (artefacts.size() != 0) {
EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, portStruct, secCallback);
flc.put("artefacts" + i, artefactCtrl.getInitialComponent());
listenTo(artefactCtrl);
tableCtrls.add(artefactCtrl);
}
if (!parentMapClosed && secCallback.canAddArtefact()) {
// get an addElement-button for each structure
EPAddElementsController addButton = new EPAddElementsController(ureq, getWindowControl(), portStruct);
listenTo(addButton);
addButton.setShowLink(EPAddElementsController.ADD_ARTEFACT);
flc.put("addButton" + i, addButton.getInitialComponent());
addBtnCtrls.add(addButton);
}
i++;
}
if (i != maxStructAmount)
maxStructAmount = i;
}
Aggregations