<commit_before><?php $this->includeAtTemplateBase('includes/header.php'); ?>

	
	<div id="content">


		<?php
		
		
		function showEntry($header, $list) {
		
			echo '<h3>' . $header . '</h3>';
		
			foreach ($list AS $entityid => $entity) {
				$name = $entityid;
				if (isset($entity['optional.found']['name'])) $name = $entity['optional.found']['name'];

				//print_r($entity);

				echo '<h4>' . htmlspecialchars($name) . '</h4>';
				if (isset($entity['optional.found']['description'])) {
					echo '<p>' . htmlspecialchars($entity['optional.found']['description']) . '</p>';
				}
				
				echo '<div style="margin-left: 1em">';
				echo '<div class="efieldlist"><h5>Required fields<h5>';
				echo '<dl>';
				foreach ($entity['required.found'] AS $key => $value) {
					echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars($value) . '</dd>';
				}
				echo '</dl>';


	
				if (count($entity['required.notfound']) > 0) {
					echo '</div><div class="efieldlist warning">';
					echo '<h5>The following required fields was not found</h5><ul>';
					foreach ($entity['required.notfound'] AS $key) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
			
				
				if (count($entity['optional.found']) > 0) {
					echo '</div><div class="efieldlist">';
					echo '<h5>Optional fields</h5>';
					echo '<dl>';
					foreach ($entity['optional.found'] AS $key => $value) {
						echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars($value) . '</dd>';
					}
					echo '</dl>';
				}
				
				
	
				if (count($entity['optional.notfound']) > 0) {
					echo '</div><div class="efieldlist info">';				
					echo '<h5>The following optional fields was not found:</h5><ul>';
					foreach ($entity['optional.notfound'] AS $key) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
				
				if (count($entity['leftovers']) > 0) {
					echo '</div><div class="efieldlist warning">';
					echo '<h5>The following fields was not reckognized</h5><ul>';
					foreach ($entity['leftovers'] AS $key => $value) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
				echo '</div></div>';
			}
		}
		
		
		if (array_key_exists('metadata.saml20-sp-hosted', $data)) 
			showEntry('SAML 2.0 Service Provider (Hosted)', $data['metadata.saml20-sp-hosted']);
		if (array_key_exists('metadata.saml20-sp-remote', $data)) 
			showEntry('SAML 2.0 Service Provider (Remote)', $data['metadata.saml20-sp-remote']);
		if (array_key_exists('metadata.saml20-idp-hosted', $data)) 
			showEntry('SAML 2.0 Identity Provider (Hosted)', $data['metadata.saml20-idp-hosted']);
		if (array_key_exists('metadata.saml20-idp-remote', $data)) 
			showEntry('SAML 2.0 Identity Provider (Remote)', $data['metadata.saml20-idp-remote']);

		if (array_key_exists('metadata.shib13-sp-hosted', $data)) 
			showEntry('Shib 1.3 Service Provider (Hosted)', $data['metadata.shib13-sp-hosted']);
		if (array_key_exists('metadata.shib13-sp-remote', $data)) 
			showEntry('Shib 1.3 Service Provider (Remote)', $data['metadata.shib13-sp-remote']);
		if (array_key_exists('metadata.shib13-idp-hosted', $data)) 
			showEntry('Shib 1.3 Identity Provider (Hosted)', $data['metadata.shib13-idp-hosted']);
		if (array_key_exists('metadata.shib13-idp-remote', $data)) 
			showEntry('Shib 1.3 Identity Provider (Remote)', $data['metadata.shib13-idp-remote']);

		
		?><commit_msg>Improved metadata overview page. Now you must click on an entity to show details. There is also an error icon, if something is wrong with an entity<commit_after><?php $this->includeAtTemplateBase('includes/header.php'); ?>

	
	<div id="content">

		<p>To look at the details for an SAML entity, click on the SAML entity header.</p>

		<?php
		
		
		function showEntry($header, $list, $baseurl) {
		
			echo '<h3>' . $header . '</h3>';
			
			foreach ($list AS $entityid => $entity) {
				$name = $entityid;
				if (isset($entity['optional.found']['name'])) $name = $entity['optional.found']['name'];

				//print_r($entity);
				
				$warning = false;
				if (count($entity['leftovers']) > 0) $warning = TRUE;
				if (count($entity['required.notfound']) > 0) $warning = TRUE;



				echo '<h4 style="padding-left: 2em; clear: both;" onclick="document.getElementById(\'metadatasection-' . $entityid . '\').style.display=\'block\';">' . htmlspecialchars($name) . '</h4>';
				
				if ($warning) {
					echo '<div><img src="/' . $baseurl . 'resources/icons/caution.png" style="float: left; margin-right: 1em" />';
					echo 'Error in this metadata entry.</div>';
				}
				
				echo '<div id="metadatasection-' . $entityid . '" style="display: none">';
				
				if (isset($entity['optional.found']['description'])) {
					echo '<p>' . htmlspecialchars($entity['optional.found']['description']) . '</p>';
				}
				
				echo '<div style="margin-left: 1em">';
				echo '<div class="efieldlist"><h5>Required fields<h5>';
				echo '<dl>';
				foreach ($entity['required.found'] AS $key => $value) {
					echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars(var_export($value, TRUE)) . '</dd>';
				}
				echo '</dl>';


	
				if (count($entity['required.notfound']) > 0) {
					echo '</div><div class="efieldlist warning">';
					echo '<h5>The following required fields was not found</h5><ul>';
					foreach ($entity['required.notfound'] AS $key) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
			
				
				if (count($entity['optional.found']) > 0) {
					echo '</div><div class="efieldlist">';
					echo '<h5>Optional fields</h5>';
					echo '<dl>';
					foreach ($entity['optional.found'] AS $key => $value) {
						echo '<dt>' . htmlspecialchars($key) . '</dt><dd>' . htmlspecialchars(var_export($value, TRUE)) . '</dd>';
					}
					echo '</dl>';
				}
				
				
	
				if (count($entity['optional.notfound']) > 0) {
					echo '</div><div class="efieldlist info">';				
					echo '<h5>The following optional fields was not found:</h5><ul>';
					foreach ($entity['optional.notfound'] AS $key) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
				
				if (count($entity['leftovers']) > 0) {
					echo '</div><div class="efieldlist warning">';
					echo '<h5>The following fields was not reckognized</h5><ul>';
					foreach ($entity['leftovers'] AS $key => $value) {
						echo '<li>' . htmlspecialchars($key) . '</li>';
					}
					echo '</ul>';				
				}
				echo '</div></div>';
				echo '</div>';
			}
		}
		
		
		if (array_key_exists('metadata.saml20-sp-hosted', $data)) 
			showEntry('SAML 2.0 Service Provider (Hosted)', $data['metadata.saml20-sp-hosted'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.saml20-sp-remote', $data)) 
			showEntry('SAML 2.0 Service Provider (Remote)', $data['metadata.saml20-sp-remote'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.saml20-idp-hosted', $data)) 
			showEntry('SAML 2.0 Identity Provider (Hosted)', $data['metadata.saml20-idp-hosted'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.saml20-idp-remote', $data)) 
			showEntry('SAML 2.0 Identity Provider (Remote)', $data['metadata.saml20-idp-remote'], $this->data['baseurlpath']);

		if (array_key_exists('metadata.shib13-sp-hosted', $data)) 
			showEntry('Shib 1.3 Service Provider (Hosted)', $data['metadata.shib13-sp-hosted'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.shib13-sp-remote', $data)) 
			showEntry('Shib 1.3 Service Provider (Remote)', $data['metadata.shib13-sp-remote'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.shib13-idp-hosted', $data)) 
			showEntry('Shib 1.3 Identity Provider (Hosted)', $data['metadata.shib13-idp-hosted'], $this->data['baseurlpath']);
		if (array_key_exists('metadata.shib13-idp-remote', $data)) 
			showEntry('Shib 1.3 Identity Provider (Remote)', $data['metadata.shib13-idp-remote'], $this->data['baseurlpath']);

		
		?>
{'fraction_non_alphanumeric': 0.20987654320987653, 'fraction_numerical': 0.017209128320239433, 'mean_word_length': 3.559408754974417, 'pattern_counts': {'":': 0, '<': 120, '<?xml version=': 0, '>': 148, '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': '7239102', 'n_tokens_mistral': 3327, 'n_tokens_neox': 2635, 'n_words': 556}