Hi all, I am trying to incorporate the wonderful PDCalendar component created by Peter Dijksterhuis into the very latest Umbraco. I have gotten as far as getting the actual calendar to display on the page but I am stuck as to how to configure templates/documents in order to be able to add events? I have tried to look at Peter's site but it is currently unavialble however I am hoping that he may be around this forum? Can anyone help me with some instructions or point to a tutorial or tell me how they managed to implmentit?
Sorry that my sites are down, working on getting things online again. And yes, I'm around on the forum ;)
To get the calendar working, you need to do a couple of things.
First, you need to modify the document-type you want to use for the events. Add a new property there with datatype PDCalendar. Remember the alias you give it.
Secondly, open the xslt-macro that you included in your template (You obviously chose one because you have a calendar;) ). Look for the line:
Firstly, my profound apologise for making a post yesterday that appeared to break this issue in the forum and make it unreadable, I am unsure what I did wrong but it must have something to do with some code snippets that I tried to post, sorry!
Just another quick question if you are still around Peter? I am struggling to extract the daat that I need from my events, I am very new to XSLT and am finding it a bit of a steep learning curve (do not how or what to use to debug it, but that is another question for another time!). I have added a textbox to my event page so that a user can enter comments for an ebent but I am having trouble retrieveing the data back. I can retreive my start and end date like so;
But I cannot seem to get at my comments which are in another data element at the same level the start and end date. I have tried the following, and combinations of the following, to no avail;
I can see the data in the XML so I know I can get it but I am unsure how. Also how can you format the start and end date, is that configured somewhere?
Hi Andy, it wasn't your post itself that caused it, it was our html sanitizer that went balistic on it, I updated the sanitizer today so hopefully we won't see this kind of issues again.
I think a few of us learned a thing or 2 because what you did ;)
Please have a look at the PDCalendar.xslt that was installed with the package. That should give you a basic idea how to get events in a certain time-period and how to list them (and display additional info). I think that one should get you going pretty quickly.
As for the date-formatting, you can use umbraco.library:
Let me ask first why you want to use the pdcstart-date? If the event is re-occurring, then that date is of no use to show right (that date could be 5 years ago) or am I missing something here?
Either you are missing something here or I am! :-) When I add an event to the calendar I get the option of adding a start date and end date. I assumed that the start date is the date that the event will occur on, therefore if I enter an event that takes place today the the start date is todays date? I have even got as far as looking at recurrence yet so maybe is this likely to trip me up?
By the way your date formatting suggestions works perfectly, thanks.
Your approach can work if you do not use recurrence.
If you want to use recurrence however, an event starts to occur on more than 1 date. The startdate will not change, it will still be 1 date. You would have to create a new node for each time that event occured.
If you just use the startdate to display events, you have no way of knowing which dates the events occurs on as well. That is why I created the package. The datatype stores info. Now when you make a call to the DLL (examples in the 3 xslt-files) it will return a list of dates, as children of those dates are the events listed, if they occur on that date.
Yes, of course, thank you. Now I get it. We do not care what the start/end date is I am simply displaying the events that occur on the selected date. :-)
In that case, make the call to the library. That will decide if an event needs to be shown on the selected date. The startdate and enddate you enter at the backend is only used to check if that event would be valid or not.
Take a look at PDCalendar.xslt. That will simply list all events that occur from 1st januari till 31st december. That timespan can be easily adjusted to your needs.
And I need to replace it with the date that was selected in the calendar, is that right? In the calendar I only click on a event, not the actual date, what am I missing? Please be patient I am far more confused than I look!
By the way, I did not intend to mark your answer with a negative, can it be undone?
hahaha, the negative points are valid, I think I'm making you more confused than you allready are ;) (I don't think you can undo negative marker, but no worries about that)
I think I completely misunderstood you as well here. Basically you have a calendar in which you show the events, from there people can click through to the details of the event right? At least, this is how I understand it now.
On the details-page, you want to show the startdate of the event? If you don't use recurrsion, you could display the startdate. If you do use recursion however, an event can have multiple startdates. Right now that is something you cannot show then. But that would be a good addition to add to the package I guess (retrieve all valid dates that an event can occur on)
Yes that is what I am trying to do. User creates an event, and lets say it is a recurring event for 5 days from Monday to Friday. A second event is added that occurs only once on the Tuesday of the same week, therefore when you look at Tuesday you will see 2 events. If I click on either of those events I would like to only see the details of the events that occur on that day i.e. 2 events. I think we are the same wavelength way.
Now the tricky part, can PDCalendar accomodate this and if so how? If not is possible to get the source code and I can try to amend it myself (bit cheeky I know but I thought I would ask!) :-)
1- In the calendar itself, it knows that those 2 events are both on that day. You could use some jquery to popup the additional info about that day.
2- Link to a new page (both events to same link) where you add the date that you request. With that date, you could then do a request to the DLL to see which events are valid on that day.
An option I'm going to build in a next release is to be able to get a list of dates on which that event is valid. As for the source-code, that's a no-go. It's partially commercial, if I would distribute the source, nobody would likely want to buy the commercial-version I guess.
Good point, I didn't realise you had a commercial aspect to this, definately cant give out source, no worries. I think I will try looking at the JQuery option as they will do as much I need to do at the moment. Many thanks. I look forward to seeing your next release! :-)
Peter wanted me to chime in here and show the mods i made to the calendar to list how many events were on a day then linked to a jquery overlay window using fancybox...
Wow! That is awesome! I will definately look into trying to do that, that is an excellent peice of work. For the time being a solution that I finally came up with at the moment is as follows,
For each of the events on a given day, in PDCUlliCalendar.xslt, I create the link as follows
This then actually gives me all of the events for that specific day.
Not sure if this the best way to do this as my understanding and grasp of XSLT is still very much in its early days but I pleased witrh myself for getting this far thanks to all your help!
Definately going to look into jquery option, see if I can figure that out!
Just out of interest Bob, if ever you want to share your calendar jquery overlay window using fancybox please let me know! Kust kidding, I am probably pushing my luck now, I should get of my ar*e and make the effort to learn this stuff. So much to learn, so little time! :-)
Using PDCalendar - any instructions?
Hi all, I am trying to incorporate the wonderful PDCalendar component created by Peter Dijksterhuis into the very latest Umbraco. I have gotten as far as getting the actual calendar to display on the page but I am stuck as to how to configure templates/documents in order to be able to add events? I have tried to look at Peter's site but it is currently unavialble however I am hoping that he may be around this forum? Can anyone help me with some instructions or point to a tutorial or tell me how they managed to implmentit?
Any help greatly appreciated.
Make a new document type for events and add a property of the type PDCalendar. Now you can pick a date that will appear on the calendar.
Hi Andy,
Sorry that my sites are down, working on getting things online again. And yes, I'm around on the forum ;)
To get the calendar working, you need to do a couple of things.
First, you need to modify the document-type you want to use for the events. Add a new property there with datatype PDCalendar. Remember the alias you give it.
Secondly, open the xslt-macro that you included in your template (You obviously chose one because you have a calendar;) ). Look for the line:
Hm, copied-pasted the last part from outlook-express......forum doesn't like that
Sorry about that!
Thanks for the quick response guys, this is really appreciated, you have made my Saturday a lot shorter. Many thanks for providing the package Peter!
Glad it is of use for you :D
Firstly, my profound apologise for making a post yesterday that appeared to break this issue in the forum and make it unreadable, I am unsure what I did wrong but it must have something to do with some code snippets that I tried to post, sorry!
Just another quick question if you are still around Peter? I am struggling to extract the daat that I need from my events, I am very new to XSLT and am finding it a bit of a steep learning curve (do not how or what to use to debug it, but that is another question for another time!). I have added a textbox to my event page so that a user can enter comments for an ebent but I am having trouble retrieveing the data back. I can retreive my start and end date like so;
Start Date: <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/data/pdcalendarevent/pdcstart"/>
Start Date: <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/data/pdcalendarevent/pdcend"/>
But I cannot seem to get at my comments which are in another data element at the same level the start and end date. I have tried the following, and combinations of the following, to no avail;
Comments: <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/calEventComments"/>
I can see the data in the XML so I know I can get it but I am unsure how. Also how can you format the start and end date, is that configured somewhere?
Thanks for your help.
Hi Andy, it wasn't your post itself that caused it, it was our html sanitizer that went balistic on it, I updated the sanitizer today so hopefully we won't see this kind of issues again.
Ok, thats a relief, I thought I might bet banned for breaking it! :-)
I think a few of us learned a thing or 2 because what you did ;)
Please have a look at the PDCalendar.xslt that was installed with the package. That should give you a basic idea how to get events in a certain time-period and how to list them (and display additional info). I think that one should get you going pretty quickly.
As for the date-formatting, you can use umbraco.library:
As for additional data, I take it that you simply added a new property right? You can display that like:
Hope this helps to get you going again.
Cheers,
Peter
Thanks for this however I am still a little confused, sorry. How to amend this statement
<xsl:value-of select="umbraco.library:FormatDateTime($currentPage/@updateDate, 'MMMM d, yyyy')"/>
to get the same value from the below statement?
<xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/data/pdcalendarevent/pdcstart"/>
I tried the following but it does not work
<xsl:value-of select="umbraco.library:FormatDateTime(GetXmlNodeById(@id)/data/pdcalendarevent/pdcstart, 'MMMM d, yyyy')"/>
<xsl:value-of select="umbraco.library:FormatDateTime(GetXmlNodeById(@id)/data/pdcalendarevent/@pdcstart, 'MMMM d, yyyy')"/>
So obviously I am getting this completely wrong.
I really need to a more intensive XSLT training course.
Let me ask first why you want to use the pdcstart-date? If the event is re-occurring, then that date is of no use to show right (that date could be 5 years ago) or am I missing something here?
If you really must use it, try this instead:
<xsl:value-of select="umbraco.library:FormatDateTime(umbraco.library:GetXmlNodeById(@id)/data/pdcalendarevent/pdcstart, 'MMMM d, yyyy')"/>
Obviously, you can change the 'MMMM d, yyyy' to fit your needs.
Either you are missing something here or I am! :-) When I add an event to the calendar I get the option of adding a start date and end date. I assumed that the start date is the date that the event will occur on, therefore if I enter an event that takes place today the the start date is todays date? I have even got as far as looking at recurrence yet so maybe is this likely to trip me up?
By the way your date formatting suggestions works perfectly, thanks.
Your approach can work if you do not use recurrence.
If you want to use recurrence however, an event starts to occur on more than 1 date. The startdate will not change, it will still be 1 date. You would have to create a new node for each time that event occured.
If you just use the startdate to display events, you have no way of knowing which dates the events occurs on as well. That is why I created the package. The datatype stores info. Now when you make a call to the DLL (examples in the 3 xslt-files) it will return a list of dates, as children of those dates are the events listed, if they occur on that date.
Does this make things clearer?
Yes, of course, thank you. Now I get it. We do not care what the start/end date is I am simply displaying the events that occur on the selected date. :-)
In that case, make the call to the library. That will decide if an event needs to be shown on the selected date. The startdate and enddate you enter at the backend is only used to check if that event would be valid or not.
Take a look at PDCalendar.xslt. That will simply list all events that occur from 1st januari till 31st december. That timespan can be easily adjusted to your needs.
Cheers,
Peter
So I need to chan this line
<xsl:variable name="messages" select="pdcalendar:GenerateDates('2009-01-01','2009-12-31','pdCalendarEvent')" />
And I need to replace it with the date that was selected in the calendar, is that right? In the calendar I only click on a event, not the actual date, what am I missing? Please be patient I am far more confused than I look!
By the way, I did not intend to mark your answer with a negative, can it be undone?
hahaha, the negative points are valid, I think I'm making you more confused than you allready are ;) (I don't think you can undo negative marker, but no worries about that)
I think I completely misunderstood you as well here. Basically you have a calendar in which you show the events, from there people can click through to the details of the event right? At least, this is how I understand it now.
On the details-page, you want to show the startdate of the event? If you don't use recurrsion, you could display the startdate. If you do use recursion however, an event can have multiple startdates. Right now that is something you cannot show then. But that would be a good addition to add to the package I guess (retrieve all valid dates that an event can occur on)
Yes that is what I am trying to do. User creates an event, and lets say it is a recurring event for 5 days from Monday to Friday. A second event is added that occurs only once on the Tuesday of the same week, therefore when you look at Tuesday you will see 2 events. If I click on either of those events I would like to only see the details of the events that occur on that day i.e. 2 events. I think we are the same wavelength way.
Now the tricky part, can PDCalendar accomodate this and if so how? If not is possible to get the source code and I can try to amend it myself (bit cheeky I know but I thought I would ask!) :-)
I think you have 2 options here.
1- In the calendar itself, it knows that those 2 events are both on that day. You could use some jquery to popup the additional info about that day.
2- Link to a new page (both events to same link) where you add the date that you request. With that date, you could then do a request to the DLL to see which events are valid on that day.
An option I'm going to build in a next release is to be able to get a list of dates on which that event is valid. As for the source-code, that's a no-go. It's partially commercial, if I would distribute the source, nobody would likely want to buy the commercial-version I guess.
Good point, I didn't realise you had a commercial aspect to this, definately cant give out source, no worries. I think I will try looking at the JQuery option as they will do as much I need to do at the moment. Many thanks. I look forward to seeing your next release! :-)
Andy,
Peter wanted me to chime in here and show the mods i made to the calendar to list how many events were on a day then linked to a jquery overlay window using fancybox...
http://www.hoosiertrailsbsa.org/news--events/council-calendar.aspx?m=9&y=2009
here is an example, click an event link to see the popup.
hope this provides some inspiration for you.
Wow! That is awesome! I will definately look into trying to do that, that is an excellent peice of work. For the time being a solution that I finally came up with at the moment is as follows,
For each of the events on a given day, in PDCUlliCalendar.xslt, I create the link as follows
<a class="">
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
<xsl:text disable-output-escaping="yes">?d=</xsl:text>
<xsl:value-of select="$cell/@date"/>
</xsl:attribute>
<xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/@nodeName"/>
</a>
This passes the correct date in the Url. Then in PDCalendar.xslt I generate the dates using the following
<xsl:variable name="messages" select="pdcalendar:GenerateDates(umbraco.library:RequestQueryString('d'),umbraco.library
This then actually gives me all of the events for that specific day.
Not sure if this the best way to do this as my understanding and grasp of XSLT is still very much in its early days but I pleased witrh myself for getting this far thanks to all your help!
Definately going to look into jquery option, see if I can figure that out!
Just out of interest Bob, if ever you want to share your calendar jquery overlay window using fancybox please let me know! Kust kidding, I am probably pushing my luck now, I should get of my ar*e and make the effort to learn this stuff. So much to learn, so little time! :-)
Andy, hit me up via email bob[atsign]maliciousthinktank[heresthedot]com
i will send you the the markup, etc. i am using.
is working on a reply...