Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-19324

Show upcoming events in Calendar portlet

    Details

    • Type: Feature Request
    • Status: Closed
    • Priority: Minor
    • Resolution: Implemented in Marketplace
    • Affects Version/s: 6.1.0 CE RC1
    • Fix Version/s: None
    • Component/s: Calendar
    • Labels:
      None
    • Environment:
      trunk, Tomcat, MySQL 5

      Description

      Hello,

      the calendar portlet shows (in the summary view) only the events for the current date. Sometimes it is useful to show upcoming events therefore it would be nice if one could configure the calendar to show events up to a certain number of days in the future.
      In the Preferences for the portlet one could add a flag (Show future events) and a numeric value (Number of days to include). The numeric value would only be activated if the flag is set to true and the default would be 1 to match the current behavior.

      I created a hook with a custom JSP to add the code to retrieve the future events, I didn't implement the preferences because in our case we only need to include events for the next 7 days.

      Here're the changes I did in "event_iterator.jspf":

      ...
      headerNames.add("date"); // We need to show the date in the list
      ...
      for (int i = 0; i < 7; i++) { // Iterate over the next 7 days to include events (7 would be retrieve from the preferences)
      selCal.add(Calendar.DATE, 1);
      results.addAll(CalEventServiceUtil.getEvents(scopeGroupId, selCal, eventType));
      }
      selCal.add(Calendar.DATE, -7); // Restore the calendar to the current date, not sure if needed I just want to be clean

      DateFormat formatter = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); // Create a date formatter to show the date in the list
      formatter.setTimeZone(timeZone);
      ...

      row.addText(formatter.format(event.getStartDate()), rowURL); // Fill the date column in the list

      I also attached the complete jspf.

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            alex.weirig@technolink.lu Alex Weirig
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Packages

                Version Package