<commit_before>// load the master sakai object to access all Sakai OAE API methods
require(["jquery", 
         "sakai/sakai.api.core", 
         "/devwidgets/lecturelist/javascript/jquery.icalendar.js",
         "/devwidgets/lecturelist/javascript/parseuri.js"], 
        function($, sakai) {
	
    /**
     * @name sakai.WIDGET_ID
     *
     * @class WIDGET_ID
     *
     * @description
     * WIDGET DESCRIPTION
     *
     * @version 0.0.1
     * @param {String} tuid Unique id of the widget
     * @param {Boolean} showSettings Show the settings of the widget or not
     */
	sakai_global.lecturelist = function (tuid, showSettings) {
         
		var ICAL_PROXY_PATH = "/var/proxy/ical.json"
			
		var LECTURE_ENTRY = $("#lecturelist_templates .entry", $rootel);
		var AGENDA_ROW = $("#lecturelist_templates .agenda-row", $rootel);
		/////////////////////////////
        // Configuration variables //
        /////////////////////////////
		
    	// DOM jQuery Objects
        var $rootel = $("#" + tuid);  // unique container for each widget instance
        var $mainContainer = $("#lecturelist_main", $rootel);
        var $settingsContainer = $("#lecturelist_settings", $rootel);
        var settingsForm = $("#lecturelist_settings_form", $rootel);
        var settingsFormTitleField = $("#lecturelist_settings_txtTitle", $rootel);
        var settingsFormUrlField = $("#lecturelist_settings_txtUrl", $rootel);
        
        // Widget state vars
        var _title = null;
        var _feedUrl = null;
        var _groupedDays = null;
        
        DAYS = {"0": "Mon",
        		"1": "Tue",
        		"2": "Wed",
        		"3": "Thu",
        		"4": "Fri",
        		"5": "Sat",
        		"6": "Sun"};

        MONTHS = {"0": "Jan",
        		  "1": "Feb",
        		  "2": "Mar",
        		  "3": "Apr",
        		  "4": "May",
        		  "5": "Jun",
        		  "6": "Jul",
        		  "7": "Aug",
        		  "8": "Sep",
        		  "9": "Oct",
        		  "10": "Nov",
        		  "11": "Dec"};
        
        /**
         * A class to represent events.
         */
    	function Event(vevent) {
    		
    		function paragraphBreak(text) {
    			// Break the text on blank lines
    			return text.split(/^\s*$/m);
    		}
    		
    		this.vevent = vevent;
    		this.date = buildDateString(vevent.DTSTART);
    		this.time = buildTimeString(vevent.DTSTART);
    		this.summary = vevent.SUMMARY || vevent.DESCRIPTION || "";
    		this.description = vevent.DESCRIPTION || vevent.SUMMARY || "";
    		if(this.description == this.summary) {
    			this.description = "";
    		}
    		this.description = paragraphBreak(this.description);
    		
    		// These fields may be undefined
    		this.url = vevent.URL;
    		this.location = vevent.LOCATION;
    		this.contact = vevent.CONTACT;
    	}
        
        ///////////////////////
        // Utility functions //
        ///////////////////////
        
        function onStateAvailable(succeeded, state) {
        	if(!succeeded) {
        		alert("Failed to fetch widget state.");
        		return;
        	}
        	
        	_title = state.title;
        	_feedUrl = state.url;
        	fetchCalendarData();
        }
        
        function fetchCalendarData() {
        	var success = function(data) {
        		if(data.vcalendar && data.vcalendar.vevents) {
        			var events = data.vcalendar.vevents;
        			
        			// Convert event date strings into date objects
        			events = $.map(events, parseEventDates);
        			
        			// Filter the events to just those happening today
        			events = $.grep(events, notBefore(dateToday()));
        			
        			// Group the events into a list of groups, one for each day
        			_groupedDays = groupByDay(events);
        			
        		}
        		updateCalendar();
        	};
        	
        	$.ajax({
        		url: ICAL_PROXY_PATH,
        		data: {fooble: _feedUrl},
        		success: success});
        }
        
        function parseEventDates(event) {
        	event.DTSTART = new Date(event.DTSTART);
        	event.DTEND = new Date(event.DTEND);
        	return event;
        }
        
        function dateToday() {
        	return stripTime(new Date());
        }
        function dateTomorrow() {
        	var today = dateToday();
        	today.setDate(today.getDate() + 1);
        	return today;
        }
        
        function notBefore(date) {
        	return function(event) {<commit_msg>Changed proxy url param to reflect current proxy config.<commit_after>// load the master sakai object to access all Sakai OAE API methods
require(["jquery", 
         "sakai/sakai.api.core", 
         "/devwidgets/lecturelist/javascript/jquery.icalendar.js",
         "/devwidgets/lecturelist/javascript/parseuri.js"], 
        function($, sakai) {
	
    /**
     * @name sakai.WIDGET_ID
     *
     * @class WIDGET_ID
     *
     * @description
     * WIDGET DESCRIPTION
     *
     * @version 0.0.1
     * @param {String} tuid Unique id of the widget
     * @param {Boolean} showSettings Show the settings of the widget or not
     */
	sakai_global.lecturelist = function (tuid, showSettings) {
         
		var ICAL_PROXY_PATH = "/var/proxy/ical.json"
			
		var LECTURE_ENTRY = $("#lecturelist_templates .entry", $rootel);
		var AGENDA_ROW = $("#lecturelist_templates .agenda-row", $rootel);
		/////////////////////////////
        // Configuration variables //
        /////////////////////////////
		
    	// DOM jQuery Objects
        var $rootel = $("#" + tuid);  // unique container for each widget instance
        var $mainContainer = $("#lecturelist_main", $rootel);
        var $settingsContainer = $("#lecturelist_settings", $rootel);
        var settingsForm = $("#lecturelist_settings_form", $rootel);
        var settingsFormTitleField = $("#lecturelist_settings_txtTitle", $rootel);
        var settingsFormUrlField = $("#lecturelist_settings_txtUrl", $rootel);
        
        // Widget state vars
        var _title = null;
        var _feedUrl = null;
        var _groupedDays = null;
        
        DAYS = {"0": "Mon",
        		"1": "Tue",
        		"2": "Wed",
        		"3": "Thu",
        		"4": "Fri",
        		"5": "Sat",
        		"6": "Sun"};

        MONTHS = {"0": "Jan",
        		  "1": "Feb",
        		  "2": "Mar",
        		  "3": "Apr",
        		  "4": "May",
        		  "5": "Jun",
        		  "6": "Jul",
        		  "7": "Aug",
        		  "8": "Sep",
        		  "9": "Oct",
        		  "10": "Nov",
        		  "11": "Dec"};
        
        /**
         * A class to represent events.
         */
    	function Event(vevent) {
    		
    		function paragraphBreak(text) {
    			// Break the text on blank lines
    			return text.split(/^\s*$/m);
    		}
    		
    		this.vevent = vevent;
    		this.date = buildDateString(vevent.DTSTART);
    		this.time = buildTimeString(vevent.DTSTART);
    		this.summary = vevent.SUMMARY || vevent.DESCRIPTION || "";
    		this.description = vevent.DESCRIPTION || vevent.SUMMARY || "";
    		if(this.description == this.summary) {
    			this.description = "";
    		}
    		this.description = paragraphBreak(this.description);
    		
    		// These fields may be undefined
    		this.url = vevent.URL;
    		this.location = vevent.LOCATION;
    		this.contact = vevent.CONTACT;
    	}
        
        ///////////////////////
        // Utility functions //
        ///////////////////////
        
        function onStateAvailable(succeeded, state) {
        	if(!succeeded) {
        		alert("Failed to fetch widget state.");
        		return;
        	}
        	
        	_title = state.title;
        	_feedUrl = state.url;
        	fetchCalendarData();
        }
        
        function fetchCalendarData() {
        	var success = function(data) {
        		if(data.vcalendar && data.vcalendar.vevents) {
        			var events = data.vcalendar.vevents;
        			
        			// Convert event date strings into date objects
        			events = $.map(events, parseEventDates);
        			
        			// Filter the events to just those happening today
        			events = $.grep(events, notBefore(dateToday()));
        			
        			// Group the events into a list of groups, one for each day
        			_groupedDays = groupByDay(events);
        			
        		}
        		updateCalendar();
        	};
        	
        	$.ajax({
        		url: ICAL_PROXY_PATH,
        		data: {feedurl: _feedUrl},
        		success: success});
        }
        
        function parseEventDates(event) {
        	event.DTSTART = new Date(event.DTSTART);
        	event.DTEND = new Date(event.DTEND);
        	return event;
        }
        
        function dateToday() {
        	return stripTime(new Date());
        }
        function dateTomorrow() {
        	var today = dateToday();
        	today.setDate(today.getDate() + 1);
        	return today;
        }
        
        function notBefore(date) {
        	return function(event) {
{'fraction_non_alphanumeric': 0.14442473952560408, 'fraction_numerical': 0.005542008423852805, 'mean_word_length': 1.5560906515580737, 'pattern_counts': {'":': 38, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6855019', 'n_tokens_mistral': 2928, 'n_tokens_neox': 2759, 'n_words': 596}