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: New Feature


Go to End
Reply

16 Posts   2978 Views

Avatar
UncleCheese

25 August 2009 at 7:27am (Last edited: 25 August 2009 7:27am), 4085 Posts

Revision 74 of Event Calendar introduces a new UI feature:

LiveCalendarWidget

This is an AJAX-based counterpart to CalendarWidget that is event-aware and will mark dates that have events. Further, because it is AJAX based and not generated completely client side, it adheres to MVC, making it easy to extend and customize. To change the look and feel, simply create your own LiveCalendarWidget.ss in your mysite/templates directory, or simply create an extension to LiveCalendarWidget.css for simpler modifications.

This revision has also deploys some handy new functions through a new SiteTree decorator, making calendars easier to syndicate with much less coding.

On any page, you can now use:

<% control UpcomingEvents(count,calendar-url-segment) %>

<% control RecentEvents(count,calendar-url-segment) %>

$CalendarWidget(calendar-url-segment)

$LiveCalendarWidget(calendar-url-segment) %>

Note that if no url segment is given, the controller will assume there is only one Calendar in the site tree and get an instance of it. In other words, unless you have multiple calendars on your web site, you can use $CalendarWidget, <% control UpcomingEvents %>, etc.

Also note that "count" defaults to 5.

Lastly, a date string can be given to $CalendarWidget and $LiveCalendarWidget to override the default start date, for example:

$LiveCalendarWidget(calendar-url-segment,20090801)

Avatar
cpxksr

26 August 2009 at 10:48am Community Member, 5 Posts

Hi UncleCheese and thanks so much for developing this awesome module.

I've set it up and all looks good, except for when I add a new Calendar Event.

I can set the name etc on the Event but when I select the dates tab and want to add a new date, the date picker doesn't show up and I can't type into the box :-/

I've tried this in FF 3.5, Chrome and IE7

thanks!
cpxksr

Avatar
UncleCheese

29 August 2009 at 4:44am 4085 Posts

I'm not too sure what you mean by the first question. You'll have to give me a better example.

For your second question, there are three criteria for finding an event within a date range:

            (StartDate <= '$start' AND EndDate >= '$end') OR
            (StartDate BETWEEN '$start' AND '$end') OR
            (EndDate BETWEEN '$start' AND '$end')

So I would think your event would catch the third filter, having an end date between Sept 1 and Sept 30.

Avatar
UncleCheese

29 August 2009 at 5:37am 4085 Posts

In Silverstripe, you're always able to call a controller from the URL, as far as I know. It's better practice to declare a $url_segment variable in your controller to make this a little more secure, though. If you use the $allowed_actions array, you can limit which functions can be run from the URL, as well, so it's pretty secure.

Just checked in that change to give Announcements the same criteria. Want to test it?

Avatar
cpxksr

29 August 2009 at 6:18am Community Member, 5 Posts

Is this the wrong thread to post problems with the module? :)

br,
cpxksr

Avatar
karibe

29 September 2009 at 9:30pm Community Member, 56 Posts

How can I localize $LiveCalendarWidget, this is what I'm looking for my home page but I have to translate some elements into polish.
I see some mnemonics like

<optgroup label="<% _t('LiveCalendarWidget.JUMPTOMONTH','Jump to...') %>" />

but translating it in event_calendar/lang/pl_PL.php
or mysite/lang/pl_PL.php has no effect. I did translation with CalendarWidget by changing into $lang['pl_PL']['CalendarWidget']['LOCALEFILE'] = 'date_pl.js'; but habe no idea how to do that with Live widget

Avatar
karibe

30 September 2009 at 9:27pm Community Member, 56 Posts

No one knows ?

Avatar
karibe

30 September 2009 at 11:06pm Community Member, 56 Posts

Ok as I see mnemonics are used from event_calendar/lang but only from en_US.php.
All other page elements are properly translated to polish language but $LiveCalendarWidget is not reacting.

I'm setting language in Page_Controller init method like this:

      if($this->dataRecord->hasExtension('Translatable'))
      {
         if ( ereg("^".Translatable::default_lang(), $_SERVER['HTTP_ACCEPT_LANGUAGE']) )
         {
            i18n::set_locale(Translatable::default_locale());
         }
         else
         {
            Translatable::set_current_locale("en_US");
            i18n::set_locale("en_US");
         }
      }

Go to Top