use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.
the class IQConfigurationController method doChooseTestAndSurvey.
private void doChooseTestAndSurvey(UserRequest ureq) {
removeAsListenerAndDispose(cmc);
removeAsListenerAndDispose(searchController);
if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, SurveyFileResource.TYPE_NAME, translate("command.chooseSurvey"));
} else {
// test and selftest use same repository resource type
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, new String[] { TestFileResource.TYPE_NAME, ImsQTI21Resource.TYPE_NAME }, translate("command.chooseTest"));
}
listenTo(searchController);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.chooseRepFile"));
cmc.activate();
}
use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.
the class VarForm 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) {
// those must be links
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue
// only if the config is valid
RepositoryEntry re = getScormCPReference(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("error.cprepoentrymissing");
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
// configure some display options
boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
previewController.showNavButtons(showNavButtons);
DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewController.setDeliveryOptions(deliveryOptions);
previewController.activate();
}
}
}
use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.
the class WikiEditController 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 == previewLink) {
// Preview as modal dialogue only if the config is valid
RepositoryEntry re = getWikiRepoReference(moduleConfiguration, 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
this.showError("error.repoentrymissing");
} else {
// File cpRoot =
// FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
Identity ident = ureq.getIdentity();
boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isResourceOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ident, re);
CourseEnvironment cenv = course.getCourseEnvironment();
SubscriptionContext subsContext = WikiManager.createTechnicalSubscriptionContextForCourse(cenv, wikiCourseNode);
WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOlatAdmin, false, false, isResourceOwner, subsContext);
wikiCtr = WikiManager.getInstance().createWikiMainController(ureq, getWindowControl(), re.getOlatResource(), callback, null);
cmcWikiCtr = new CloseableModalController(getWindowControl(), translate("command.close"), wikiCtr.getInitialComponent());
this.listenTo(cmcWikiCtr);
cmcWikiCtr.activate();
}
} else if (source == chooseButton || source == changeButton) {
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, WikiResource.TYPE_NAME, translate("command.choose"));
this.listenTo(searchController);
cmcSearchController = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.create"));
cmcSearchController.activate();
} else if (source == editLink) {
RepositoryEntry repositoryEntry = wikiCourseNode.getReferencedRepositoryEntry();
if (repositoryEntry == null) {
// do nothing
return;
}
String bPath = "[RepositoryEntry:" + repositoryEntry.getKey() + "][Editor:0]";
NewControllerFactory.getInstance().launch(bPath, ureq, getWindowControl());
}
}
use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.
the class CourseSiteAdminController method doSelecCourse.
private void doSelecCourse(UserRequest ureq, LanguageConfigurationRow row) {
removeAsListenerAndDispose(selectCtrl);
selectCtrl = new ReferencableEntriesSearchController(getWindowControl(), ureq, new String[] { "CourseModule" }, translate("select"), true, true, false, true);
selectCtrl.setUserObject(row);
listenTo(selectCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), selectCtrl.getInitialComponent(), true, translate("select"));
cmc.activate();
listenTo(cmc);
}
use of org.olat.repository.controllers.ReferencableEntriesSearchController in project openolat by klemens.
the class BusinessGroupEditResourceController 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)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == addTabResourcesButton) {
removeAsListenerAndDispose(repoSearchCtr);
removeAsListenerAndDispose(cmc);
RepositoryEntryFilter filter = new ManagedEntryfilter();
repoSearchCtr = new ReferencableEntriesSearchController(getWindowControl(), ureq, new String[] { CourseModule.getCourseTypeName() }, filter, translate("resources.add"), true, true, true, true, Can.referenceable);
listenTo(repoSearchCtr);
cmc = new CloseableModalController(getWindowControl(), translate("close"), repoSearchCtr.getInitialComponent(), true, translate("resources.add.title"));
listenTo(cmc);
cmc.activate();
}
}
Aggregations