<% /** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ %> <% Calendar cal = (Calendar)selCal.clone(); dateFormatDate = new SimpleDateFormat("MMMMM d, yyyy", locale); %>
<% cal.add(Calendar.DATE, -1); %> <% cal.add(Calendar.DATE, 1); %> <%= dateFormatDate.format(Time.getDate(cal)) %> <% cal.add(Calendar.DATE, 1); %>

" onClick="location.href = '';" /> " onClick="location.href = '';" />

<% List results = CalEventLocalServiceUtil.getEvents(scopeGroupId, selCal, eventType); List allDayResults = new ArrayList(); List partDayResults = new ArrayList(); Iterator itr = results.iterator(); while (itr.hasNext()) { CalEvent event = itr.next(); if (event.isAllDay()) { allDayResults.add(event); } else { partDayResults.add(event); } } partDayResults = ListUtil.sort(partDayResults, new EventTimeComparator(timeZone, locale)); List> sortedResults = new ArrayList>(); if (partDayResults.size() > 0) { sortedResults.add(new ArrayList()); sortedResults.get(0).add(partDayResults.get(0)); for (int i = 1; i < partDayResults.size(); i++) { CalEvent event = partDayResults.get(i); Date startDate = event.getStartDate(); int startDateScore = (startDate.getHours() * 60) + startDate.getMinutes(); for (int j = 0; j < sortedResults.size(); j++) { List curEvents = sortedResults.get(j); CalEvent curEvent = (CalEvent)curEvents.get(curEvents.size() - 1); Date curStartDate = curEvent.getStartDate(); int curStartDateScore = (curStartDate.getHours() * 60) + curStartDate.getMinutes() + (curEvent.getDurationHour() * 60) + curEvent.getDurationMinute(); if (curStartDateScore <= startDateScore) { sortedResults.get(j).add(event); break; } else if (sortedResults.size() <= (j + 1)) { sortedResults.add(new ArrayList()); sortedResults.get(j + 1).add(event); break; } } } } %>
<% for (int i = 0; i < allDayResults.size(); i++) { CalEvent event = allDayResults.get(i); event = event.toEscapedModel(); %> <% } %>
<% for (int i = 0; i < 24; i++) { String displayTime = ((i % 12) == 0 ? "12" : (i % 12)) + ( i < 12 ? " AM" : " PM"); String businessHours = ((i >= 9) && (i < 17)) ? "business-hour" : "night-hour"; %>
<%= displayTime %>
<% } %> <% int eventWidth = 90 / (sortedResults.size() > 0 ? sortedResults.size() : 1); for (int i = 0; i < sortedResults.size(); i++) { List displayResults = sortedResults.get(i); for (CalEvent event : displayResults) { event = event.toEscapedModel(); Date startDate = event.getStartDate(); if (event.isTimeZoneSensitive()) { startDate = Time.getDate(event.getStartDate(), timeZone); } int eventStartPos = (int)(((((startDate.getHours() * 60) + (float)startDate.getMinutes() ) / 60) * 50) - 2); int eventBoxLength = (int)(((((event.getDurationHour() * 60) + (float)event.getDurationMinute()) / 60) * 50) - 12); if ((eventBoxLength + eventStartPos) > 1186) { eventBoxLength -= (eventBoxLength + eventStartPos) - 1186; // = (24 * 50) - 4 } %>
<%= dateFormatTime.format(Time.getDate(event.getStartDate(), timeZone)) %> - <%= dateFormatTime.format(Time.getDate(CalUtil.getEndTime(event), timeZone)) %> <%= dateFormatTime.format(event.getStartDate()) %> - <%= dateFormatTime.format(CalUtil.getEndTime(event)) %>
<%= StringUtil.shorten(event.getDescription(), 100) %>
<% } } %>
<% cal.add(Calendar.DATE, -1); PortalUtil.setPageSubtitle(dateFormatDate.format(Time.getDate(cal)), request); %>