Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Events Calendar simple integration w/ Google
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Events Calendar simple integration w/ Google

 Post Reply Post Reply Page  123>
Author
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Topic: Events Calendar simple integration w/ Google
    Posted: 27 October 2013 at 2:47pm
modification to add a "add to your google calendar" button to events.

modified file is Forum_posts.asp

Insert at about line 155 the following:
Dim strGoogleCalendar
Insert at approx line 1055, after the line "If isDate(dtmEventDateEnd) Then Response.Write(" - " & stdDateFormat(dtmEventDateEnd, False))" the following:
    strGoogleCalendar = right(dtmEventDate,4)

    if len(dtmEventDate) = 10 then
        strGoogleCalendar = strGoogleCalendar & mid(dtmEventDate, 1, 2) & mid(dtmEventDate, 4, 2)
    else
        if len(dtmEventDate) = 9 then
            if mid(dtmEventDate,2,1) = "/" then
                strGoogleCalendar = strGoogleCalendar & "0" & mid(dtmEventDate, 1, 1) & mid(dtmEventDate, 3, 2)
            else
                strGoogleCalendar = strGoogleCalendar & mid(dtmEventDate, 1, 2) & "0" & mid(dtmEventDate, 4, 1)
            end if
        else
            strGoogleCalendar = strGoogleCalendar & "0" & mid(dtmEventDate, 1, 1) & "0" & mid(dtmEventDate, 3, 1)
        end if
    End if
   
    if isDate(dtmEventDateEnd) then

        strGoogleCalendar = strGoogleCalendar & "/" & right(dtmEventDateEnd,4)

        if len(dtmEventDateEnd) = 10 then
            strGoogleCalendar = strGoogleCalendar & mid(dtmEventDateEnd, 1, 2) & mid(dtmEventDateEnd, 4, 2)
        else
            if len(dtmEventDateEnd) = 9 then
                if mid(dtmEventDateEnd,2,1) = "/" then
                    strGoogleCalendar = strGoogleCalendar & "0" & mid(dtmEventDateEnd, 1, 1) & mid(dtmEventDateEnd, 3, 2)
                else
                    strGoogleCalendar = strGoogleCalendar & mid(dtmEventDateEnd, 1, 2) & "0" & mid(dtmEventDateEnd, 4, 1)
                end if
            else
                strGoogleCalendar = strGoogleCalendar & "0" & mid(dtmEventDateEnd, 1, 1) & "0" & mid(dtmEventDateEnd, 3, 1)
            end if
        end if
    else
   
    strGoogleCalendar = strGoogleCalendar & "/" & strGoogleCalendar
       
    End if
       
    strGoogleCalendar = "<a href=""http://www.google.com/calendar/event?action=TEMPLATE&text=" & strSubject & "&dates=" & strGoogleCalendar
    strGoogleCalendar = strGoogleCalendar & "&details=" & strForumPath & strLinkPage & """ target=""_blank"" title=""Add this event to your Google Calendar!""><img src=""//www.google.com/calendar/images/ext/gc_button6.gif"" border=0 alt=""Add this event to your Google Calendar!""></a>"

    Response.Write("  " & strGoogleCalendar)

This will add an icon at the end of an event display subject line that looks like and is hyperlinked to the user's personal google calendar with the correct start and end date of the event, correct subject, and a description that includes a link back to the original event posting on the webwiz forum.

If I have stepped outside of what's allowed or this is inappropriate modification, I apologize in advance.  I hope this mod is useful to someone else.
Back to Top
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2017 at 9:08pm
Webwiz - apparently the latest major version breaks this mod.  We would like it reimplemented (its something we use a lot), but I havent taken the time to figure out what's wrong, so its gone from the version we have hosted on your service. 

Is there any intent to roll this into a near-term release?  I dont want to waste my time trying to get this working again if yall are going to do it for me....and you will probably implement it much better than I will....

???
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2017 at 8:03am
If there is time will look at it, but there is nothing stopping you from providing the code to include in the next release.
Back to Top
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2017 at 1:55pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

If there is time will look at it, but there is nothing stopping you from providing the code to include in the next release.


Well, <ahem> I thought that's what I was doing with the original 2013 post, but it was not incorporated into the code base going forward. 

I will try to get it working in the current version and repost the new code.  It may be a few weeks.  Do you have a deadline for the next release?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2017 at 4:01pm
Not at the present time
Back to Top
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2017 at 12:37am
UPDATED!  This is based on version 11.06

Modification to add a "add to google calendar" button to events.  User can click on the button and a draft event on the uers personal calendar will be created.  User can modify it, toss it, save it whatever.

Modified file is Forum_posts.asp

Insert after line 155 the following:
Dim strGoogleCalendar
Insert at approx line 1061 (including the added line above), after the line "If isDate(dtmEventDateEnd) Then Response.Write(" - " & stdDateFormat(dtmEventDateEnd, False))" the following:
'added to support google calendar integration

'Google calendar api requires full day events to end on the day after they start, so
'set event end to either 1 day after date of the event for single day events
'or 1 day after the specified end date if multiday event

    If not isDate(dtmEventDateEnd) Then
      dtmEventDateEnd = DateAdd("d",1,dtmEventDate)
    else
      dtmEventDateEnd = DateAdd("d",1,dtmEventDateEnd)
    end if

'provide correctly formatted date yyyymmdd for calendar API from start date
             
    strGoogleCalendar = cstr(datepart("yyyy",dtmEventDate))
    if datepart("m",dtmEventDate) <= 9 then
      strGoogleCalendar = strGoogleCalendar & "0" & cstr(datepart("m",dtmEventDate))
    else
      strGoogleCalendar = strGoogleCalendar & cstr(datepart("m",dtmEventDate))
    end if
    if datepart("d",dtmEventDate) <= 9 then
      strGoogleCalendar = strGoogleCalendar & "0" & cstr(datepart("d",dtmEventDate))
    else
      strGoogleCalendar = strGoogleCalendar & cstr(datepart("d",dtmEventDate))
    end if

'Add a slash
   strGoogleCalendar = strGoogleCalendar & "/"

'Provide correctly formatted end date
    strGoogleCalendar = strGoogleCalendar & cstr(datepart("yyyy",dtmEventDate))
    if datepart("m",dtmEventDateEnd) <= 9 then
      strGoogleCalendar = strGoogleCalendar & "0" & cstr(datepart("m",dtmEventDateEnd))
    else
      strGoogleCalendar = strGoogleCalendar & cstr(datepart("m",dtmEventDateEnd))
    end if
    if datepart("d",dtmEventDateEnd) <= 9 then
      strGoogleCalendar = strGoogleCalendar & "0" & cstr(datepart("d",dtmEventDateEnd))
    else
      strGoogleCalendar = strGoogleCalendar & cstr(datepart("d",dtmEventDateEnd))
    end if

'Create the HTML string for the API call, and write it to browser
            
    strGoogleCalendar = "<a href=""http://www.google.com/calendar/event?action=TEMPLATE&text=" & strSubject & "&dates=" & strGoogleCalendar
    strGoogleCalendar = strGoogleCalendar & "&details=" & strForumPath & strLinkPage & """ target=""_blank"" title=""Add this event to your Google Calendar!""><img src=""//www.google.com/calendar/images/ext/gc_button6.gif"" border=0 alt=""Add this event to your Google Calendar!""></a>"
    Response.Write("  " & strGoogleCalendar)

'end of additional code for google calendar integration

This will add an icon at the end of an event display subject line that looks like and is hyperlinked to the user's personal google calendar with the correct start and end date of the event, correct subject, and a description that includes a link back to the original event posting on the webwiz forum.

Please include in next release after you have suitably tested it.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2017 at 12:24pm
Looks good will look at adding it.

What date format does it use?

It looks like an ISO date in which case the forums built in function internationalDateTime() should be able to format the date by just using;


strGoogleCalendar = strGoogleCalendar & cstr(internationalDateTime(dtmEventDateEnd))


Back to Top
alabamatoy View Drop Down
Groupie
Groupie


Joined: 04 February 2006
Location: United States
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote alabamatoy Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2017 at 1:30pm
It uses yyyymmdd but the year and date must have a leading zero when less than 10.  If the built-in function will do that, then it will shave off a bunch of code.  I will attempt to implement it that way, but it will be a couple days before I can get to it.
Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.