Search in sources :

Example 21 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project OpenOLAT by OpenOLAT.

the class CourseOptionsController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == glossarySearchCtr) {
        cmc.deactivate();
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            RepositoryEntry repoEntry = glossarySearchCtr.getSelectedEntry();
            doSelectGlossary(repoEntry);
            setSaveButtonDirty();
        }
        cleanUp();
    } else if (source == folderSearchCtr) {
        cmc.deactivate();
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            RepositoryEntry repoEntry = folderSearchCtr.getSelectedEntry();
            doSelectSharedFolder(ureq, repoEntry);
            setSaveButtonDirty();
        }
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    } else if (source == folderRefRemoveWarnBox) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            doRemoveSharedFolder();
            setSaveButtonDirty();
        }
    } else if (source == folderRefAddWarnBox) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            folderSearchCtr = new ReferencableEntriesSearchController(getWindowControl(), ureq, SharedFolderFileResource.TYPE_NAME, translate("select"));
            listenTo(folderSearchCtr);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), folderSearchCtr.getInitialComponent());
            listenTo(cmc);
            cmc.activate();
        }
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 22 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project OpenOLAT by OpenOLAT.

the class IQConfigurationController method doChangeTestAndSurvey.

private void doChangeTestAndSurvey(UserRequest ureq, RepositoryEntry re) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(searchController);
    String[] types;
    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
        // test
        types = new String[] { TestFileResource.TYPE_NAME, ImsQTI21Resource.TYPE_NAME };
    } else {
        // survey
        types = new String[] { SurveyFileResource.TYPE_NAME };
    }
    if (moduleConfiguration.get(IQEditController.CONFIG_KEY_TYPE_QTI) == null) {
        updateQtiType(re);
    }
    int onyxSuccess = 0;
    if (moduleConfiguration.get(IQEditController.CONFIG_KEY_TYPE_QTI) != null && moduleConfiguration.get(IQEditController.CONFIG_KEY_TYPE_QTI).equals(IQEditController.CONFIG_VALUE_QTI2)) {
        if (courseNode.getClass().equals(IQSURVCourseNode.class)) {
            File surveyDir = new File(course.getCourseEnvironment().getCourseBaseContainer().getBasefile() + File.separator + courseNode.getIdent() + File.separator);
            if (surveyDir != null && surveyDir.exists() && surveyDir.listFiles().length > 0) {
                onyxSuccess = surveyDir.listFiles().length;
            }
        } else {
            onyxSuccess = QTIResultManager.getInstance().countResults(course.getResourceableId(), courseNode.getIdent(), re.getKey());
        }
    }
    if (moduleConfiguration.get(IQEditController.CONFIG_KEY_TYPE_QTI) != null && moduleConfiguration.get(IQEditController.CONFIG_KEY_TYPE_QTI).equals(IQEditController.CONFIG_VALUE_QTI2) && onyxSuccess > 0) {
        showError("error.onyx");
    } else {
        List<QTIResult> results = QTIResultManager.getInstance().selectResults(course.getResourceableId(), courseNode.getIdent(), re.getKey(), null, 1);
        // test was passed from an user
        boolean passed = (results != null && !results.isEmpty()) ? true : false;
        // test was started and not passed
        // it exists partly results for this test
        List<Identity> identitiesWithQtiSerEntry = iqManager.getIdentitiesWithQtiSerEntry(course.getResourceableId(), courseNode.getIdent());
        if (passed || !identitiesWithQtiSerEntry.isEmpty()) {
            learners = new ArrayList<>();
            for (QTIResult result : results) {
                Identity identity = result.getResultSet().getIdentity();
                if (identity != null && !learners.contains(identity)) {
                    learners.add(identity);
                }
            }
            // add identities with qti.ser entry
            for (Identity identity : identitiesWithQtiSerEntry) {
                if (!learners.contains(identity)) {
                    learners.add(identity);
                }
            }
            replaceWizard = new IQEditReplaceWizard(ureq, getWindowControl(), course, courseNode, types, learners, results, identitiesWithQtiSerEntry.size());
            replaceWizard.addControllerListener(this);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), replaceWizard.getInitialComponent());
            cmc.activate();
        } else {
            if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
                // test
                searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, types, translate("command.chooseTest"));
            } else {
                // survey
                searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, types, translate("command.chooseSurvey"));
            }
            listenTo(searchController);
            cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent());
            cmc.activate();
        }
    }
}
Also used : QTIResult(org.olat.ims.qti.QTIResult) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) Identity(org.olat.core.id.Identity) File(java.io.File)

