<commit_before><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/webcgh.tld" prefix="webcgh" %>

<script language="Javascript">

	/**
	 * This function bulk-modifies the values of all
	 * text fields that correspond to output experiment and bioassay
	 * names.
	 * @param augmentation The text augmentation that will be
	 * made to the current value of some source string.
	 * @param location The relative location where the augmentation
	 * will be made in the source string--i.e., prefix or suffix
	 * @param source Indicates the source text field that will
	 * be augmented.  This may be either 'input' or 'output.'
	 * If 'input,' the actual source text will be the names of
	 * input experiment or bioassay names.  If 'output,' the actual
	 * source text will be the names of output experiment or
	 * bioassay names.
	 */
	function augmentNames(augmentation, location, source) {
	
		// Get form input fields
		var inputs = document.forms[0].elements;
		
		// Iterate over input fields
		for (var i = 0; i < inputs.length; i++) {
			var input = inputs[i];
			var name = input.getAttribute("name");
			
			// Input field is experiment or bioassay output name
			if (name.indexOf("eo_") == 0 || name.indexOf("bo_") == 0) {
			
				// Get source text
				var sourceText = null;
				if ("input" == source) {
					expOrBioAssayId = name.substring(3);
					var sourceInputName = null;
					if (name.indexOf("eo_") == 0) {
						sourceInputId = "ei_" + expOrBioAssayId;
					} else if (name.indexOf("bo_") == 0) {
						sourceInputId = "bi_" + expOrBioAssayId;
					}
					var sourceElmt = document.getElementById(sourceInputId);
					sourceText = sourceElmt.value;
				} else if ("output" == source) {
					sourceText = input.value;
				}
				
				// Create augmented text and set input value
				var augmentedText = null;
				if ("prefix" == location) {
					augmentedText = augmentation + sourceText;
				} else if ("suffix" == location) {
					augmentedText = sourceText + augmentation;	
				}
				input.value = augmentedText;
			}
		}
	}
	
	/**
	 * This function bulk-modifies the values of all
	 * text fields that correspond to output experiment and bioassay
	 * names.  It obtains parameters for making these bulk
	 * modifications from the form.
	 */
	function augmentOutputNames() {
	
		// Get augmentation text value from form
		var augmentation = document.forms[0].augmentation.value;
		
		// Get relative location of augmentation--i.e., prefix or suffix
		var p = document.forms[0].location.selectedIndex;
		var location = document.forms[0].location.options[p].value;
		
		// Get source of base of augmented name.  This may be
		// either the name of the input experiment or bioassay,
		// or the current name of the output experiment or bioassay--
		// i.e., the value of a text field.
		p = document.forms[0].source.selectedIndex;
		var source = document.forms[0].source.options[p].value;
		
		// Augment names
		augmentNames(augmentation, location, source);
	}
	
	/** Illegal characters in form input. */
	var illegalChars = ['&', '#', '\"', '\''];
	
	/**
	 * Does given string contains illegal characters?
	 * @param s A string
	 * @return A boolean value
	 */
	function containsIllegalChars(s) {
		var illegal = false;
		for (var i = 0; i < s.length && !illegal; i++) {
			var c = s.charAt(i);
			for (var j = 0; j < illegalChars.length && !illegal; j++) {
				var d = illegalChars[j];
				if (c == d) {
					illegal = true;
				}
			}
		}
		return illegal;
	}
	
	/**
	 * Validates some input fields.  Validation of the remaining fields
	 * takes place server side.
	 */
	function validate() {
		var valid = true;
	
	 	// Get form input fields
		var inputs = document.forms[0].elements;
		
		// Make sure all output experiment and bioassay text boxes
		// are not empty and do not contain illegal characters.
		for (var i = 0; i < inputs.length && valid; i++) {
			var input = inputs[i];
			var name = input.getAttribute("name");
			
			// Input field is experiment or bioassay output name
			if (name.indexOf("eo_") == 0 || name.indexOf("bo_") == 0) {
				var text = input.value;
				if (text.length < 1 || containsIllegalChars(text)) {
					valid = false;
				}
			}
		}
		
		// Show alert box if not valid
		if (!valid) {
			var msg = "Output names cannot be empty or contain the following characters: ";
			for (var i = 0; i < illegalChars.length; i++) {
				if (i > 0) {
					msg += ", "
				}
				msg += "'" + illegalChars[i] + "'";
			}
			alert(msg);
		}
		
		return valid;
	}
</script>

<html:form action="/cart/analysis" onsubmit="return validate()">
<h1 align="center"><bean:write name="op" property="name"/> parameters</h1>
<commit_msg>Fixed compatibility issues with Mozilla based browsers<commit_after><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/webcgh.tld" prefix="webcgh" %>

