-
-
Notifications
You must be signed in to change notification settings - Fork 956
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-50690 Meetings add banner to register and add option to download …
…assistance reports CSV (#13027)
- Loading branch information
Showing
22 changed files
with
768 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,22 +19,23 @@ | |
import java.time.Instant; | ||
import java.time.format.DateTimeParseException; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Locale; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Collections; | ||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.sakaiproject.component.api.ServerConfigurationService; | ||
import org.sakaiproject.authz.api.Member; | ||
import org.sakaiproject.authz.api.SecurityService; | ||
import org.sakaiproject.exception.IdUnusedException; | ||
import org.sakaiproject.meetings.api.MeetingService; | ||
import org.sakaiproject.meetings.api.model.AttendeeType; | ||
import org.sakaiproject.meetings.api.model.Meeting; | ||
import org.sakaiproject.meetings.api.model.MeetingAttendee; | ||
import org.sakaiproject.meetings.api.model.*; | ||
import org.sakaiproject.meetings.controller.data.GroupData; | ||
import org.sakaiproject.meetings.controller.data.MeetingData; | ||
import org.sakaiproject.meetings.controller.data.NotificationType; | ||
|
@@ -43,17 +44,17 @@ | |
import org.sakaiproject.microsoft.api.MicrosoftCommonService; | ||
import org.sakaiproject.microsoft.api.MicrosoftSynchronizationService; | ||
import org.sakaiproject.microsoft.api.SakaiProxy; | ||
import org.sakaiproject.microsoft.api.data.MeetingRecordingData; | ||
import org.sakaiproject.microsoft.api.data.SakaiCalendarEvent; | ||
import org.sakaiproject.microsoft.api.data.TeamsMeetingData; | ||
import org.sakaiproject.microsoft.api.data.*; | ||
import org.sakaiproject.microsoft.api.exceptions.MicrosoftCredentialsException; | ||
import org.sakaiproject.site.api.Group; | ||
import org.sakaiproject.site.api.Site; | ||
import org.sakaiproject.user.api.User; | ||
import org.sakaiproject.util.ResourceLoader; | ||
import org.springframework.beans.BeanUtils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
@@ -79,7 +80,10 @@ public class MeetingsController { | |
|
||
/** Resource bundle using current language locale */ | ||
private static ResourceLoader rb = new ResourceLoader("Messages"); | ||
|
||
|
||
@Autowired | ||
private ServerConfigurationService serverConfigurationService; | ||
|
||
@Autowired | ||
private MeetingService meetingService; | ||
|
||
|
@@ -104,7 +108,21 @@ public class MeetingsController { | |
private static final String NOTIF_CONTENT = "notification.content"; | ||
private static final String SMTP_FROM = "[email protected]"; | ||
private static final String NO_REPLY = "no-reply@"; | ||
|
||
private static final String REPORT_FORMAT_CSV = "csv"; | ||
private static final String ATTENDANCE_REPORT_FILENAME = "attendance_report.csv"; | ||
|
||
/** | ||
* Default meetings properties | ||
* @return | ||
*/ | ||
@GetMapping(value="/config", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Map<String, Boolean> getConfig() { | ||
boolean showMeetingBanner = serverConfigurationService.getBoolean( "show.meeting.banner", false); | ||
|
||
return Map.of( | ||
"showMeetingBanner", showMeetingBanner | ||
); | ||
} | ||
/** | ||
* Check if there's an user logged | ||
* @return | ||
|
@@ -593,6 +611,40 @@ public void deleteMeeting(@PathVariable String meetingId) throws MeetingsExcepti | |
throw new MeetingsException(e.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
@GetMapping(value = "/meeting/{meetingId}/attendanceReport", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<?> getMeetingAttendanceReport(@PathVariable String meetingId, @RequestParam(required = false) String format) throws MeetingsException { | ||
checkCurrentUserInMeeting(meetingId); | ||
Meeting meeting = meetingService.getMeeting(meetingId); | ||
String onlineMeetingId = meetingService.getMeetingProperty(meeting, ONLINE_MEETING_ID); | ||
String organizerEmail = meetingService.getMeetingProperty(meeting, ORGANIZER_USER); | ||
checkUpdatePermissions(meeting.getSiteId()); | ||
List<String> columnNames = Arrays.asList( | ||
rb.getString("meeting.column_name"), | ||
rb.getString("meeting.column_email"), | ||
rb.getString("meeting.column_role"), | ||
rb.getString("meeting.column_duration"), | ||
rb.getString("meeting.entry_date"), | ||
rb.getString("meeting.exit_date"), | ||
rb.getString("meeting.interval_duration") | ||
); | ||
|
||
try { | ||
List<AttendanceRecord> attendanceRecords = microsoftCommonService.getMeetingAttendanceReport(onlineMeetingId, organizerEmail); | ||
if (REPORT_FORMAT_CSV.equalsIgnoreCase(format)) { | ||
byte[] csvContent = microsoftCommonService.createAttendanceReportCsv(attendanceRecords, columnNames); | ||
return ResponseEntity.ok() | ||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + ATTENDANCE_REPORT_FILENAME + "\"") | ||
.contentType(MediaType.TEXT_PLAIN) | ||
.body(csvContent); | ||
} else { | ||
return ResponseEntity.ok(attendanceRecords); | ||
} | ||
} catch (Exception e) { | ||
log.error("Error when obtaining the attendance report", e); | ||
throw new MeetingsException(e.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Get i18n bundle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
notification.subject=A new meeting \u0027{0}\u0027 has been published in the site \u0027{1}\u0027 | ||
notification.content=You have been invited to participate in the meeting <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.column_name=Name | ||
meeting.column_email=Email | ||
meeting.column_role=Role | ||
meeting.column_duration=Duration (seconds) | ||
meeting.entry_date=Entry Date | ||
meeting.exit_date=Exit Date | ||
meeting.interval_duration=Interval Duration (seconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
notification.subject=S\u2019ha publicat una nova reuni\u00F3 \u0027{0}\u0027 a l\u2019espai {1} | ||
notification.content=Ha sigut convidat a participar en la reuni\u00F3 <i>{0}</i>. | ||
notification.content=Ha sigut convidat a participar en la reuni\u00F3 <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.column_name=Nom | ||
meeting.column_email=Correu | ||
meeting.column_role=Rol | ||
meeting.column_duration=Duraci\u00F3 (segons) | ||
meeting.entry_date=Data d\u2019entrada | ||
meeting.exit_date=Data de sortida | ||
meeting.interval_duration=Interval de Duraci\u00F3 (segons) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
notification.subject=Se ha publicado una nueva reuni\u00f3n '{0}' en el sitio {1} | ||
notification.content=Ha sido invitado a participar en la reuni\u00f3n <i>{0}</i>. | ||
|
||
#Meetings | ||
meeting.column_name=Nombre | ||
meeting.column_email=Correo | ||
meeting.column_role=Rol | ||
meeting.column_duration=Duraci\u00f3n (segundos) | ||
meeting.entry_date=Fecha de entrada | ||
meeting.exit_date=Fecha de salida | ||
meeting.interval_duration=Intervalo de Duraci\u00f3n (segundos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.