Search in sources :

Example 16 with ForumChangedEvent

use of org.olat.modules.fo.ForumChangedEvent in project openolat by klemens.

the class MessageListController method doOpenThread.

private void doOpenThread() {
    if (thread != null) {
        thread = forumManager.getMessageById(thread.getKey());
        Status status = Status.getStatus(thread.getStatusCode());
        status.setClosed(false);
        thread.setStatusCode(Status.getStatusCode(status));
        thread = forumManager.updateMessage(thread, true);
        // before sending async event
        DBFactory.getInstance().commit();
        closeThreadButton.setVisible(true && !guestOnly);
        openThreadButton.setVisible(false);
        mainVC.setDirty(true);
        ForumChangedEvent event = new ForumChangedEvent(ForumChangedEvent.OPEN, thread.getKey(), null, getIdentity());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, forumOres);
        ThreadLocalUserActivityLogger.log(ForumLoggingAction.FORUM_THREAD_REOPEN, getClass(), LoggingResourceable.wrap(thread));
    }
}
Also used : Status(org.olat.modules.fo.Status) ForumChangedEvent(org.olat.modules.fo.ForumChangedEvent)

Example 17 with ForumChangedEvent

use of org.olat.modules.fo.ForumChangedEvent in project openolat by klemens.

the class MessageListController method event.

@Override
public void event(Event event) {
    if (event instanceof ForumChangedEvent) {
        ForumChangedEvent fce = (ForumChangedEvent) event;
        if (ForumChangedEvent.CHANGED_MESSAGE.equals(fce.getCommand()) || ForumChangedEvent.NEW_MESSAGE.equals(fce.getCommand()) || ForumChangedEvent.DELETED_MESSAGE.equals(fce.getCommand())) {
            Long threadtopKey = fce.getThreadtopKey();
            Long senderId = fce.getSendByIdentityKey();
            if (thread != null && threadtopKey != null && thread.getKey().equals(threadtopKey) && (senderId == null || !senderId.equals(getIdentity().getKey()))) {
                reloadList = true;
            }
        }
    }
}
Also used : ForumChangedEvent(org.olat.modules.fo.ForumChangedEvent)

Example 18 with ForumChangedEvent

use of org.olat.modules.fo.ForumChangedEvent in project openolat by klemens.

the class MessageListController method doCloseThread.

/**
 * Sets the closed status to the thread message.
 * @param ureq
 * @param msg
 * @param closed
 */
private void doCloseThread() {
    if (thread != null) {
        thread = forumManager.getMessageById(thread.getKey());
        Status status = Status.getStatus(thread.getStatusCode());
        status.setClosed(true);
        thread.setStatusCode(Status.getStatusCode(status));
        thread = forumManager.updateMessage(thread, false);
        // before sending async event
        DBFactory.getInstance().commit();
        closeThreadButton.setVisible(false);
        openThreadButton.setVisible(true && !guestOnly);
        mainVC.setDirty(true);
        ForumChangedEvent event = new ForumChangedEvent(ForumChangedEvent.CLOSE, thread.getKey(), null, getIdentity());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, forumOres);
        ThreadLocalUserActivityLogger.log(ForumLoggingAction.FORUM_THREAD_CLOSE, getClass(), LoggingResourceable.wrap(thread));
    }
}
Also used : Status(org.olat.modules.fo.Status) ForumChangedEvent(org.olat.modules.fo.ForumChangedEvent)

Aggregations

ForumChangedEvent (org.olat.modules.fo.ForumChangedEvent)18 Status (org.olat.modules.fo.Status)10 Message (org.olat.modules.fo.Message)4 ArrayList (java.util.ArrayList)2 Pseudonym (org.olat.modules.fo.Pseudonym)2 DeleteMessageEvent (org.olat.modules.fo.ui.events.DeleteMessageEvent)2 DeleteThreadEvent (org.olat.modules.fo.ui.events.DeleteThreadEvent)2 ErrorEditMessage (org.olat.modules.fo.ui.events.ErrorEditMessage)2