Skip to content

Commit 2b15e05

Browse files
committed
Add/Edit Room: Room Sharing
- added an ability to list all departments as available for room sharing (instead of those that are being used, i.e., departments that have a manager, a subject area, or another room) - set unitime.roomDepts.usedDepartmentsOnly to false to enable (defaults to true, only show departments that are being used)
1 parent d5969c5 commit 2b15e05

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

JavaSource/org/unitime/timetable/defaults/ApplicationProperty.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,6 +3805,12 @@ public enum ApplicationProperty {
38053805
@Description("Instructional Offerings: show subject area titles in the Subject filter")
38063806
@Since(4.9)
38073807
OfferingsFilterSubjectTitle("unitime.offering.subjectFilterShowTitles"),
3808+
3809+
@Type(Boolean.class)
3810+
@DefaultValue("true")
3811+
@Description("Rooms: list only used departments as available for room sharing (i.e., departments that have a manager, a subject area, or another room).")
3812+
@Since(4.9)
3813+
RoomDeptUsedDeptsOnly("unitime.roomDepts.usedDepartmentsOnly"),
38083814
;
38093815

38103816
String iKey;

JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public RoomPropertiesInterface execute(RoomPropertiesRequest request, SessionCon
141141
response.addExamType(new ExamTypeInterface(type.getUniqueId(), type.getReference(), type.getLabel(), type.getType() == ExamType.sExamTypeFinal));
142142
}
143143

144-
for (Department d: Department.getUserDepartments(context.getUser())) {
144+
boolean usedOnly = ApplicationProperty.RoomDeptUsedDeptsOnly.isTrue();
145+
for (Department d: Department.getUserDepartments(context.getUser(), usedOnly)) {
145146
DepartmentInterface department = new DepartmentInterface();
146147
department.setId(d.getUniqueId());
147148
department.setDeptCode(d.getDeptCode());
@@ -155,7 +156,7 @@ public RoomPropertiesInterface execute(RoomPropertiesRequest request, SessionCon
155156
department.setCanEditRoomSharing(context.hasPermission(d, Right.EditRoomDepartments));
156157
response.addDepartment(department);
157158
}
158-
response.setNrDepartments(Department.findAllBeingUsed(response.getAcademicSessionId()).size());
159+
response.setNrDepartments(usedOnly ? Department.findAllBeingUsed(response.getAcademicSessionId()).size() : Department.findAll(response.getAcademicSessionId()).size());
159160

160161
response.setHorizontal(context.getUser() == null ? false : CommonValues.HorizontalGrid.eq(context.getUser().getProperty(UserProperty.GridOrientation)));
161162
response.setGridAsText(context.getUser() == null ? false : CommonValues.TextGrid.eq(context.getUser().getProperty(UserProperty.GridOrientation)));

JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ public RoomSharingModel loadRoomSharing(Location location, boolean includeRoomPr
136136
}
137137

138138
boolean deptIndependent = context.getUser().getCurrentAuthority().hasRight(Right.DepartmentIndependent);
139+
boolean usedOnly = ApplicationProperty.RoomDeptUsedDeptsOnly.isTrue();
139140
if (location == null) {
140141
Long neutralId = (includeRoomPreferences ? PreferenceLevel.getPreferenceLevel(PreferenceLevel.sNeutral).getUniqueId() : null);
141-
for (Department d: Department.findAllBeingUsed(context.getUser().getCurrentAcademicSessionId())) {
142+
for (Department d: (usedOnly ? Department.findAllBeingUsed(context.getUser().getCurrentAcademicSessionId()) : Department.findAll(context.getUser().getCurrentAcademicSessionId()))) {
142143
Long prefId = null;
143144
if (includeRoomPreferences && (deptIndependent || context.getUser().getCurrentAuthority().hasQualifier(d)))
144145
prefId = neutralId;
@@ -168,7 +169,7 @@ public int compare(RoomDept rd1, RoomDept rd2) {
168169
d.getDeptCode(), d.getName() + (d.isExternalManager() ? " (EXT: " + d.getExternalMgrLabel() + ")" : ""), editable, prefId));
169170
}
170171

171-
for (Department d: Department.findAllBeingUsed(context.getUser().getCurrentAcademicSessionId())) {
172+
for (Department d: (usedOnly ? Department.findAllBeingUsed(context.getUser().getCurrentAcademicSessionId()) : Department.findAll(context.getUser().getCurrentAcademicSessionId()))) {
172173
Long prefId = null;
173174
if (includeRoomPreferences && (deptIndependent || context.getUser().getCurrentAuthority().hasQualifier(d))) {
174175
prefId = neutralId;

WebContent/help/Release-Notes.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
<line>Added an ability to not show the subject area titles in the filter (when unitime.offering.subjectFilterShowTitles is set to false).</line>
4444
</description>
4545
</item>
46+
<item>
47+
<name>Add/Edit Room: Room Sharing</name>
48+
<description>
49+
<line>Added an ability to list all departments as available for room sharing (instead of those that are being used, i.e., departments that have a manager, a subject area, or another room).
50+
<line>Set unitime.roomDepts.usedDepartmentsOnly to false to enable (defaults to true, only show departments that are being used).</line>
51+
</line>
52+
</description>
53+
</item>
4654
</category>
4755
<category>
4856
<title>Examination Timetabling</title>

0 commit comments

Comments
 (0)