diff --git a/modules/aggregator/dictionaries/dict.php b/modules/aggregator/dictionaries/dict.php new file mode 100644 index 0000000000000000000000000000000000000000..86f74c2db01c774864aadd9ba5e1de05a51cde6d --- /dev/null +++ b/modules/aggregator/dictionaries/dict.php @@ -0,0 +1,20 @@ +<?php + +$lang = array( + 'frontpage_link' => array ( + 'en' => 'Metadata aggregator', + ), + 'aggregator_header' => array ( + 'en' => 'Aggregators', + ), + 'no_aggregators' => array ( + 'en' => 'No aggregators defined in configuration.', + ), + 'text' => array ( + 'en' => 'text', + ), + +); + + +?> \ No newline at end of file diff --git a/modules/aggregator/hooks/hook_frontpage.php b/modules/aggregator/hooks/hook_frontpage.php new file mode 100644 index 0000000000000000000000000000000000000000..d8fa136cb1cf25a01d76c9db3b5e27fa4323e905 --- /dev/null +++ b/modules/aggregator/hooks/hook_frontpage.php @@ -0,0 +1,17 @@ +<?php +/** + * Hook to add the aggregator list to the frontpage. + * + * @param array &$links The links on the frontpage, split into sections. + */ +function aggregator_hook_frontpage(&$links) { + assert('is_array($links)'); + assert('array_key_exists("links", $links)'); + + $links['links'][] = array( + 'href' => SimpleSAML_Module::getModuleURL('aggregator/'), + 'text' => '{aggregator:dict:frontpage_link}', + ); + +} +?> \ No newline at end of file diff --git a/modules/aggregator/templates/default/list.php b/modules/aggregator/templates/default/list.php new file mode 100644 index 0000000000000000000000000000000000000000..5a8f7f318fec15b5a58fbd3a318fdb8d7d600a81 --- /dev/null +++ b/modules/aggregator/templates/default/list.php @@ -0,0 +1,27 @@ +<?php +$this->data['header'] = $this->t('{aggregator:dict:aggregator_header}'); +$this->includeAtTemplateBase('includes/header.php'); + +echo('<div id="content">'); +echo('<h1>'. $this->data['header'] . '</h1>'); + +if (count($this->data['sources']) === 0) { + echo('<p>' . $this->t('{aggregator:dict:no_aggregators}') . '</p>'); +} else { + + echo('<ul>'); + + foreach ($this->data['sources'] as $source) { + $encId = urlencode($source); + $encName = htmlspecialchars($source); + echo('<li>'); + echo('<a href="?id=' . $encId . '">' . $encName . '</a>'); + echo(' <a href="?id=' . $encId . '&mimetype=text/plain">[' . $this->t('{aggregator:dict:text}') . ']</a>'); + echo('</li>'); + } + + echo('</ul>'); +} + +$this->includeAtTemplateBase('includes/footer.php'); +?> \ No newline at end of file diff --git a/modules/aggregator/www/index.php b/modules/aggregator/www/index.php index af4fee7d86e0f83d9e761d4067259564fc99221e..8605b5e6110c68baca84eb4a5ff598dbe5903e54 100644 --- a/modules/aggregator/www/index.php +++ b/modules/aggregator/www/index.php @@ -14,8 +14,9 @@ $aggregatorConfig = $globalConfig->copyFromBase('aggregator', 'aggregator.php'); $aggregators = $aggregatorConfig->getArray('aggragators'); if (!array_key_exists('id', $_GET)) { - /* TODO: Show list. */ - echo('TODO: Show list'); + $t = new SimpleSAML_XHTML_Template($globalConfig, 'aggregator:list.php'); + $t->data['sources'] = array_keys($aggregators); + $t->show(); exit; }