Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Event Calendar and 2.4.0


Reply


41 Posts   6044 Views

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 4:57pm

Ah forget that. It's working fine, I just had to uncomment the stuff at the bottom of the _config.php in $customDateTemplates.

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 5:10pm

The Month/Year link attached to the top of the Calendar Widget seems broken, onclick it sends you to /201004 rather than /2010-04 resulting in a 404.

Fix is in calendar_widget.js line 20:

From

function(cal, obj) {navigateToDate(obj.displayedYear.toString() + zeroPad(obj.displayedMonth+1).toString())}

To

function(cal, obj) {navigateToDate(obj.displayedYear.toString() + '-' + zeroPad(obj.displayedMonth+1).toString())}

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 7:06pm

I'm just adding these as I go so I don't forget. I'm not really sure how to put together a patch file so hopefully someone can do that with the stuff I find, alternatively I can collate them into a single post somewhere once I've got as far as I can.

ICS Links appear to have broken due to nested-urls. When the calendar is at the top level ie domain.com/events/ics it works fine, but in my case, domain.com/private/events/ics do not work. I experimented with different Director Rules but I didn't know exactly what I was doing TBH. I got to the following Rule, but had to hack it a bit further until someone who knows more about this stuff than I do gets the chance to take a look :)

So this isn't a proper fix but it's doing the trick for now. (btw, it's working because I've only got one event calendar, and CMS users can not delete it, so I can hard code the calendar/page ID.):

Added to _config.php:

Director::addRules(50, array('path/to/eventscalendar//ics/$ID/$OtherID' => 'Calendar_Controller'));
global $eventCalendarID;
$eventCalendarID = 38; // where 38 is the ID of my Calendar in the SiteTree

Edited Calendar.php

From

   public function getModel()
   {
      $model_class = str_replace("_Controller", "", get_class($this));
      return DataObject::get_by_id($model_class,$this->ID);   
   }

To

   public function getModel()
   {
      global $eventCalendarID;
      $model_class = str_replace("_Controller", "", get_class($this));
      return DataObject::get_by_id($model_class,$eventCalendarID);   
   }

Obviously none of these changes should be made to the module itself, so the changes to Calendar.php should be after subclassing it - but right now I'm just trying to get it all working. One step at a time.

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 7:23pm

Now that the ICS link is working, the URL in the file it generates is relative rather than absolute -> which isn't of much use after it's imported into iCal or etc. I'm not sure if this is an existing bug in Event Calendar mod or a byproduct of my above hack but here is a fix:

added to Calendar.php ( function ics() ):

From

   if(!$feed)
      $URL = $announcement ? $event->Calendar()->Link() : $event->Link();
   else
      $URL = "";

To

   if(!$feed)
      $URL = $announcement ? $event->Calendar()->Link() : $event->Link();
   else
      $URL = "";
   $URL = 'http://' . $_SERVER['HTTP_HOST'] . $URL; // NEW LINE

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 8:14pm

Ok. I've run out of time and my knowledge of Silverstripe isn't deep enough yet to debug a lot of the issues I'm facing.

So for reference, right now using Event Calendar r93 and 2.4rc1 in a nested-url location, to avoid issues I've had to temporarily do the following:

a) Hide the Announcments tab from Calendar pages (as the Announcement popup insists on hiddenfield 'is_announcment' value of "" rather than "1")

b) Hide the ICS feed tab - client won't be using this. Not sure if it is/isn't working

c) Patch referenced earlier in this thread

d) Changes for ICS links to work referenced earlier in this thread

e) Uncomment the stuff at the bottom of the module _config.php

f) Comment out all the fields regarding Recurring Events -> firstly in the CMS CalendarEvent 'Dates & Times' tab the Recurring fields show/hide/functionality and the like isn't working. Secondly when I did setup a recurring event I couldn't see it in any date range of the calendar.

Basically, the Calendar is just left with Calendar Events - no announcements or recurring-events. And ICS links work if there's only one Calendar. It'll do for now.. eek!

I gave it my best shot, hope some of the rubbish I posted in this thread is of help lol! *Very* keen to see a 2.4-compatible Event Calendar module soon :)

Avatar
dizzystuff

Community Member, 93 Posts

10 April 2010 at 8:28pm

The BackLink stuff is also dodgy with nested URLs.

In CalendarDateTime.php I had to

