From 2a26d01f8b7bda1ba2fce4a39f7b71018ba136bb Mon Sep 17 00:00:00 2001 From: aboeckle <alexander.boeckle@frentix.com> Date: Wed, 19 Feb 2020 13:25:27 +0100 Subject: [PATCH] OO-4374 - Groupsort added table to pop up group selection --- .../condition/GroupSelectionController.java | 77 ++++++++++++++++--- .../_i18n/LocalStrings_de.properties | 11 +++ .../_i18n/LocalStrings_en.properties | 11 +++ .../en/ENEditGroupAreaFormController.java | 47 ++++++++--- .../nodes/en/ENEditGroupTableContentRow.java | 66 +++++++++++++++- .../nodes/en/ENEditGroupTableModel.java | 37 ++++++++- .../nodes/en/_i18n/LocalStrings_de.properties | 7 ++ .../nodes/en/_i18n/LocalStrings_en.properties | 10 +++ .../olat/group/manager/BusinessGroupDAO.java | 8 +- .../group/model/BusinessGroupQueryParams.java | 12 +-- .../model/StatisticsBusinessGroupRow.java | 8 +- .../ui/main/EditMembershipController.java | 4 +- 12 files changed, 257 insertions(+), 41 deletions(-) diff --git a/src/main/java/org/olat/course/condition/GroupSelectionController.java b/src/main/java/org/olat/course/condition/GroupSelectionController.java index fc159cca581..410ed3c31e7 100644 --- a/src/main/java/org/olat/course/condition/GroupSelectionController.java +++ b/src/main/java/org/olat/course/condition/GroupSelectionController.java @@ -28,7 +28,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItemContainer; @@ -47,13 +49,20 @@ import org.olat.course.condition.model.GroupSelectionTableContentRow; import org.olat.course.condition.model.GroupSelectionTableModel; import org.olat.course.condition.model.GroupSelectionTableModel.GroupSelectionTableColumns; import org.olat.course.groupsandrights.CourseGroupManager; +import org.olat.course.nodes.en.ENEditGroupTableContentRow; +import org.olat.course.nodes.en.ENEditGroupTableModel; +import org.olat.course.nodes.en.ENEditGroupTableModel.ENEditGroupTableColumns; import org.olat.group.BusinessGroup; +import org.olat.group.BusinessGroupService; +import org.olat.group.model.BusinessGroupQueryParams; +import org.olat.group.model.StatisticsBusinessGroupRow; import org.olat.group.ui.NewBGController; import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntryManagedFlag; import org.olat.repository.RepositoryManager; import org.springframework.beans.factory.annotation.Autowired; + /** * Initial Date: 15.06.2007 <br> * @author patrickb @@ -70,11 +79,13 @@ public class GroupSelectionController extends FormBasicController { private boolean createEnable; private FlexiTableElement groupTableElement; - private GroupSelectionTableModel groupTableModel; - private List<GroupSelectionTableContentRow> groupTableRows; + private ENEditGroupTableModel groupTableModel; + private List<ENEditGroupTableContentRow> groupTableRows; @Autowired private RepositoryManager repositoryManager; + @Autowired + private BusinessGroupService businessGroupService; public GroupSelectionController(UserRequest ureq, WindowControl wControl, boolean allowCreate, CourseGroupManager courseGrpMngr, List<Long> selectionKeys) { @@ -92,13 +103,21 @@ public class GroupSelectionController extends FormBasicController { public void loadModel(List<Long> selectionKeys) { List<BusinessGroup> groups = courseGrpMngr.getAllBusinessGroups(); - groupTableRows = new ArrayList<GroupSelectionTableContentRow>(); - Set<Integer> selectedRows = new HashSet<Integer>(); + BusinessGroupQueryParams params = new BusinessGroupQueryParams(); + List<Long> keys = new ArrayList<>(); + for (BusinessGroup group : groups) { + keys.add(group.getKey()); + } + + params.setBusinessGroupKeys(keys); + Map<Long, StatisticsBusinessGroupRow> stats = businessGroupService.findBusinessGroupsStatistics(params).stream().collect(Collectors.toMap(StatisticsBusinessGroupRow::getKey, g -> g, (u, v) -> u)); + groupTableRows = new ArrayList<>(); + Set<Integer> selectedRows = new HashSet<Integer>(); for (BusinessGroup businessGroup : groups) { - groupTableRows.add(new GroupSelectionTableContentRow(businessGroup.getKey(), businessGroup.getName())); + groupTableRows.add(new ENEditGroupTableContentRow(businessGroup, stats.get(businessGroup.getKey()))); for (Long selectionKey : selectionKeys) { if (selectionKey.equals(businessGroup.getKey())) { selectedRows.add(groupTableRows.size() - 1); @@ -140,8 +159,19 @@ public class GroupSelectionController extends FormBasicController { // select new value Collection<BusinessGroup> newGroups = groupCreateCntrllr.getCreatedGroups(); List<Integer> selectedRows = new ArrayList<>(groupTableElement.getMultiSelectedIndex()); + List<Long> keys = new ArrayList<>(); + + for (BusinessGroup businessGroup : newGroups) { + keys.add(businessGroup.getKey()); + } + + BusinessGroupQueryParams params = new BusinessGroupQueryParams(); + params.setBusinessGroupKeys(keys); + + Map<Long, StatisticsBusinessGroupRow> stats = businessGroupService.findBusinessGroupsStatistics(params).stream().collect(Collectors.toMap(StatisticsBusinessGroupRow::getKey, g -> g, (u, v) -> u)); + for(BusinessGroup newGroup : newGroups) { - groupTableRows.add(new GroupSelectionTableContentRow(newGroup.getKey(), newGroup.getName())); + groupTableRows.add(new ENEditGroupTableContentRow(newGroup, stats.get(newGroup.getKey()))); selectedRows.add(groupTableRows.size() - 1); } groupTableModel.setObjects(groupTableRows); @@ -165,11 +195,38 @@ public class GroupSelectionController extends FormBasicController { createNew = uifactory.addFormLink("create", formLayout, Link.BUTTON); } - FlexiTableColumnModel columnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); - columnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(GroupSelectionTableColumns.key)); - columnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(GroupSelectionTableColumns.groupName)); + FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); + DefaultFlexiColumnModel keyColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.key); + keyColumn.setDefaultVisible(true); + keyColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(keyColumn); + + DefaultFlexiColumnModel groupColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.groupName); + groupColumn.setDefaultVisible(true); + groupColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(groupColumn); + + DefaultFlexiColumnModel descriptionColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.description); + descriptionColumn.setDefaultVisible(true); + descriptionColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(descriptionColumn); + + DefaultFlexiColumnModel participantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.participants); + participantsColumn.setDefaultVisible(true); + participantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(participantsColumn); + + DefaultFlexiColumnModel maxParticipantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.maxParticipants); + maxParticipantsColumn.setDefaultVisible(true); + maxParticipantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(maxParticipantsColumn); + + DefaultFlexiColumnModel minParticipantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.minParticipants); + minParticipantsColumn.setDefaultVisible(true); + minParticipantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(minParticipantsColumn); - groupTableModel = new GroupSelectionTableModel(columnModel, getTranslator()); + groupTableModel = new ENEditGroupTableModel(columnsModel, getLocale(), getTranslator()); groupTableElement = uifactory.addTableElement(getWindowControl(), "entries", groupTableModel, getTranslator(), formLayout); groupTableElement.setEmtpyTableMessageKey("groupselection.noentries"); groupTableElement.setMultiSelect(true); diff --git a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties index 250254e563a..3ffd576670f 100644 --- a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_de.properties @@ -8,6 +8,17 @@ create=Erstellen create.group=Gruppe erstellen easy.operator=Operator easy.value=Wert +engroupedit.table.key=ID +engroupedit.table.up=Hoch +engroupedit.table.description=Beschreibung +engroupedit.table.down=Runter +engroupedit.table.groupName=Gruppenname +engroupedit.table.maxPart=Max. Teilnehmer +engroupedit.table.minPart=Min. Teilnehmer +engroupedit.table.enrolled=Belegt +engroupedit.table.waitinglist=Warteliste +engroupedit.table.waitinglistParticipants=Teilnehmer auf Warteliste +engroupedit.table.remove=Entfernen error.argtype.areanameexpected=Die "{0}"-Funktion muss mit einem Lernbereichsnamen aufgerufen werden. error.argtype.attributename=Die "{0}"-Funktion muss mit einem Attributsnamen aufgerufen werden. error.argtype.attribvalue=Die "{0}"-Funktion muss mit einem Attributswert aufgerufen werden. diff --git a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties index 7b79b31c9d0..332d5bbf3d0 100644 --- a/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/condition/_i18n/LocalStrings_en.properties @@ -8,6 +8,17 @@ create=Create create.group=Create group easy.operator=Operator easy.value=Value +engroupedit.table.key=ID +engroupedit.table.up=Up +engroupedit.table.description=Description +engroupedit.table.down=Down +engroupedit.table.groupName=Groupname +engroupedit.table.maxPart=Max. participants +engroupedit.table.minPart=Min. participants +engroupedit.table.enrolled=Enrolled +engroupedit.table.waitinglist=Waitinglist +engroupedit.table.waitinglistParticipants=Participants on waitinglist +engroupedit.table.remove=Remove error.argtype.areanameexpected=The "{0}" function must be part of a learning area. error.argtype.attributename=The "{0}" function must have an attribute name. error.argtype.attribvalue=The "{0}" function must have a matching attribute value. diff --git a/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java b/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java index 042625d80eb..7d6693993c3 100644 --- a/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java +++ b/src/main/java/org/olat/course/nodes/en/ENEditGroupAreaFormController.java @@ -71,6 +71,7 @@ import org.olat.course.editor.CourseEditorEnv; import org.olat.course.editor.NodeEditController; import org.olat.course.nodes.ENCourseNode; import org.olat.course.nodes.en.ENEditGroupTableModel.ENEditGroupTableColumns; +import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupShort; import org.olat.group.area.BGArea; @@ -129,7 +130,6 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener private final boolean managedGroups; private final BGAreaManager areaManager; - private final BusinessGroupService businessGroupService; private static final String CMD_UP = "up"; private static final String CMD_DOWN = "down"; @@ -137,6 +137,10 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener @Autowired private RepositoryManager repositoryManager; + @Autowired + private EnrollmentManager enrollmentManager; + @Autowired + private BusinessGroupService businessGroupService; public ENEditGroupAreaFormController(UserRequest ureq, WindowControl wControl, ModuleConfiguration moduleConfig, CourseEditorEnv cev) { super(ureq, wControl); @@ -144,7 +148,6 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener this.setTranslator(pT); areaManager = CoreSpringFactory.getImpl(BGAreaManager.class); - businessGroupService = CoreSpringFactory.getImpl(BusinessGroupService.class); singleUserEventCenter = ureq.getUserSession().getSingleUserEventCenter(); groupConfigChangeEventOres = OresHelper.createOLATResourceableType(MultiUserEvent.class); @@ -179,12 +182,17 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener } public void updateModel(List<Long> groupKeys) { - List<BusinessGroupShort> groups = businessGroupService.loadShortBusinessGroups(groupKeys); - Map<Long,BusinessGroupShort> groupMap = groups.stream().collect(Collectors.toMap(BusinessGroupShort::getKey, g -> g, (u, v) -> u)); + List<BusinessGroup> groups = businessGroupService.loadBusinessGroups(groupKeys); + Map<Long,BusinessGroup> groupMap = groups.stream().collect(Collectors.toMap(BusinessGroup::getKey, g -> g, (u, v) -> u)); + List<EnrollmentRow> enrollmentRows = enrollmentManager.getEnrollments(getIdentity(), groupKeys, null, 256); + Map<Long,EnrollmentRow> enrollmentMap = enrollmentRows.stream().collect(Collectors.toMap(EnrollmentRow::getKey, g -> g, (u, v) -> u)); easyGroupTableRows = new ArrayList<ENEditGroupTableContentRow>(); for (Long groupKey : groupKeys) { - easyGroupTableRows.add(new ENEditGroupTableContentRow(groupKey, groupMap.get(groupKey).getName())); + BusinessGroup group = groupMap.get(groupKey); + EnrollmentRow enrollment = enrollmentMap.get(groupKey); + + easyGroupTableRows.add(new ENEditGroupTableContentRow(group, enrollment)); } easyGroupTableModel.setObjects(easyGroupTableRows); @@ -231,7 +239,7 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener // groups String page = this.velocity_root + "/chooseGroups.html"; FormLayoutContainer buttonLayout = FormLayoutContainer.createCustomFormLayout("chooseGroups", getTranslator(), page); - formLayout.add("asdfasdf",buttonLayout); + formLayout.add("buttonLayout",buttonLayout); chooseGroupsLink = uifactory.addFormLink("chooseGroup", buttonLayout, "btn btn-default o_xsmall o_form_groupchooser"); chooseGroupsLink.setI18nKey("choose"); @@ -274,11 +282,30 @@ class ENEditGroupAreaFormController extends FormBasicController implements Gener groupColumn.setDefaultVisible(true); groupColumn.setAlwaysVisible(true); columnsModel.addFlexiColumnModel(groupColumn); + + DefaultFlexiColumnModel descriptionColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.description); + descriptionColumn.setDefaultVisible(true); + descriptionColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(descriptionColumn); + + DefaultFlexiColumnModel participantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.participants); + participantsColumn.setDefaultVisible(true); + participantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(participantsColumn); + + DefaultFlexiColumnModel maxParticipantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.maxParticipants); + maxParticipantsColumn.setDefaultVisible(true); + maxParticipantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(maxParticipantsColumn); + + DefaultFlexiColumnModel minParticipantsColumn = new DefaultFlexiColumnModel(ENEditGroupTableColumns.minParticipants); + minParticipantsColumn.setDefaultVisible(true); + minParticipantsColumn.setAlwaysVisible(true); + columnsModel.addFlexiColumnModel(minParticipantsColumn); + + columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ENEditGroupTableColumns.remove, CMD_REMOVE)); - columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ENEditGroupTableColumns.remove, CMD_REMOVE, - new StaticFlexiCellRenderer("", CMD_REMOVE, "o_icon o_icon-lg o_icon_delete_item"))); - - easyGroupTableModel = new ENEditGroupTableModel(columnsModel, getLocale()); + easyGroupTableModel = new ENEditGroupTableModel(columnsModel, getLocale(), getTranslator()); easyGroupTableElement = uifactory.addTableElement(getWindowControl(), "en_edit_group_table", easyGroupTableModel, getTranslator(), formLayout); easyGroupTableElement.setCustomizeColumns(false); easyGroupTableElement.setNumOfRowsEnabled(false); diff --git a/src/main/java/org/olat/course/nodes/en/ENEditGroupTableContentRow.java b/src/main/java/org/olat/course/nodes/en/ENEditGroupTableContentRow.java index 32aecf3aa44..a016e950727 100644 --- a/src/main/java/org/olat/course/nodes/en/ENEditGroupTableContentRow.java +++ b/src/main/java/org/olat/course/nodes/en/ENEditGroupTableContentRow.java @@ -19,6 +19,11 @@ */ package org.olat.course.nodes.en; +import org.olat.group.BusinessGroup; +import org.olat.group.model.StatisticsBusinessGroupRow; + +import com.rometools.rome.feed.rss.Description; + /** * * Initial date: 23 Dec 2019<br> @@ -29,15 +34,44 @@ public class ENEditGroupTableContentRow { private final Long key; private final String groupName; + private final String description; + private final int minParticipants; + private final int maxParticipants; + private final int participants; + private final int onWaitinglist; + private final boolean waitinglistEnabled; public ENEditGroupTableContentRow() { key = null; groupName = null; + description = null; + minParticipants = 0; + maxParticipants = 0; + participants = 0; + onWaitinglist = 0; + waitinglistEnabled = false; } - public ENEditGroupTableContentRow(Long key, String groupName) { - this.key = key; - this.groupName = groupName; + public ENEditGroupTableContentRow(BusinessGroup group, EnrollmentRow enrollment) { + this.key = group.getKey(); + this.groupName = group.getName(); + this.description = group.getDescription() != null ? group.getDescription() : ""; + this.maxParticipants = group.getMaxParticipants() != null ? group.getMaxParticipants() : -1; + this.minParticipants = group.getMinParticipants() != null ? group.getMinParticipants() : -1; + this.waitinglistEnabled = group.getWaitingListEnabled(); + this.onWaitinglist = enrollment.getNumInWaitingList(); + this.participants = enrollment.getNumOfParticipants(); + } + + public ENEditGroupTableContentRow(BusinessGroup group, StatisticsBusinessGroupRow stats) { + this.key = group.getKey(); + this.groupName = group.getName(); + this.description = group.getDescription() != null ? group.getDescription() : ""; + this.maxParticipants = group.getMaxParticipants() != null ? group.getMaxParticipants() : -1; + this.minParticipants = group.getMinParticipants() != null ? group.getMinParticipants() : -1; + this.waitinglistEnabled = group.getWaitingListEnabled(); + this.onWaitinglist = stats.getNumWaiting(); + this.participants = stats.getNumOfParticipants(); } @@ -48,4 +82,30 @@ public class ENEditGroupTableContentRow { public String getGroupName() { return groupName; } + + public String getDescription() { + return description; + } + + public String getMinParticipants() { + return minParticipants > -1 ? String.valueOf(minParticipants) : " - "; + } + + public String getMaxParticipants() { + return maxParticipants > -1 ? String.valueOf(maxParticipants) : " - "; + } + + public int getParticipants() { + return participants; + } + + public int getOnWaitinglist() { + return onWaitinglist; + } + + public boolean isWaitinglistEnabled() { + return waitinglistEnabled; + } + + } diff --git a/src/main/java/org/olat/course/nodes/en/ENEditGroupTableModel.java b/src/main/java/org/olat/course/nodes/en/ENEditGroupTableModel.java index b4f9aafe307..719a0cfc933 100644 --- a/src/main/java/org/olat/course/nodes/en/ENEditGroupTableModel.java +++ b/src/main/java/org/olat/course/nodes/en/ENEditGroupTableModel.java @@ -23,10 +23,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import org.olat.core.util.Formatter; import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiColumnDef; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModel; +import org.olat.core.gui.translator.Translator; +import org.olat.core.util.filter.FilterFactory; /** * @@ -39,10 +42,12 @@ public class ENEditGroupTableModel extends DefaultFlexiTableDataModel<ENEditGrou implements FlexiTableDataModel<ENEditGroupTableContentRow> { private final Locale locale; + private final Translator translator; - public ENEditGroupTableModel(FlexiTableColumnModel columnModel, Locale locale) { + public ENEditGroupTableModel(FlexiTableColumnModel columnModel, Locale locale, Translator translator) { super(columnModel); this.locale = locale; + this.translator = translator; } @Override @@ -64,6 +69,20 @@ public class ENEditGroupTableModel extends DefaultFlexiTableDataModel<ENEditGrou return row.getKey(); case groupName: return row.getGroupName(); + case remove: + return translator.translate(ENEditGroupTableColumns.remove.i18nHeaderKey); + case minParticipants: + return row.getMinParticipants(); + case maxParticipants: + return row.getMaxParticipants(); + case description: + return Formatter.truncate(FilterFactory.getHtmlTagAndDescapingFilter().filter(row.getDescription()), 250); + case waitinglistEnabled: + return row.isWaitinglistEnabled(); + case onWaitinglist: + return row.getOnWaitinglist(); + case participants: + return row.getParticipants(); default: return "ERROR"; @@ -72,7 +91,7 @@ public class ENEditGroupTableModel extends DefaultFlexiTableDataModel<ENEditGrou @Override public DefaultFlexiTableDataModel<ENEditGroupTableContentRow> createCopyWithEmptyList() { - return new ENEditGroupTableModel(getTableColumnModel(), locale); + return new ENEditGroupTableModel(getTableColumnModel(), locale, translator); } public List<String> getNames() { @@ -96,8 +115,18 @@ public class ENEditGroupTableModel extends DefaultFlexiTableDataModel<ENEditGrou } public enum ENEditGroupTableColumns implements FlexiColumnDef { - key("engroupedit.table.key"), groupName("engroupedit.table.groupName"), up("engroupedit.table.up"), - down("engroupedit.table.down"), remove("engroupedit.table.remove"); + key("engroupedit.table.key"), + groupName("engroupedit.table.groupName"), + up("engroupedit.table.up"), + down("engroupedit.table.down"), + remove("engroupedit.table.remove"), + minParticipants("engroupedit.table.minPart"), + maxParticipants("engroupedit.table.maxPart"), + description("engroupedit.table.description"), + participants("engroupedit.table.enrolled"), + waitinglistEnabled("engroupedit.table.waitinglist"), + onWaitinglist("engroupedit.table.waitinglistParticipants"), + isProtected("engroupedit.table.isProteced"); private final String i18nHeaderKey; diff --git a/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_de.properties index f61661f5bd9..cfb271b8dc8 100644 --- a/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_de.properties @@ -18,9 +18,16 @@ title_en=Einschreibung cmd.enroll.in.group=Einschreiben cmd.enrolled.cancel=Austragen config.header1=Einschreibung in Lerngruppen und Lernbereiche +engroupedit.table.key=ID engroupedit.table.up=Hoch +engroupedit.table.description=Beschreibung engroupedit.table.down=Runter engroupedit.table.groupName=Gruppenname +engroupedit.table.maxPart=Max. Teilnehmer +engroupedit.table.minPart=Min. Teilnehmer +engroupedit.table.enrolled=Belegt +engroupedit.table.waitinglist=Warteliste +engroupedit.table.waitinglistParticipants=Teilnehmer auf Warteliste engroupedit.table.remove=Entfernen enroll.explain=W\u00E4hlen Sie eine der untenstehenden Lerngruppen aus, um sich einzuschreiben. enrolled.explain=Sie sind in die untenstehende(n) Lerngruppe(n) eingeschrieben. W\u00E4hlen Sie - sofern vorhanden - den Link Austragen, um sich aus der entsprechenden Gruppe auszutragen. <b>Achtung\:</b> Diese Einschreibung betrifft einzig die gew\u00E4hlten Gruppen im entsprechenden OpenOlat-Kurs. diff --git a/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_en.properties index d4aeaa55a8f..43aba2b969d 100644 --- a/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/nodes/en/_i18n/LocalStrings_en.properties @@ -17,6 +17,16 @@ cmd.enroll.in.group=Enrol cmd.enrolled.cancel=Cancel config.header1=Enrolment in learning groups and learning areas +engroupedit.table.up=Up +engroupedit.table.description=Description +engroupedit.table.down=Down +engroupedit.table.groupName=Groupname +engroupedit.table.maxPart=Max. participants +engroupedit.table.minPart=Min. participants +engroupedit.table.enrolled=Enrolled +engroupedit.table.waitinglist=Waitinglist +engroupedit.table.waitinglistParticipants=Participants on waitinglist +engroupedit.table.remove=Remove enroll.explain=Choose one of the learning groups below to enrol. enrolled.explain=You have already enroled for the learning groups mentioned below. To cancel your enrolment please click on the button below (if available). <b>Attention\:</b> Your enrolment concerns only the groups selected in the corresponding OpenOlat course. enrolled.group.desc=Description diff --git a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java index a42f913fa43..eb09dcc351f 100644 --- a/src/main/java/org/olat/group/manager/BusinessGroupDAO.java +++ b/src/main/java/org/olat/group/manager/BusinessGroupDAO.java @@ -991,8 +991,8 @@ public class BusinessGroupDAO { query.setParameter("identityKey", identity.getKey()); } - if(params.getBusinessGroupKey() != null) { - query.setParameter("businessGroupKey", params.getBusinessGroupKey()); + if(params.getBusinessGroupKeys() != null && !params.getBusinessGroupKeys().isEmpty()) { + query.setParameter("businessGroupKeys", params.getBusinessGroupKeys()); } if(params.getRepositoryEntry() != null) { @@ -1068,9 +1068,9 @@ public class BusinessGroupDAO { sb.append(")"); } - if(params.getBusinessGroupKey() != null) { + if(params.getBusinessGroupKeys() != null) { where = PersistenceHelper.appendAnd(sb, where); - sb.append(" bgi.key=:businessGroupKey"); + sb.append(" bgi.key in (:businessGroupKeys)"); } if(params.isMarked()) { diff --git a/src/main/java/org/olat/group/model/BusinessGroupQueryParams.java b/src/main/java/org/olat/group/model/BusinessGroupQueryParams.java index 4c9c9a6ad9c..9c732a689bc 100644 --- a/src/main/java/org/olat/group/model/BusinessGroupQueryParams.java +++ b/src/main/java/org/olat/group/model/BusinessGroupQueryParams.java @@ -19,6 +19,8 @@ **/ package org.olat.group.model; +import java.util.List; + import org.olat.repository.RepositoryEntryRef; /** @@ -46,7 +48,7 @@ public class BusinessGroupQueryParams { private boolean headless = false; private boolean authorConnection; - private Long businessGroupKey; + private List<Long> businessGroupKeys; private RepositoryEntryRef repositoryEntry; public BusinessGroupQueryParams() { @@ -174,12 +176,12 @@ public class BusinessGroupQueryParams { this.resources = resources; } - public Long getBusinessGroupKey() { - return businessGroupKey; + public List<Long> getBusinessGroupKeys() { + return businessGroupKeys; } - public void setBusinessGroupKey(Long businessGroupKey) { - this.businessGroupKey = businessGroupKey; + public void setBusinessGroupKeys(List<Long> businessGroupKeys) { + this.businessGroupKeys = businessGroupKeys; } public RepositoryEntryRef getRepositoryEntry() { diff --git a/src/main/java/org/olat/group/model/StatisticsBusinessGroupRow.java b/src/main/java/org/olat/group/model/StatisticsBusinessGroupRow.java index 58f9a4dcc7e..f6706b89fb1 100644 --- a/src/main/java/org/olat/group/model/StatisticsBusinessGroupRow.java +++ b/src/main/java/org/olat/group/model/StatisticsBusinessGroupRow.java @@ -41,19 +41,19 @@ public class StatisticsBusinessGroupRow extends BusinessGroupRow { numPending = pending == null ? 0 : pending.intValue(); } - public long getNumOfCoaches() { + public int getNumOfCoaches() { return numOfCoaches; } - public long getNumOfParticipants() { + public int getNumOfParticipants() { return numOfParticipants; } - public long getNumWaiting() { + public int getNumWaiting() { return numWaiting; } - public long getNumPending() { + public int getNumPending() { return numPending; } diff --git a/src/main/java/org/olat/group/ui/main/EditMembershipController.java b/src/main/java/org/olat/group/ui/main/EditMembershipController.java index 125626549cd..363f38a0f47 100644 --- a/src/main/java/org/olat/group/ui/main/EditMembershipController.java +++ b/src/main/java/org/olat/group/ui/main/EditMembershipController.java @@ -204,7 +204,9 @@ public class EditMembershipController extends FormBasicController { Roles roles = ureq.getUserSession().getRoles(); BusinessGroupQueryParams params = new BusinessGroupQueryParams(); if(repoEntry == null && businessGroup != null) { - params.setBusinessGroupKey(businessGroup.getKey()); + List<Long> keys = new ArrayList<>(); + keys.add(businessGroup.getKey()); + params.setBusinessGroupKeys(keys); } else { params.setRepositoryEntry(repoEntry); } -- GitLab