Skip to content

Commit

Permalink
SAK-49494 Calendar externalize fullCalendar settings (sakaiproject#12136
Browse files Browse the repository at this point in the history
)
  • Loading branch information
danielmerino authored Dec 5, 2023
1 parent 02e396a commit ce2c1d9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ public class CalendarAction
private final static String ASSN_ENTITY_ID = "assignment";
private final static String ASSN_ENTITY_ACTION = "deepLink";
private final static String ASSN_ENTITY_PREFIX = EntityReference.SEPARATOR+ASSN_ENTITY_ID+EntityReference.SEPARATOR+ASSN_ENTITY_ACTION+EntityReference.SEPARATOR;

private final static String FULLCALENDAR_ASPECTRATIO = ServerConfigurationService.getString("calendar.fullCalendar.aspectRatio", "1.35");
private final static String FULLCALENDAR_SCROLLTIME = ServerConfigurationService.getString("calendar.fullCalendar.scrollTime", "06:00:00");

private NumberFormat monthFormat = null;

Expand Down Expand Up @@ -6846,6 +6849,9 @@ protected void buildViewCalendarContext(VelocityPortlet portlet, Context context
context.put("isDefaultView", isDefaultView(state, ToolManager.getCurrentPlacement()));
context.put("defaultSubview", ToolManager.getCurrentPlacement().getPlacementConfig().getProperty(PORTLET_CONFIG_DEFAULT_SUBVIEW));
context.put("isUpdater", SiteService.allowUpdateSite(ToolManager.getCurrentPlacement().getContext()));
context.put("aspectRatio", FULLCALENDAR_ASPECTRATIO);
context.put("scrollTime", FULLCALENDAR_SCROLLTIME);

} // buildCalendarContext

} // CalendarAction
11 changes: 11 additions & 0 deletions calendar/calendar-tool/tool/src/webapp/js/sakai-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const sakaiCalendar = {
this.calendar = new FullCalendar.Calendar(calendarDiv, {
initialView: 'timeGridWeek',
timeZone: sakaiCalendar.userTimeZone,
aspectRatio: 1.35,
scrollTime: '06:00',
scrollTimeReset: false,
displayEventTime: false,
allDaySlot: false,
themeSystem: 'bootstrap5',
Expand Down Expand Up @@ -132,6 +135,14 @@ const sakaiCalendar = {
gotoDate (currentDate) {
this.calendar.gotoDate(currentDate);
},

setScrollTime (scrollTimeParam) {
this.calendar.scrollToTime(scrollTimeParam);
},

setAspectRatio (aspectRatio) {
this.calendar.setOption('aspectRatio', aspectRatio);
},

// When the user changes the view, reflect the change in a param to set the default view.
onChangeCalendarView () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@
// Set the default subview based on the backend value.
const defaultSubview = '$defaultSubview';
sakaiCalendar.setDefaultSubview(defaultSubview);
const aspectRatio = '$aspectRatio';
sakaiCalendar.setAspectRatio(aspectRatio);
const scrollTime = '$scrollTime';
sakaiCalendar.setScrollTime(scrollTime);

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2522,11 +2522,13 @@
# DEFAULT: 12
# calendar.export.next.months=12

# SAK-21242 - Determine the number of hours to show in one page (default is 10).
# Second page (default) starts at 8:00 so 12 hours will show events until 20:00 and 14 hours until 22:00.
# Third page starts at 24-calendar.hoursPerPage
# Value is limited from 8 to 16 because this view is hardcoded to 3 pages.
# calendar.hoursPerPage=10
# SAK-49494: Externalize fullCalendar configuration
# scrollTime and aspectRatio allow very useful changes, more settings could be added.
# aspectRatio must be always changed before scrollTime because scrollTime needs some scroll to work.
# aspectRatio: The width-to-height aspect ratio of the calendar. Allows to fit the size.
# calendar.fullCalendar.aspectRatio=1.35
# scrollTime: The scroll pane is initially scrolled to this time in Day & Week views.
# calendar.fullCalendar.scrollTime=06:00:00

## HELP TOOL (helpPath defined in PATHS section above)
# Comma separated list of tools or categories whose help should not be added to the help index.
Expand Down

0 comments on commit ce2c1d9

Please sign in to comment.