Search in sources :

Example 51 with Assignment

use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method doMoveAssignment.

private void doMoveAssignment(UserRequest ureq, PortfolioElementRow row) {
    if (moveAssignmentCtrl != null)
        return;
    Assignment assignment = row.getAssignment();
    moveAssignmentCtrl = new AssignmentMoveController(ureq, getWindowControl(), assignment, row.getSection());
    listenTo(moveAssignmentCtrl);
    String title = translate("move.assignment");
    cmc = new CloseableModalController(getWindowControl(), null, moveAssignmentCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 52 with Assignment

use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.

the class AbstractPageListController method forgeSectionRow.

protected PortfolioElementRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignments, Map<OLATResourceable, List<Category>> categorizedElementMap) {
    PortfolioElementRow row = new PortfolioElementRow(section, assessmentSection, config.isAssessable(), (assignments != null && assignments.size() > 0));
    String openLinkId = "open_" + (++counter);
    FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL);
    openLink.setIconRightCSS("o_icon o_icon_start");
    openLink.setPrimary(true);
    row.setOpenFormLink(openLink);
    openLink.setUserObject(row);
    addCategoriesToRow(row, categorizedElementMap);
    if (assignments != null && secCallback.canViewPendingAssignments(section) && secCallback.canInstantiateAssignment()) {
        List<Assignment> startableAssignments = assignments.stream().filter(ass -> ass.getAssignmentStatus() == AssignmentStatus.notStarted).filter(ass -> ass.getPage() == null).collect(Collectors.toList());
        if (!startableAssignments.isEmpty()) {
            String[] keys = new String[startableAssignments.size() + 1];
            String[] values = new String[startableAssignments.size() + 1];
            keys[0] = "start.assignment.hint";
            values[0] = translate("start.assignment.hint");
            int count = 1;
            for (Assignment assignment : startableAssignments) {
                keys[count] = Long.toString(assignment.getKey());
                values[count] = assignment.getTitle();
                count++;
            }
            SingleSelection startEl = uifactory.addDropdownSingleselect("assignments_" + (++counter), "", flc, keys, values, null);
            startEl.setDomReplacementWrapperRequired(false);
            startEl.addActionListener(FormEvent.ONCHANGE);
            row.setStartSelection(startEl);
        }
    }
    return row;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Assignment(org.olat.modules.portfolio.Assignment) FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) TimelineElement(org.olat.modules.portfolio.ui.component.TimelineElement) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) ThreadLocalUserActivityLogger(org.olat.core.logging.activity.ThreadLocalUserActivityLogger) PageRemovedEvent(org.olat.modules.portfolio.ui.event.PageRemovedEvent) MediaResource(org.olat.core.gui.media.MediaResource) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) OLATResourceable(org.olat.core.id.OLATResourceable) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration) Category(org.olat.modules.portfolio.Category) OresHelper(org.olat.core.util.resource.OresHelper) Assignment(org.olat.modules.portfolio.Assignment) Map(java.util.Map) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) SectionStatus(org.olat.modules.portfolio.SectionStatus) AssignmentStatus(org.olat.modules.portfolio.AssignmentStatus) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) Page(org.olat.modules.portfolio.Page) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) DialogBoxController(org.olat.core.gui.control.generic.modal.DialogBoxController) PortfolioLoggingAction(org.olat.modules.portfolio.PortfolioLoggingAction) WindowControl(org.olat.core.gui.control.WindowControl) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) Set(java.util.Set) AssignmentType(org.olat.modules.portfolio.AssignmentType) Component(org.olat.core.gui.components.Component) Collectors(java.util.stream.Collectors) Mapper(org.olat.core.dispatcher.mapper.Mapper) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) PortfolioElementCellRenderer(org.olat.modules.portfolio.ui.renderer.PortfolioElementCellRenderer) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) TooledController(org.olat.core.gui.components.stack.TooledController) LoggingResourceable(org.olat.util.logging.activity.LoggingResourceable) ImageComponent(org.olat.core.gui.components.image.ImageComponent) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FileMediaResource(org.olat.core.gui.media.FileMediaResource) Section(org.olat.modules.portfolio.Section) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) PageDeletedEvent(org.olat.modules.portfolio.ui.event.PageDeletedEvent) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) HttpServletRequest(javax.servlet.http.HttpServletRequest) Calendar(java.util.Calendar) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) PageCols(org.olat.modules.portfolio.ui.PageListDataModel.PageCols) PortfolioService(org.olat.modules.portfolio.PortfolioService) Link(org.olat.core.gui.components.link.Link) FlexiTableComponentDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponentDelegate) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) Controller(org.olat.core.gui.control.Controller) File(java.io.File) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) PageImageAlign(org.olat.modules.portfolio.PageImageAlign) DialogBoxUIFactory(org.olat.core.gui.control.generic.modal.DialogBoxUIFactory) UserRequest(org.olat.core.gui.UserRequest) PageStatus(org.olat.modules.portfolio.PageStatus) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 53 with Assignment

use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.

the class BinderPageListController method loadModel.

@Override
protected void loadModel(UserRequest ureq, String searchString) {
    if (StringHelper.containsNonWhitespace(binder.getSummary())) {
        summaryComp.setText(binder.getSummary());
        flc.getFormItemComponent().put("summary", summaryCtrl.getInitialComponent());
    } else {
        flc.getFormItemComponent().remove("summary");
    }
    List<Section> sections = portfolioService.getSections(binder);
    List<CategoryToElement> categorizedElements = portfolioService.getCategorizedSectionsAndPages(binder);
    Map<OLATResourceable, List<Category>> categorizedElementMap = new HashMap<>();
    Map<Section, Set<String>> sectionAggregatedCategoriesMap = new HashMap<>();
    for (CategoryToElement categorizedElement : categorizedElements) {
        List<Category> categories = categorizedElementMap.get(categorizedElement.getCategorizedResource());
        if (categories == null) {
            categories = new ArrayList<>();
            categorizedElementMap.put(categorizedElement.getCategorizedResource(), categories);
        }
        categories.add(categorizedElement.getCategory());
    }
    // comments
    Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfComments(binder);
    // assessment sections
    List<AssessmentSection> assessmentSections = portfolioService.getAssessmentSections(binder, getIdentity());
    Map<Section, AssessmentSection> sectionToAssessmentSectionMap = assessmentSections.stream().collect(Collectors.toMap(as -> as.getSection(), as -> as));
    List<PortfolioElementRow> rows = new ArrayList<>();
    // assignments
    List<Assignment> assignments = portfolioService.getAssignments(binder, searchString);
    Map<Section, List<Assignment>> sectionToAssignmentMap = new HashMap<>();
    for (Assignment assignment : assignments) {
        List<Assignment> assignmentList;
        Section section = assignment.getSection();
        if (sectionToAssignmentMap.containsKey(section)) {
            assignmentList = sectionToAssignmentMap.get(section);
        } else {
            assignmentList = new ArrayList<>();
            sectionToAssignmentMap.put(section, assignmentList);
        }
        assignmentList.add(assignment);
    }
    for (Assignment assignment : assignments) {
        Section section = assignment.getSection();
        if (assignment.getPage() == null && secCallback.canViewPendingAssignments(section)) {
            List<Assignment> sectionAssignments = sectionToAssignmentMap.get(section);
            PortfolioElementRow row = forgePendingAssignmentRow(assignment, section, sectionAssignments);
            rows.add(row);
            if (secCallback.canAddPage(section)) {
                FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
                newEntryButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_entry");
                newEntryButton.setUserObject(row);
                row.setNewEntryLink(newEntryButton);
            }
        }
    }
    boolean userInfos = secCallback.canPageUserInfosStatus();
    Map<Long, PageUserInformations> userInfosToPage = new HashMap<>();
    rowVC.contextPut("userInfos", Boolean.valueOf(userInfos));
    if (userInfos) {
        rowVC.contextPut("userInfosRenderer", new SharedPageStatusCellRenderer(getTranslator()));
        List<PageUserInformations> userInfoList = portfolioService.getPageUserInfos(binder, getIdentity());
        for (PageUserInformations userInfo : userInfoList) {
            userInfosToPage.put(userInfo.getPage().getKey(), userInfo);
        }
    }
    List<Page> pages = portfolioService.getPages(binder, searchString);
    for (Page page : pages) {
        boolean viewElement = secCallback.canViewElement(page);
        boolean viewTitleElement = viewElement || secCallback.canViewTitleOfElement(page);
        if (!viewTitleElement) {
            continue;
        }
        Section section = page.getSection();
        PortfolioElementRow pageRow = forgePageRow(ureq, page, sectionToAssessmentSectionMap.get(section), sectionToAssignmentMap.get(section), categorizedElementMap, numberOfCommentsMap, viewElement);
        rows.add(pageRow);
        if (secCallback.canAddPage(section)) {
            FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
            newEntryButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_entry");
            newEntryButton.setUserObject(pageRow);
            pageRow.setNewEntryLink(newEntryButton);
        }
        if (secCallback.canNewAssignment() && section != null) {
            FormLink newAssignmentButton = uifactory.addFormLink("new.assignment." + (++counter), "new.assignment", "create.new.assignment", null, flc, Link.BUTTON);
            newAssignmentButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_assignment");
            newAssignmentButton.setUserObject(pageRow);
            pageRow.setNewAssignmentLink(newAssignmentButton);
        }
        if (userInfos) {
            PageUserInformations infos = userInfosToPage.get(page.getKey());
            if (infos != null) {
                pageRow.setUserInfosStatus(infos.getStatus());
            }
        }
        if (section != null) {
            Set<String> categories = sectionAggregatedCategoriesMap.get(section);
            if (categories == null) {
                categories = new HashSet<>();
                sectionAggregatedCategoriesMap.put(section, categories);
            }
            if (pageRow.getPageCategories() != null && pageRow.getPageCategories().size() > 0) {
                categories.addAll(pageRow.getPageCategories());
            }
            pageRow.setSectionCategories(categories);
        }
    }
    // sections without pages
    if (!StringHelper.containsNonWhitespace(searchString)) {
        for (Section section : sections) {
            if (!secCallback.canViewElement(section)) {
                continue;
            }
            PortfolioElementRow sectionRow = forgeSectionRow(section, sectionToAssessmentSectionMap.get(section), sectionToAssignmentMap.get(section), categorizedElementMap);
            rows.add(sectionRow);
            if (secCallback.canAddPage(section)) {
                FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
                newEntryButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_entry");
                newEntryButton.setUserObject(sectionRow);
                sectionRow.setNewEntryLink(newEntryButton);
            }
            if (secCallback.canNewAssignment() && section != null) {
                FormLink newAssignmentButton = uifactory.addFormLink("new.assignment." + (++counter), "new.assignment", "create.new.assignment", null, flc, Link.BUTTON);
                newAssignmentButton.setCustomEnabledLinkCSS("btn btn-primary o_sel_pf_new_assignment");
                newAssignmentButton.setUserObject(sectionRow);
                sectionRow.setNewAssignmentLink(newAssignmentButton);
            }
        }
    }
    if (newSectionButton != null && rows.isEmpty()) {
        flc.add("create.new.section", newSectionButton);
    } else if (newSectionButton != null) {
        flc.remove(newSectionButton);
    }
    if (newEntryLink != null && !newEntryLink.isVisible()) {
        newEntryLink.setVisible(rows.size() > 0);
        stackPanel.setDirty(true);
    }
    if (newAssignmentLink != null && !newAssignmentLink.isVisible()) {
        newAssignmentLink.setVisible(rows.size() > 0);
        stackPanel.setDirty(true);
    }
    // clean up the posters
    disposeRows();
    model.setObjects(rows);
    if (filteringSection != null) {
        doFilterSection(filteringSection);
    } else {
        tableEl.reloadData();
        updateTimeline();
    }
}
Also used : Autowired(org.springframework.beans.factory.annotation.Autowired) PageUserInformations(org.olat.modules.portfolio.PageUserInformations) TextFactory(org.olat.core.gui.components.text.TextFactory) MediaResource(org.olat.core.gui.media.MediaResource) OLATResourceable(org.olat.core.id.OLATResourceable) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration) Category(org.olat.modules.portfolio.Category) Assignment(org.olat.modules.portfolio.Assignment) Map(java.util.Map) SortKey(org.olat.core.commons.persistence.SortKey) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) WindowControl(org.olat.core.gui.control.WindowControl) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) Set(java.util.Set) Component(org.olat.core.gui.components.Component) LinkFactory(org.olat.core.gui.components.link.LinkFactory) Collectors(java.util.stream.Collectors) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) List(java.util.List) ExportBinderAsCPResource(org.olat.modules.portfolio.ui.export.ExportBinderAsCPResource) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Align(org.olat.core.gui.components.stack.TooledStackedPanel.Align) Identity(org.olat.core.id.Identity) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) LinkPopupSettings(org.olat.core.gui.components.link.LinkPopupSettings) ExtendedMediaRenderingHints(org.olat.modules.portfolio.model.ExtendedMediaRenderingHints) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Section(org.olat.modules.portfolio.Section) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) HashMap(java.util.HashMap) PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Event(org.olat.core.gui.control.Event) TextComponent(org.olat.core.gui.components.text.TextComponent) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) ExportBinderAsPDFResource(org.olat.modules.portfolio.ui.export.ExportBinderAsPDFResource) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) FlexiTableRenderEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent) Link(org.olat.core.gui.components.link.Link) Controller(org.olat.core.gui.control.Controller) CodeHelper(org.olat.core.util.CodeHelper) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserManager(org.olat.user.UserManager) BaseFullWebappPopupLayoutFactory(org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory) ToggleBoxController(org.olat.core.gui.control.generic.spacesaver.ToggleBoxController) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) PortfolioRoles(org.olat.modules.portfolio.PortfolioRoles) UserRequest(org.olat.core.gui.UserRequest) Binder(org.olat.modules.portfolio.Binder) PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Set(java.util.Set) HashSet(java.util.HashSet) Category(org.olat.modules.portfolio.Category) OLATResourceable(org.olat.core.id.OLATResourceable) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) Assignment(org.olat.modules.portfolio.Assignment) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) List(java.util.List) ArrayList(java.util.ArrayList) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) PageUserInformations(org.olat.modules.portfolio.PageUserInformations) AssessmentSection(org.olat.modules.portfolio.AssessmentSection)

