<commit_before>/**
 * Copyright (c) 2016 Source Auditor Inc.
 *
 *   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.
 *
 *
/* Functions added by ViSolve
 * 001:  Yes No Images are added based on Radio button checked
 * 
 */

var submitted, resetDialog, selectVersionDialog;

function getQuestionFormHtml(questions) {
	var html = '<div ><table class="questiontable ui-corner-all table table-hover ">\n';
	var inSubQuestions = false;
		for (var i = 0; i < questions.length; i++) {
		var type = questions[i].type;
		var isSubQuestion = (questions[i].hasOwnProperty('subQuestionOfNumber'));
		html += '<tr class="bord_"><td class="answer_cell" style="width:100px;">';
		
		html += '<span> <i class="fa yes_no_img"></i></span></td>';
		if (type == 'SUBQUESTIONS') {
			html += '<td class="answer_cell"></td>';
			html += '<td class="answer_cell"></td>';
			inSubQuestions = true;
		} 
		else if (type=="YES_NO_NA") {
			html += '<td class="answer_cell"><span>';
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_yes"  class="choicena-yes';
			if (isSubQuestion && inSubQuestions) {
				html += ' subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '"  value="yes" />';		
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_no" class="choicena-no';
			if (isSubQuestion && inSubQuestions) {
				html += ' subquestion-of-';
				html += questions[i].subQuestionNumber;
			}
			html += '" value="no" />';
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_na" class="choicena-na';
			if (isSubQuestion && inSubQuestions) {
				html += ' subquestion-of-';
				html += questions[i].subQuestionNumber;
			}
			html += '" value="na" />';
			html += '<span class="yesnona-switch">';
			html += '<label for="answer-' + questions[i].number + '_yes">Yes</label>';		
			html += '<span></span>';
			html += '<label for="answer-' + questions[i].number + '_no">No</label>';
			html += '<label for="answer-' + questions[i].number + '_na">N/A</label>';
			html += '</span></span></td>';
			html += '<td class="answer_cell"></td>';
			if (!isSubQuestion) {
				inSubQuestions = false;
			}
		} else 
			{					
			html += '<td class="answer_cell pad_cell"><div class="form-check custom-checkbox"><label class="form-check-label">';
			html += '<input type="radio" class="form-check-input custom-radiobtn" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_yes"';
			if (isSubQuestion && inSubQuestions) {
				html += ' subquestion-of-';
				html += questions[i].subQuestionNumber;
			}
			html += '"  value="yes" /><span class="translate" data-i18n="Yes">Yes</span>';
			html += '</label></div>';			
			html += '<div class="form-check custom-checkbox"><label class="form-check-label">';		
			html += '<input type="radio" class="form-check-input custom-radiobtn" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_no"';
			if (isSubQuestion && inSubQuestions) {
				html += ' subquestion-of-';
				html += questions[i].subQuestionNumber;
			}
			html += '" value="no" /><span class="translate" data-i18n="No">No</span>';
			html += '</label></div></td>';			
			html += '<td class="answer_cell pad_cell"></td>';
			if (!isSubQuestion) {
				inSubQuestions = false;
			}
		}
		if (isSubQuestion) {
			html += '<td class="tablebullet answer_cell"> <p id="question-pad" class="table-bullet" >';			
		} 
		else {
			html += '<td class="answer_cell pad_cell"><p id="question-pad">';
		}
		html+=questions[i].question +  '</p></td>\n';
		html += '</tr>\n';
	}
	html += '</table>\n</div>';
	return html;
}

function getSurvey() {
	var certForm = $("#CertForm");	
	if (!certForm.length ) {
		return;
	}
	if (certForm.is(':ui-accordion')) {
		certForm.accordion("destroy");
	}
	certForm.html('Loading <img src="resources/loading.gif" alt="Loading" class="loading" id="survey-loading">');
	$.ajax({<commit_msg>Remove extra quote (#124)<commit_after>/**
 * Copyright (c) 2016 Source Auditor Inc.
 *
 *   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.
 *
 *
/* Functions added by ViSolve
 * 001:  Yes No Images are added based on Radio button checked
 * 
 */

var submitted, resetDialog, selectVersionDialog;

function getQuestionFormHtml(questions) {
	var html = '<div ><table class="questiontable ui-corner-all table table-hover ">\n';
	var inSubQuestions = false;
		for (var i = 0; i < questions.length; i++) {
		var type = questions[i].type;
		var isSubQuestion = (questions[i].hasOwnProperty('subQuestionOfNumber'));
		html += '<tr class="bord_"><td class="answer_cell" style="width:100px;">';
		
		html += '<span> <i class="fa yes_no_img"></i></span></td>';
		if (type == 'SUBQUESTIONS') {
			html += '<td class="answer_cell"></td>';
			html += '<td class="answer_cell"></td>';
			inSubQuestions = true;
		} 
		else if (type=="YES_NO_NA") {
			html += '<td class="answer_cell"><span>';
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_yes';
			if (isSubQuestion && inSubQuestions) {
				html += 'subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '"  class="choicena-yes"  value="yes" />';		
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_no';
			if (isSubQuestion && inSubQuestions) {
				html += 'subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '" class="choicena-no" value="no" />';
			html += '<input type="radio" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_na';
			if (isSubQuestion && inSubQuestions) {
				html += 'subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '" class="choicena-na" value="na" />';
			html += '<span class="yesnona-switch">';
			html += '<label for="answer-' + questions[i].number + '_yes">Yes</label>';		
			html += '<span></span>';
			html += '<label for="answer-' + questions[i].number + '_no">No</label>';
			html += '<label for="answer-' + questions[i].number + '_na">N/A</label>';
			html += '</span></span></td>';
			html += '<td class="answer_cell"></td>';
			if (!isSubQuestion) {
				inSubQuestions = false;
			}
		} else 
			{					
			html += '<td class="answer_cell pad_cell"><div class="form-check custom-checkbox"><label class="form-check-label">';
			html += '<input type="radio" class="form-check-input custom-radiobtn" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_yes';
			if (isSubQuestion && inSubQuestions) {
				html += 'subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '"  value="yes" /><span class="translate" data-i18n="Yes">Yes</span>';
			html += '</label></div>';			
			html += '<div class="form-check custom-checkbox"><label class="form-check-label">';		
			html += '<input type="radio" class="form-check-input custom-radiobtn" name="answer-' + questions[i].number + '" id="answer-' + questions[i].number + '_no';
			if (isSubQuestion && inSubQuestions) {
				html += 'subquestion-of-';
				html += questions[i].subQuestionOfNumber;
			}
			html += '" value="no" /><span class="translate" data-i18n="No">No</span>';
			html += '</label></div></td>';			
			html += '<td class="answer_cell pad_cell"></td>';
			if (!isSubQuestion) {
				inSubQuestions = false;
			}
		}
		if (isSubQuestion) {
			html += '<td class="tablebullet answer_cell"> <p id="question-pad" class="table-bullet" >';			
		} 
		else {
			html += '<td class="answer_cell pad_cell"><p id="question-pad">';
		}
		html+=questions[i].question +  '</p></td>\n';
		html += '</tr>\n';
	}
	html += '</table>\n</div>';
	return html;
}

function getSurvey() {
	var certForm = $("#CertForm");	
	if (!certForm.length ) {
		return;
	}
	if (certForm.is(':ui-accordion')) {
		certForm.accordion("destroy");
	}
	certForm.html('Loading <img src="resources/loading.gif" alt="Loading" class="loading" id="survey-loading">');
	$.ajax({
{'fraction_non_alphanumeric': 0.1978130125751777, 'fraction_numerical': 0.00448332422088573, 'mean_word_length': 3.8726691529035695, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 123, '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': '4534042', 'n_tokens_mistral': 3329, 'n_tokens_neox': 2920, 'n_words': 704}