%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<%
String activeView = ParamUtil.getString(request, "activeView", sessionClicksDefaultView);
long date = ParamUtil.getLong(request, "date", System.currentTimeMillis());
String editCalendarBookingURL = ParamUtil.getString(request, "editCalendarBookingURL");
String filterCalendarBookings = ParamUtil.getString(request, "filterCalendarBookings", null);
boolean hideAgendaView = ParamUtil.getBoolean(request, "hideAgendaView");
boolean hideDayView = ParamUtil.getBoolean(request, "hideDayView");
boolean hideMonthView = ParamUtil.getBoolean(request, "hideMonthView");
boolean hideWeekView = ParamUtil.getBoolean(request, "hideWeekView");
String permissionsCalendarBookingURL = ParamUtil.getString(request, "permissionsCalendarBookingURL");
boolean preventPersistence = ParamUtil.getBoolean(request, "preventPersistence");
boolean readOnly = ParamUtil.getBoolean(request, "readOnly");
boolean showAddEventBtn = ParamUtil.getBoolean(request, "showAddEventBtn");
String viewCalendarBookingURL = ParamUtil.getString(request, "viewCalendarBookingURL");
%>
<%@ include file="/event_recorder.jspf" %>
Liferay.CalendarUtil.PORTLET_NAMESPACE = '';
Liferay.CalendarUtil.USER_TIME_ZONE = '<%= HtmlUtil.escapeJS(userTimeZone.getID()) %>';
window.dayView = new A.SchedulerDayView(
{
height: 700,
isoTime: <%= isoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: {
allDay: ''
}
}
);
window.weekView = new A.SchedulerWeekView(
{
height: 700,
isoTime: <%= isoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: {
allDay: ''
}
}
);
window.monthView = new A.SchedulerMonthView(
{
height: 700,
isoTime: <%= isoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: {
close: '',
more: '<%= StringUtil.toLowerCase(LanguageUtil.get(pageContext, "more")) %>',
show: ''
}
}
);
window.agendaView = new A.SchedulerAgendaView(
{
height: 700,
isoTime: <%= isoTimeFormat %>,
readOnly: <%= readOnly %>,
strings: {
noEvents: ''
}
}
);
var width = Math.min(Liferay.Util.getWindowWidth(), 550);
window.eventRecorder = new Liferay.SchedulerEventRecorder(
{
bodyTemplate: new A.Template(A.one('#eventRecorderBodyTpl').html()),
calendarId: <%= userDefaultCalendar.getCalendarId() %>,
color: '<%= ColorUtil.toHexString(userDefaultCalendar.getColor()) %>',
duration: <%= defaultDuration %>,
editCalendarBookingURL: '<%= HtmlUtil.escapeJS(editCalendarBookingURL) %>',
headerTemplate: new A.Template(A.one('#eventRecorderHeaderTpl').html()),
permissionsCalendarBookingURL: '<%= HtmlUtil.escapeJS(permissionsCalendarBookingURL) %>',
popover: {
width: width
},
portletNamespace: '',
viewCalendarBookingURL: '<%= HtmlUtil.escapeJS(viewCalendarBookingURL) %>'
}
);
var views = [];
views.push(window.dayView);
views.push(window.weekView);
views.push(window.monthView);
views.push(window.agendaView);
window.scheduler = new Liferay.Scheduler(
{
activeView: window['<%= HtmlUtil.escapeJS(activeView) %>View'],
boundingBox: '#scheduler',
<%
java.util.Calendar dateJCalendar = CalendarFactoryUtil.getCalendar(userTimeZone);
dateJCalendar.setTimeInMillis(date);
int dateYear = dateJCalendar.get(java.util.Calendar.YEAR);
int dateMonth = dateJCalendar.get(java.util.Calendar.MONTH);
int dateDay = dateJCalendar.get(java.util.Calendar.DAY_OF_MONTH);
%>
date: new Date(<%= dateYear %>, <%= dateMonth %>, <%= dateDay %>),
disabled: true,
eventRecorder: window.eventRecorder,
filterCalendarBookings: window['<%= HtmlUtil.escapeJS(filterCalendarBookings) %>'],
firstDayOfWeek: <%= weekStartsOn %>,
items: A.Object.values(Liferay.CalendarUtil.availableCalendars),
portletNamespace: '',
preventPersistence: <%= preventPersistence %>,
render: true,
showAddEventBtn: <%= showAddEventBtn %>,
strings: {
agenda: '',
day: '',
month: '',
today: '',
week: '',
year: ''
},
<%
java.util.Calendar todayJCalendar = CalendarFactoryUtil.getCalendar(userTimeZone);
int todayYear = todayJCalendar.get(java.util.Calendar.YEAR);
int todayMonth = todayJCalendar.get(java.util.Calendar.MONTH);
int todayDay = todayJCalendar.get(java.util.Calendar.DAY_OF_MONTH);
%>
todayDate: new Date(<%= todayYear %>, <%= todayMonth %>, <%= todayDay %>),
views: views
}
);