prisme-flow
Version:
prisme platform flow engine
237 lines (222 loc) • 10.4 kB
HTML
<!--
Created by prisme.io on 09/06/2017.
@author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io)
-->
<script type="text/x-red" data-template-name="google calendar in">
<div class="form-row">
<label for="node-input-google"><i class="fa fa-user"></i> <span>Google</span></label>
<input type="text" id="node-input-google">
</div>
<div class="form-row">
<label for="node-input-calendar"><i class="fa fa-tag"></i> <span>Calendar</span></label>
<input type="text" id="node-input-calendar">
</div>
<div class="form-row">
<span>Inject message</span>
<select id="node-input-offsetType" style="width:6em;">
<option value="at">at</option>
<option value="before">before</option>
<option value="after">after</option>
</select>
<span data-i18n="calendar.label.the"></span>
<select id="node-input-offsetFrom" style="width:5em;">
<option value="start">start</option>
<option value="end">end</option>
</select>
<span data-i18n="calendar.label.each-event"></span>
</div>
<div id="node-row-offset" class="form-row hidden">
<span>Inject message</span> <input type="text" id="node-input-offset" style="width: 3em;"/>
<select id="node-input-offsetUnits" style="width:7em;">
<option value="seconds">seconds</option>
<option value="minutes">minutes</option>
<option value="hours">hours</option>
<option value="days">days</option>
</select>
<span id="node-input-type"><span>before</span></span> <span>the</span>
<span id="node-input-from"><span>start</span></span> <span>of each event.</span>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="google calendar in">
<p>Send a message every time an event occurs in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
<p>The message sent from the node will have properties:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>data</b> - the raw event from the google calendar query as described in the <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
<li><b>payload</b> - an object containing:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>start</b> - Javascript Date of start time - midnight for all day event</li>
<li><b>end</b> - Javascript Date of end time - midnight for all day event</li>
<li><b>allDayEvent</b> - true if event is an all day event</li>
<li><b>creator</b> - object containing name and email properties</li>
<li><b>attendees</b> - list of objects containing name and email properties</li>
</ul>
</li>
</ul>
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('google calendar in',{
category: 'utility',
color:"#C0DEED",
defaults: {
google: {type:"google-credentials",required:true},
name: {value:""},
calendar: {value:""},
offsetType: {value:"at"},
offsetFrom: {value:"start"},
offset: {value:"10"},
offsetUnits: {value:"minutes"}
},
inputs:0,
outputs:1,
icon: "google-calendar.png",
label: function() {
return this.name || "google calendar";
},
oneditprepare: function() {
var type = this.offsetType || "at";
$("#node-input-offsetType option").filter(function() {
return $(this).val() == type;
}).attr('selected', true);
var from = this.offsetFrom || "start";
$("#node-input-offsetFrom option").filter(function() {
return $(this).val() == from;
}).attr('selected', true);
$("#node-input-offset").val(this.offset || "0");
var units = this.offsetUnits || "minutes";
$("#node-input-offsetUnits option").filter(function() {
return $(this).val() == units;
}).attr('selected', true);
var updateOptions = function() {
var type = $("#node-input-offsetType option:selected").val();
var from = $("#node-input-offsetFrom option:selected").val();
if (type === "at") {
$("#node-row-offset").hide();
} else {
$("#node-input-type").html(type);
$("#node-input-from").html(from);
$("#node-row-offset").show();
}
};
updateOptions();
$("#node-input-offsetType").change(updateOptions);
$("#node-input-offsetFrom").change(updateOptions);
},
});
</script>
<script type="text/x-red" data-template-name="google calendar">
<div class="form-row">
<label for="node-input-google"><i class="fa fa-user"></i> <span>Google</span></label>
<input type="text" id="node-input-google">
</div>
<div class="form-row">
<label for="node-input-calendar"><i class="fa fa-tag"></i> <span>Calendar</span></label>
<input type="text" id="node-input-calendar">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="google calendar">
<p>Return the next event in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
<p>The incoming message can provide the following properties:
<ul>
<li><b>payload</b> - a text search string used to select relevant events</li>
<li><b>calendar</b> - the calendar to retrieve the event from (optional, defaults
to the node calendar property or the users primary calendar)</li>
</ul>
</p>
<p>The message sent from the node will have properties:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>data</b> - the raw event from the google calendar query as described in the
<a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
<li><b>payload</b> - an object containing:
<ul>
<li><b>title</b> - the summary string from the calendar entry</li>
<li><b>description</b> - the description from the calendar entry</li>
<li><b>location.description</b> - the location string from the calendar entry</li>
<li><b>start</b> - Javascript Date of start time - midnight for all day event</li>
<li><b>end</b> - Javascript Date of end time - midnight for all day event</li>
<li><b>allDayEvent</b> - true if event is an all day event</li>
<li><b>creator</b> - object containing name and email properties</li>
<li><b>attendees</b> - list of objects containing name and email properties</li>
</ul>
</li>
</ul>
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('google calendar',{
category: 'utility',
color:"#C0DEED",
defaults: {
google: {type:"google-credentials",required:true},
name: {value:""},
calendar: {value:""}
},
inputs:1,
outputs:1,
icon: "google-calendar.png",
align: "right",
label: function() {
return this.name || "google calendar";
}
});
</script>
<script type="text/x-red" data-template-name="google calendar out">
<div class="form-row">
<label for="node-input-google"><i class="fa fa-user"></i> <span>Google</span></label>
<input type="text" id="node-input-google">
</div>
<div class="form-row">
<label for="node-input-calendar"><i class="fa fa-tag"></i> <span>Calendar</span></label>
<input type="text" id="node-input-calendar">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="google calendar out">
<p>Create an entry in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
<p>The incoming message can provide the following properties:
<ul>
<li><b>payload</b> - either a string to describe the event using <a href="https://support.google.com/calendar/answer/36604?hl=en">quick add format</a>
or an object representing the request body for an <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/insert">insert request</a></li>
<li><b>calendar</b> - the calendar to add the event to (optional, defaults to the node calendar property or the users primary calendar)</li>
<li><b>sendNotifications</b> - a boolean to determine if notifications should be sent to attendees (optional, defaults to false)</li>
</ul>
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('google calendar out',{
category: 'utility',
color:"#C0DEED",
defaults: {
google: {type:"google-credentials",required:true},
name: {value:""},
calendar: {value:""}
},
inputs:1,
outputs:0,
icon: "google-calendar.png",
align: "right",
label: function() {
return this.name || "google calendar";
}
});
</script>