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