remove

   if(isset($params['Action'])) {
      $calendar_params = "CalendarStart=" . $params['Action'];
      if(isset($params['ID']))
         $calendar_params .= "&CalendarEnd=" . $params['ID'];
   }
   else {
      $calendar_params = null;
   }

and replace with just

$calendar_params = null;

(because $params['Action'] is returning the second item in the nested URL rather than the start date, and then the backlink fails)

Avatar
UncleCheese

Forum Moderator, 4096 Posts

11 April 2010 at 5:45am

Hey, guys,

Sorry to chime in so late on this. I finally got around to branching off current version of EventCalendar to /branches/2.3. The 2.4 version is on the trunk now.

You probably ought to revert your changes. While good in a pinch, none of them were usable. Thanks for turning up all those incompatibilities, though. That was a huge help.

Also, only lightly tested at this point. I have it set up on dataobjectmanager.carlinowebdesign.com as "holder/nested-calendar".

FYI - about the date headers -- the calendar should fall back on the lang file to get its date formatting patterns. $customDateTemplates is for users who want to override their lang file. I did find a bug that was causing non en_US locales to be left without a fallback to en_US, so that's probably why $customDateTemplates was the only thing working.

Avatar
dizzystuff

Community Member, 93 Posts

11 April 2010 at 5:56pm

Hey UncleCheese

Sweet! Thanks for getting all that into the repo :D Yeah, no intentions here to push forward with much of what I described previously in the thread, it was just stop-gap measures to get things working in the meantime. Glad that my turning up some of the 2.4 conflicts helped.

So, I'm now running latest trunk r97. CMS is behaving much much nicer now, no Announcements problems and the Recurring Events interface is working sweet. Also, yeah I'm running with en_GB so that'd explain the date headers, which are working now too.

I am coming across a few issues still though. My setup is "lightly nested" too -> "http://www.domain.com/private-section/events" , events being my CalendarPage.

a) Firstly there are references throughout CalendarDateTime.php and CalendarEvent.php to CalendarDateFields ... I've search/replaced them with DatePickerFields which is fine but it means out-of-the-box the mod is erroring on 2.4 atm.

b) If I create a CalendarEvent and assign it a Date/Time, it shows up correctly in the Calendar -> in the initial upcoming events listing and via a filter search. But the moment I turn it into a Recurring Event, it disappears from the initial listing and also any search. Not sure if it's a data-entry issue on my part or something with the mod.

c) If I click on the Month Name on the top of the CalendarWidget it now routes me to /view/201004. It doesn't have the - in between 2010-04 but that doesn't seem to be a prob -> the page itself comes back as "April 2010", however the listing is empty. That is, if I click that title month of the WidgetCalendar, it returns an empty listing (when there are definitely both announcements and events/datetimes).

d) ICS file links are working great now, but inside the file that is returned, the URL is still relative rather than absolute. I don't know if this is on purpose but it doesn't seem right to me? After I import the file into iCal and I view the event, there is a link to click on but without the domain it doesn't work?

e) The CalendarBackLinks stuff is still, well, troubled :) With a nested url implementation at least. For example, after arriving at /private-section/events the links to events are clean. After clicking on a week in the CalendarWidget which takes me to http://www.domain.com/private-section/events/view/2010-04-19/2010-04-25, the links now look like below:

http://www.domain.com/private-section/events/test-event/view/2010-04-23?CalendarStart=view&CalendarEnd=2010-04-19

It's still getting view/2010-04-19 rather than 2010-04-19 and 2010-04-25. Also, the ampersand in between CalendarStart and CalendarEnd is coming through as the HTML entity instead of an actual & symbol. ... And then as I click around the links just get more muddled. If I click through to view the test-event on the link in the code block above, I reach the event fine but the link wrapped around the event date on this detail page now reads:

http://www.domain.com/private-section/events/test-event/view/2010-04-23?CalendarStart=test-event&CalendarEnd=view

f) The final thing is just a small self indulgence :) I noticed in the recurring events that for Monthly you can choose to repeat on the first, second, third or last x-day of each month. This particular client I'm working with has a major event on the fourth Friday of each month. Which, depending on the month/calendar/alignment-of-the-stars/lol/etc isn't always the last Friday. Is it a minor task to add 'Fourth' to this drop down?

Major things IMHO are RecurringEvents and the BackLinks.

Sorry for all the long posts to this thread! I hope this one helps and/or makes 2.4 compatibility a bit easier though.