Search in sources :

Example 1 with PortfolioModule

use of org.olat.portfolio.PortfolioModule in project OpenOLAT by OpenOLAT.

the class EPArtefactWizzardStepCallback method execute.

/**
 * @see org.olat.core.gui.control.generic.wizard.StepRunnerCallback#execute(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.core.gui.control.generic.wizard.StepsRunContext)
 */
@Override
public Step execute(UserRequest ureq2, WindowControl wControl, StepsRunContext runContext) {
    boolean hasChanges = false;
    if (runContext.containsKey("artefact")) {
        hasChanges = true;
        AbstractArtefact locArtefact = (AbstractArtefact) runContext.get("artefact");
        ePFMgr = (EPFrontendManager) CoreSpringFactory.getBean("epFrontendManager");
        PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
        // set the defined signature level, if its not from inside olat
        if (locArtefact.getSignature() < 0 && ((runContext.containsKey("copyright.accepted") && (Boolean) runContext.get("copyright.accepted")) || !portfolioModule.isCopyrightStepEnabled())) {
            locArtefact.setSignature(-1 * locArtefact.getSignature());
        }
        ePFMgr.updateArtefact(locArtefact);
        if (runContext.containsKey("tempArtFolder")) {
            // a new text or file-artefact was created, copy everything to destination
            VFSContainer tmpFolder = (VFSContainer) runContext.get("tempArtFolder");
            copyFromTempToArtefactContainer(locArtefact, tmpFolder);
        } else if (tempUpload != null) {
            // an artefact was collected in bc, only copy the selected file
            copyFromBCToArtefactContainer(locArtefact, tempUpload);
        }
        // add to a structure if any was selected
        if (runContext.containsKey("selectedStructure")) {
            PortfolioStructure parentStructure = (PortfolioStructure) runContext.get("selectedStructure");
            if (parentStructure != null) {
                ePFMgr.addArtefactToStructure(ureq2.getIdentity(), locArtefact, parentStructure);
            }
        }
        @SuppressWarnings("unchecked") List<String> allTags = (List<String>) runContext.get("artefactTagsList");
        ePFMgr.setArtefactTags(ureq2.getIdentity(), locArtefact, allTags);
        ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(locArtefact));
        ThreadLocalUserActivityLogger.log(EPLoggingAction.EPORTFOLIO_ARTEFACT_ADDED, getClass());
    }
    return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) List(java.util.List) PortfolioModule(org.olat.portfolio.PortfolioModule)

Example 2 with PortfolioModule

use of org.olat.portfolio.PortfolioModule in project OpenOLAT by OpenOLAT.

the class UserInfoMainController method buildTreeModel.

/**
 * Generates the archiver menu
 *
 * @return The generated menu tree model
 * @param firstLastName
 */
private GenericTreeModel buildTreeModel(String name) {
    GenericTreeNode root, gtn;
    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode();
    root.setTitle(name);
    root.setAltText(name);
    root.setAccessible(false);
    gtm.setRootNode(root);
    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.homepage"));
    gtn.setUserObject(CMD_HOMEPAGE);
    gtn.setAltText(translate("menu.homepage.alt"));
    root.addChild(gtn);
    // following user info elements are only shown for undeleted and real
    // users (not invited
    // eportfolio users)
    boolean isInvitee = invitationDao.isInvitee(chosenIdentity);
    boolean isDeleted = chosenIdentity.getStatus().equals(Identity.STATUS_DELETED);
    if (!isDeleted && !isInvitee) {
        if (calendarModule.isEnablePersonalCalendar()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.calendar"));
            gtn.setUserObject(CMD_CALENDAR);
            gtn.setAltText(translate("menu.calendar.alt"));
            gtn.setCssClass("o_visiting_card_calendar");
            root.addChild(gtn);
        }
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.folder"));
        gtn.setUserObject(CMD_FOLDER);
        gtn.setAltText(translate("menu.folder.alt"));
        gtn.setCssClass("o_visiting_card_folder");
        root.addChild(gtn);
    }
    if (!isDeleted) {
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.contact"));
        gtn.setUserObject(CMD_CONTACT);
        gtn.setAltText(translate("menu.contact.alt"));
        gtn.setCssClass("o_visiting_card_contact");
        root.addChild(gtn);
    }
    if (!isDeleted && !isInvitee) {
        PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
        if (portfolioModule.isEnabled()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.portfolio"));
            gtn.setUserObject(CMD_PORTFOLIO);
            gtn.setAltText(translate("menu.portfolio.alt"));
            gtn.setCssClass("o_visiting_card_portfolio");
            root.addChild(gtn);
        }
    }
    return gtm;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) PortfolioModule(org.olat.portfolio.PortfolioModule)

Example 3 with PortfolioModule

use of org.olat.portfolio.PortfolioModule in project OpenOLAT by OpenOLAT.

the class EPCollectRestrictionResultController method getMessageArgs.

public static String[] getMessageArgs(CollectRestriction restriction, Translator translator) {
    String[] args = new String[3];
    args[0] = translator.translate("restriction." + restriction.getRestriction());
    PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
    EPArtefactHandler<?> handler = portfolioModule.getArtefactHandler(restriction.getArtefactType());
    if (handler != null) {
        String handlerClass = PortfolioFilterController.HANDLER_PREFIX + handler.getClass().getSimpleName() + PortfolioFilterController.HANDLER_TITLE_SUFFIX;
        args[1] = handler.getHandlerTranslator(translator).translate(handlerClass);
    } else {
        args[1] = translator.translate("restriction.handler.unknown");
    }
    args[2] = Integer.toString(restriction.getAmount());
    return args;
}
Also used : PortfolioModule(org.olat.portfolio.PortfolioModule)

