Posts Tagged ‘calendar’
Logged out users can’t bring up the Plone popup calendar
It’s another one of those ‘strange’ problems that has cropped up, but by default in Plone, users who aren’t authenticated aren’t actually able to bring up a pop-up calendar on a date field.
It’s amazing that I haven’t run into this issue before with something like PloneFormGen, where you’d think that a simple Date input field would be pretty common. Although, I guess it’s the case that even though I’ve used these given forms, I’ve probably never taken much notice of the popup calendar icon and just selected a random date from the drop-down lists. I suppose entering a random number on they keyboard and hitting tab across the fields 3 times is simpler than going for the mouse. Who knows. (more…)
PloneFormGen (Plone) & Google Calendar Integration
It’s a little bit of a different mash-up, but it’s still nonetheless useful to have, given types of booking forms and so forth that could utilise it. The easiest way I found (to avoid security issues with Python scripts in Plone) was to create an external method and just import it within a PFG Custom Adapter.
Parts
- My GoogleCalendar.py external method. I’ve had to add this into a policy product I have. The function should be generalised enough to work with any Google account, hosted or not. In short:
- It takes in a variety of arguments (email, password, calendar_url, start_time, end_time, title, location, content).
- Email/password are your auth details
- calendar_url is where you’re putting the event,
- and the rest of the args are related to the event itself.
- It builds the XML-based request to create the event. I tried going for the gdata API, but it’s just over the top for a simple exercise like this.
- Send the request to Google (twice, as required), and create the event in the process.
- It takes in a variety of arguments (email, password, calendar_url, start_time, end_time, title, location, content).
- A custom PFG script adapter like this:
from DateTime import DateTime from my.theme.Extensions.GoogleCalendar import createGoogleCalendarEvent calendar_url = 'http://www.google.com/...' email = 'myu...@google.com' password = 'shhhhhsecret' startDateTime = (DateTime(str(fields['start-date-time']))).HTML4() endDateTime = (DateTime(str(fields['end-date-time']))).HTML4() eventTitle = str(fields['purpose']) eventLocation = str(fields['rooms-to-book']) eventContent = 'Booked for: '+ str(fields['booking-name']) createGoogleCalendarEvent(context, email, password, calendar_url, startDateTime, endDateTime, eventTitle, eventLocation, eventContent)
And that should be that. As long as all your URLs, emails, passwords, and fields in your form are suitable, this should work a treat. Note that the start-date-time and end-date-time fields are date/time fields in your Form Folder and converting to HTML4() makes them into Google’s format. Additional info can be added in the eventContent variable, and that’ll turn up in the Description in Google Calendar.
For added spice…
Just add a web interface to your Google Calendar to your Plone site (eg in a normal Plone page; watch out for iframe filtering) and let people book themselves into things. Would be great to see PFG know when a Google Calendar event was on (and stop people submitting) but it’s a bit much just for now.
Plone: Google Calendar Integration
Wouldn’t it be great if you could somehow add your Event content item within the Plone CMS onto your Google Calendar with just a click? (it’d be better with fewer, but 1 click is pretty good – give me a break!) (more…)