Example 23 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project OpenOLAT by OpenOLAT.

the class IQEditReplaceWizard method doStep1.

private void doStep1(UserRequest ureq) {
    searchCtr = new ReferencableEntriesSearchController(getWindowControl(), ureq, types, translate("command.chooseTest"));
    searchCtr.addControllerListener(this);
    vcStep1 = createVelocityContainer("replacewizard_step1");
    vcStep1.put("search", searchCtr.getInitialComponent());
    setNextWizardStep(translate("replace.wizard.title.step1"), vcStep1);
}
Also used : ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 24 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project OpenOLAT by OpenOLAT.

the class PortfolioConfigForm method doChangeTemplate.

private void doChangeTemplate(UserRequest ureq) {
    if (searchController != null)
        return;
    if (isDirty) {
        showWarning("form.dirty");
        return;
    }
    removeAsListenerAndDispose(searchController);
    removeAsListenerAndDispose(cmc);
    searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, new String[] { EPTemplateMapResource.TYPE_NAME, BinderTemplateResource.TYPE_NAME }, translate("select.map2"), false, true, false, false);
    listenTo(searchController);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("select.map"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 25 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project OpenOLAT by OpenOLAT.

the class VideoOptionsForm method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == chooseVideoButton || source == changeVideoButton) {
        removeAsListenerAndDispose(searchController);
        searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, new String[] { VideoFileResource.TYPE_NAME }, translate(NLS_COMMAND_CHOOSEVIDEO), true, false, false, false);
        listenTo(searchController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(NLS_COMMAND_CHOOSEVIDEO));
        listenTo(cmc);
        cmc.activate();
    } else if (source == previewLink) {
        VideoDisplayController previewController = null;
        switch(config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_SELECT)) {
            case "resourceDescription":
                previewController = new VideoDisplayController(ureq, getWindowControl(), repositoryEntry, config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY), config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS), config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING), true, "", false, false, "", true);
                break;
            case "customDescription":
                previewController = new VideoDisplayController(ureq, getWindowControl(), repositoryEntry, config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY), config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS), config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING), true, "", true, false, config.getStringValue(VideoEditController.CONFIG_KEY_DESCRIPTION_CUSTOMTEXT), true);
                break;
            case "none":
                previewController = new VideoDisplayController(ureq, getWindowControl(), repositoryEntry, config.getBooleanSafe(VideoEditController.CONFIG_KEY_AUTOPLAY), config.getBooleanSafe(VideoEditController.CONFIG_KEY_COMMENTS), config.getBooleanSafe(VideoEditController.CONFIG_KEY_RATING), true, "", true, false, "", true);
                break;
        }
        cmc = new CloseableModalController(getWindowControl(), translate("close"), previewController.getInitialComponent(), true, translate(NLS_COMMAND_CHOOSEVIDEO));
        listenTo(cmc);
        cmc.activate();
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VideoDisplayController(org.olat.modules.video.ui.VideoDisplayController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Aggregations

ReferencableEntriesSearchController (org.olat.repository.controllers.ReferencableEntriesSearchController)40 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)38 RepositoryEntry (org.olat.repository.RepositoryEntry)10 File (java.io.File)6 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)4 Identity (org.olat.core.id.Identity)4 RepositoryEntryFilter (org.olat.repository.controllers.RepositoryEntryFilter)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)2 SelectionElement (org.olat.core.gui.components.form.flexible.elements.SelectionElement)2 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)2 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)2 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)2 QTIResult (org.olat.ims.qti.QTIResult)2 ScormAPIandDisplayController (org.olat.modules.scorm.ScormAPIandDisplayController)2 VideoDisplayController (org.olat.modules.video.ui.VideoDisplayController)2 FeedPreviewSecurityCallback (org.olat.modules.webFeed.FeedPreviewSecurityCallback)2 FeedSecurityCallback (org.olat.modules.webFeed.FeedSecurityCallback)2 WikiSecurityCallback (org.olat.modules.wiki.WikiSecurityCallback)2 WikiSecurityCallbackImpl (org.olat.modules.wiki.WikiSecurityCallbackImpl)2