diff --git a/modules/modinfo/default-enable b/modules/modinfo/default-enable new file mode 100644 index 0000000000000000000000000000000000000000..25615cb47c350d23033eb9801627ed8330bcc3e9 --- /dev/null +++ b/modules/modinfo/default-enable @@ -0,0 +1,3 @@ +This file indicates that the default state of this module +is enabled. To disable, create a file named disable in the +same directory as this file. diff --git a/modules/modinfo/dictionaries/dict.php b/modules/modinfo/dictionaries/dict.php new file mode 100644 index 0000000000000000000000000000000000000000..afa0006e53a38dd8c5891dfdfd800ca443ebd34b --- /dev/null +++ b/modules/modinfo/dictionaries/dict.php @@ -0,0 +1,23 @@ +<?php + +$lang = array( + 'modlist_header' => array ( + 'en' => 'Available modules', + ), + 'modlist_name' => array ( + 'en' => 'Name', + ), + 'modlist_status' => array ( + 'en' => 'Status', + ), + 'modlist_enabled' => array ( + 'en' => 'Enabled', + ), + 'modlist_disabled' => array ( + 'en' => 'Disabled', + ), + +); + + +?> \ No newline at end of file diff --git a/modules/modinfo/hooks/hook_frontpage.php b/modules/modinfo/hooks/hook_frontpage.php new file mode 100644 index 0000000000000000000000000000000000000000..2f8b5ccb25c54ae209de1e0527624ce893145e60 --- /dev/null +++ b/modules/modinfo/hooks/hook_frontpage.php @@ -0,0 +1,17 @@ +<?php +/** + * Hook to add the modinfo module to the frontpage. + * + * @param array &$links The links on the frontpage, split into sections. + */ +function modinfo_hook_frontpage(&$links) { + assert('is_array($links)'); + assert('array_key_exists("links", $links)'); + + $links['links'][] = array( + 'href' => SimpleSAML_Module::getModuleURL('modinfo/'), + 'text' => '{modinfo:dict:modlist_header}', + ); + +} +?> \ No newline at end of file diff --git a/modules/modinfo/templates/default/modlist.php b/modules/modinfo/templates/default/modlist.php new file mode 100644 index 0000000000000000000000000000000000000000..09a4717947cd1d61a876a4301ae7abb9fdcee36f --- /dev/null +++ b/modules/modinfo/templates/default/modlist.php @@ -0,0 +1,34 @@ +<?php +$this->data['header'] = $this->t('{modinfo:dict:modlist_header}'); +$this->includeAtTemplateBase('includes/header.php'); + +#$icon_enabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="' . +#htmlspecialchars($this->t(...)" />'; +#$icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="disabled" />'; + +?> +<div id="content"> + +<h2><?php echo($this->data['header']); ?></h2> + +<table> +<tr> +<th><?php echo($this->t('{modinfo:dict:modlist_name}')); ?></th> +<th><?php echo($this->t('{modinfo:dict:modlist_status}')); ?></th> +</tr> +<?php +foreach($this->data['modules'] as $id => $info) { + echo('<tr>'); + echo('<td>' . htmlspecialchars($id) . '</td>'); + if($info['enabled']) { + echo('<td><img src="/' . $this->data['baseurlpath'] . 'resources/icons/accept.png" alt="' . + htmlspecialchars($this->t('{modinfo:dict:modlist_enabled}')) . '" /></td>'); + } else { + echo('<td><img src="/' . $this->data['baseurlpath'] . 'resources/icons/delete.png" alt="' . + htmlspecialchars($this->t('{modinfo:dict:modlist_disabled}')) . '" /></td>'); + } + echo('</tr>'); +} +?> +</table> +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file diff --git a/modules/modinfo/www/index.php b/modules/modinfo/www/index.php new file mode 100644 index 0000000000000000000000000000000000000000..1de275fd76efa1df971edd529be604e588d1e0c9 --- /dev/null +++ b/modules/modinfo/www/index.php @@ -0,0 +1,19 @@ +<?php + +$modules = SimpleSAML_Module::getModules(); +sort($modules); + +$modinfo = array(); + +foreach($modules as $m) { + $modinfo[$m] = array( + 'enabled' => SimpleSAML_Module::isModuleEnabled($m), + ); +} + +$config = SimpleSAML_Configuration::getInstance(); +$t = new SimpleSAML_XHTML_Template($config, 'modinfo:modlist.php'); +$t->data['modules'] = $modinfo; +$t->show(); + +?> \ No newline at end of file