Search in sources :

Example 1 with ContextualSubscriptionController

use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.

the class HistoryController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (!ureq.getUserSession().getRoles().isGuestOnly()) {
        subsContext = new SubscriptionContext(PortfolioNotificationsHandler.TYPE_NAME, binder.getKey(), PortfolioNotificationsHandler.TYPE_NAME);
        if (subsContext != null) {
            String businessPath = "[Binder:" + binder.getKey() + "]";
            PublisherData data = new PublisherData(PortfolioNotificationsHandler.TYPE_NAME, null, businessPath);
            cSubscriptionCtrl = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, data);
            listenTo(cSubscriptionCtrl);
            flc.put("subscription", cSubscriptionCtrl.getInitialComponent());
        }
    }
    dateChooser = uifactory.addDateChooser("dateChooser", "changes.since", null, formLayout);
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    cal.set(Calendar.DATE, -8);
    dateChooser.setDate(cal.getTime());
    dateChooser.addActionListener(FormEvent.ONCHANGE);
}
Also used : ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) Calendar(java.util.Calendar) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) PublisherData(org.olat.core.commons.services.notifications.PublisherData) Date(java.util.Date)

Example 2 with ContextualSubscriptionController

use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.

the class GTAAbstractController method process.

protected final void process(UserRequest ureq) {
    Task task;
    if (businessGroupTask) {
        task = gtaManager.getTask(assessedGroup, taskList);
    } else {
        task = gtaManager.getTask(assessedIdentity, taskList);
    }
    if (withSubscription && subsContext != null) {
        contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
        listenTo(contextualSubscriptionCtr);
        mainVC.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
    }
    boolean assignment = config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT);
    mainVC.contextPut("assignmentEnabled", assignment);
    if (assignment) {
        task = stepAssignment(ureq, task);
    } else if (task == null) {
        TaskProcess firstStep = gtaManager.firstStep(gtaNode);
        task = gtaManager.createTask(null, taskList, firstStep, assessedGroup, assessedIdentity, gtaNode);
    }
    boolean submit = config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT);
    mainVC.contextPut("submitEnabled", submit);
    if (submit) {
        task = stepSubmit(ureq, task);
    } else if (task != null && task.getTaskStatus() == TaskProcess.submit) {
        task = gtaManager.nextStep(task, gtaNode, Role.auto);
    }
    boolean reviewAndCorrection = config.getBooleanSafe(GTACourseNode.GTASK_REVIEW_AND_CORRECTION);
    mainVC.contextPut("reviewAndCorrectionEnabled", reviewAndCorrection);
    if (reviewAndCorrection) {
        task = stepReviewAndCorrection(ureq, task);
    } else if (task != null && task.getTaskStatus() == TaskProcess.review) {
        task = gtaManager.nextStep(task, gtaNode, Role.auto);
    }
    boolean revision = config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD);
    mainVC.contextPut("revisionEnabled", reviewAndCorrection && revision);
    if (reviewAndCorrection && revision) {
        task = stepRevision(ureq, task);
    } else if (task != null && (task.getTaskStatus() == TaskProcess.revision || task.getTaskStatus() == TaskProcess.correction)) {
        task = gtaManager.nextStep(task, gtaNode, Role.auto);
    }
    boolean solution = config.getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION);
    mainVC.contextPut("solutionEnabled", solution);
    if (solution) {
        stepSolution(ureq, task);
    } else if (task != null && task.getTaskStatus() == TaskProcess.solution) {
        task = gtaManager.nextStep(task, gtaNode, Role.auto);
    }
    boolean grading = config.getBooleanSafe(GTACourseNode.GTASK_GRADING);
    mainVC.contextPut("gradingEnabled", grading);
    if (grading) {
        stepGrading(ureq, task);
    } else if (task != null && task.getTaskStatus() == TaskProcess.grading) {
        task = gtaManager.nextStep(task, gtaNode, Role.auto);
    }
    mainVC.contextPut("changelogconfig", courseModule.isDisplayChangeLog());
    resetTask(ureq, task);
    nodeLog();
    collapsedContents(task);
}
Also used : Task(org.olat.course.nodes.gta.Task) ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) TaskProcess(org.olat.course.nodes.gta.TaskProcess)

Example 3 with ContextualSubscriptionController

use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.

the class FeedMainController method display.

/**
 * Sets up the velocity container for displaying the view
 *
 * @param ores
 * @param ureq
 * @param wControl
 * @param previewMode
 * @param isCourseNode
 */
private void display(UserRequest ureq, WindowControl wControl, FeedItemDisplayConfig displayConfig) {
    vcMain = createVelocityContainer("feed_main");
    vcInfo = uiFactory.createInfoVelocityContainer(this);
    vcInfo.contextPut("feed", feed);
    vcInfo.contextPut("helper", helper);
    if (subsContext != null) {
        String businessPath = wControl.getBusinessControl().getAsString();
        PublisherData data = new PublisherData(ores.getResourceableTypeName(), ores.getResourceableId().toString(), businessPath);
        cSubscriptionCtrl = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, data);
        listenTo(cSubscriptionCtrl);
        vcInfo.put("subscription", cSubscriptionCtrl.getInitialComponent());
    }
    vcRightCol = uiFactory.createRightColumnVelocityContainer(this);
    vcMain.put("rightColumn", vcRightCol);
    RepositoryEntry repositoryEntry = repositoryManager.lookupRepositoryEntry(feed, false);
    if (repositoryEntry == null && callback.mayEditMetadata()) {
        editFeedButton = LinkFactory.createButtonSmall("feed.edit", vcInfo, this);
        editFeedButton.setElementCssClass("o_sel_feed_edit");
    }
    vcInfo.contextPut("callback", callback);
    displayUrlCtr = new DisplayFeedUrlController(ureq, wControl, feed, helper, uiFactory.getTranslator());
    listenTo(displayUrlCtr);
    vcInfo.put("feedUrlComponent", displayUrlCtr.getInitialComponent());
    vcMain.put("info", vcInfo);
    itemsCtr = new ItemsController(ureq, wControl, feed, helper, uiFactory, callback, vcRightCol, displayConfig);
    listenTo(itemsCtr);
    vcMain.put("items", itemsCtr.getInitialComponent());
    putInitialPanel(vcMain);
}
Also used : ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) RepositoryEntry(org.olat.repository.RepositoryEntry) PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Example 4 with ContextualSubscriptionController

