Skip to content
Snippets Groups Projects
Commit 6f04c0d1 authored by srosse's avatar srosse
Browse files

Merge with da5a6d252f4d6366b48a7ecab34fc4b6242d797b

parents c75acabe e650af60
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ import org.olat.modules.portfolio.ui.media.CollectTextMediaController;
import org.olat.modules.portfolio.ui.model.MediaRow;
import org.olat.modules.portfolio.ui.renderer.MediaTypeCellRenderer;
import org.olat.portfolio.PortfolioModule;
import org.olat.portfolio.manager.EPArtefactManager;
import org.olat.portfolio.manager.EPFrontendManager;
import org.olat.portfolio.model.artefacts.AbstractArtefact;
import org.olat.portfolio.ui.EPArtefactPoolRunController;
import org.olat.portfolio.ui.artefacts.view.EPArtefactChoosenEvent;
......@@ -129,7 +129,7 @@ public class MediaCenterController extends FormBasicController
private PortfolioService portfolioService;
@Autowired
private EPArtefactManager legacyArtefactManager;
private EPFrontendManager legacyEPFontentManager;
@Autowired
private PortfolioModule legacyPortfolioModule;
......@@ -166,7 +166,7 @@ public class MediaCenterController extends FormBasicController
stackPanel.addTool(addCitationLink, Align.left);
// only if there are v1 artefacts available
if (legacyPortfolioModule.isEnabled() && legacyArtefactManager.countArtefacts(getIdentity()) > 0) {
if (legacyPortfolioModule.isEnabled() && legacyEPFontentManager.hasMapOrArtefact(getIdentity())) {
importArtefactV1Link = LinkFactory.createToolLink("import.artefactV1", translate("import.artefactV1"), this);
importArtefactV1Link.setIconLeftCSS("o_icon o_icon-lg o_icon_import");
stackPanel.addTool(importArtefactV1Link, Align.left);
......@@ -653,7 +653,7 @@ public class MediaCenterController extends FormBasicController
private static class NewMediasController extends BasicController {
@Autowired
private EPArtefactManager legacyArtefactManager;
private EPFrontendManager legacyEPFontentManager;
@Autowired
private PortfolioModule legacyPortfolioModule;
......@@ -674,7 +674,7 @@ public class MediaCenterController extends FormBasicController
addCitationLink.setIconLeftCSS("o_icon o_icon_citation");
// only if there are v1 artefacts available
if (legacyPortfolioModule.isEnabled() && legacyArtefactManager.countArtefacts(getIdentity()) > 0) {
if (legacyPortfolioModule.isEnabled() && legacyEPFontentManager.hasMapOrArtefact(getIdentity())) {
importArtefactV1Link = LinkFactory.createLink("import.artefactV1", "import.artefactV1", getTranslator(), mainVc, this, Link.LINK);
importArtefactV1Link.setIconLeftCSS("o_icon o_icon_import");
} else {
......
......@@ -126,9 +126,13 @@ public class EPFrontendManager implements UserDataDeletable, DeletableGroupData
@Autowired
private AssessmentService assessmentService;
/**
* Check if a user has any kind of EP v1 resources: artefacts, a owned map or a shared map
* @param identity
* @return true: yes, has some EP v1 stuff; false: has no EP v1 resources
*/
public boolean hasMapOrArtefact(Identity identity) {
return artefactManager.hasArtefactPool(identity) || structureManager.hasMap(identity);
return artefactManager.hasArtefactPool(identity) || structureManager.hasMap(identity) || structureManager.hasStructureElementsFromOthersWithoutPublic(identity);
}
/**
......
......@@ -417,7 +417,27 @@ public class EPStructureManager {
return query.getResultList();
}
protected boolean hasStructureElementsFromOthersWithoutPublic(IdentityRef ident){
StringBuilder sb = new StringBuilder();
sb.append("select stEl.key from ").append(EPStructureElement.class.getName()).append(" stEl ")
.append(" inner join stEl.groups as relGroup on relGroup.defaultGroup=false")
.append(" inner join relGroup.group as baseGroup")
.append(" inner join baseGroup.members as members")
.append(" where members.identity.key=:identityKey")
.append(" and (relGroup.validFrom is null or relGroup.validFrom<=:date)")
.append(" and (relGroup.validTo is null or relGroup.validTo>=:date)");
List<Long> count = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Long.class)
.setParameter("identityKey", ident.getKey())
.setParameter("date", new Date())
.setFirstResult(0)
.setMaxResults(1)
.getResultList();
return count != null && count.size() > 0 && count.get(0) != null && count.get(0) >= 0;
}
private Class<?> getImplementation(ElementType type) {
switch(type) {
case DEFAULT_MAP: return EPDefaultMap.class;
......
......@@ -10,7 +10,7 @@ create.map.fromTemplate=Mappe aus Vorlage erstellen
create.map.intro=W\u00E4hlen Sie die Art von Sammelmappe, welche Sie erstellen m\u00F6chten.
create.map.selectTemplate=Vorlage ausw\u00E4hlen
enabled=Ein
eportfolio.menu.title=ePortfolio
eportfolio.menu.title=ePortfolio 1.0
eportfolio.menu.title.alt=ePortfolio mit Artefakten und Sammelmappen
handlers.intro=W\u00E4hlen Sie die verf\u00FCgbaren Artefakt-Typen. Ausgeschaltete Artefakte werden angezeigt, k\u00F6nnen aber nicht mehr gesammelt werden.
handlers.title=Artefakt-Typen
......
......@@ -10,7 +10,7 @@ create.map.fromTemplate=Create folder from template
create.map.intro=Please select the type of binder to be created
create.map.selectTemplate=Select template
enabled=Enabled
eportfolio.menu.title=ePortfolio
eportfolio.menu.title=ePortfolio 1.0
eportfolio.menu.title.alt=ePortfolio along with artefacts and binders
handlers.intro=Please select all available artefact types. Deactivated artefacts will be displayed; however, you can no longer collect them.
handlers.title=Artefact types
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment