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();
}
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();
}
}
}
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);
}
}
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();
}
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();
}
}
}
Aggregations