744 Posts in 309 Topics by 287 members
| Go to End | ||
| Author | Topic: | 7600 Views |
-
Re: Event Calendar Widget

12 October 2010 at 2:45pm Last edited: 12 October 2010 10:31pm
I'm running 2.4.1 and have widgetEventCalendar-1.3, from this thread. The calendar shows in the front end without modification now, but with problems:
1: The calendar is displayed twice... Commenting this line "return parent::Content();" in EventCalendarWidget.php seems to fix this.
2: All the calendar links go to 404. (http://mydomain.com/undefined2010-10-10)
3: The Widget loads Jquery v1.3.2 - which means in my installation I have two Jquery libraries loaded at the same time. I'm not sure if this affects performance, but it seems crazy to be loading pretty well the same library twice.
-
Re: Event Calendar Widget

17 October 2010 at 9:32pm
Hi,
i have the same Problem as you. I see the Widget in the Sidebar twice, the links go to 404.... did you find any solution to this? -
Re: Event Calendar Widget

2 November 2010 at 3:15pm Last edited: 2 November 2010 3:33pm
Kia Ora,
Sorry I have only just checked this forum again. Yes we found a slight fix for the 404 issue. In the EventCalendarWidget.js file, about line 22 I added in a bit more code. I noticed that when I was on the Calendar page and clicked on a date my address became something like "http://localhost/websitename/calendar/view/2010-11-09 " , but the event calendar widget wanted to go somewhere else.
So i added in the "view/" to my line (22?). This is what it now reads. location.href = this.options.calendar+'view/' + dateText; // <-- added in the 'view/' here..
Again not sure if this is the right way to do (not too much of a coder myself). But it seemed to work.
Also pbolger: The javascript stuff loading twice. I think the orginal EventCalendarWidget.php said "Requirements::javascript('widget_EventCalendar/javascript/jquery-1.3.2.min.js');" at about line 95. I changed this, so mine read "Requirements::javascript('sapphire/thirdparty/jquery/jquery.js');" This means that it reads the main sapphire jquery, and it wont try to load the script twice. Mine still requires other javascipt as well, as I have rolled a custom theme for it.
Hope that kinda helps.
L -
Re: Event Calendar Widget

2 November 2010 at 8:48pm Last edited: 2 November 2010 8:54pm
Hey guys,
I have been helping Lavan out with the issues when using this widget with SS 2.4.
Here are a list of all the changes made:
EventCalendarWidget.ss, line 1 : Change the class of the div to something other than "EventCalendarWidget". I suggest something like "Widget_EventCalendar"
EventCalendarWidget.js, line 3 : Change the jQuery selector to the same class as used in line 1 of EventCalendarWidget.ss
EventCalendarWidget.js, line 27 : Change from "location.href = this.options.calendar + dateText;" to "location.href = this.options.calendar + "view/" + dateText;"
(line numbers change heaps but should be fairly straight forward)
EventCalendarWidget.php : Change the class that EventCalendarWidget_Controller extends from Controller to Widget_ControllerEventCalendarWidget.php : Move (or copy) the Content method from the Model class (EventCalendarWidget) to the Controller class (EventCalendarWidget_Controller)
(this might be optional but should be done as best practice as a page should not have multiple jQuery libraries)
EventCalendarWidget.php : Change the line containing "Requirements::javascript('widget_EventCalendar/javascript/jquery-1.3.2.min.js');" to "Requirements::javascript('sapphire/thirdparty/jquery/jquery.js');"
Some of these Lavan already said to do but thought I would put them together in one place.I've tested this with SS 2.4.2 and have attached the widget with all of the above changes made to it
-
Re: Event Calendar Widget

3 December 2010 at 6:28pm
Hi everyone,
I have looked into this Event Calendar Widget some more and found these changes that need to be made:
EventCalendarWidget.js, line 114 : Change from "location.href = widget.options.calendar + widget.monthYear;" to "location.href = widget.options.calendar + "view/" + widget.monthYear;"
EventCalendarWidget.php, line 139 : Change "HTTPRequest" to "SS_HTTPRequest" due to renaming of some classes for the SilverStripe 2.4 release to reduce classname conflicts
EventCalendarWidget.php, line 149 : Change "HTTPResponse" to "SS_HTTPResponse" same reason as above
EventCalendarWidget.php, line 155 : Change "HTTPResponse" to "SS_HTTPResponse" same reason as above
EventCalendarWidget.php, line 231 : Change "HTTPResponse" to "SS_HTTPResponse" same reason as above
The first change fixes the behavior when clicking the month title on the widget. The rest of the changes fixes the Live mode so only dates that have an event are click-able.
I have also noticed some odd behavior where the widget shows Events that are in the draft site but are not published. I appears that this method in Calendar.php of the Event Calendar module is where the unpublished Events are being included:
protected function getEventIds()
{
$ids = array();
if($children = $this->Children()) {
foreach($children as $child)
$ids[] = $child->ID;return $ids;
}
else {
return false;
}
}My understanding is that "$this->Children()" should only return published pages but for some reason it is returning unpublished pages also. A solution I thought of is to add an if statement to check the isPublished value but I don't think that is right. Maybe someone else could try and find out what is happening here.
-
Re: Event Calendar Widget

23 January 2011 at 7:01am
I'm having problems getting the widget working correctly. When I click on a day in the widget I get forwarded to the correct events for that day, but the widget displays December 1969 rather than the current date. Does anyone have a suggestion as to what I need to fix/change to make it work correctly?
Thanks all,
Vance -
Re: Event Calendar Widget

23 January 2011 at 8:05am Last edited: 23 January 2011 8:06am
After poking around in the code for awhile, I think it's working correctly now.
I changed line 29 in EventCalendarWidget.php from:
$dateText = join('-', array_pad(explode('-', $urlParams['Action']), 3, '01'));
to
$dateText = $urlParams['ID'];
-Vance
-
Re: Event Calendar Widget

24 January 2011 at 11:53pm
I had noticed that happened when I was working with this widget but never got to the root of the problem. Haven't really touched it since my last post. But if I remember correctly this would happen when you had this widget on an actual Event Calendar type page. And when I was working with it this wasn't a requirement.
Congrats Vance on finding your own solution and sharing it here. I'm sure you will have helped someone out there.
| 7600 Views | ||
| Go to Top |