Example 54 with Assignment

use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.

the class TableOfContentController method forgeSectionRow.

private SectionRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignemnts, boolean first, boolean last) {
    String sectionId = "section" + (++counter);
    String title = StringHelper.escapeHtml(section.getTitle());
    List<Assignment> notAssignedAssignments = new ArrayList<>();
    if (secCallback.canViewPendingAssignments(section)) {
        if (assignemnts != null) {
            for (Assignment assignemnt : assignemnts) {
                if (assignemnt.getPage() == null) {
                    notAssignedAssignments.add(assignemnt);
                }
            }
        }
    }
    Link sectionLink = LinkFactory.createCustomLink(sectionId, "open_section", title, Link.LINK | Link.NONTRANSLATED, mainVC, this);
    SectionRow sectionRow = new SectionRow(section, sectionLink, assessmentSection, notAssignedAssignments);
    sectionLink.setUserObject(sectionRow);
    Dropdown editDropdown = new Dropdown(sectionId.concat("_dropdown"), null, false, getTranslator());
    editDropdown.setElementCssClass("o_sel_pf_section_tools");
    editDropdown.setTranslatedLabel("");
    editDropdown.setOrientation(DropdownOrientation.right);
    editDropdown.setIconCSS("o_icon o_icon_actions");
    if (secCallback.canCloseSection(section)) {
        if (SectionStatus.isClosed(section)) {
            Link reopenLink = LinkFactory.createLink(sectionId.concat("_ropens"), "reopen.section", "reopen.section", mainVC, this);
            reopenLink.setUserObject(sectionRow);
            editDropdown.addComponent(reopenLink);
        } else {
            Link closeLink = LinkFactory.createLink(sectionId.concat("_closes"), "close.section", "close.section", mainVC, this);
            closeLink.setUserObject(sectionRow);
            editDropdown.addComponent(closeLink);
        }
        if (section.getEndDate() != null) {
            Link overrideDatesLink = LinkFactory.createLink(sectionId.concat("_overd"), "override.dates.section", "override.dates.section", mainVC, this);
            overrideDatesLink.setUserObject(sectionRow);
            editDropdown.addComponent(overrideDatesLink);
        }
    }
    if (secCallback.canEditSection()) {
        Link editSectionLink = LinkFactory.createLink(sectionId.concat("_edit"), "section.edit", "edit_section", mainVC, this);
        editSectionLink.setIconLeftCSS("o_icon o_icon_edit");
        editSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(editSectionLink);
        Link deleteSectionLink = LinkFactory.createLink(sectionId.concat("_delete"), "section.delete", "delete_section", mainVC, this);
        deleteSectionLink.setElementCssClass("o_sel_pf_delete_section");
        deleteSectionLink.setIconLeftCSS("o_icon o_icon_delete_item");
        deleteSectionLink.setUserObject(sectionRow);
        editDropdown.addComponent(deleteSectionLink);
        Link upSectionLink = LinkFactory.createCustomLink(sectionId.concat("_up"), "up_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        upSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_up");
        upSectionLink.setUserObject(sectionRow);
        upSectionLink.setEnabled(!first);
        sectionRow.setUpSectionLink(upSectionLink);
        Link downSectionLink = LinkFactory.createCustomLink(sectionId.concat("_down"), "down_section", "", Link.LINK | Link.NONTRANSLATED, mainVC, this);
        downSectionLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_down");
        downSectionLink.setUserObject(sectionRow);
        downSectionLink.setEnabled(!last);
        sectionRow.setDownSectionLink(downSectionLink);
    }
    if (editDropdown.getComponents().iterator().hasNext()) {
        mainVC.put(editDropdown.getComponentName(), editDropdown);
        sectionRow.setEditDropdown(editDropdown);
    }
    return sectionRow;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) Link(org.olat.core.gui.components.link.Link)

