Skip to content
Snippets Groups Projects
Commit c665515b authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Reformat and enhance the federation tab page.

parent 55a1030c
No related branches found
No related tags found
No related merge requests found
...@@ -3,164 +3,137 @@ ...@@ -3,164 +3,137 @@
$this->data['header'] = $this->t('{core:frontpage:page_title}'); $this->data['header'] = $this->t('{core:frontpage:page_title}');
$this->includeAtTemplateBase('includes/header.php'); $this->includeAtTemplateBase('includes/header.php');
?>
<!--
<div id="tabdiv">
<ul>
<li><a href="#welcome"><?php echo $this->t('{core:frontpage:welcome}'); ?></a></li>
<li><a href="#configuration"><?php echo $this->t('{core:frontpage:configuration}'); ?></a></li>
<li><a href="#metadata"><?php echo $this->t('{core:frontpage:metadata}'); ?></a></li>
</ul> -->
<?php
if ($this->data['isadmin']) { if ($this->data['isadmin']) {
echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; echo '<p class="float-r youareadmin">'.$this->t('{core:frontpage:loggedin_as_admin}').'</p>';
} else { } else {
echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; echo '<p class="float-r youareadmin"><a href="'.$this->data['loginurl'].'">'.
$this->t('{core:frontpage:login_as_admin}').'</a></p>';
} }
?>
function mtype($set)
<?php {
switch ($set) {
case 'saml20-sp-remote':
function mtype($set) { return '{admin:metadata_saml20-sp}';
switch($set) { case 'saml20-sp-hosted':
case 'saml20-sp-remote': return '{admin:metadata_saml20-sp}'; return '{admin:metadata_saml20-sp}';
case 'saml20-sp-hosted': return '{admin:metadata_saml20-sp}'; case 'saml20-idp-remote':
case 'saml20-idp-remote': return '{admin:metadata_saml20-idp}'; return '{admin:metadata_saml20-idp}';
case 'saml20-idp-hosted': return '{admin:metadata_saml20-idp}'; case 'saml20-idp-hosted':
case 'shib13-sp-remote': return '{admin:metadata_shib13-sp}'; return '{admin:metadata_saml20-idp}';
case 'shib13-sp-hosted': return '{admin:metadata_shib13-sp}'; case 'shib13-sp-remote':
case 'shib13-idp-remote': return '{admin:metadata_shib13-idp}'; return '{admin:metadata_shib13-sp}';
case 'shib13-idp-hosted': return '{admin:metadata_shib13-idp}'; case 'shib13-sp-hosted':
case 'adfs-sp-remote'; return '{admin:metadata_adfs-sp}'; return '{admin:metadata_shib13-sp}';
case 'adfs-sp-hosted'; return '{admin:metadata_adfs-sp}'; case 'shib13-idp-remote':
case 'adfs-idp-remote'; return '{admin:metadata_adfs-idp}'; return '{admin:metadata_shib13-idp}';
case 'adfs-idp-hosted'; return '{admin:metadata_adfs-idp}'; case 'shib13-idp-hosted':
} return '{admin:metadata_shib13-idp}';
case 'adfs-sp-remote':
return '{admin:metadata_adfs-sp}';
case 'adfs-sp-hosted':
return '{admin:metadata_adfs-sp}';
case 'adfs-idp-remote':
return '{admin:metadata_adfs-idp}';
case 'adfs-idp-hosted':
return '{admin:metadata_adfs-idp}';
}
} }
$now = time(); $now = time();
echo '<dl>'; echo '<dl>';
if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaentries']['hosted']) > 0) if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaentries']['hosted']) > 0) {
foreach ($this->data['metaentries']['hosted'] AS $hm) { foreach ($this->data['metaentries']['hosted'] as $hm) {
echo '<dt>' . $this->t(mtype($hm['metadata-set'])) . '</dt>'; echo '<dt>'.$this->t(mtype($hm['metadata-set'])).'</dt>';
echo '<dd>'; echo '<dd>';
echo '<p>Entity ID: ' . $hm['entityid']; echo '<p>Entity ID: '.$hm['entityid'];
if (isset($hm['deprecated']) && $hm['deprecated']) if (isset($hm['deprecated']) && $hm['deprecated']) {
echo '<br /><b>Deprecated</b>'; echo '<br /><b>Deprecated</b>';
if ($hm['entityid'] !== $hm['metadata-index']) }
echo '<br />Index: ' . $hm['metadata-index']; if ($hm['entityid'] !== $hm['metadata-index']) {
if (!empty($hm['name'])) echo '<br />Index: '.$hm['metadata-index'];
echo '<br /><strong>' . $this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($hm['name'], 'en')) . '</strong>'; }
if (!empty($hm['descr'])) if (!empty($hm['name'])) {
echo '<br /><strong>' . $this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($hm['descr'], 'en')) . '</strong>'; echo '<br /><strong>'.$this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($hm['name'], 'en')).
'</strong>';
echo '<br />[ <a href="' . $hm['metadata-url'] . '">' . $this->t('{core:frontpage:show_metadata}') . '</a> ]'; }
if (!empty($hm['descr'])) {
echo '</p></dd>'; echo '<br /><strong>'.$this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($hm['descr'], 'en')).
'</strong>';
}
echo '<br />[ <a href="'.$hm['metadata-url'].'">'.$this->t('{core:frontpage:show_metadata}').'</a> ]';
echo '</p></dd>';
}
} }
echo '</dl>'; echo '</dl>';
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) {
foreach($this->data['metaentries']['remote'] AS $setkey => $set) { foreach ($this->data['metaentries']['remote'] as $setkey => $set) {
echo '<fieldset class="fancyfieldset"><legend>' . $this->t(mtype($setkey)) . ' (Trusted)</legend>'; echo '<fieldset class="fancyfieldset"><legend>'.$this->t(mtype($setkey)).' (Trusted)</legend>';
echo '<ul>'; echo '<ul>';
foreach($set AS $entry) { foreach ($set as $entry) {
echo '<li>'; echo '<li>';
echo ('<a href="' . echo('<a href="'.
htmlspecialchars(SimpleSAML_Module::getModuleURL('core/show_metadata.php', array('entityid' => $entry['entityid'], 'set' => $setkey ))) . htmlspecialchars(
'">'); SimpleSAML_Module::getModuleURL(
if (!empty($entry['name'])) { 'core/show_metadata.php',
echo htmlspecialchars($this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($entry['name'], 'en'))); array('entityid' => $entry['entityid'], 'set' => $setkey)
} elseif (!empty($entry['OrganizationDisplayName'])) { )
echo htmlspecialchars($this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($entry['OrganizationDisplayName'], 'en'))); ).'">');
} else { if (!empty($entry['name'])) {
echo htmlspecialchars($entry['entityid']); echo htmlspecialchars($this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($entry['name'], 'en')));
} } elseif (!empty($entry['OrganizationDisplayName'])) {
echo '</a>'; echo htmlspecialchars(
if (array_key_exists('expire', $entry)) { $this->getTranslation(SimpleSAML\Utils\Arrays::arrayize($entry['OrganizationDisplayName'], 'en'))
if ($entry['expire'] < $now) { );
echo('<span style="color: #500; font-weight: bold"> (expired ' . number_format(($now - $entry['expire'])/3600, 1) . ' hours ago)</span>'); } else {
} else { echo htmlspecialchars($entry['entityid']);
echo(' (expires in ' . number_format(($entry['expire'] - $now)/3600, 1) . ' hours)'); }
} echo '</a>';
} if (array_key_exists('expire', $entry)) {
echo '</li>'; if ($entry['expire'] < $now) {
} echo '<span style="color: #500; font-weight: bold"> (expired '.
echo '</ul>'; number_format(($now - $entry['expire']) / 3600, 1).' hours ago)</span>';
echo '</fieldset>'; } else {
echo ' (expires in '.number_format(($entry['expire'] - $now) / 3600, 1).' hours)';
}
}
echo '</li>';
}
echo '</ul>';
echo '</fieldset>';
}
} }
?> ?>
<h2><?php echo $this->t('{core:frontpage:tools}'); ?></h2>
<ul><?php
foreach ($this->data['links_federation'] as $link) {
echo '<li><a href="'.htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a></li>';
}
<h2><?php echo $this->t('{core:frontpage:tools}'); ?></h2>
<ul>
<?php
foreach ($this->data['links_federation'] AS $link) {
echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>';
}
?> ?>
</ul> </ul>
<?php <?php
if ($this->data['isadmin']) { ?>
if ($this->data['isadmin']) { <fieldset class="fancyfieldset">
<legend>Lookup metadata</legend>
<form action="<?php echo SimpleSAML_Module::getModuleURL('core/show_metadata.php'); ?>" method="get">
<p style="margin: 1em 2em ">Look up metadata for entity:
<select name="set"><?php
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) {
foreach ($this->data['metaentries']['remote'] as $setkey => $set) {
echo '<option value="'.htmlspecialchars($setkey).'">'.$this->t(mtype($setkey)).'</option>';
}
}
?> ?>
</select>
<fieldset class="fancyfieldset"><legend>Lookup metadata</legend> <input type="text" name="entityid" />
<form action="<?php echo SimpleSAML_Module::getModuleURL('core/show_metadata.php'); ?>" method="get" > <button class="btn" type="submit">Lookup </button>
<p style="margin: 1em 2em ">Look up metadata for entity: </p>
<select name="set"> </form>
</fieldset>
<?php
if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) {
foreach($this->data['metaentries']['remote'] AS $setkey => $set) {
echo '<option value="' . htmlspecialchars($setkey) . '">' . $this->t(mtype($setkey)) . '</option>';
}
}
?>
</select>
<input type="text" name="entityid">
<input type="submit" value="Lookup">
</p>
</form>
</fieldset>
<?php <?php
}
} $this->includeAtTemplateBase('includes/footer.php');
?>
<?php $this->includeAtTemplateBase('includes/footer.php');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment