Skip to content

Commit

Permalink
SS4 upgrade (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
gheggie authored May 17, 2020
1 parent 13c151c commit 7bc21f6
Show file tree
Hide file tree
Showing 113 changed files with 4,923 additions and 3,861 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
.vscode/
47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
# SilverStripe Event Calendar Module
# Silverstripe Event Calendar

The Event Calendar module for SilverStripe
## Introduction

## Features
This is an event calendar module for Silverstripe CMS, with the following features:

* **Calendar** - This Page is used to hold/present events and announcments.
* **Calendar Event** - This page represents an event, which can have many DateTimes.
* **Recurring Events** - Calendar Events can also be set up reoccur automatically.
* **Calendar Announcements** - Entries in a Calendar which don't have a page associated.
* **ICS feeds** - Add multiple ICS feeds to a Calendar to display these events in the feed.
* **ICS output** - Download an ics file for easy importing into calendar apps.
* **RSS feed** - RSS feed of calendar events
* **Calendar Widget** - Display a calendar view in a Widget.
* **Caching**
* **Calendar** - A page type used to hold/present events and announcements.
* **Calendar event** - A page type which represents an event, with one or more DateTimes (an instance of an event).
* **Recurring events** - Calendar events can be set up reoccur automatically.
* **Calendar announcements** - Entries in a calendar which don't have an event page associated.
* **ICS feeds** - Add external ICS feeds to a calendar to display these events.
* **ICS output** - Download an ics file for easy importing into calendar apps.
* **RSS feed** - RSS feed of calendar events.
* **Calendar widget** - Display a calendar view in a widget, so website users can select to view events by year/month/week/day periods.
* **Caching**

## Requirements

Silverstripe CMS 4.4 or greater

Carbon ( version 1 - https://github.com/briannesbitt/carbon )

## Configuration Options

Enable jquery
Enable jQuery (that is, do not request a local copy)

```yaml
Calendar:
UncleCheese\EventCalendar\Pages\Calendar:
jquery_included: true
```
Enable caching, and years worth of data to cache
Caching options
```yaml
Calendar:
UncleCheese\EventCalendar\Pages\Calendar:
caching_enabled: true
cache_future_years: 2
```
Set default timezone, lang for ICS output:
Set default time zone and language for ICS output
```yaml
Calendar:
UncleCheese\EventCalendar\Pages\Calendar:
timezone: America/New_York
language: EN
```
3 changes: 3 additions & 0 deletions _config/calendar.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
---
Name: 'event-calendar'
---
CachedCalendarTask:
cache_future_years: 2
14 changes: 14 additions & 0 deletions _config/legacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
Name: event-calendar-legacy
---
SilverStripe\ORM\DatabaseAdmin:
classname_value_remapping:
CachedCalendarEntry: UncleCheese\EventCalendar\Models\CachedCalendarEntry
Calendar: UncleCheese\EventCalendar\Pages\Calendar
CalendarAnnouncement: UncleCheese\EventCalendar\Models\CalendarAnnouncement
CalendarDateTime: UncleCheese\EventCalendar\Models\CalendarDateTime
CalendarEvent: UncleCheese\EventCalendar\Pages\CalendarEvent
ICSFeed: UncleCheese\EventCalendar\Models\ICSFeed
RecurringDayOfMonth: UncleCheese\EventCalendar\Models\RecurringDayOfMonth
RecurringDayOfWeek: UncleCheese\EventCalendar\Models\RecurringDayOfWeek
RecurringException: UncleCheese\EventCalendar\Models\RecurringException
1 change: 1 addition & 0 deletions client/dist/css/calendar.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions client/dist/css/calendar_cms.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#Repeat_Alert_Message { background:#fff3a7; padding:2px 4px; border-top:1px solid #d3af22; border-bottom:1px solid #d3af22; }

.optionset .radio.val {
display: none;
}
1 change: 1 addition & 0 deletions client/dist/css/calendar_widget.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
103 changes: 103 additions & 0 deletions client/dist/js/calendar_cms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
;(function($) {

$(function() {

$('.field.defaultView select').entwine({
onmatch: function() {
if ($(this).val() != 'upcoming') {
$('.field.defaultFutureMonths').hide();
}
},
onchange: function() {
$('.field.defaultFutureMonths').hide();
if ($(this).val() == 'upcoming') {
$('.field.defaultFutureMonths').show();
}
}
});

$('.field.checkbox.recursion').entwine({
onmatch: function() {
var fieldHolderID = function(field) {
return '#Form_EditForm_' + field + '_Holder';
}
var $recursion = this;
var $tab = $recursion.closest('.tab-pane');
var $customRecursionType = $tab.find(fieldHolderID('CustomRecursionType')).hide();
var $dailyInterval = $tab.find('.dailyinterval').hide();
var $weeklyInterval = $tab.find('.weeklyinterval').hide();
var $monthlyInterval = $tab.find('.monthlyinterval').hide();
var $monthlyIndex = $tab.find('.monthlyindex').hide();
var $recurringDaysOfWeek = $tab.find(fieldHolderID('RecurringDaysOfWeek')).hide();
var $recurringDaysOfMonth = $tab.find(fieldHolderID('RecurringDaysOfMonth')).hide();
var $monthlyRecursionType1 = $tab.find(fieldHolderID('MonthlyRecursionType1')).hide();
var $monthlyRecursionType2 = $tab.find(fieldHolderID('MonthlyRecursionType2')).hide();

var resetPanels = function() {
$dailyInterval.hide();
$weeklyInterval.hide();
$monthlyInterval.hide();
$recurringDaysOfWeek.hide();
$recurringDaysOfMonth.hide().find(':checkbox').attr('disabled', true);
$monthlyRecursionType1.hide();
$monthlyRecursionType2.hide();
$monthlyIndex.hide().find('select').attr('disabled', true);
};

var resetSubPanels = function() {
$recurringDaysOfMonth.hide().find(':checkbox').attr('disabled', true);
$monthlyIndex.hide().find('select').attr('disabled', true);
};

$recursion.find('input').change(function() {
if ($(this).is(':checked')) {
$customRecursionType.show();
} else {
$tab.find(':checkbox, :radio').attr('checked', false);
$customRecursionType.hide();
resetPanels();
}
}).change();

$customRecursionType.find('input').change(function() {
if ($(this).is(':checked')) {
resetPanels();
switch($(this).val()) {
case "1":
$dailyInterval.show();
break;
case "2":
$weeklyInterval.show();
$recurringDaysOfWeek.show();
break;
case "3":
$monthlyInterval.show();
$monthlyRecursionType1.show();
$monthlyRecursionType2.show();
break;
}
}
}).change();

$monthlyRecursionType1.find('input').change(function() {
if ($(this).is(':checked')) {
resetSubPanels();
$recurringDaysOfMonth.show().find(':checkbox').attr('disabled', false);
$monthlyIndex.find('select').attr('disabled', true);
$monthlyRecursionType2.find('input').attr('checked', false).change();
}
}).change();

$monthlyRecursionType2.find('input').change(function() {
if ($(this).is(':checked')) {
resetSubPanels();
$monthlyIndex.show();
$recurringDaysOfMonth.find(':checkbox').attr('disabled', true);
$monthlyIndex.find('select').attr('disabled', false);
$monthlyRecursionType1.find('input').attr('checked', false).change();
}
}).change();
}
});
});
})(jQuery);
3 changes: 1 addition & 2 deletions javascript/calendar_core.js → client/dist/js/calendar_core.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ function navigateToDate(date)
function zeroPad(num) {
var s = '0'+num;
return s.substring(s.length-2)
}

}
File renamed without changes.
51 changes: 2 additions & 49 deletions javascript/calendar_widget.js → client/dist/js/calendar_widget.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
attachTo: function(element) {
this.element = element;
},


getContainer: function() {
return this.element;
},


setMonth: function(month, year) {
this.month = month;
this.year = year;
Expand All @@ -35,51 +31,33 @@
this.monthLength = 29;
}
}

