File: scotts\widgets\gsp_calendar\server.js
(function() {
/**
*
* @class GSPCalendar.Server
* @constructor
* @extends Widget.Server
* @module Widgets
*/
/**
* The PortalCalendar for the active service portal.
* @property calendar
* @type GlideRecord | PortalCalendar
*/
var calendar = new GlideRecord("u_portal_calendar"),
/**
* The GlideRecord for the active ServicePortal from which to pull values
* such as the current calendar or owner information if needed.
* @property sp
* @type GlideRecord | ServicePortal
*/
sp = $sp.getPortalRecord(),
/**
* Used for retrieving necessary calendar information.
* @property utility
* @type CWTCalendarUtil
*/
utility;
calendar.get("u_sp_portal", sp.sys_id.getValue());
utility = new CWTCalendarUtil(calendar.getValue("sys_id"));
/**
* The data to describe the basics of the current calendar such
* as title and description.
*
* See the Calendar utility for the details retrieved by the
* {{#crossLink "CWTCalendarUtil/getCalendarJSON:method"}}{{/crossLink}}
* method.
* @property data.calendar
* @type Object
*/
data.calendar = utility.getCalendarJSON();
/**
* All events for the currently associated Calendar where the
* {{#crossLink "PortalCalendarEvent/u_publish_to_calendar:property"}}{{/crossLink}}
* flag is true.
*
* This may pose a memory issue at a future point, but the current
* use case lets this remain simple.
*
* See the Calendar utility for the details retrieved by the
* {{#crossLink "CWTCalendarUtil/getEvents:method"}}{{/crossLink}}
* method.
* @property data.events
* @type Object
*/
data.events = utility.getEvents(true);
})();