Search in sources :

Example 6 with CloseInstantMessagingEvent

use of org.olat.instantMessaging.CloseInstantMessagingEvent in project openolat by klemens.

the class ChatManagerController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source instanceof ChatController) {
        if (event instanceof CloseInstantMessagingEvent) {
            CloseInstantMessagingEvent close = (CloseInstantMessagingEvent) event;
            Long chatId = close.getChatId();
            chats.remove(chatId);
            Component c = container.getComponent(chatId.toString());
            container.remove(c);
            ChatController chatCtr = (ChatController) source;
            imService.unlistenChat(getIdentity(), chatCtr.getOlatResourceable(), chatCtr);
        }
        // forward event also to main controller
        fireEvent(ureq, event);
    }
}
Also used : CloseInstantMessagingEvent(org.olat.instantMessaging.CloseInstantMessagingEvent) Component(org.olat.core.gui.components.Component)

Example 7 with CloseInstantMessagingEvent

use of org.olat.instantMessaging.CloseInstantMessagingEvent in project OpenOLAT by OpenOLAT.

the class ScormRunController method doLaunch.

private void doLaunch(UserRequest ureq, boolean doActivate) {
    ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(new CloseInstantMessagingEvent(), InstantMessagingService.TOWER_EVENT_ORES);
    if (cpRoot == null) {
        // it is the first time we start the contentpackaging from this
        // instance
        // of this controller.
        // need to be strict when launching -> "true"
        RepositoryEntry re = ScormEditController.getScormCPReference(config, false);
        if (re == null) {
            doSetMissingResourcesWarning(ureq);
            return;
        }
        cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        addLoggingResourceable(LoggingResourceable.wrapScormRepositoryEntry(re));
        // nodes reference them
        if (cpRoot == null) {
            doSetMissingResourcesWarning(ureq);
            logError("File of repository entry " + re.getKey() + " was missing", null);
            return;
        }
    }
    // else cpRoot is already set (save some db access if the user opens /
    // closes / reopens the cp from the same CPRuncontroller instance)
    String courseId;
    boolean showMenu = config.getBooleanSafe(ScormEditController.CONFIG_SHOWMENU, true);
    final boolean fullWindow = config.getBooleanSafe(ScormEditController.CONFIG_FULLWINDOW, true);
    if (isPreview) {
        courseId = new Long(CodeHelper.getRAMUniqueID()).toString();
        scormDispC = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, courseId, ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, doActivate, fullWindow, false, deliveryOptions);
    } else {
        boolean attemptsIncremented = false;
        // increment user attempts only once!
        if (!config.getBooleanSafe(ScormEditController.CONFIG_ADVANCESCORE, true) || !config.getBooleanSafe(ScormEditController.CONFIG_ATTEMPTSDEPENDONSCORE, false)) {
            scormNode.incrementUserAttempts(userCourseEnv, Role.user);
            attemptsIncremented = true;
        }
        courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().toString();
        if (isAssessable) {
            // When a SCORE is transfered, the run mode is hardcoded
            scormDispC = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, this, cpRoot, null, courseId + "-" + scormNode.getIdent(), ScormConstants.SCORM_MODE_NORMAL, ScormConstants.SCORM_MODE_CREDIT, false, assessableType, doActivate, fullWindow, attemptsIncremented, deliveryOptions);
        } else if (chooseScormRunMode.getSelectedElement().equals(ScormConstants.SCORM_MODE_NORMAL)) {
            // When not assessible users can choose between normal mode where data is stored...
            scormDispC = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, this, cpRoot, null, courseId + "-" + scormNode.getIdent(), ScormConstants.SCORM_MODE_NORMAL, ScormConstants.SCORM_MODE_CREDIT, false, assessableType, doActivate, fullWindow, attemptsIncremented, deliveryOptions);
        } else {
            // ... and preview mode where no data is stored
            scormDispC = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, this, cpRoot, null, courseId, ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, false, assessableType, doActivate, fullWindow, attemptsIncremented, deliveryOptions);
        }
    }
    // configure some display options
    boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
    scormDispC.showNavButtons(showNavButtons);
    if (deliveryOptions != null && deliveryOptions.getInherit() != null && deliveryOptions.getInherit().booleanValue()) {
        ScormPackageConfig pConfig = ScormMainManager.getInstance().getScormPackageConfig(cpRoot);
        deliveryOptions = (pConfig == null ? null : pConfig.getDeliveryOptions());
    }
    if (deliveryOptions == null) {
        scormDispC.setHeightPX(680);
    } else {
        scormDispC.setDeliveryOptions(deliveryOptions);
    }
    listenTo(scormDispC);
// the scormDispC activates itself
}
Also used : CloseInstantMessagingEvent(org.olat.instantMessaging.CloseInstantMessagingEvent) ScormPackageConfig(org.olat.modules.scorm.ScormPackageConfig) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 8 with CloseInstantMessagingEvent

use of org.olat.instantMessaging.CloseInstantMessagingEvent in project openolat by klemens.

the class ChatController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == chatPanelCtr) {
        fireEvent(ureq, new CloseInstantMessagingEvent(getOlatResourceable()));
        allChats.remove(Integer.toString(hashCode()));
        jsc.setRefreshIntervall(5000);
    } else if (source == sendMessageForm) {
        if (StringHelper.containsNonWhitespace(sendMessageForm.getMessage())) {
            InstantMessage message = doSendMessage(sendMessageForm.getMessage());
            appendToMessageHistory(message, true);
            sendMessageForm.resetTextField();
        } else {
            // ignore empty manObjectessage entry and refocus on entry field
            chatMsgFieldContent.contextPut("chatMessages", messageHistory);
            chatMsgFieldContent.contextPut("focus", Boolean.TRUE);
        }
    } else if (source == rosterCtrl) {
        doSendPresence(rosterCtrl.getNickName(), rosterCtrl.isUseNickName());
    }
}
Also used : CloseInstantMessagingEvent(org.olat.instantMessaging.CloseInstantMessagingEvent) InstantMessage(org.olat.instantMessaging.InstantMessage)

Aggregations

CloseInstantMessagingEvent (org.olat.instantMessaging.CloseInstantMessagingEvent)8 Component (org.olat.core.gui.components.Component)2 InstantMessage (org.olat.instantMessaging.InstantMessage)2 ScormPackageConfig (org.olat.modules.scorm.ScormPackageConfig)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2