Page 1 of 23

Dashticz - Module - Calendar

Posted: Thursday 04 May 2017 23:05
by robgeerts
You can add a block with upcoming events from your ical-calendar (gmail, apple etc.).
Define them as:

Code: Select all

var calendars = {}
calendars.business = { maxitems: 5, url: 'https://calendar.google.com/calendar/', icalurl: 'https://calendar.google.com/calendar/' }
calendars.private = { maxitems: 5, icalurl: 'https://cors-anywhere.herokuapp.com/https://calendar.google.com/calendar/' }
And define them in a column like:

Code: Select all

columns[1] = {}
columns[1]['width'] = 2;
columns[1]['blocks'] = [calendars.business,calendars.private]
If you want to combine multiple calendars, add this code:

Code: Select all

calendars.combined = {}
calendars.combined.maxitems = 5;
calendars.combined.calendars = [
	{ color:'white',calendar:calendars.business }, 
	{ color:'#ccc',calendar:calendars.private }
]
calendars.combined.url = 'https://calendar.google.com/calendar';
And define them in a column like:

Code: Select all

columns[1] = {}
columns[1]['width'] = 2;
columns[1]['blocks'] = [calendars.combined]
If calendars wont load, add https://cors-anywhere.herokuapp.com/ in front of the url.
For example:

Code: Select all

calendars.private = { maxitems:5, icalurl: 'https://cors-anywhere.herokuapp.com/https://calendar.google.com/calendar/' }

Re: Dashticz - Module - Calendar

Posted: Saturday 06 May 2017 17:27
by EdwinK
Mmm. I thought I had it..

Code: Select all

Missing required request header. Must specify one of: origin,x-requested-with

Code: Select all

ar calendars = {}
calendars.business = { url: 'https://cors-anywhere.herokuapp.com/https://calendar.google.com/calendar/', icalurl: 'https://cors-anywhere.herokuapp.com/<<Google kalender URL.basic.ics' }
calendars.private = { icalurl: 'https://cors-anywhere.herokuapp.com/Google kalender URL.basic.ics/' }

calendars.combined = {}
calendars.combined.calendars = [
   { color:'white',calendar:calendars.business }, 
   { color:'#ccc',calendar:calendars.private }
]
calendars.combined.url = ' https://cors-anywhere.herokuapp.com/https://calendar.google.com/calendar';
Edit. I now have removed the cors-anywhere link and then I get the following in the console:

Code: Select all

Request Headers
Provisional headers are shown
Referer:http://192.168.0.10/dashboard/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36

Re: Dashticz - Module - Calendar

Posted: Saturday 06 May 2017 17:42
by EdwinK
Or this might be a problem too:

Code: Select all

Refused to display 'https://calendar.google.com/calendar/render' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Re: Dashticz - Module - Calendar

Posted: Sunday 07 May 2017 23:24
by poudenes
Is there any solution how to shown calendars that repeating? I have lots of calendar items that is repeating every 3 weeks. Somedays more then 2 on a day.

I only see the 1 time calendar items ...

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 10:37
by bsmeding
Yes me too, now whole day or repeating items.
Also still a problem with the timezone, everything is +2 hour, is there a possibility to change the timezone

I'm using iCloud calendar

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 11:19
by robgeerts
Timezone and repeating will be fixed in upcoming version.

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 12:09
by robgeerts
bsmeding wrote:Yes me too, now whole day or repeating items.
Also still a problem with the timezone, everything is +2 hour, is there a possibility to change the timezone

I'm using iCloud calendar
Could you try latest BETA?
I'm not sure but I changed one thing that may fix it...

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 12:18
by qwerk
I am sorry to say, it does not look fixed.
no repeat en two ours off.

an ICS taking from my own mailserver ( kopano) gives the correct time. but also no repeats.

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 12:22
by robgeerts
Didnt check the repeating events yet ;)
ARRGGGHHH I hate the time offset.
In my calendar, all events were ok, but one. One had a time offset of 2 hours..
(Created on another device..)

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 12:42
by htilburgs
Maybe I've overlooked it, but is there also a posibilty to just use one calendar?
I only want to use my icloud calendar.

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 12:48
by HansieNL
htilburgs wrote:Maybe I've overlooked it, but is there also a posibilty to just use one calendar?
I only want to use my icloud calendar.
var calendars = {}
calendars.icloud = { title: 'My Calendar', icalurl: 'http://<your_url>' }