html = this.generateHTML();
$(this.element).html(html);

var calendar = this;

$('.prev', this.element).click(function() {
calendar.previousMonth();
});


$('.next', this.element).click(function() {
calendar.nextMonth();
});


$('.calendar-day',this.element).click(function() {
calendar.showDay(this);
});


$('.show-week', this.element).click(function() {
calendar.showWeek(this);
});


$('.show-month',this.element).click(function() {
calendar.showMonth(this);
});
},



getPaddedMonth: function() {
return this.pad(this.month+1);
},



setOptions: function(options) {
$.extend(this.settings, options);
},



getNextMonthYear: function() {
var m = this.month+1;
var y = this.year;
Expand All @@ -89,9 +67,6 @@
}
return [m, y];
},



getPrevMonthYear: function() {
var m = this.month-1;
var y = this.year;
Expand All @@ -101,47 +76,30 @@
}
return [m, y];
},



previousMonth: function() {
result = this.getPrevMonthYear();
this.setMonth(result[0], result[1]);
this.settings.onMonthChange(result[0]+1, result[1], this);
},



nextMonth: function() {
result = this.getNextMonthYear();
this.setMonth(result[0], result[1]);
this.settings.onMonthChange(result[0]+1, result[1], this);
},



showDay: function(element) {
this.settings.onShowDay($(element).data('date'), this);
},



showWeek: function(element) {
var start = $(element).closest('tr').find('td').eq(0);
var end = $(element).closest('tr').find('td').eq(6);
this.settings.onShowWeek(start.data('date'), end.data('date'), this);
},



showMonth: function(element) {
month = this.getPaddedMonth();
start = this.year + '-' + month + '-01';
end = this.year + '-' + month + '-' + this.monthLength;
this.settings.onShowMonth(start, end, this);
},


generateHTML: function() {
// do the header
var monthName = this.settings.calMonthsLabels[this.month]
Expand Down Expand Up @@ -212,17 +170,12 @@
html += '</tr></tbody></table>';
return html;
},

pad: function(num) {
str = new String(num);
return (str.length == 1) ? "0"+str : str;
}


});



$.fn.extend({
CalendarWidget: function(options) {
return this.each(function() {
Expand Down Expand Up @@ -252,4 +205,4 @@
calMonthsLabels: []
});

})( jQuery );
})(jQuery);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions javascript/lang/calendar_en.js → client/dist/js/lang/calendar_en.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
startOnMonday: false,
calDaysLabels: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
calMonthsLabels: ['January', 'February', 'March', 'April','May', 'June', 'July', 'August', 'September','October', 'November', 'December']

})
});
})(jQuery);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
startOnMonday: true,
calDaysLabels: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
calMonthsLabels: ['Januar', 'Februar', 'Mars', 'April','Mai', 'Juni', 'Juli', 'August', 'September','Oktober', 'November', 'Desember']

})
});
})(jQuery);
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
startOnMonday: true,
calDaysLabels: ['Po', 'Ut', 'St', 'Št', 'Pi', 'So', 'Ne'],
calMonthsLabels: ['Január', 'Február', 'Marec', 'Apríl','Máj', 'Jún', 'Júl', 'August', 'September','Október', 'November', 'December']
})
});
})(jQuery);
Loading

0 comments on commit 7bc21f6

Please sign in to comment.