diff --git a/modules/portal/config-templates/module_portal.php b/modules/portal/config-templates/module_portal.php new file mode 100644 index 0000000000000000000000000000000000000000..ebcba744fe4bfaef0de50d69f9a2d05c9f511b3f --- /dev/null +++ b/modules/portal/config-templates/module_portal.php @@ -0,0 +1,16 @@ +<?php +/* + * Configuration for the module portal. + * + * $Id: $ + */ + +$config = array ( + + 'pagesets' => array( + array('santitycheck', 'statistics'), + ), + +); + +?> diff --git a/modules/portal/default-disable b/modules/portal/default-disable new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php new file mode 100644 index 0000000000000000000000000000000000000000..5072744966d388d26efec46084b5be36eeb57f23 --- /dev/null +++ b/modules/portal/hooks/hook_htmlinject.php @@ -0,0 +1,41 @@ +<?php + +/** + * Hook to inject HTML content into all pages... + * + * @param array &$hookinfo hookinfo + */ +function portal_hook_htmlinject(&$hookinfo) { + assert('is_array($hookinfo)'); + assert('array_key_exists("pre", $hookinfo)'); + assert('array_key_exists("post", $hookinfo)'); + assert('array_key_exists("page", $hookinfo)'); + + $links = array('links' => array()); + SimpleSAML_Module::callHooks('frontpage', $links); + +# echo('<pre>'); print_r($links); exit; + + $portalConfig = SimpleSAML_Configuration::getConfig('module_portal.php'); + + + + $portal = new sspmod_portal_Portal($links['links'], $portalConfig->getValue('pagesets') ); + + if (!$portal->isPortalized($hookinfo['page'])) return; + + #print_r($portal->getMenu($hookinfo['page'])); exit; + + // Include jquery UI CSS files in header. + $hookinfo['jquery']['css'] = 1; + + // Header + $hookinfo['pre'][0] = ' +<div id="portalmenu"> + <ul class="ui-tabs-nav">' . $portal->getMenu($hookinfo['page']) . '</ul> +<div id="portalcontent" class="ui-tabs-panel" style="display: block;">'; + + // Footer + $hookinfo['post'][0] = '</div></div>'; + +} diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php new file mode 100644 index 0000000000000000000000000000000000000000..9b3dfcf41e50dc976f22f2975e8aaa1080395f0e --- /dev/null +++ b/modules/portal/lib/Portal.php @@ -0,0 +1,67 @@ +<?php + +class sspmod_portal_Portal { + + private $pages; + private $config; + + function __construct($pages, $config = NULL) { + $this->pages = $pages; + $this->config = $config; + } + + function getTabset($thispage) { + if (!isset($this->config)) return NULL; + foreach($this->config AS $set) { + if (in_array($thispage, $set)) { + return $set; + } + } + return NULL; + } + + function isPortalized($thispage) { + foreach($this->config AS $set) { + if (in_array($thispage, $set)) { + return TRUE; + } + } + return FALSE; + } + + function getMenu($thispage) { + + $config = SimpleSAML_Configuration::getInstance(); + $t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check-tpl.php'); + + $tabset = $this->getTabset($thispage); + + #echo($thispage); + #echo('<pre>'); print_r($this->pages); exit; + + $text = '<ul>'; + foreach($this->pages AS $pageid => $page) { + + if (isset($tabset) && !in_array($pageid, $tabset, TRUE)) continue; + + #echo('This page [' . $pageid . '] is part of [' . join(',', $tabset) . ']'); + + $name = 'uknown'; + if (isset($page['text'])) $name = $page['text']; + if (isset($page['shorttext'])) $name = $page['shorttext']; + + if (!isset($page['href'])) { + $text .= '<li class="ui-tabs-selected"><a href="#">' . $t->t($name) . '</a></li>'; + } else if($pageid === $thispage ) { + $text .= '<li class="ui-tabs-selected"><a href="#">' . $t->t($name) . '</a></li>'; + } else { + $text .= '<li><a href="' . $page['href'] . '">' . $t->t($name) . '</a></li>'; + } + + } + $text .= '</ul>'; + return $text; + } + + +} \ No newline at end of file diff --git a/templates/includes/footer.php b/templates/includes/footer.php index b851679ec8121a04d273f1e6ac47201dbd8af58f..329bc68f70f585c1e2bfd59e5421878cd4b39c3e 100644 --- a/templates/includes/footer.php +++ b/templates/includes/footer.php @@ -1,5 +1,15 @@ +<?php + +if(array_key_exists('htmlContentPost', $this->data)) { + foreach(array_reverse($this->data['htmlContentPost']) AS $c) { + echo $c; + } +} +?> + + <hr /> diff --git a/templates/includes/header.php b/templates/includes/header.php index 0aa15123cfb815312d95b726c554e650cf6a8b5e..15357734ae039067892dff05a33d511d0f053e2a 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -13,7 +13,28 @@ if(array_key_exists('header', $this->data)) { <link rel="stylesheet" type="text/css" href="/<?php echo $this->data['baseurlpath']; ?>resources/default.css" /> <link rel="icon" type="image/icon" href="/<?php echo $this->data['baseurlpath']; ?>resources/icons/favicon.ico" /> - <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> + +<?php + +if(array_key_exists('jquery', $this->data)) { + + #echo('<pre>'); print_r($this->data['jquery']); exit; + if (isset($this->data['jquery']['core']) && $this->data['jquery']['core']) + echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery.js"></script>'); + + if (isset($this->data['jquery']['ui']) && $this->data['jquery']['ui']) + echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui.js"></script>'); + + if (isset($this->data['jquery']['css']) && $this->data['jquery']['css']) + echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . 'resources/uitheme/jquery-ui-themeroller.css" />'); + +} + +?> + + + <meta name="robots" content="noindex, nofollow" /> + <?php if(array_key_exists('head', $this->data)) { @@ -91,6 +112,19 @@ if($onLoad !== '') { echo '</div>'; } - + + + ?> <div id="content"> + + + +<?php +if(array_key_exists('htmlContentPre', $this->data)) { + foreach($this->data['htmlContentPre'] AS $c) { + echo $c; + } +} + +?>