Search in sources :

Example 46 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

the class AbstractPageListController method forgePendingAssignmentRow.

protected PortfolioElementRow forgePendingAssignmentRow(Assignment assignment, Section section, List<Assignment> assignments) {
    int index = assignments == null ? 0 : assignments.indexOf(assignment);
    PortfolioElementRow row = new PortfolioElementRow(assignment, section, index);
    if (secCallback.canInstantiateAssignment()) {
        if (assignment.getAssignmentStatus() == AssignmentStatus.notStarted) {
            String title = assignment.getTitle();
            FormLink startLink = uifactory.addFormLink("create_assign_" + (++counter), "start.assignment", title, null, flc, Link.NONTRANSLATED);
            startLink.setUserObject(row);
            startLink.setIconLeftCSS("o_icon o_icon_assignment o_icon-fw");
            row.setInstantiateAssignmentLink(startLink);
        }
    } else if (secCallback.canNewAssignment()) {
        if (assignment.getTemplateReference() == null) {
            FormLink editLink = uifactory.addFormLink("edit_assign_" + (++counter), "edit.assignment", "edit", null, flc, Link.BUTTON);
            editLink.setUserObject(row);
            row.setEditAssignmentLink(editLink);
            FormLink deleteLink = uifactory.addFormLink("del_assign_" + (++counter), "delete.assignment", "delete", null, flc, Link.BUTTON);
            deleteLink.setUserObject(row);
            row.setDeleteAssignmentLink(deleteLink);
            FormLink moveLink = uifactory.addFormLink("move_assign_" + (++counter), "move.assignment", "move", null, flc, Link.BUTTON);
            moveLink.setUserObject(row);
            row.setMoveAssignmentLink(moveLink);
            FormLink upLink = uifactory.addFormLink("up_assign_" + (++counter), "up.assignment", "", null, flc, Link.BUTTON | Link.NONTRANSLATED);
            upLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_up");
            upLink.setEnabled(index > 0);
            upLink.setUserObject(row);
            row.setUpAssignmentLink(upLink);
            FormLink downLink = uifactory.addFormLink("down_assign_" + (++counter), "down.assignment", "", null, flc, Link.BUTTON | Link.NONTRANSLATED);
            downLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_down");
            downLink.setUserObject(row);
            downLink.setEnabled(assignments != null && index + 1 != assignments.size());
            row.setDownAssignmentLink(downLink);
        }
    }
    return row;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 47 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

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 48 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

the class BinderController method activateEntries.

private void activateEntries(UserRequest ureq) {
    int numOfPages = doOpenEntries(ureq).getNumOfPages();
    if (numOfPages == 1 && !secCallback.canEditBinder()) {
        PortfolioElementRow firstPage = entriesCtrl.getFirstPage();
        if (firstPage != null) {
            OLATResourceable ores = OresHelper.createOLATResourceableInstance("Page", firstPage.getPage().getKey());
            List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromString(ores);
            entriesCtrl.activate(ureq, entries, null);
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)48 ArrayList (java.util.ArrayList)16 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)14 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)12 Section (org.olat.modules.portfolio.Section)12 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)10 List (java.util.List)8 Assignment (org.olat.modules.portfolio.Assignment)8 Category (org.olat.modules.portfolio.Category)8 Page (org.olat.modules.portfolio.Page)8 HashMap (java.util.HashMap)6 Component (org.olat.core.gui.components.Component)6 FlexiTableRenderEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent)6 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)6 TimelinePoint (org.olat.modules.portfolio.ui.component.TimelinePoint)6 Map (java.util.Map)4 Set (java.util.Set)4