use of org.olat.portfolio.model.structel.EPAbstractMap in project openolat by klemens.
the class EPTOCController method checkArtefactTarget.
private boolean checkArtefactTarget(AbstractArtefact artefact, Object targetObj) {
PortfolioStructure newParStruct;
if (targetObj instanceof EPAbstractMap) {
return false;
} else if (targetObj instanceof PortfolioStructure) {
newParStruct = (PortfolioStructure) targetObj;
} else {
return false;
}
boolean sameTarget = ePFMgr.isArtefactInStructure(artefact, newParStruct);
if (sameTarget) {
return false;
}
return true;
}
use of org.olat.portfolio.model.structel.EPAbstractMap in project openolat by klemens.
the class EPTOCTreeModel method checkArtefactTarget.
private boolean checkArtefactTarget(Object droppedParentObj, AbstractArtefact artefact, Object targetObj, Object targetParentObj, boolean sibling) {
PortfolioStructure newParStruct;
if (targetObj instanceof EPAbstractMap) {
return false;
} else if (targetObj instanceof PortfolioStructure) {
newParStruct = (PortfolioStructure) targetObj;
} else if (sibling) {
if (targetObj instanceof AbstractArtefact && targetParentObj instanceof PortfolioStructure) {
if (droppedParentObj != null && droppedParentObj.equals(targetParentObj)) {
// reorder
return true;
} else {
newParStruct = (PortfolioStructure) targetParentObj;
}
} else {
return false;
}
} else {
return false;
}
boolean sameTarget = ePFMgr.isArtefactInStructure(artefact, newParStruct);
if (sameTarget) {
return false;
}
return true;
}
use of org.olat.portfolio.model.structel.EPAbstractMap in project OpenOLAT by OpenOLAT.
the class EPTOCController 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 instanceof Link) {
Link link = (Link) source;
if (link.getCommand().equals(DELETE_LINK_CMD)) {
if (artefactClicked != null) {
AbstractArtefact artefact = artefactClicked;
PortfolioStructure parentStruct = getArtefactParentStruct(artefactClicked);
ePFMgr.removeArtefactFromStructure(artefact, parentStruct);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else if (structureClicked != null) {
if ((structureClicked instanceof EPPage) && !(structureClicked instanceof EPAbstractMap)) {
PortfolioStructure ps = structureClicked;
while (ePFMgr.loadStructureParent(ps) != null) {
ps = ePFMgr.loadStructureParent(ps);
}
int childPages = ePFMgr.countStructureChildren(ps);
if (childPages > 1) {
eSTMgr.removeStructureRecursively(structureClicked);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else {
showError("last.page.not.deletable");
}
} else if (structureClicked instanceof EPStructureElement && !(structureClicked instanceof EPAbstractMap)) {
// structures should always be deletable
eSTMgr.removeStructureRecursively(structureClicked);
// refresh the view
fireEvent(ureq, Event.CHANGED_EVENT);
} else {
showInfo("element.not.deletable");
}
}
}
} else if (source == treeCtr) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
doSelectTreeElement(ureq, te);
}
} else if (event instanceof TreeDropEvent) {
TreeDropEvent te = (TreeDropEvent) event;
doDrop(ureq, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild());
}
}
}
use of org.olat.portfolio.model.structel.EPAbstractMap in project OpenOLAT by OpenOLAT.
the class EPTOCTreeModel method checkArtefactTarget.
private boolean checkArtefactTarget(Object droppedParentObj, AbstractArtefact artefact, Object targetObj, Object targetParentObj, boolean sibling) {
PortfolioStructure newParStruct;
if (targetObj instanceof EPAbstractMap) {
return false;
} else if (targetObj instanceof PortfolioStructure) {
newParStruct = (PortfolioStructure) targetObj;
} else if (sibling) {
if (targetObj instanceof AbstractArtefact && targetParentObj instanceof PortfolioStructure) {
if (droppedParentObj != null && droppedParentObj.equals(targetParentObj)) {
// reorder
return true;
} else {
newParStruct = (PortfolioStructure) targetParentObj;
}
} else {
return false;
}
} else {
return false;
}
boolean sameTarget = ePFMgr.isArtefactInStructure(artefact, newParStruct);
if (sameTarget) {
return false;
}
return true;
}
use of org.olat.portfolio.model.structel.EPAbstractMap in project OpenOLAT by OpenOLAT.
the class EPCollectStepForm04 method formOK.
/**
* @see org.olat.core.gui.control.generic.wizard.StepFormBasicController#formOK(org.olat.core.gui.UserRequest)
*/
@Override
protected void formOK(UserRequest ureq) {
PortfolioStructure selectedPortfolioStructure = preSelectedStructure;
TreeNode node = mapsTreeController == null ? null : mapsTreeController.getSelectedNode();
if (node != null) {
Object obj = node.getUserObject();
if (obj == null) {
selectedPortfolioStructure = null;
} else if (obj instanceof PortfolioStructure && !(obj instanceof EPAbstractMap)) {
selectedPortfolioStructure = (PortfolioStructure) obj;
}
}
if (selectedPortfolioStructure != null) {
ePFMgr.setUsersLastUsedPortfolioStructure(getIdentity(), selectedPortfolioStructure);
}
if (isUsedInStepWizzard()) {
addToRunContext("selectedStructure", selectedPortfolioStructure);
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
} else {
if (selectedPortfolioStructure != null && !selectedPortfolioStructure.getKey().equals(oldStructure.getKey())) {
ePFMgr.moveArtefactFromStructToStruct(artefact, oldStructure, selectedPortfolioStructure);
// refresh ui
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.CHANGED, selectedPortfolioStructure));
}
}
}
Aggregations