Skip to content

Commit

Permalink
Merge pull request #671 from Nosrac/develop
Browse files Browse the repository at this point in the history
Support calendar-specific maximumEntries and maximumNumberOfDays
  • Loading branch information
MichMich authored Jan 31, 2017
2 parents 6d50cbb + 9f659ee commit 8e12914
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added some missing translaton strings in the sv.json file.

### Added
- Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays`
- Add loaded function to modules, providing an async callback.
- Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures)
- Add use pm2 for manager process into Installer RaspberryPi script
Expand Down
20 changes: 10 additions & 10 deletions modules/default/calendar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ config: {


#### Calendar configuration options:

-| Option | Description
-| --------------------- | -----------
-| `url` | The url of the calendar .ical. This property is required. <br><br> **Possible values:** Any public accessble .ical calendar.
-| `symbol` | The symbol to show in front of an event. This property is optional. <br><br> **Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website.
-| `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true. <br><br> **Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)).
-| `repeatingCountTitle` | The count title for yearly repating events in this calendar. <br><br> **Example:** `'Birthday'`
-| `user` | The username for HTTP Basic authentication.
-| `pass` | The password for HTTP Basic authentication.
| Option | Description
| --------------------- | -----------
| `url` | The url of the calendar .ical. This property is required. <br><br> **Possible values:** Any public accessble .ical calendar.
| `symbol` | The symbol to show in front of an event. This property is optional. <br><br> **Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website.
| `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true. <br><br> **Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)).
| `repeatingCountTitle` | The count title for yearly repating events in this calendar. <br><br> **Example:** `'Birthday'`
| `user` | The username for HTTP Basic authentication.
| `pass` | The password for HTTP Basic authentication.
| `maximumEntries` | The maximum number of events shown. Overrides global setting. **Possible values:** `0` - `100`
| `maximumNumberOfDays` | The maximum number of days in the future. Overrides global setting
14 changes: 10 additions & 4 deletions modules/default/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ Module.register("calendar", {
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://");
this.addCalendar(calendar.url, calendar.user, calendar.pass);

var calendarConfig = {
maximumEntries: calendar.maximumEntries,
maximumNumberOfDays: calendar.maximumNumberOfDays,
};

this.addCalendar(calendar.url, calendar.user, calendar.pass, calendarConfig);
}

this.calendarData = {};
Expand Down Expand Up @@ -307,11 +313,11 @@ Module.register("calendar", {
*
* argument url sting - Url to add.
*/
addCalendar: function (url, user, pass) {
addCalendar: function (url, user, pass, calendarConfig) {
this.sendSocketNotification("ADD_CALENDAR", {
url: url,
maximumEntries: this.config.maximumEntries,
maximumNumberOfDays: this.config.maximumNumberOfDays,
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
fetchInterval: this.config.fetchInterval,
user: user,
pass: pass
Expand Down

0 comments on commit 8e12914

Please sign in to comment.