Merge pull request #9 from flaviotsf/feature/outlookcom

Adds Support for Outlook.com
This commit is contained in:
Jason Salzman
2017-05-21 23:04:41 -07:00
committed by GitHub
5 changed files with 24 additions and 4 deletions
@@ -15,6 +15,7 @@ export default React.createClass({
let items = [ let items = [
{ outlook: 'Outlook' }, { outlook: 'Outlook' },
{ outlookcom: 'Outlook.com' },
{ apple: 'iCal' }, { apple: 'iCal' },
{ yahoo: 'Yahoo!' }, { yahoo: 'Yahoo!' },
{ google: 'Google' } { google: 'Google' }
@@ -28,6 +29,8 @@ export default React.createClass({
       
{"\{ outlook: 'Outlook' \}"}<br/> {"\{ outlook: 'Outlook' \}"}<br/>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{"\{ outlookcom: 'Outlook.com' \}"}<br/>
&nbsp;&nbsp;&nbsp;
{"\{ apple: 'iCal' \}"}<br/> {"\{ apple: 'iCal' \}"}<br/>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{"\{ yahoo: 'Yahoo!' \}"}<br/> {"\{ yahoo: 'Yahoo!' \}"}<br/>
@@ -15,6 +15,7 @@ export default React.createClass({
let items = [ let items = [
{ outlook: 'Outlook' }, { outlook: 'Outlook' },
{ outlookcom: 'Outlook.com' },
{ apple: 'Apple Calendar' }, { apple: 'Apple Calendar' },
{ yahoo: 'Yahoo' }, { yahoo: 'Yahoo' },
{ google: 'Google' } { google: 'Google' }
@@ -28,6 +29,8 @@ export default React.createClass({
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{"\{ outlook: 'Outlook' \}"}<br/> {"\{ outlook: 'Outlook' \}"}<br/>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{"\{ outlookcom: 'Outlook.com' \}"}<br/>
&nbsp;&nbsp;&nbsp;
{"\{ apple: 'Apple Calendar' \}"}<br/> {"\{ apple: 'Apple Calendar' \}"}<br/>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
{"\{ yahoo: 'Yahoo' \}"}<br/> {"\{ yahoo: 'Yahoo' \}"}<br/>
+1
View File
@@ -67,6 +67,7 @@ defaultValue: `[
{ apple: 'Apple Calendar' }, { apple: 'Apple Calendar' },
{ google: 'Google' }, { google: 'Google' },
{ outlook: 'Outlook' }, { outlook: 'Outlook' },
{ outlookcom: 'Outlook.com' },
{ yahoo: 'Yahoo' } { yahoo: 'Yahoo' }
]` ]`
+3 -2
View File
@@ -62,7 +62,7 @@ export default class ReactAddToCalendar extends React.Component {
let icon = null; let icon = null;
if (self.props.displayItemIcons) { if (self.props.displayItemIcons) {
let currentIcon = (currentItem === 'outlook') ? 'windows' : currentItem; let currentIcon = (currentItem === 'outlook' || currentItem === 'outlookcom') ? 'windows' : currentItem;
icon = <i className={'fa fa-' + currentIcon}/>; icon = <i className={'fa fa-' + currentIcon}/>;
} }
@@ -187,7 +187,8 @@ ReactAddToCalendar.defaultProps = {
{ apple: 'Apple Calendar' }, { apple: 'Apple Calendar' },
{ google: 'Google' }, { google: 'Google' },
{ outlook: 'Outlook' }, { outlook: 'Outlook' },
{ yahoo: 'Yahoo' } { outlookcom: 'Outlook.com' },
{ yahoo: 'Yahoo' },
], ],
rootClass: 'react-add-to-calendar' rootClass: 'react-add-to-calendar'
}; };
+14 -2
View File
@@ -46,13 +46,25 @@ export default class helpers {
// yahoo doesn't utilize endTime so we need to calulate duration // yahoo doesn't utilize endTime so we need to calulate duration
let duration = this.calculateDuration(event.startTime, event.endTime); let duration = this.calculateDuration(event.startTime, event.endTime);
calendarUrl = 'https://calendar.yahoo.com/?v=60&view=d&type=20'; calendarUrl = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
calendarUrl += '&title=' + event.title; calendarUrl += '&title=' + encodeURIComponent(event.title);
calendarUrl += '&st=' + this.formatTime(event.startTime); calendarUrl += '&st=' + this.formatTime(event.startTime);
calendarUrl += '&dur=' + duration; calendarUrl += '&dur=' + duration;
calendarUrl += '&desc=' + event.description; calendarUrl += '&desc=' + encodeURIComponent(event.description);
calendarUrl += '&in_loc=' + encodeURIComponent(event.location); calendarUrl += '&in_loc=' + encodeURIComponent(event.location);
break; break;
case 'outlookcom':
calendarUrl = "https://outlook.live.com/owa/?rru=addevent";
calendarUrl += "&startdt=" + this.formatTime(event.startTime);
calendarUrl += "&enddt=" + this.formatTime(event.endTime);
calendarUrl += "&subject=" + encodeURIComponent(event.title);
calendarUrl += "&location=" + encodeURIComponent(event.location);
calendarUrl += "&body=" + encodeURIComponent(event.description);
calendarUrl += "&allday=false";
calendarUrl += "&uid=" + this.getRandomKey();
calendarUrl += "&path=/calendar/view/Month";
break;
default: default:
calendarUrl = [ calendarUrl = [
'BEGIN:VCALENDAR', 'BEGIN:VCALENDAR',