diff --git a/modules/core/templates/show_metadata.tpl.php b/modules/core/templates/show_metadata.tpl.php index 68e836f43158513a5ffc6d8b66b84fb25bd9971b..3996fbd2ed487a1242d8ad868470ec3a3beac8a4 100644 --- a/modules/core/templates/show_metadata.tpl.php +++ b/modules/core/templates/show_metadata.tpl.php @@ -1,14 +1,22 @@ -<?php - -$this->includeAtTemplateBase('includes/header.php'); +<?php +$this->includeAtTemplateBase('includes/header.php'); ?> -<pre class="metadatabox"> +<div class="metadatabox"> + <button data-clipboard-target="#metadata" id="btncp" class="btn topright" style="margin-right: 0.5em;"> + <img src="<?php echo $this->data['baseurlpath'].'/resources/icons/clipboard.svg'; ?>" + alt="Copy to clipboard"> + </button> + <pre id="metadata"> $metadata['<?php echo $this->data['m']['metadata-index']; unset($this->data['m']['metadata-index']) ?>'] => <?php echo htmlspecialchars(var_export($this->data['m'], true)); ?> -</pre> -<p>[ <a href="<?php echo $this->data['backlink']; ?>">back</a> ]</p> + </pre> +</div> +<script type="text/javascript"> + var clipboard = new Clipboard('#btncp'); +</script> +<br/> +<p><a href="<?php echo $this->data['backlink']; ?>"><span class="btn">Back</span></a></p> <?php -$this->includeAtTemplateBase('includes/footer.php'); - +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php index 8c20104c521634c42bff7645bc961805f9befd37..8afa298917f073b975b9d0dd728834a67bc9b3c0 100644 --- a/modules/core/www/show_metadata.php +++ b/modules/core/www/show_metadata.php @@ -1,32 +1,33 @@ <?php - - -/* Load simpleSAMLphp, configuration */ +// load configuration $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); SimpleSAML\Utils\Auth::requireAdmin(); - -if (!array_key_exists('entityid', $_REQUEST)) - throw new Exception('required parameter [entityid] missing'); -if (!array_key_exists('set', $_REQUEST)) - throw new Exception('required parameter [set] missing'); -if (!in_array($_REQUEST['set'], array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote'))) - throw new Exception('Invalid set'); - +if (!array_key_exists('entityid', $_REQUEST)) { + throw new Exception('required parameter [entityid] missing'); +} +if (!array_key_exists('set', $_REQUEST)) { + throw new Exception('required parameter [set] missing'); +} +if (!in_array( + $_REQUEST['set'], + array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote') +)) { + throw new Exception('Invalid set'); +} $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $m = $metadata->getMetadata($_REQUEST['entityid'], $_REQUEST['set']); $t = new SimpleSAML_XHTML_Template($config, 'core:show_metadata.tpl.php'); +$t->data['clipboard.js'] = true; $t->data['pageid'] = 'show_metadata'; $t->data['header'] = 'simpleSAMLphp Show Metadata'; $t->data['backlink'] = SimpleSAML_Module::getModuleURL('core/frontpage_federation.php'); $t->data['m'] = $m; - $t->show(); -