Search in sources :

Example 31 with SubscriptionContext

use of org.olat.core.commons.services.notifications.SubscriptionContext 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 32 with SubscriptionContext

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

the class AbstractFeedCourseNode method cleanupOnDelete.

@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    SubscriptionContext subsContext = CourseModule.createSubscriptionContext(course.getCourseEnvironment(), this);
    NotificationsManager.getInstance().delete(subsContext);
}
Also used : SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext)

Example 33 with SubscriptionContext

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

the class DocumentPoolMainController method doSelectTaxonomyLevel.

private DocumentPoolLevelController doSelectTaxonomyLevel(UserRequest ureq, TaxonomyTreeNode node) {
    if (isTaxonomyAdmin || node.isCanRead() || node.isCanWrite()) {
        TaxonomyLevel level = node.getTaxonomyLevel();
        SubscriptionContext subscriptionCtx = notificationsHandler.getTaxonomyDocumentsLibrarySubscriptionContext();
        TaxonomyVFSSecurityCallback secCallback = new TaxonomyVFSSecurityCallback(node, subscriptionCtx);
        OLATResourceable ores = OresHelper.createOLATResourceableInstance("TaxonomyLevel", node.getTaxonomyLevel().getKey());
        WindowControl bwControl = addToHistory(ureq, ores, null);
        DocumentPoolLevelController levelCtrl = new DocumentPoolLevelController(ureq, bwControl, level, node, secCallback);
        listenTo(levelCtrl);
        String displayName = level.getDisplayName();
        content.popUpToRootController(ureq);
        List<TreeNode> parentLines = TreeHelper.getTreePath(node);
        for (int i = 1; i < parentLines.size() - 1; i++) {
            TreeNode parent = parentLines.get(i);
            content.pushController(parent.getTitle(), null, parent);
        }
        content.pushController(displayName, levelCtrl);
        return levelCtrl;
    }
    return null;
}
Also used : TaxonomyVFSSecurityCallback(org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback) OLATResourceable(org.olat.core.id.OLATResourceable) TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyTreeNode(org.olat.modules.taxonomy.model.TaxonomyTreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WindowControl(org.olat.core.gui.control.WindowControl)

Example 34 with SubscriptionContext

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

the class DocumentPoolWebDAVMergeSource method addTemplates.

private VFSContainer addTemplates(TaxonomyTreeNode taxonomyNode, Taxonomy taxonomy) {
    VFSContainer documents = taxonomyService.getDocumentsLibrary(taxonomy);
    SubscriptionContext subscriptionCtx = notificationsHandler.getTaxonomyDocumentsLibrarySubscriptionContext();
    TaxonomyVFSSecurityCallback secCallback = new TaxonomyVFSSecurityCallback(taxonomyNode, subscriptionCtx);
    System.out.println(taxonomyNode.isCanWrite());
    documents.setLocalSecurityCallback(secCallback);
    return new NamedContainerImpl(taxonomyNode.getTitle(), documents);
}
Also used : TaxonomyVFSSecurityCallback(org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback) VFSContainer(org.olat.core.util.vfs.VFSContainer) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) NamedContainerImpl(org.olat.core.util.vfs.NamedContainerImpl)

Example 35 with SubscriptionContext

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

the class DocumentPoolWebDAVMergeSource method addDocument.

private VFSContainer addDocument(TaxonomyTreeNode taxonomyNode) {
    VFSContainer documents = taxonomyService.getDocumentsLibrary(taxonomyNode.getTaxonomyLevel());
    SubscriptionContext subscriptionCtx = notificationsHandler.getTaxonomyDocumentsLibrarySubscriptionContext();
    TaxonomyVFSSecurityCallback secCallback = new TaxonomyVFSSecurityCallback(taxonomyNode, subscriptionCtx);
    documents.setLocalSecurityCallback(secCallback);
    return new NamedContainerImpl("_documents", documents);
}
Also used : TaxonomyVFSSecurityCallback(org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback) VFSContainer(org.olat.core.util.vfs.VFSContainer) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) NamedContainerImpl(org.olat.core.util.vfs.NamedContainerImpl)

Aggregations

SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)204 PublisherData (org.olat.core.commons.services.notifications.PublisherData)84 Identity (org.olat.core.id.Identity)72 Test (org.junit.Test)66 Publisher (org.olat.core.commons.services.notifications.Publisher)58 RepositoryEntry (org.olat.repository.RepositoryEntry)38 VFSContainer (org.olat.core.util.vfs.VFSContainer)32 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)28 BusinessGroup (org.olat.group.BusinessGroup)28 ArrayList (java.util.ArrayList)20 Subscriber (org.olat.core.commons.services.notifications.Subscriber)20 HttpResponse (org.apache.http.HttpResponse)18 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)18 Forum (org.olat.modules.fo.Forum)18 File (java.io.File)16 HttpGet (org.apache.http.client.methods.HttpGet)16 CollaborationTools (org.olat.collaboration.CollaborationTools)14 OLATResourceable (org.olat.core.id.OLATResourceable)14 NamedContainerImpl (org.olat.core.util.vfs.NamedContainerImpl)14 Roles (org.olat.core.id.Roles)12