Search in sources :

Example 1 with BlogEntryMedia

use of org.olat.modules.webFeed.portfolio.BlogEntryMedia in project OpenOLAT by OpenOLAT.

the class ItemsController method createButtonsForItem.

private void createButtonsForItem(UserRequest ureq, Feed feed, Item item) {
    boolean author = getIdentity().getKey().equals(item.getAuthorKey());
    boolean edit = callback.mayEditItems() || (author && callback.mayEditOwnItems());
    boolean delete = callback.mayDeleteItems() || (author && callback.mayDeleteOwnItems());
    String guid = item.getGuid();
    String editId = "feed.edit.item.".concat(guid);
    Link editButton = LinkFactory.createCustomLink(editId, editId, "feed.edit.item", Link.BUTTON_SMALL, vcItems, this);
    editButton.setElementCssClass("o_sel_feed_item_edit");
    editButton.setEnabled(edit);
    editButton.setVisible(edit);
    String deleteId = "delete.".concat(guid);
    Link deleteButton = LinkFactory.createCustomLink(deleteId, deleteId, "delete", Link.BUTTON_SMALL, vcItems, this);
    deleteButton.setElementCssClass("o_sel_feed_item_delete");
    deleteButton.setEnabled(delete);
    deleteButton.setVisible(delete);
    if (feedResource.isInternal() && getIdentity().getKey() != null && getIdentity().getKey().equals(item.getAuthorKey())) {
        String businessPath = BusinessControlFactory.getInstance().getAsString(getWindowControl().getBusinessControl());
        businessPath += "[item=" + item.getKey() + ":0]";
        if (portfolioModule.isEnabled()) {
            String name = "feed.artefact.item.".concat(guid);
            BlogEntryMedia media = new BlogEntryMedia(feed, item);
            MediaCollectorComponent collectorCmp = new MediaCollectorComponent(name, getWindowControl(), media, blogMediaHandler, businessPath);
            vcItems.put(name, collectorCmp);
        } else {
            Controller artefactCtrl = EPUIFactory.createArtefactCollectWizzardController(ureq, getWindowControl(), feedResource, businessPath);
            if (artefactCtrl != null) {
                artefactLinks.put(item, artefactCtrl);
                vcItems.put("feed.artefact.item.".concat(guid), artefactCtrl.getInitialComponent());
            }
        }
    }
    editButton.setUserObject(item);
    deleteButton.setUserObject(item);
    editButtons.add(editButton);
    deleteButtons.add(deleteButton);
}
Also used : MediaCollectorComponent(org.olat.modules.portfolio.ui.component.MediaCollectorComponent) BlogEntryMedia(org.olat.modules.webFeed.portfolio.BlogEntryMedia) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) DialogBoxController(org.olat.core.gui.control.generic.modal.DialogBoxController) BasicController(org.olat.core.gui.control.controller.BasicController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) YearNavigationController(org.olat.core.commons.controllers.navigation.YearNavigationController) Controller(org.olat.core.gui.control.Controller) Link(org.olat.core.gui.components.link.Link)

Example 2 with BlogEntryMedia

use of org.olat.modules.webFeed.portfolio.BlogEntryMedia in project openolat by klemens.

the class ItemsController method createButtonsForItem.

private void createButtonsForItem(UserRequest ureq, Feed feed, Item item) {
    boolean author = getIdentity().getKey().equals(item.getAuthorKey());
    boolean edit = callback.mayEditItems() || (author && callback.mayEditOwnItems());
    boolean delete = callback.mayDeleteItems() || (author && callback.mayDeleteOwnItems());
    String guid = item.getGuid();
    String editId = "feed.edit.item.".concat(guid);
    Link editButton = LinkFactory.createCustomLink(editId, editId, "feed.edit.item", Link.BUTTON_SMALL, vcItems, this);
    editButton.setElementCssClass("o_sel_feed_item_edit");
    editButton.setEnabled(edit);
    editButton.setVisible(edit);
    String deleteId = "delete.".concat(guid);
    Link deleteButton = LinkFactory.createCustomLink(deleteId, deleteId, "delete", Link.BUTTON_SMALL, vcItems, this);
    deleteButton.setElementCssClass("o_sel_feed_item_delete");
    deleteButton.setEnabled(delete);
    deleteButton.setVisible(delete);
    if (feedResource.isInternal() && getIdentity().getKey() != null && getIdentity().getKey().equals(item.getAuthorKey())) {
        String businessPath = BusinessControlFactory.getInstance().getAsString(getWindowControl().getBusinessControl());
        businessPath += "[item=" + item.getKey() + ":0]";
        if (portfolioModule.isEnabled()) {
            String name = "feed.artefact.item.".concat(guid);
            BlogEntryMedia media = new BlogEntryMedia(feed, item);
            MediaCollectorComponent collectorCmp = new MediaCollectorComponent(name, getWindowControl(), media, blogMediaHandler, businessPath);
            vcItems.put(name, collectorCmp);
        } else {
            Controller artefactCtrl = EPUIFactory.createArtefactCollectWizzardController(ureq, getWindowControl(), feedResource, businessPath);
            if (artefactCtrl != null) {
                artefactLinks.put(item, artefactCtrl);
                vcItems.put("feed.artefact.item.".concat(guid), artefactCtrl.getInitialComponent());
            }
        }
    }
    editButton.setUserObject(item);
    deleteButton.setUserObject(item);
    editButtons.add(editButton);
    deleteButtons.add(deleteButton);
}
Also used : MediaCollectorComponent(org.olat.modules.portfolio.ui.component.MediaCollectorComponent) BlogEntryMedia(org.olat.modules.webFeed.portfolio.BlogEntryMedia) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) DialogBoxController(org.olat.core.gui.control.generic.modal.DialogBoxController) BasicController(org.olat.core.gui.control.controller.BasicController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) YearNavigationController(org.olat.core.commons.controllers.navigation.YearNavigationController) Controller(org.olat.core.gui.control.Controller) Link(org.olat.core.gui.components.link.Link)

Aggregations

YearNavigationController (org.olat.core.commons.controllers.navigation.YearNavigationController)2 UserCommentsAndRatingsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController)2 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)2 Link (org.olat.core.gui.components.link.Link)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 DialogBoxController (org.olat.core.gui.control.generic.modal.DialogBoxController)2 MediaCollectorComponent (org.olat.modules.portfolio.ui.component.MediaCollectorComponent)2 BlogEntryMedia (org.olat.modules.webFeed.portfolio.BlogEntryMedia)2