Skip to content

Commit 33e6bdb

Browse files
ioigoumenikosev
authored andcommitted
Add configurable theme wrapper for simple html views
1 parent 7959c79 commit 33e6bdb

5 files changed

Lines changed: 49 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This version is compatible with [SimpleSAMLphp v1.18](https://simplesamlphp.org/
1515
- Add style rules and logos for IdP umbrellaid.
1616
- Add exception template for attrauthcomanage module
1717
- Add template for Email Confirmation
18+
- Add configurable theme wrapper for simple html views
1819

1920
### Fixed
2021

config-example/module_themevanilla.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
'purpose' => 'Preserve user session ID to retrieve session information',
7979
],
8080
],
81+
'views' => [
82+
// 'aup' => 'https://example.com/test.html',
83+
],
8184
'enable_cookies_banner' => false,
8285
'ribbon_text' => '',
8386
];

dictionaries/default.definition.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
},
2020
"message_sub": {
2121
"en": "<span class=\"subtitle-msg\">You will have <b>72 hours</b> to verify your account</span>"
22+
},
23+
"no_content": {
24+
"en": "<h2>Unable to retrieve content.</h2>"
2225
}
2326
}

templates/views.tpl.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
// Get Configuration
4+
$themeConfig = SimpleSAML\Configuration::getConfig('module_themevanilla.php');
5+
$views = $themeConfig->getValue('views');
6+
7+
// Content
8+
$body = $this->t('{themevanilla:default:no_content}');
9+
10+
// Get request parameter and load Content
11+
if (!empty($_REQUEST['id']) && !empty($views)) {
12+
$ld_view = $views[$_REQUEST['id']];
13+
$contextOptions = array(
14+
'ssl' => array(
15+
'verify_peer' => false,
16+
),
17+
'http' => array(
18+
'timeout' => 2, // 2 Seconds
19+
),
20+
);
21+
$sslContext = stream_context_create($contextOptions);
22+
$loaded_content = file_get_contents($ld_view, false, $sslContext);
23+
if (!empty($loaded_content)) {
24+
$body = $loaded_content;
25+
}
26+
}
27+
28+
// Load Head and Dependencies
29+
$this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true);
30+
// Load Header
31+
$this->includeAtTemplateBase('includes/header.php');
32+
// Load Body
33+
echo $body;
34+
// Load Footer
35+
$this->includeAtTemplateBase('includes/footer.php');

www/views.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
// Get global config
4+
$config = SimpleSAML\Configuration::getInstance();
5+
// Get the template
6+
$template = new SimpleSAML\XHTML\Template($config, 'themevanilla:views.tpl.php');
7+
$template->show();

0 commit comments

Comments
 (0)