use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.

the class PFCoachController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        OLATResource course = courseEnv.getCourseGroupManager().getCourseResource();
        String businessPath = getWindowControl().getBusinessControl().getAsString();
        SubscriptionContext subsContext = new SubscriptionContext(course, pfNode.getIdent());
        PublisherData publisherData = new PublisherData(OresHelper.calculateTypeName(PFCourseNode.class), String.valueOf(course.getResourceableId()), businessPath);
        contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, getWindowControl(), subsContext, publisherData);
        listenTo(contextualSubscriptionCtr);
        layoutCont.put("contextualSubscription", contextualSubscriptionCtr.getInitialComponent());
        backLink = LinkFactory.createLinkBack(layoutCont.getFormItemComponent(), this);
    }
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    int i = 0;
    FlexiTableSortOptions options = new FlexiTableSortOptions();
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        int colIndex = USER_PROPS_OFFSET + i++;
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        FlexiColumnModel col;
        if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName)) {
            col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, userPropertyHandler.getName(), true, propName, new StaticFlexiCellRenderer(userPropertyHandler.getName(), new TextFlexiCellRenderer()));
        } else {
            col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, true, propName);
        }
        columnsModel.addFlexiColumnModel(col);
        if (!options.hasDefaultOrderBy()) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        } else if (UserConstants.LASTNAME.equals(propName)) {
            options.setDefaultOrderBy(new SortKey(propName, true));
        }
    }
    if (pfNode.hasParticipantBoxConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFiles, "drop.box"));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdate));
    }
    if (pfNode.hasCoachBoxConfigured()) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.numberFilesReturn, "return.box"));
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.lastUpdateReturn));
    }
    StaticFlexiCellRenderer openCellRenderer = new StaticFlexiCellRenderer(translate("open.box"), "open.box");
    openCellRenderer.setIconRightCSS("o_icon_start o_icon-fw");
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(DropBoxCols.openbox, "open.box", openCellRenderer));
    tableModel = new DropBoxTableModel(columnsModel, getTranslator());
    dropboxTable = uifactory.addTableElement(getWindowControl(), "table", tableModel, getTranslator(), formLayout);
    dropboxTable.setMultiSelect(true);
    dropboxTable.setSelectAllEnable(true);
    dropboxTable.setExportEnabled(true);
    dropboxTable.setSortSettings(options);
    dropboxTable.setAndLoadPersistedPreferences(ureq, "participant-folder_coach_" + pfView.name());
    dropboxTable.setEmtpyTableMessageKey("table.empty");
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonGroupLayout.setElementCssClass("o_button_group");
    formLayout.add(buttonGroupLayout);
    downloadLink = uifactory.addFormLink("download.link", buttonGroupLayout, Link.BUTTON);
    uploadAllLink = uifactory.addFormLink("upload.link", buttonGroupLayout, Link.BUTTON);
}
Also used : PFCourseNode(org.olat.course.nodes.PFCourseNode) FlexiTableSortOptions(org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) FlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) OLATResource(org.olat.resource.OLATResource) SortKey(org.olat.core.commons.persistence.SortKey) PublisherData(org.olat.core.commons.services.notifications.PublisherData) ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 5 with ContextualSubscriptionController

use of org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController in project OpenOLAT by OpenOLAT.

the class AbstractTaskNotificationHandler method createContextualSubscriptionController.

public static ContextualSubscriptionController createContextualSubscriptionController(UserRequest ureq, WindowControl wControl, String folderPath, SubscriptionContext subsContext, Class<?> callerClass) {
    String businessPath = wControl.getBusinessControl().getAsString();
    PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(callerClass), folderPath, businessPath);
    ContextualSubscriptionController contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, wControl, subsContext, pdata);
    return contextualSubscriptionCtr;
}
Also used : ContextualSubscriptionController(org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController) PublisherData(org.olat.core.commons.services.notifications.PublisherData)

Aggregations

ContextualSubscriptionController (org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController)14 PublisherData (org.olat.core.commons.services.notifications.PublisherData)12 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)6 Date (java.util.Date)4 Calendar (java.util.Calendar)2 CalendarManager (org.olat.commons.calendar.CalendarManager)2 SortKey (org.olat.core.commons.persistence.SortKey)2 FlexiTableSortOptions (org.olat.core.gui.components.form.flexible.elements.FlexiTableSortOptions)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)2 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)2 PFCourseNode (org.olat.course.nodes.PFCourseNode)2 Task (org.olat.course.nodes.gta.Task)2 TaskProcess (org.olat.course.nodes.gta.TaskProcess)2 BusinessGroup (org.olat.group.BusinessGroup)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 OLATResource (org.olat.resource.OLATResource)2