columns[1]['blocks'] = [calendars.icloud];

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 13:33
by EdwinK
Still can't get it to work.
Spoiler: show
var calendars = {}
calendars.business = { url: 'https://calendar.google.com/calendar/', icalurl: 'path_to_basic.ics' }
calendars.private = { icalurl: 'path_to/basic.ics' }
calendars.combined = {}
calendars.combined.calendars = [
{ color:'white',calendar:calendars.business },
{ color:'red',calendar:calendars.private }
]
calendars.combined.url = 'https://calendar.google.com/calendar';
I can see a place under 'Agenda' a slightly lighter place where there should be something, but when clicking it's empty. I think it because of the 'calendars.combined.url'. What should be there?
Agenda
Agenda
Screen Shot 2017-05-08 at 13.31.00.png (128.97 KiB) Viewed 13623 times

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 14:28
by bsmeding
robgeerts wrote:
bsmeding wrote:Yes me too, now whole day or repeating items.
Also still a problem with the timezone, everything is +2 hour, is there a possibility to change the timezone

I'm using iCloud calendar
Could you try latest BETA?
I'm not sure but I changed one thing that may fix it...
I checked latest beta, but still a 2 hour offset

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 14:31
by bsmeding
EdKo66 wrote:Still can't get it to work.
Spoiler: show
var calendars = {}
calendars.business = { url: 'https://calendar.google.com/calendar/', icalurl: 'path_to_basic.ics' }
calendars.private = { icalurl: 'path_to/basic.ics' }
calendars.combined = {}
calendars.combined.calendars = [
{ color:'white',calendar:calendars.business },
{ color:'red',calendar:calendars.private }
]
calendars.combined.url = 'https://calendar.google.com/calendar';
I can see a place under 'Agenda' a slightly lighter place where there should be something, but when clicking it's empty. I think it because of the 'calendars.combined.url'. What should be there?

Screen Shot 2017-05-08 at 13.31.00.png
the block must have the value 'calendars.combined' {without the .url}

Code: Select all

columns[2]['blocks'] = [314,315,399,''blocktitle_14',calendars.combined]

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 14:45
by bsmeding
For all that use iCloud calendar but don't want to use an public service processing their calendar items (privacy)

I download the ical from iCloud every 5 minutes to a local folder and use this local file for the calendar plugin

the file is a php file, so you need php available
create in custom a new folder :
mkdir ical
place this file to this folder
change the path in the file for $local_file, use full path because it will run from cronjob

$remote_file = url from iCloud calendar (in example the dutch holiday's) but you can use this for you own shared iCloud calendar.

calendar.feestdagen.php

Code: Select all

<?php
$local_file = "/var/www/home.local/web/dashboard/dashticz_beta/custom/ical/calendar.feestdagen.ics";//This is the file where we save the information
$remote_file = "https://p58-calendars.icloud.com/holidays/nl_nl.ics"; //Here is the file we are downloading


$ch = curl_init();
$fp = fopen ($local_file, 'w+');
$ch = curl_init($remote_file);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_exec($ch);
curl_close($ch);
fclose($fp);

open 'crontab -e'

Code: Select all

*/5 * * * * /usr/bin/php /var/www/home.local/web/dashboard/dashticz_beta/custom/ical/calendar.gezamenlijk.php
00 00 * * * /usr/bin/php /var/www/home.local/web/dashboard/dashticz_beta/custom/ical/calendar.feestdagen.php
I use two scripts, one for holidays, update every day once at 00:00 hour
and second script run every 5 minutes to update the iCloud shared calendar (gezamenlijke) these two icals will be used in Dashticz

CONFIG.js

Code: Select all

var calendars = {}
calendars.gezamenlijk = { icalurl: 'custom/ical/calendar.gezamenlijk.ics' }
calendars.feestdagen = { icalurl: 'custom/ical/calendar.feestdagen.ics' }

calendars.combined = {}
calendars.combined.calendars = [
   { color:'white',calendar:calendars.gezamenlijk },
   { color:'#ccc',calendar:calendars.feestdagen }
]
calendars.combined.url = 'https://www.icloud.com/#calendar';



columns[2]['blocks'] = [314,315,399,'blocktitle_6','buttons.cameravoordeur','blocktitle_14',[b]calendars.combined[/b]]


Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 15:33
by EdwinK
bsmeding wrote:
Screen Shot 2017-05-08 at 13.31.00.png
the block must have the value 'calendars.combined' {without the .url}

Code: Select all

columns[2]['blocks'] = [314,315,399,''blocktitle_14',calendars.combined]
[/quote]

That is what I have. Maybe I do something wrong with the Google Calendar. Trying with Icloud.

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 15:43
by robgeerts
I'm rewriting the calendar block, will be up in few days I hope, please be patient! :)

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 16:33
by EdwinK
Will do ;)

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 16:37
by poudenes
robgeerts wrote:Timezone and repeating will be fixed in upcoming version.
In v2 and Beta i can't see my repeating calendar. just the one time calendars.

Re: Dashticz - Module - Calendar

Posted: Monday 08 May 2017 17:09
by robgeerts
You mentioned that already, will be fixed soon ;)