<commit_before>/**
 *
 * Copyright 2015, Institute for Systems Biology
 *
 * 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.
 *
 */

require.config({
    baseUrl: STATIC_FILES_URL+'js/',
    paths: {
        jquery: 'libs/jquery-1.11.1.min',
        bootstrap: 'libs/bootstrap.min',
        jqueryui: 'libs/jquery-ui.min',
        session_security: 'session_security',
        underscore: 'libs/underscore-min',
    },
    shim: {
        'bootstrap': ['jquery'],
        'session_security': ['jquery'],
    }
});

require([
    'jquery',
    'jqueryui',
    'bootstrap',
    'session_security',
    'base'
], function($, jqueryui, bootstrap, session_security, base) {

    // Resets forms in modals on cancel. Suppressed warning when leaving page with dirty forms
    $('.modal').on('hide.bs.modal', function() {
        var form = $(this).find('form')[0];
        if(form){
            form.reset();
        }
    });

    $('input[name="select-datasets"]:radio').change(function() {
        if ($('input[name="select-datasets"]:checked').val() === 'yes' || $('input[name="select-datasets"]:checked').val() === 'alter') {
            $('#datasets-select-div').show();
            $('#register-sa input[name="select-datasets"][value="remove"]').remove();
        } else {
            $('input[name="datasets"]').attr('checked',false);
            $('#datasets-select-div').hide();
        }
    });

    $('#verify-sa div input').change(function() {
        $('.register-sa-btn, .retry-btn').attr("disabled","disabled");
    });

    $('#verify-sa').on('submit', function(e) {
        $('#user_sa').length > 0 && $('#user_sa').val($('#user_sa').val().trim());
        $('#js-messages button.close').click();
        e.preventDefault();
        e.stopPropagation();
        var $this = $(this);
        var fields = $this.serialize();
        var user_ver_div = $('.user-verification');
        user_ver_div.hide();
        $('.cannot-register').hide();
        $('.register-sa-div').hide();
        $('.verify-pending').show();

        $this.find('input[type="submit"]').prop('disabled', 'disabled');
        $.ajax({
            url: $this.attr('action'),
            data: fields,
            method: 'POST',
            success: function(data) {
                var tbody = user_ver_div.find('tbody');
                tbody.empty();
                $('.verify-pending').hide();
                var register_form = $('form#register-sa');
                var user_input = register_form.find('input[name="user_sa"]');
                var dataset_input = register_form.find('input[name="datasets"]');
                if (user_input.length === 0) {<commit_msg>--> ticket#2238: bug fix for 'Retry' button - removed disabling feature upon changing datasets after sa verification.<commit_after>/**
 *
 * Copyright 2015, Institute for Systems Biology
 *
 * 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.
 *
 */

require.config({
    baseUrl: STATIC_FILES_URL+'js/',
    paths: {
        jquery: 'libs/jquery-1.11.1.min',
        bootstrap: 'libs/bootstrap.min',
        jqueryui: 'libs/jquery-ui.min',
        session_security: 'session_security',
        underscore: 'libs/underscore-min',
    },
    shim: {
        'bootstrap': ['jquery'],
        'session_security': ['jquery'],
    }
});

require([
    'jquery',
    'jqueryui',
    'bootstrap',
    'session_security',
    'base'
], function($, jqueryui, bootstrap, session_security, base) {

    // Resets forms in modals on cancel. Suppressed warning when leaving page with dirty forms
    $('.modal').on('hide.bs.modal', function() {
        var form = $(this).find('form')[0];
        if(form){
            form.reset();
        }
    });

    $('input[name="select-datasets"]:radio').change(function() {
        if ($('input[name="select-datasets"]:checked').val() === 'yes' || $('input[name="select-datasets"]:checked').val() === 'alter') {
            $('#datasets-select-div').show();
            $('#register-sa input[name="select-datasets"][value="remove"]').remove();
        } else {
            $('input[name="datasets"]').attr('checked',false);
            $('#datasets-select-div').hide();
        }
    });

    $('#verify-sa div input').change(function() {
        $('.register-sa-btn').attr("disabled","disabled");
    });

    $('#verify-sa').on('submit', function(e) {
        $('#user_sa').length > 0 && $('#user_sa').val($('#user_sa').val().trim());
        $('#js-messages button.close').click();
        e.preventDefault();
        e.stopPropagation();
        var $this = $(this);
        var fields = $this.serialize();
        var user_ver_div = $('.user-verification');
        user_ver_div.hide();
        $('.cannot-register').hide();
        $('.register-sa-div').hide();
        $('.verify-pending').show();

        $this.find('input[type="submit"]').prop('disabled', 'disabled');
        $.ajax({
            url: $this.attr('action'),
            data: fields,
            method: 'POST',
            success: function(data) {
                var tbody = user_ver_div.find('tbody');
                tbody.empty();
                $('.verify-pending').hide();
                var register_form = $('form#register-sa');
                var user_input = register_form.find('input[name="user_sa"]');
                var dataset_input = register_form.find('input[name="datasets"]');
                if (user_input.length === 0) {
{'fraction_non_alphanumeric': 0.18136491118728576, 'fraction_numerical': 0.005297600498597694, 'mean_word_length': 2.58203125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1326545', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1807, 'n_words': 420}