Example 4 with PortfolioModule

use of org.olat.portfolio.PortfolioModule in project OpenOLAT by OpenOLAT.

the class CollaborationToolsFactory method initAvailableTools.

/**
 * Helper method to initialize the list of enabled tools based system wide
 * configuration.
 */
public synchronized void initAvailableTools() {
    ArrayList<String> toolArr = new ArrayList<String>();
    toolArr.add(CollaborationTools.TOOL_NEWS);
    toolArr.add(CollaborationTools.TOOL_CONTACT);
    CalendarModule calendarModule = CoreSpringFactory.getImpl(CalendarModule.class);
    if (calendarModule.isEnabled() && calendarModule.isEnableGroupCalendar()) {
        toolArr.add(CollaborationTools.TOOL_CALENDAR);
    }
    toolArr.add(CollaborationTools.TOOL_FOLDER);
    toolArr.add(CollaborationTools.TOOL_FORUM);
    if (CoreSpringFactory.getImpl(InstantMessagingModule.class).isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_CHAT);
    }
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (securityModule.isWikiEnabled()) {
        toolArr.add(CollaborationTools.TOOL_WIKI);
    }
    PortfolioModule portfolioModule = CoreSpringFactory.getImpl(PortfolioModule.class);
    PortfolioV2Module portfolioV2Module = CoreSpringFactory.getImpl(PortfolioV2Module.class);
    if (portfolioModule.isEnabled() || portfolioV2Module.isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_PORTFOLIO);
    }
    OpenMeetingsModule openMeetingsModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
    if (openMeetingsModule.isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_OPENMEETINGS);
    }
    TOOLS = ArrayHelper.toArray(toolArr);
}
Also used : ArrayList(java.util.ArrayList) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) CalendarModule(org.olat.commons.calendar.CalendarModule) OpenMeetingsModule(org.olat.modules.openmeetings.OpenMeetingsModule) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule) PortfolioModule(org.olat.portfolio.PortfolioModule)

Example 5 with PortfolioModule

use of org.olat.portfolio.PortfolioModule in project openolat by klemens.

the class UserInfoMainController method buildTreeModel.

/**
 * Generates the archiver menu
 *
 * @return The generated menu tree model
 * @param firstLastName
 */
private GenericTreeModel buildTreeModel(String name) {
    GenericTreeNode root, gtn;
    GenericTreeModel gtm = new GenericTreeModel();
    root = new GenericTreeNode();
    root.setTitle(name);
    root.setAltText(name);
    root.setAccessible(false);
    gtm.setRootNode(root);
    gtn = new GenericTreeNode();
    gtn.setTitle(translate("menu.homepage"));
    gtn.setUserObject(CMD_HOMEPAGE);
    gtn.setAltText(translate("menu.homepage.alt"));
    root.addChild(gtn);
    // following user info elements are only shown for undeleted and real
    // users (not invited
    // eportfolio users)
    boolean isInvitee = invitationDao.isInvitee(chosenIdentity);
    boolean isDeleted = chosenIdentity.getStatus().equals(Identity.STATUS_DELETED);
    if (!isDeleted && !isInvitee) {
        if (calendarModule.isEnablePersonalCalendar()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.calendar"));
            gtn.setUserObject(CMD_CALENDAR);
            gtn.setAltText(translate("menu.calendar.alt"));
            gtn.setCssClass("o_visiting_card_calendar");
            root.addChild(gtn);
        }
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.folder"));
        gtn.setUserObject(CMD_FOLDER);
        gtn.setAltText(translate("menu.folder.alt"));
        gtn.setCssClass("o_visiting_card_folder");
        root.addChild(gtn);
    }
    if (!isDeleted) {
        gtn = new GenericTreeNode();
        gtn.setTitle(translate("menu.contact"));
        gtn.setUserObject(CMD_CONTACT);
        gtn.setAltText(translate("menu.contact.alt"));
        gtn.setCssClass("o_visiting_card_contact");
        root.addChild(gtn);
    }
    if (!isDeleted && !isInvitee) {
        PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
        if (portfolioModule.isEnabled()) {
            gtn = new GenericTreeNode();
            gtn.setTitle(translate("menu.portfolio"));
            gtn.setUserObject(CMD_PORTFOLIO);
            gtn.setAltText(translate("menu.portfolio.alt"));
            gtn.setCssClass("o_visiting_card_portfolio");
            root.addChild(gtn);
        }
    }
    return gtm;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) PortfolioModule(org.olat.portfolio.PortfolioModule)

Aggregations

PortfolioModule (org.olat.portfolio.PortfolioModule)8 ArrayList (java.util.ArrayList)2 List (java.util.List)2 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)2 CalendarModule (org.olat.commons.calendar.CalendarModule)2 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 InstantMessagingModule (org.olat.instantMessaging.InstantMessagingModule)2 OpenMeetingsModule (org.olat.modules.openmeetings.OpenMeetingsModule)2 PortfolioV2Module (org.olat.modules.portfolio.PortfolioV2Module)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2