<commit_before><?php

$subelements = nbt_get_sub_extraction_elements_for_elementid ( $nbtSubExtractionElementID );

$subextractions = nbt_get_sub_extractions ( $nbtSubExtractionElementID, $nbtExtractRefSet, $nbtExtractRefID, $_SESSION[INSTALL_HASH . '_nbt_userid'] );

foreach ( $subextractions as $subextraction ) {

	?><div class="nbtSubExtraction" id="nbtSubExtractionInstance<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>">
		<button style="float: right;" onclick="$(this).fadeOut(0);$('#nbtSubRemoveExtraction<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>').fadeIn();">Delete</button>
		<button class="nbtHidden" id="nbtSubRemoveExtraction<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>" style="float: right;" onclick="nbtDeleteSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>);">For real</button>
		<button style="float: right;" onclick="nbtMoveSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, -1, <?php echo $nbtExtractRefSet; ?>, <?php echo $nbtExtractRefID; ?>, <?php echo $_SESSION[INSTALL_HASH . '_nbt_userid']; ?>);">&#8595;</button>
		<button style="float: right;" onclick="nbtMoveSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, 1, <?php echo $nbtExtractRefSet; ?>, <?php echo $nbtExtractRefID; ?>, <?php echo $_SESSION[INSTALL_HASH . '_nbt_userid']; ?>);">&#8593;</button>
		<?php

		foreach ( $subelements as $subelement ) {

			switch ( $subelement['type'] ) {

				case "open_text":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						nbt_echo_subextraction_text_field ($nbtSubExtractionElementID, $subextraction, $subelement['dbname'], 500, FALSE, $subelement['regex']); // Needs fixin'

					if ( $previous != NULL & $subelement['copypreviousprompt'] == 1 ) {

						?><button style="display: block; margin-top: 4px;" onclick="$('#nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>').val( $('#nbtSub<?php echo $previous['id']; ?>TextField<?php echo $subelement['dbname']; ?>').val() ); nbtSaveSubExtractionTextField(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, '<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>Feedback');">Copy from previous</button><?php

					}

					?></div><?php

				break;

				case "date_selector":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						nbt_echo_sub_date_selector ($nbtSubExtractionElementID, $subextraction, $subelement['dbname']);

					if ( $previous != NULL & subelement['copypreviousprompt'] == 1) {

						?><button style="display: block; margin-top: 4px;" onclick="$('#nbtSub<?php echo $subextraction['id']; ?>DateField<?php echo $subelement['dbname']; ?>').val('<?php echo $previous[$subelement['dbname']]; ?>');nbtSaveSubExtractionDateField(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, '<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>DateField<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>Feedback');">Copy from previous</button><?php

					}

					?></div><?php

				break;

				case "single_select":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						$answers = array ();<commit_msg>Fixed bug with display of "copy from previous"<commit_after><?php

$subelements = nbt_get_sub_extraction_elements_for_elementid ( $nbtSubExtractionElementID );

$subextractions = nbt_get_sub_extractions ( $nbtSubExtractionElementID, $nbtExtractRefSet, $nbtExtractRefID, $_SESSION[INSTALL_HASH . '_nbt_userid'] );

foreach ( $subextractions as $subextraction ) {

	?><div class="nbtSubExtraction" id="nbtSubExtractionInstance<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>">
		<button style="float: right;" onclick="$(this).fadeOut(0);$('#nbtSubRemoveExtraction<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>').fadeIn();">Delete</button>
		<button class="nbtHidden" id="nbtSubRemoveExtraction<?php echo $nbtSubExtractionElementID; ?>-<?php echo $subextraction['id']; ?>" style="float: right;" onclick="nbtDeleteSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>);">For real</button>
		<button style="float: right;" onclick="nbtMoveSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, -1, <?php echo $nbtExtractRefSet; ?>, <?php echo $nbtExtractRefID; ?>, <?php echo $_SESSION[INSTALL_HASH . '_nbt_userid']; ?>);">&#8595;</button>
		<button style="float: right;" onclick="nbtMoveSubExtraction(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, 1, <?php echo $nbtExtractRefSet; ?>, <?php echo $nbtExtractRefID; ?>, <?php echo $_SESSION[INSTALL_HASH . '_nbt_userid']; ?>);">&#8593;</button>
		<?php

		foreach ( $subelements as $subelement ) {

			switch ( $subelement['type'] ) {

				case "open_text":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						nbt_echo_subextraction_text_field ($nbtSubExtractionElementID, $subextraction, $subelement['dbname'], 500, FALSE, $subelement['regex']); // Needs fixin'

					if ( $previous != NULL & $subelement['copypreviousprompt'] == 1 ) {

						?><button style="display: block; margin-top: 4px;" onclick="$('#nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>').val( $('#nbtSub<?php echo $previous['id']; ?>TextField<?php echo $subelement['dbname']; ?>').val() ); nbtSaveSubExtractionTextField(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, '<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>Feedback');">Copy from previous</button><?php

					}

					?></div><?php

				break;

				case "date_selector":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						nbt_echo_sub_date_selector ($nbtSubExtractionElementID, $subextraction, $subelement['dbname']);

					if ( $previous != NULL & $subelement['copypreviousprompt'] == 1) {

						?><button style="display: block; margin-top: 4px;" onclick="$('#nbtSub<?php echo $subextraction['id']; ?>DateField<?php echo $subelement['dbname']; ?>').val('<?php echo $previous[$subelement['dbname']]; ?>');nbtSaveSubExtractionDateField(<?php echo $nbtSubExtractionElementID; ?>, <?php echo $subextraction['id']; ?>, '<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>DateField<?php echo $subelement['dbname']; ?>', 'nbtSub<?php echo $subextraction['id']; ?>TextField<?php echo $subelement['dbname']; ?>Feedback');">Copy from previous</button><?php

					}

					?></div><?php

				break;

				case "single_select":

					?><div<?php

					if ( $subelement['toggle'] != "" ) {

						?> class="nbtHidden <?php echo $subelement['toggle']; ?>_sub<?php echo $subextraction['id']; ?>"<?php

					}

					?>><?php

						nbt_echo_display_name_and_codebook ( $subelement['displayname'], $subelement['codebook'] );

						$answers = array ();
{'fraction_non_alphanumeric': 0.20682080924855492, 'fraction_numerical': 0.004161849710982659, 'mean_word_length': 6.197171381031614, 'pattern_counts': {'":': 6, '<': 159, '<?xml version=': 0, '>': 157, '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': '4593464', 'n_tokens_mistral': 3229, 'n_tokens_neox': 2814, 'n_words': 529}