<commit_before>/*jslint browser: true, plusplus: true */
/*global jQuery, Handlebars, top */
(function ($) {
    "use strict";
    $(document).ready(function () {

        var ferpa_base_roles = ['TeacherEnrollment', 'TaEnrollment', 'DesignerEnrollment'];

        // prep for api post/put
        function csrfSafeMethod(method) {
            // these HTTP methods do not require CSRF protection
            return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
        }

        $.ajaxSetup({
            crossDomain: false, // obviates need for sameOrigin test
            beforeSend: function (xhr, settings) {
                if (window.canvas_users.session_id) {
                    xhr.setRequestHeader("X-SessionId", window.canvas_users.session_id);
                }
                if (!csrfSafeMethod(settings.type)) {
                    xhr.setRequestHeader("X-CSRFToken", window.canvas_users.csrftoken);
                }
            }
        });

        function postWindowMessage(subject, message) {
            window.parent.postMessage('{ "subject": "'
                                      + subject
                                      + '", "message": "'
                                      + (message ? message : '')
                                      + '" }',
                                      'https://' + window.canvas_users.canvas_host);
        }

        function randomId(len) {
            var id = [];

            for (var i = 0; i < len; i++) {
                id.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[((Math.random() * 10000) % 36) | 0]);
            }

            return id.join('');
        }

        function setProgress(container, progress) {
            container.find('.progress-bar').css('width', progress + '%')
                .attr('aria-valuenow', progress)
                .html(progress + '%');
        };

        function confirmFERPA(e) {
            var tpl = Handlebars.compile($('#ferpa-tmpl').html()),
                modal_id = randomId(32),
                modal_container,
                error_msg,
                $confirmation,
                e_data = e.data;

            $('body').append(tpl({
                modal_id: modal_id
            }));

            modal_container = $('#' + modal_id);
            modal_container.modal({
                backdrop: 'static',
                show: true
            });

            $confirmation = modal_container.find('button.confirmation');
            $confirmation.on('click', function (e) {
                modal_container.modal('hide');
                e.data = e_data;
                importUsers(e);
            });

            modal_container.find('#confirmed').on('change', function () {
                if ($(this).is(':checked')) {
                    $confirmation.removeProp('disabled');
                } else {
                    $confirmation.prop('disabled', true);
                }
            });

            modal_container.on('hidden.bs.modal', function () {
                modal_container.remove();
            });
        };

        function problemAddingUsers(msg, add_container) {
            var tpl = Handlebars.compile($('#failure-tmpl').html()),
                modal_id = randomId(32),
                modal_container,
                error_msg;

            error_msg = 'PROBLEM PROBLEM';

            $('body').append(tpl({
                modal_id: modal_id,
                error_message: 'THIS IS  PROBLEM'
            }));

            modal_container = $('#' + modal_id);
            modal_container.modal({
                backdrop: 'static',
                show: true
            });

            if (add_container) {
                modal_container.find('button.start-over').on('click', function () {<commit_msg>inserts error message into error dialog<commit_after>/*jslint browser: true, plusplus: true */
/*global jQuery, Handlebars, top */
(function ($) {
    "use strict";
    $(document).ready(function () {

        var ferpa_base_roles = ['TeacherEnrollment', 'TaEnrollment', 'DesignerEnrollment'];

        // prep for api post/put
        function csrfSafeMethod(method) {
            // these HTTP methods do not require CSRF protection
            return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
        }

        $.ajaxSetup({
            crossDomain: false, // obviates need for sameOrigin test
            beforeSend: function (xhr, settings) {
                if (window.canvas_users.session_id) {
                    xhr.setRequestHeader("X-SessionId", window.canvas_users.session_id);
                }
                if (!csrfSafeMethod(settings.type)) {
                    xhr.setRequestHeader("X-CSRFToken", window.canvas_users.csrftoken);
                }
            }
        });

        function postWindowMessage(subject, message) {
            window.parent.postMessage('{ "subject": "'
                                      + subject
                                      + '", "message": "'
                                      + (message ? message : '')
                                      + '" }',
                                      'https://' + window.canvas_users.canvas_host);
        }

        function randomId(len) {
            var id = [];

            for (var i = 0; i < len; i++) {
                id.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[((Math.random() * 10000) % 36) | 0]);
            }

            return id.join('');
        }

        function setProgress(container, progress) {
            container.find('.progress-bar').css('width', progress + '%')
                .attr('aria-valuenow', progress)
                .html(progress + '%');
        };

        function confirmFERPA(e) {
            var tpl = Handlebars.compile($('#ferpa-tmpl').html()),
                modal_id = randomId(32),
                modal_container,
                error_msg,
                $confirmation,
                e_data = e.data;

            $('body').append(tpl({
                modal_id: modal_id
            }));

            modal_container = $('#' + modal_id);
            modal_container.modal({
                backdrop: 'static',
                show: true
            });

            $confirmation = modal_container.find('button.confirmation');
            $confirmation.on('click', function (e) {
                modal_container.modal('hide');
                e.data = e_data;
                importUsers(e);
            });

            modal_container.find('#confirmed').on('change', function () {
                if ($(this).is(':checked')) {
                    $confirmation.removeProp('disabled');
                } else {
                    $confirmation.prop('disabled', true);
                }
            });

            modal_container.on('hidden.bs.modal', function () {
                modal_container.remove();
            });
        };

        function problemAddingUsers(msg, add_container) {
            var tpl = Handlebars.compile($('#failure-tmpl').html()),
                modal_id = randomId(32),
                modal_container,
                error_msg;

            error_msg = 'PROBLEM PROBLEM';

            $('body').append(tpl({
                modal_id: modal_id,
                error_message: 'PROBLEM IS ' + (msg ? msg : 'unspecified')
            }));

            modal_container = $('#' + modal_id);
            modal_container.modal({
                backdrop: 'static',
                show: true
            });

            if (add_container) {
                modal_container.find('button.start-over').on('click', function () {
{'fraction_non_alphanumeric': 0.13059456621603885, 'fraction_numerical': 0.006037537734610842, 'mean_word_length': 1.3686664594342555, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3943351', 'n_tokens_mistral': 2065, 'n_tokens_neox': 1910, 'n_words': 333}