Search in sources :

Example 31 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.

the class AssignmentEditController method doSelectForm.

private void doSelectForm(UserRequest ureq) {
    if (searchFormCtrl != null)
        return;
    searchFormCtrl = new ReferencableEntriesSearchController(getWindowControl(), ureq, EvaluationFormResource.TYPE_NAME, translate("select.form"));
    listenTo(searchFormCtrl);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), searchFormCtrl.getInitialComponent(), true, translate("select.form"));
    cmc.suppressDirtyFormWarningOnClose();
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 32 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.

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 33 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.

the class CompMenuForm method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Component source, Event event) {
    if (source == chooseCPButton || source == changeCPButton) {
        removeAsListenerAndDispose(searchController);
        searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ImsCPFileResource.TYPE_NAME, translate(NLS_COMMAND_CHOOSECP));
        listenTo(searchController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(NLS_COMMAND_CREATECP));
        listenTo(cmc);
        cmc.activate();
    } else if (source == previewLink) {
        // Preview as modal dialogue only if the config is valid
        RepositoryEntry re = getCPReference(config, false);
        if (re == null) {
            // we cannot preview it, because the repository entry
            // had been deleted between the time when it was chosen here, and now
            showError(NLS_ERROR_CPREPOENTRYMISSING);
        } else {
            File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
            Boolean showMenuB = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU);
            // pre: showMenuB != null
            removeAsListenerAndDispose(previewCtr);
            DeliveryOptions previewOptions = deliveryOptionsCtrl.getOptionsForPreview();
            previewCtr = CPUIFactory.getInstance().createMainLayoutPreviewController_v2(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), showMenuB.booleanValue(), previewOptions);
            stackPanel.pushController(translate("preview.cp"), previewCtr);
        }
    } else if (source == editLink) {
        CourseNodeFactory.getInstance().launchReferencedRepoEntryEditor(ureq, getWindowControl(), cpNode);
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) RepositoryEntry(org.olat.repository.RepositoryEntry) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 34 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.

the class IQConfigurationController method doChangeSelfTest.

private void doChangeSelfTest(UserRequest ureq) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(searchController);
    String[] types = new String[] { TestFileResource.TYPE_NAME, ImsQTI21Resource.TYPE_NAME };
    searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, types, translate("command.chooseTest"));
    listenTo(searchController);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent());
    listenTo(searchController);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController)

Example 35 with ReferencableEntriesSearchController

use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.

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)

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