Search in sources :

Example 6 with Status

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

the class MessageListController method doShowThread.

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

Example 7 with Status

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

the class MessageListController method doHideThread.

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

Example 8 with Status

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

the class MessageListController method doToogleSticky.

private void doToogleSticky() {
    Status status = Status.getStatus(thread.getStatusCode());
    status.setSticky(!status.isSticky());
    thread.setStatusCode(Status.getStatusCode(status));
    thread = forumManager.updateMessage(thread, false);
    DBFactory.getInstance().commit();
    stickyButton.setVisible(!status.isSticky() && foCallback.mayEditMessageAsModerator());
    removeStickyButton.setVisible(status.isSticky() && foCallback.mayEditMessageAsModerator());
    mainVC.setDirty(true);
    ForumChangedEvent event = new ForumChangedEvent(ForumChangedEvent.STICKY, thread.getKey(), null, getIdentity());
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, forumOres);
    ThreadLocalUserActivityLogger.log(ForumLoggingAction.FORUM_MESSAGE_EDIT, getClass(), LoggingResourceable.wrap(thread));
}
Also used : Status(org.olat.modules.fo.Status) ForumChangedEvent(org.olat.modules.fo.ForumChangedEvent)

Example 9 with Status

use of org.olat.modules.fo.Status in project OpenOLAT by OpenOLAT.

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)

Example 10 with Status

use of org.olat.modules.fo.Status in project OpenOLAT by OpenOLAT.

the class MessageListController method doShowThread.

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

Aggregations

Status (org.olat.modules.fo.Status)16 ForumChangedEvent (org.olat.modules.fo.ForumChangedEvent)10 Message (org.olat.modules.fo.Message)2 MessageImpl (org.olat.modules.fo.model.MessageImpl)2 ReadMessageImpl (org.olat.modules.fo.model.ReadMessageImpl)2