plugin insertar google evento addevent javascript outlook google-api icalendar yahoo-api

javascript - insertar - icalendar jquery



Agrega eventos a google calendar, yahoo calendar, outlook y ical (5)

Los usuarios de mi sitio basado en Javascript a menudo necesitan crear un evento donde publican un nombre de evento, una descripción del evento, la hora de inicio y la hora de finalización del evento junto con la fecha. Ahora, les gustaría agregar esos detalles del evento a su calendario de Google o el calendario de Yahoo o iCal o Outlook, ¿es su biblioteca estándar para eso? Estoy tratando de resolverlo durante los últimos 3 días, aunque estoy al tanto de los API de Google pero no conozco ni de iCal ni de Outlook, ni tampoco de Yahoo. Estoy buscando algo muy similar a este " http://compute2011.doattend.com/ ". En el lado derecho, puede ver esta parte de "Agregar esto a su sitio", me gustaría hacer lo mismo.

Por favor ayúdame a ponerme en las manos.


Creo que esta es la mejor opción para hacer esto. Este complemento puede crear un archivo .ics a partir de variables en html.

http://addtocalendar.com/


Esto es lo que uso en caso de que ayude a alguien. Estoy usando ASP.NET MVC / C #, pero debería darle la idea de lo que se necesita para construirlo usted mismo.

Outlook y iCal:

var icsUrl = ''/todos/geticsfile/'' + id; public ActionResult GetIcsFile(string id) { var user = UserService.Get(UserId); var todo = ToDoService.Get(id); var content = GetOutlookFileContents(user, todo); var bytes = Encoding.UTF8.GetBytes(content); return File(bytes, "text/calendar", "housters-todo.ics"); } public static string GetOutlookFileContents(User user, ToDo todo) { var builder = new StringBuilder(); builder.AppendLine("BEGIN:VCALENDAR"); builder.AppendLine("METHOD:REQUEST"); builder.AppendLine("PRODID:Microsoft Exchange Server 2010"); builder.AppendLine("VERSION:2.0"); builder.AppendLine("BEGIN:VTIMEZONE"); builder.AppendLine("TZID:Eastern Standard Time"); builder.AppendLine("BEGIN:STANDARD"); builder.AppendLine("DTSTART:16010101T020000"); builder.AppendLine("TZOFFSETFROM:-0700"); builder.AppendLine("TZOFFSETTO:-0800"); builder.AppendLine("RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11"); builder.AppendLine("END:STANDARD"); builder.AppendLine("BEGIN:DAYLIGHT"); builder.AppendLine("DTSTART:16010101T020000"); builder.AppendLine("TZOFFSETFROM:-0800"); builder.AppendLine("TZOFFSETTO:-0700"); builder.AppendLine("RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3"); builder.AppendLine("END:DAYLIGHT"); builder.AppendLine("END:VTIMEZONE"); builder.AppendLine("BEGIN:VEVENT"); builder.AppendLine("ORGANIZER;CN=" + user.Name + ":MAILTO:" + user.EmailAddress); builder.AppendLine("ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=" + user.EmailAddress + ":MAILTO:" + user.EmailAddress); builder.AppendLine("DESCRIPTION;LANGUAGE=en-US:" + todo.Task); builder.AppendLine("SUMMARY;LANGUAGE=en-US:" + todo.TitleOrTask); builder.AppendLine("DTSTART;TZID=Eastern Standard Time:" + todo.DueDate.Value.ToString("yyyyMMdd")); builder.AppendLine("DTEND;TZID=Eastern Standard Time:" + todo.DueDate.Value.ToString("yyyyMMdd")); builder.AppendLine("UID:" + Guid.NewGuid().ToString()); builder.AppendLine("CLASS:PUBLIC"); builder.AppendLine("PRIORITY:5"); builder.AppendLine("DTSTAMP:" + todo.DueDate.Value.ToString("yyyyMMdd") + "T023422Z"); builder.AppendLine("TRANSP:OPAQUE"); builder.AppendLine("STATUS:CONFIRMED"); builder.AppendLine("SEQUENCE:0"); if(todo.PropertyId != null) { var property = PropertyService.Get(todo.PropertyId); builder.AppendLine("LOCATION;LANGUAGE=en-US:" + property.FullAddress); } else { builder.AppendLine("LOCATION;LANGUAGE=en-US:Unknown"); } builder.AppendLine("X-MICROSOFT-CDO-APPT-SEQUENCE:0"); builder.AppendLine("X-MICROSOFT-CDO-OWNERAPPTID:2112076272"); builder.AppendLine("X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE"); builder.AppendLine("X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY"); builder.AppendLine("X-MICROSOFT-CDO-ALLDAYEVENT:FALSE"); builder.AppendLine("X-MICROSOFT-CDO-IMPORTANCE:1"); builder.AppendLine("X-MICROSOFT-CDO-INSTTYPE:0"); builder.AppendLine("X-MICROSOFT-DISALLOW-COUNTER:FALSE"); builder.AppendLine("BEGIN:VALARM"); builder.AppendLine("ACTION:DISPLAY"); builder.AppendLine("DESCRIPTION:REMINDER"); builder.AppendLine("TRIGGER;RELATED=START:-PT15M"); builder.AppendLine("END:VALARM"); builder.AppendLine("END:VEVENT"); builder.AppendLine("END:VCALENDAR"); return builder.ToString(); }

Google:

var text = encodeURIComponent(''Housters To-Do Due: '' + self.task()); var startDate = moment(self.dueDate()).format(''YYYYMMDD''); var endDate = moment(self.dueDate()).add(''days'', 1).format(''YYYYMMDD''); var details = encodeURIComponent(self.task()); var location = encodeURIComponent(self.propertyName()); var googleCalendarUrl = ''http://www.google.com/calendar/event?action=TEMPLATE&text='' + text + ''&dates='' + startDate + ''/'' + endDate + ''&details='' + details + ''&location='' + location;


He estado buscando algo similar esta noche y encontré este plugin jQuery que parece que podría ayudarte. Puede generar directamente archivos .ics "sobre la marcha" con él, lo que debería ser bueno para Google, Outlook, iCal y Yahoo.

http://keith-wood.name/icalendar.html

Sin embargo, no he tenido la oportunidad de probarlo, pero planeo hacerlo en los próximos días. Sin embargo HTH!



Para una solución javascript pura, hay ics.js Genera archivos ics utilizando únicamente javascript. El único inconveniente es que no admite versiones anteriores de IE.