Example 55 with Assignment

use of org.olat.modules.portfolio.Assignment in project OpenOLAT by OpenOLAT.

the class PortfolioServiceImpl method internalCopyTransientBinder.

private Binder internalCopyTransientBinder(Binder transientBinder, RepositoryEntry entry, String imagePath, boolean copy) {
    Binder binder = binderDao.createAndPersist(transientBinder.getTitle(), transientBinder.getSummary(), imagePath, entry);
    // copy sections
    for (Section transientSection : ((BinderImpl) transientBinder).getSections()) {
        SectionImpl section = binderDao.createSection(transientSection.getTitle(), transientSection.getDescription(), transientSection.getBeginDate(), transientSection.getEndDate(), binder);
        List<Assignment> transientAssignments = ((SectionImpl) transientSection).getAssignments();
        for (Assignment transientAssignment : transientAssignments) {
            if (transientAssignment != null) {
                File newStorage = portfolioFileStorage.generateAssignmentSubDirectory();
                String storage = portfolioFileStorage.getRelativePath(newStorage);
                assignmentDao.createAssignment(transientAssignment.getTitle(), transientAssignment.getSummary(), transientAssignment.getContent(), storage, transientAssignment.getAssignmentType(), transientAssignment.getAssignmentStatus(), section, transientAssignment.isOnlyAutoEvaluation(), transientAssignment.isReviewerSeeAutoEvaluation(), transientAssignment.isAnonymousExternalEvaluation(), transientAssignment.getFormEntry());
                // copy attachments
                File templateDirectory = portfolioFileStorage.getAssignmentDirectory(transientAssignment);
                if (copy && templateDirectory != null) {
                    FileUtils.copyDirContentsToDir(templateDirectory, newStorage, false, "Assignment attachments");
                }
            }
        }
    }
    return binder;
}
Also used : Assignment(org.olat.modules.portfolio.Assignment) Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SectionImpl(org.olat.modules.portfolio.model.SectionImpl) AssessmentSectionImpl(org.olat.modules.portfolio.model.AssessmentSectionImpl) File(java.io.File)

Aggregations

Assignment (org.olat.modules.portfolio.Assignment)78 Section (org.olat.modules.portfolio.Section)48 Binder (org.olat.modules.portfolio.Binder)30 Identity (org.olat.core.id.Identity)28 Test (org.junit.Test)26 Page (org.olat.modules.portfolio.Page)26 ArrayList (java.util.ArrayList)24 RepositoryEntry (org.olat.repository.RepositoryEntry)20 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)18 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)18 SectionRef (org.olat.modules.portfolio.SectionRef)16 File (java.io.File)8 HashMap (java.util.HashMap)8 List (java.util.List)8 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 SectionImpl (org.olat.modules.portfolio.model.SectionImpl)8 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)8 Link (org.olat.core.gui.components.link.Link)6