Search in sources :

Example 21 with PortfolioService

use of org.olat.modules.portfolio.PortfolioService in project openolat by klemens.

the class EvaluationFormHandler method getEditor.

@Override
public Controller getEditor(UserRequest ureq, WindowControl wControl, PageElement element) {
    if (element instanceof EvaluationFormPart) {
        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
        // find assignment
        EvaluationFormPart eva = (EvaluationFormPart) element;
        PageBody body = eva.getBody();
        Assignment assignment = portfolioService.getAssignment(body);
        // find the evaluation form
        RepositoryEntry re = assignment.getFormEntry();
        File repositoryDir = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), FileResourceManager.ZIPDIR);
        File formFile = new File(repositoryDir, FORM_XML_FILE);
        return new EvaluationFormController(ureq, wControl, formFile);
    }
    return null;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) EvaluationFormPart(org.olat.modules.portfolio.model.EvaluationFormPart) PortfolioService(org.olat.modules.portfolio.PortfolioService) RepositoryEntry(org.olat.repository.RepositoryEntry) PageBody(org.olat.modules.portfolio.PageBody) File(java.io.File)

Example 22 with PortfolioService

use of org.olat.modules.portfolio.PortfolioService in project openolat by klemens.

the class EvaluationFormHandler method getControllerForAssignment.

private Controller getControllerForAssignment(UserRequest ureq, WindowControl wControl, PageBody body, Assignment assignment, boolean onePage) {
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    // find the evaluation form
    RepositoryEntry re = assignment.getFormEntry();
    Page page = assignment.getPage();
    PageStatus pageStatus = page.getPageStatus();
    Controller ctrl = null;
    List<AccessRights> accessRights = portfolioService.getAccessRights(page);
    boolean anonym = assignment.isAnonymousExternalEvaluation();
    if (pageStatus == null || pageStatus == PageStatus.draft) {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, false, false);
        }
    } else if (assignment.isOnlyAutoEvaluation()) {
        // only the auto evaluation is shown
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted);
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
            }
        }
    } else {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            if (coachesAndReviewers.size() > 0) {
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
            }
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                List<Identity> reviewers = Collections.singletonList(ureq.getIdentity());
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, reviewers, body, re, true, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, !readOnly);
            }
        }
    }
    return ctrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioHomeController(org.olat.modules.portfolio.ui.PortfolioHomeController) AccessRights(org.olat.modules.portfolio.model.AccessRights) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioService(org.olat.modules.portfolio.PortfolioService) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Example 23 with PortfolioService

use of org.olat.modules.portfolio.PortfolioService in project openolat by klemens.

the class CollaborationTools method createPortfolioController.

/**
 * @param ureq
 * @param wControl
 * @param mapProperty The property is mandatory!
 * @return
 */
private Controller createPortfolioController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, Property mapProperty) {
    Long key = mapProperty.getLongValue();
    String version = mapProperty.getStringValue();
    Controller ctrl;
    if ("2".equals(version)) {
        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
        Binder binder = portfolioService.getBinderByKey(key);
        portfolioService.updateBinderUserInformations(binder, ureq.getIdentity());
        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
        BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
        ctrl = binderCtrl;
    } else {
        PortfolioStructureMap map = (PortfolioStructureMap) CoreSpringFactory.getImpl(EPFrontendManager.class).loadPortfolioStructureByKey(key);
        EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
        ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
    }
    return ctrl;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Binder(org.olat.modules.portfolio.Binder) PortfolioService(org.olat.modules.portfolio.PortfolioService) BinderController(org.olat.modules.portfolio.ui.BinderController) EPSecurityCallback(org.olat.portfolio.EPSecurityCallback) 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)

Example 24 with PortfolioService

use of org.olat.modules.portfolio.PortfolioService 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;
            }
        });
    }
}
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)

Aggregations

PortfolioService (org.olat.modules.portfolio.PortfolioService)24 Binder (org.olat.modules.portfolio.Binder)12 Controller (org.olat.core.gui.control.Controller)10 EvaluationFormController (org.olat.modules.forms.ui.EvaluationFormController)8 MultiEvaluationFormController (org.olat.modules.portfolio.ui.MultiEvaluationFormController)8 RepositoryEntry (org.olat.repository.RepositoryEntry)7 File (java.io.File)6 PortfolioHomeController (org.olat.modules.portfolio.ui.PortfolioHomeController)6 OLATResource (org.olat.resource.OLATResource)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 CalendarController (org.olat.commons.calendar.ui.CalendarController)4 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)4 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)4 Translator (org.olat.core.gui.translator.Translator)4 Identity (org.olat.core.id.Identity)4 CourseLinkProviderController (org.olat.course.run.calendar.CourseLinkProviderController)4 InfoGroupRunController (org.olat.group.ui.run.InfoGroupRunController)4 ChatToolController (org.olat.instantMessaging.ui.ChatToolController)4 ContactFormController (org.olat.modules.co.ContactFormController)4