<script language="Javascript">

	/**
	 * This function bulk-modifies the values of all
	 * text fields that correspond to output experiment and bioassay
	 * names.
	 * @param augmentation The text augmentation that will be
	 * made to the current value of some source string.
	 * @param location The relative location where the augmentation
	 * will be made in the source string--i.e., prefix or suffix
	 * @param source Indicates the source text field that will
	 * be augmented.  This may be either 'input' or 'output.'
	 * If 'input,' the actual source text will be the names of
	 * input experiment or bioassay names.  If 'output,' the actual
	 * source text will be the names of output experiment or
	 * bioassay names.
	 */
	function augmentNames(augmentation, location, source) {
	
		// Get form input fields
		var inputs = document.forms[0].elements;
		
		// Iterate over input fields
		for (var i = 0; i < inputs.length; i++) {
			var input = inputs[i];
			var name = input.name;
			
			// Input field is experiment or bioassay output name
			if (name.indexOf("eo_") == 0 || name.indexOf("bo_") == 0) {
			
				// Get source text
				var sourceText = null;
				if ("input" == source) {
					expOrBioAssayId = name.substring(3);
					var sourceInputName = null;
					if (name.indexOf("eo_") == 0) {
						sourceInputId = "ei_" + expOrBioAssayId;
					} else if (name.indexOf("bo_") == 0) {
						sourceInputId = "bi_" + expOrBioAssayId;
					}
					var sourceElmt = document.getElementById(sourceInputId);
					sourceText = sourceElmt.value;
				} else if ("output" == source) {
					sourceText = input.value;
				}
				
				// Create augmented text and set input value
				var augmentedText = null;
				if ("prefix" == location) {
					augmentedText = augmentation + sourceText;
				} else if ("suffix" == location) {
					augmentedText = sourceText + augmentation;	
				}
				input.value = augmentedText;
			}
		}
	}
	
	/**
	 * This function bulk-modifies the values of all
	 * text fields that correspond to output experiment and bioassay
	 * names.  It obtains parameters for making these bulk
	 * modifications from the form.
	 */
	function augmentOutputNames() {
	
		// Get augmentation text value from form
		var augmentation = document.forms[0].augmentation.value;
		
		// Get relative location of augmentation--i.e., prefix or suffix
		var p = document.forms[0].location.selectedIndex;
		var location = document.forms[0].location.options[p].value;
		
		// Get source of base of augmented name.  This may be
		// either the name of the input experiment or bioassay,
		// or the current name of the output experiment or bioassay--
		// i.e., the value of a text field.
		p = document.forms[0].source.selectedIndex;
		var source = document.forms[0].source.options[p].value;
		
		// Augment names
		augmentNames(augmentation, location, source);
	}
	
	/** Illegal characters in form input. */
	var illegalChars = ['&', '#', '\"', '\''];
	
	/**
	 * Does given string contains illegal characters?
	 * @param s A string
	 * @return A boolean value
	 */
	function containsIllegalChars(s) {
		var illegal = false;
		for (var i = 0; i < s.length && !illegal; i++) {
			var c = s.charAt(i);
			for (var j = 0; j < illegalChars.length && !illegal; j++) {
				var d = illegalChars[j];
				if (c == d) {
					illegal = true;
				}
			}
		}
		return illegal;
	}
	
	/**
	 * Validates some input fields.  Validation of the remaining fields
	 * takes place server side.
	 */
	function validate() {
		var valid = true;
	
	 	// Get form input fields
		var inputs = document.forms[0].elements;
		
		// Make sure all output experiment and bioassay text boxes
		// are not empty and do not contain illegal characters.
		for (var i = 0; i < inputs.length && valid; i++) {
			var input = inputs[i];
			var name = input.name;
			
			// Input field is experiment or bioassay output name
			if (name.indexOf("eo_") == 0 || name.indexOf("bo_") == 0) {
				var text = input.value;
				if (text.length < 1 || containsIllegalChars(text)) {
					valid = false;
				}
			}
		}
		
		// Show alert box if not valid
		if (!valid) {
			var msg = "Output names cannot be empty or contain the following characters: ";
			for (var i = 0; i < illegalChars.length; i++) {
				if (i > 0) {
					msg += ", "
				}
				msg += "'" + illegalChars[i] + "'";
			}
			alert(msg);
		}
		
		return valid;
	}
</script>

<html:form action="/cart/analysis" onsubmit="return validate()">
<h1 align="center"><bean:write name="op" property="name"/> parameters</h1>

{'fraction_non_alphanumeric': 0.12879809188012029, 'fraction_numerical': 0.004770299699263714, 'mean_word_length': 2.947605403192796, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 25, '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': '1777679', 'n_tokens_mistral': 3537, 'n_tokens_neox': 2872, 'n_words': 1008}