Search in sources :

Example 6 with EPFrontendManager

use of org.olat.portfolio.manager.EPFrontendManager in project OpenOLAT by OpenOLAT.

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;
            }
        });
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) ChatToolController(org.olat.instantMessaging.ui.ChatToolController) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) BinderController(org.olat.modules.portfolio.ui.BinderController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) ContactFormController(org.olat.modules.co.ContactFormController) Controller(org.olat.core.gui.control.Controller) CalendarController(org.olat.commons.calendar.ui.CalendarController) InfoGroupRunController(org.olat.group.ui.run.InfoGroupRunController) EPSecurityCallbackImpl(org.olat.portfolio.EPSecurityCallbackImpl) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) Binder(org.olat.modules.portfolio.Binder) PortfolioService(org.olat.modules.portfolio.PortfolioService) BinderController(org.olat.modules.portfolio.ui.BinderController) Translator(org.olat.core.gui.translator.Translator) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) EPSecurityCallback(org.olat.portfolio.EPSecurityCallback) ArrayList(java.util.ArrayList) List(java.util.List) NarrowedPropertyManager(org.olat.properties.NarrowedPropertyManager) Property(org.olat.properties.Property)

Example 7 with EPFrontendManager

use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.

the class PortfolioExtension method createUserTool.

@Override
public UserTool createUserTool(UserRequest ureq, WindowControl wControl, Locale locale) {
    EPFrontendManager epMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    boolean hasMapOrArtefact = epMgr.hasMapOrArtefact(ureq.getIdentity());
    if (hasMapOrArtefact) {
        return super.createUserTool(ureq, wControl, locale);
    }
    return null;
}
Also used : EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 8 with EPFrontendManager

use of org.olat.portfolio.manager.EPFrontendManager in project openolat by klemens.

the class PortfolioHandler method createResource.

@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    PortfolioStructureMap mapTemp = eSTMgr.createAndPersistPortfolioMapTemplateFromEntry(initialAuthor, re);
    // add a page, as each map should have at least one per default!
    Translator pt = Util.createPackageTranslator(EPCreateMapController.class, locale);
    String pageTitle = pt.translate("new.page.title");
    String pageDescription = pt.translate("new.page.desc");
    ePFMgr.createAndPersistPortfolioPage(mapTemp, pageTitle, pageDescription);
    DBFactory.getInstance().commit();
    return re;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Translator(org.olat.core.gui.translator.Translator) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager) RepositoryService(org.olat.repository.RepositoryService)

Example 9 with EPFrontendManager

use of org.olat.portfolio.manager.EPFrontendManager in project OpenOLAT by OpenOLAT.

the class PortfolioExtension method createUserTool.

@Override
public UserTool createUserTool(UserRequest ureq, WindowControl wControl, Locale locale) {
    EPFrontendManager epMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    boolean hasMapOrArtefact = epMgr.hasMapOrArtefact(ureq.getIdentity());
    if (hasMapOrArtefact) {
        return super.createUserTool(ureq, wControl, locale);
    }
    return null;
}
Also used : EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 10 with EPFrontendManager

use of org.olat.portfolio.manager.EPFrontendManager in project OpenOLAT by OpenOLAT.

the class PortfolioHandler method importResource.

@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
    RepositoryEntry re = null;
    PortfolioStructure structure = EPXStreamHandler.getAsObject(file, false);
    if (structure != null) {
        OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
        re = CoreSpringFactory.getImpl(RepositoryService.class).create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
        ePFMgr.importPortfolioMapTemplate(structure, resource);
    }
    return re;
}
Also used : PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) EPStructureManager(org.olat.portfolio.manager.EPStructureManager)

Aggregations

EPFrontendManager (org.olat.portfolio.manager.EPFrontendManager)20 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)10 RepositoryEntry (org.olat.repository.RepositoryEntry)8 Translator (org.olat.core.gui.translator.Translator)6 OLATResource (org.olat.resource.OLATResource)6 EPStructureManager (org.olat.portfolio.manager.EPStructureManager)4 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)4 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CalendarController (org.olat.commons.calendar.ui.CalendarController)2 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)2 Controller (org.olat.core.gui.control.Controller)2 MediaResource (org.olat.core.gui.media.MediaResource)2 StreamedMediaResource (org.olat.core.gui.media.StreamedMediaResource)2 Roles (org.olat.core.id.Roles)2 EfficiencyStatement (org.olat.course.assessment.EfficiencyStatement)2