use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class GTACoachedGroupGradingController method doOpenAssessmentForm.
private void doOpenAssessmentForm(UserRequest ureq) {
removeAsListenerAndDispose(assessmentCtrl);
RepositoryEntry courseEntry = courseEnv.getCourseGroupManager().getCourseEntry();
assessmentCtrl = new GroupAssessmentController(ureq, getWindowControl(), courseEntry, gtaNode, assessedGroup);
listenTo(assessmentCtrl);
String title = translate("grading");
cmc = new CloseableModalController(getWindowControl(), "close", assessmentCtrl.getInitialComponent(), true, title, true);
listenTo(cmc);
cmc.activate();
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class GTACoachedParticipantListController method collectIdentities.
private void collectIdentities(Consumer<Identity> participantCollector) {
Set<Identity> duplicateKiller = new HashSet<>();
CourseGroupManager cgm = coachCourseEnv.getCourseEnvironment().getCourseGroupManager();
boolean admin = coachCourseEnv.isAdmin();
List<BusinessGroup> coachedGroups = admin ? cgm.getAllBusinessGroups() : coachCourseEnv.getCoachedGroups();
List<Identity> participants = businessGroupService.getMembers(coachedGroups, GroupRoles.participant.name());
for (Identity participant : participants) {
if (!duplicateKiller.contains(participant)) {
participantCollector.accept(participant);
duplicateKiller.add(participant);
}
}
RepositoryEntry re = coachCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
boolean repoTutor = admin || (coachedGroups.isEmpty() && repositoryService.hasRole(getIdentity(), re, GroupRoles.coach.name()));
if (repoTutor) {
List<Identity> courseParticipants = repositoryService.getMembers(re, GroupRoles.participant.name());
for (Identity participant : courseParticipants) {
if (!duplicateKiller.contains(participant)) {
participantCollector.accept(participant);
duplicateKiller.add(participant);
}
}
}
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class GTACoachedParticipantListController method doToogleMark.
private boolean doToogleMark(UserRequest ureq, Long particiantKey) {
RepositoryEntry entry = courseEnv.getCourseGroupManager().getCourseEntry();
Identity participant = securityManager.loadIdentityByKey(particiantKey);
return gtaManager.toggleMark(entry, gtaNode, ureq.getIdentity(), participant);
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class CourseGlossaryFactory method createCourseGlossaryMainRunController.
/**
* The glossarymaincontroller allows browsing in the glossary. A flag enables
* the edit mode.
*
* @param windowControl
* @param ureq
* @param courseConfig use the glossary configuration from the given course
* configuration
* @param hasGlossaryEditRights
* @return
*/
public static GlossaryMainController createCourseGlossaryMainRunController(WindowControl lwControl, UserRequest lureq, CourseConfig cc, boolean hasGlossaryRights) {
if (cc.hasGlossary()) {
RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
if (repoEntry == null) {
// seems to be removed
return null;
}
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
boolean owner = repositoryService.hasRole(lureq.getIdentity(), repoEntry, GroupRoles.owner.name());
VFSContainer glossaryFolder = GlossaryManager.getInstance().getGlossaryRootFolder(repoEntry.getOlatResource());
Properties glossProps = GlossaryItemManager.getInstance().getGlossaryConfig(glossaryFolder);
boolean editUsersEnabled = "true".equals(glossProps.getProperty(GlossaryItemManager.EDIT_USERS));
GlossarySecurityCallback secCallback;
if (lureq.getUserSession().getRoles().isGuestOnly()) {
secCallback = new GlossarySecurityCallbackImpl();
} else {
secCallback = new GlossarySecurityCallbackImpl(hasGlossaryRights, owner, editUsersEnabled, lureq.getIdentity().getKey());
}
return new GlossaryMainController(lwControl, lureq, glossaryFolder, repoEntry.getOlatResource(), secCallback, true);
}
return null;
}
use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.
the class CourseSiteAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("admin.menu.title");
enableToolbar = uifactory.addCheckboxesHorizontal("site.enable.toolbar", "site.enable.toolbar", formLayout, new String[] { "x" }, new String[] { "" });
enableToolbar.addActionListener(FormEvent.ONCHANGE);
if (siteConfiguration.isToolbar()) {
enableToolbar.select("x", true);
}
String cssClass = siteConfiguration.getNavIconCssClass();
iconCssClassEl = uifactory.addTextElement("site.iconCssClass", "site.icon", 32, cssClass, formLayout);
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.defLanguage.i18nKey(), CSCols.defLanguage.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.language.i18nKey(), CSCols.language.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.title.i18nKey(), CSCols.title.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, CSCols.courseId.i18nKey(), CSCols.courseId.ordinal(), false, null));
FlexiCellRenderer renderer = new StaticFlexiCellRenderer("openre", new TextFlexiCellRenderer());
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(CSCols.courseTitle.i18nKey(), CSCols.courseTitle.ordinal(), "openre", renderer));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("remove", translate("remove"), "remove"));
String page = velocity_root + "/lang_options.html";
tableLayout = FormLayoutContainer.createCustomFormLayout("site.options.lang", getTranslator(), page);
tableLayout.setRootForm(mainForm);
tableLayout.setLabel("site.courses", null);
formLayout.add(tableLayout);
model = new CourseSiteDataModel(columnsModel);
List<LanguageConfigurationRow> configs = new ArrayList<LanguageConfigurationRow>();
Map<String, LanguageConfiguration> langToConfigMap = new HashMap<String, LanguageConfiguration>();
if (siteConfiguration.getConfigurations() != null) {
for (LanguageConfiguration langConfig : siteConfiguration.getConfigurations()) {
langToConfigMap.put(langConfig.getLanguage(), langConfig);
}
}
for (String langKey : i18nModule.getEnabledLanguageKeys()) {
if (langToConfigMap.containsKey(langKey)) {
LanguageConfiguration langConfig = langToConfigMap.get(langKey);
RepositoryEntry re = repositoryManager.lookupRepositoryEntryBySoftkey(langConfig.getRepoSoftKey(), false);
configs.add(new LanguageConfigurationRow(langConfig, re, tableLayout));
} else {
configs.add(new LanguageConfigurationRow(new LanguageConfiguration(langKey), null, tableLayout));
}
}
model.setObjects(configs);
tableEl = uifactory.addTableElement(getWindowControl(), "languageTable", model, getTranslator(), tableLayout);
tableEl.setRendererType(FlexiTableRendererType.classic);
tableEl.setCustomizeColumns(true);
tableEl.setAndLoadPersistedPreferences(ureq, "course-site-admin");
FormLayoutContainer buttonsLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsLayout);
okButton = uifactory.addFormLink("save", "save", null, buttonsLayout, Link.BUTTON);
okButton.setCustomEnabledLinkCSS("btn btn-primary");
// uifactory.addFormSubmitButton("save", "save", formLayout);
}
Aggregations