Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • qwertyuiop 1 post 20 karma points
    Jul 27, 2009 @ 18:59
    qwertyuiop
    0

    Start and End Time

    Is there a way to associate a start/end time with an event like the "Datepicker with time" data type? Or is that in the pro version?

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 27, 2009 @ 19:27
    Peter Dijksterhuis
    0

    No sorry, at the moment that is not available.

    I'm planning on updating the package with a slightly different approach for the start- and enddates which will then also include times.

    Perhaphs you can add a few properties of your own which contain the start and end times? I don't know how you plan to use it, but could be worth trying.

    Peter

  • Josh Reid 182 posts 258 karma points
    Aug 12, 2009 @ 22:56
    Josh Reid
    0

    Hi Peter

    I am trying to list events only in the future in a simple list and have the xslt:

    <xsl:for-each select="$newsPage/node[./data[@alias = 'event']/pdcalendarevent/pdcstart!='' and umbraco.library:DateGreaterThanOrEqualToday(umbraco.library:FormatDateTime(./data[@alias = 'event']/pdcalendarevent/pdcstart, 'dd/MM/yyyy'))]">

    But it fails and says that:

    String was not recognized as a valid DateTime. String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at umbraco.library.DateGreaterThanOrEqualToday(String firstDate)

    What format is the pdcstart and how would i format as datetime???

    Thanks
    J

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 12, 2009 @ 23:17
    Peter Dijksterhuis
    0

    Hi Josh,

    perhaphs an easier approach to get the events is this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
       version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:msxml="urn:schemas-microsoft-com:xslt"
       xmlns:exslt="urn:Exslt.ExsltCommon"
       xmlns:date="urn:Exslt.ExsltDatesAndTimes"
       xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:pdcalendar="urn:pdcalendar" 
       exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets pdcalendar date">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:variable name="messages" select="pdcalendar:GenerateDates(date:date(),date:add(date:date(),'P1M'),'event')" />
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <ul>
    <xsl:for-each select="$messages/node">
    <xsl:if test="count(./event) &gt; 0">
    <li>
    <xsl:value-of select="@date"/>
    <ul>
    <xsl:for-each select="./event">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="umbraco.library:GetXmlNodeById(@id)/@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>
    </li>
    </xsl:if>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    You need to change the 'event' in the GenerateDates() to match the alias of the property PDCalendar you use. 

    The first parameter represents the current date, the second one adds 1 months to the current date.

    The variable will be filled with the veents that will happen in the upcoming month. 

    Does this help you? Or do you have a specific reason why you want to loop through the nodes like you do now?

    Peter

  • Heather Floyd 604 posts 1002 karma points MVP 5x c-trib
    Aug 12, 2009 @ 23:25
    Heather Floyd
    0

    Josh,

    I recently did something similar.

    This is some of the code I used (keep in mind I made it such that different start & end dates could be specified, so you wouldn't need all of this, but you should get the idea:

    <!--Get first and last dates for all events -->
        <xsl:variable name = "AllFirstDate">
            <xsl:for-each select="$EventsNode/node [@nodeTypeAlias='Event']">
            <xsl:sort select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcstart" order="ascending" data-type="text"/>
                <xsl:if test="position()=1">
                    <xsl:value-of select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcstart" />
                </xsl:if>
            </xsl:for-each>
        </xsl:variable>
       
        <xsl:variable name = "AllLastDate">
            <xsl:for-each select="$EventsNode/node [@nodeTypeAlias='Event']">
            <xsl:sort select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcend" order="descending" data-type="text"/>
                <xsl:if test="position()=1">
                    <xsl:value-of select="./data [@alias ='EventDateInfo']/pdcalendarevent/pdcend" />
                </xsl:if>
            </xsl:for-each>
        </xsl:variable>
    ...............................................
    <!-- Get List of All Events -->
        <xsl:variable name="messages" select="pdcalendar:GenerateDates($AllFirstDate,$AllLastDate,'EventDateInfo')" />
    ..................
    <!--Is date within range and does it have events?-->
            <xsl:for-each select="$messages/node [umbraco.library:DateGreaterThanOrEqual(@date, $StartDate)
                                             and not(umbraco.library:DateGreaterThanOrEqual(@date, $EndDate))
                                             and count(./event) &gt; 0]">
    ..do stuff...
    </xsl:for-each>

     

    The format that the pdcstart and pdcend date are in is 'yyyy-mm-dd', I believe, which means you should be able to pass @date into expressions without doing any formatting. It will be correctly recognized as a date automatically.

    I hope this helps.

    ~Heather

  • Josh Reid 182 posts 258 karma points
    Aug 12, 2009 @ 23:31
    Josh Reid
    0

    Hey thanks Peter

    Yeah it is because i wish to display in the calendar on the main events page, but i also need to make a simple summary list macro for inclusion on all pages in sub-column.

    So i want the next X number of events in the future regardless of their date (but obv they must be in the future).

    So really just need to know that pdcstart data is available to compare as datetime (or to transform somehow)?

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Aug 12, 2009 @ 23:36
    Sebastiaan Janssen
    0

    If you were to add a start time and / or end time property, then you could just add the time to the date right? And then test for that.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 12, 2009 @ 23:40
    Peter Dijksterhuis
    0

    The macro I showed can be used on any page, the rendering of the dates does not depend on the currentPage in XSLT. By using the date:date() option, you force the events to be returned to start today or later.

    Also, the pdcstart is actually a mandatory field, so it is always filled. If you get around that somehow, please tell me because that is not intended use ;)

    But, as Heather pointed out, the format is yyyy-mm-dd, so you can use your own option as well if you like.

  • Josh Reid 182 posts 258 karma points
    Aug 12, 2009 @ 23:45
    Josh Reid
    0

    Oh god i feel stupid now- I had old event nodes that i was ttrying to iterate without having republished with the pdcalendar datatype!

    So thanks for time and great info ;) I am sorted now, cheers!

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 12, 2009 @ 23:46
    Peter Dijksterhuis
    0

    No problem :)

    If you have any more questions, just ask!

  • Josh Reid 182 posts 258 karma points
    Aug 26, 2009 @ 00:12
    Josh Reid
    0

    It appears the calendar wont list any events on the last day of any months?!

    Has anyone else found this and solved the issue?

    PD any thoughts?

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 26, 2009 @ 00:50
    Peter Dijksterhuis
    0

    Hm, I thought I solved that in the latest version. What version are you using?

    Try downloading the latest version and overwrite the dll in the bin-folder (don't install package, but just extract the package and only use the dll)

    If that doesn't help, I need to look into it.

    Peter

  • Josh Reid 182 posts 258 karma points
    Aug 26, 2009 @ 01:06
    Josh Reid
    0

    Cool - Sorted now thanks Peter!

  • MikeD 92 posts 112 karma points
    Jan 06, 2010 @ 22:02
    MikeD
    0

    I'm just getting started with Umbraco and xsl... would it be possible for someone to show me, in like 3rd grade language in crayon... how to get the start and and date for an event and display it along with the title thusly:

     

    Event Title

    [Start Date] - [End Date]

     

    Just my newbie opinion, but this should be a LOT easier to get...  not EVERYONE needs a calendar in calendar format.  :D

    Thanks in advance!

  • MikeD 92 posts 112 karma points
    Jan 06, 2010 @ 22:21
    MikeD
    0

    Figures... 2 minutes after I post I figure it out...

    Thanks anyway...

  • Craig Palenshus 39 posts 63 karma points
    May 26, 2011 @ 19:10
    Craig Palenshus
    0

    Has any progress been made on adding times to the start and end date pickers?

  • Jignesh 31 posts 51 karma points
    Jan 24, 2012 @ 07:54
    Jignesh
    0

    Hello,

    i got this error

    Cannot find a script or an extension object associated with namespace 'urn:pdcalendar'. 

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 24, 2012 @ 07:59
    Jan Skovgaard
    0

    Hi Jignesh

    What does your code look like?

    /Jan

  • Jignesh 31 posts 51 karma points
    Jan 31, 2012 @ 11:25
    Jignesh
    0

    Hi..

    Problem solve its because of framework version at server...

  • Steve 472 posts 1216 karma points
    Sep 10, 2012 @ 14:38
    Steve
    0

    Nevermind, figured it out...

Please Sign in or register to post replies

Write your reply to:

Draft