use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.
the class PortfolioHandler method getAsMediaResource.
/**
* Transform the map in a XML file and zip it (Repository export want a zip)
* @see org.olat.repository.handlers.RepositoryHandler#getAsMediaResource(org.olat.core.id.OLATResourceable)
*/
@Override
public MediaResource getAsMediaResource(OLATResourceable res, boolean backwardsCompatible) {
MediaResource mr = null;
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
PortfolioStructure structure = ePFMgr.loadPortfolioStructure(res);
try {
InputStream inOut = EPXStreamHandler.toStream(structure);
mr = new StreamedMediaResource(inOut, null, null, null);
} catch (IOException e) {
log.error("Cannot export this map: " + structure, e);
}
return mr;
}
use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.
the class FeedMediaDispatcher method hasAccess.
/**
* Verifiy if the identity has access to the feed.
*
* @param identity
* @param token
* @param feed
* @return true if the identity has access.
*/
private boolean hasAccess(Identity identity, String token, OLATResourceable feed) {
boolean hasAccess = false;
RepositoryManager resMgr = RepositoryManager.getInstance();
RepositoryEntry repoEntry = resMgr.lookupRepositoryEntry(feed, false);
if (allowsGuestAccess(repoEntry)) {
hasAccess = true;
} else if (identity != null) {
if (repoEntry != null) {
final Roles roles = BaseSecurityManager.getInstance().getRoles(identity);
final boolean isAllowedToLaunch = resMgr.isAllowedToLaunch(identity, roles, repoEntry);
if (isAllowedToLaunch && validAuthentication(identity, token)) {
hasAccess = true;
}
} else {
// no repository entry -> could be a feed without a repository-entry (ePortfolio-Blog-feed)
EPFrontendManager ePFMgr = (EPFrontendManager) CoreSpringFactory.getBean("epFrontendManager");
if (ePFMgr.checkFeedAccess(feed, identity)) {
return validAuthentication(identity, token);
}
}
}
return hasAccess;
}
use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.
the class CollaborationTools method createPortfolioController.
/**
* return an controller for the wiki tool
* @param ureq
* @param wControl
* @return
*/
public Controller createPortfolioController(final UserRequest ureq, final WindowControl wControl, final TooledStackedPanel stackPanel, final BusinessGroup group) {
final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property mapProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
if (mapProperty != null) {
return createPortfolioController(ureq, wControl, stackPanel, mapProperty);
} else {
return coordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Controller>() {
@Override
public Controller execute() {
Controller ctrl;
Property mapKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
if (mapKeyProperty == null) {
PortfolioV2Module moduleV2 = CoreSpringFactory.getImpl(PortfolioV2Module.class);
if (moduleV2.isEnabled()) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Binder binder = portfolioService.createNewBinder(group.getName(), group.getDescription(), null, null);
CoreSpringFactory.getImpl(BinderUserInformationsDAO.class).updateBinderUserInformationsInSync(binder, ureq.getIdentity());
mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, binder.getKey(), "2", null);
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType("Toc");
binderCtrl.activate(ureq, entries, null);
ctrl = binderCtrl;
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(binder));
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_BINDER_CREATED, getClass());
} else {
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
PortfolioStructureMap map = ePFMgr.createAndPersistPortfolioDefaultMap(group.getName(), group.getDescription());
Translator pT = Util.createPackageTranslator(EPCreateMapController.class, ureq.getLocale());
// add a page, as each map should have at least one per default!
ePFMgr.createAndPersistPortfolioPage(map, pT.translate("new.page.title"), pT.translate("new.page.desc"));
mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, map.getKey(), null, null);
EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
}
npm.saveProperty(mapKeyProperty);
} else {
ctrl = createPortfolioController(ureq, wControl, stackPanel, mapProperty);
}
return ctrl;
}
});
}
}
use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.
the class EfficiencyStatementArtefactHandler method createDetailsController.
@Override
public Controller createDetailsController(UserRequest ureq, WindowControl wControl, AbstractArtefact artefact, boolean readOnlyMode) {
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
String statementXml = ePFMgr.getArtefactFullTextContent(artefact);
EfficiencyStatement statement = null;
if (StringHelper.containsNonWhitespace(statementXml)) {
try {
statement = (EfficiencyStatement) myXStream.fromXML(statementXml);
} catch (Exception e) {
log.error("Cannot load efficiency statement from artefact", e);
}
}
CertificateAndEfficiencyStatementController efficiencyCtrl = new CertificateAndEfficiencyStatementController(wControl, ureq, statement);
return new LayoutMain3ColsController(ureq, wControl, efficiencyCtrl);
}
use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.
the class PortfolioCourseNode method importNode.
@Override
public void importNode(File importDirectory, ICourse course, Identity owner, Locale locale, boolean withReferences) {
RepositoryEntryImportExport rie = new RepositoryEntryImportExport(importDirectory, getIdent());
if (withReferences && rie.anyExportedPropertiesAvailable()) {
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(EPTemplateMapResource.TYPE_NAME);
RepositoryEntry re = handler.importResource(owner, rie.getInitialAuthor(), rie.getDisplayName(), rie.getDescription(), false, locale, rie.importGetExportedFile(), null);
if (re != null) {
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
PortfolioStructure map = ePFMgr.loadPortfolioStructure(re.getOlatResource());
PortfolioCourseNodeEditController.setReference(re, map, getModuleConfiguration());
} else {
PortfolioCourseNodeEditController.removeReference(getModuleConfiguration());
}
} else {
PortfolioCourseNodeEditController.removeReference(getModuleConfiguration());
}
}
Aggregations