UNPKG

node-red-node-web-nodes

Version:

A collection of Node-RED nodes for popular web services.

243 lines (227 loc) 10.6 kB
<!-- Copyright 2014 IBM Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <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> Google</label> <input type="text" id="node-input-google"> </div> <div class="form-row"> <label for="node-input-calendar"><i class="fa fa-tag"></i> Calendar</label> <input type="text" id="node-input-calendar"> </div> <div class="form-row"> Inject message <select id="node-input-offsetType" style="width:6em;"> <option value="at">at</option> <option value="before">before</option> <option value="after">after</option> </select> the <select id="node-input-offsetFrom" style="width:5em;"> <option value="start">start</option> <option value="end">end</option> </select> of each event. </div> <div id="node-row-offset" class="form-row hidden"> Inject message <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" selected="true">minutes</option> <option value="hours">hours</option> <option value="days">days</option> </select> <span id="node-input-type">before</span> the <span id="node-input-from">start</span> of each event. </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</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: 'Google', 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> Google</label> <input type="text" id="node-input-google"> </div> <div class="form-row"> <label for="node-input-calendar"><i class="fa fa-tag"></i> Calendar</label> <input type="text" id="node-input-calendar"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</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: 'social', 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> Google</label> <input type="text" id="node-input-google"> </div> <div class="form-row"> <label for="node-input-calendar"><i class="fa fa-tag"></i> Calendar</label> <input type="text" id="node-input-calendar"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</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: 'Google', 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>