From 256f31c92a4c58f9b253401149b1d7e3bb1677bf Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Mon, 15 Jan 2018 11:31:21 +0100
Subject: [PATCH] consentAdmin: Extract CSS from template file
---
.../consentAdmin/templates/consentadmin.php | 59 +++----------------
.../www/assets/css/consentAdmin.css | 22 +++++++
.../www/assets/js/consentAdmin.js | 3 +
.../js}/consentSimpleAjax.js | 0
4 files changed, 32 insertions(+), 52 deletions(-)
create mode 100644 modules/consentAdmin/www/assets/css/consentAdmin.css
create mode 100644 modules/consentAdmin/www/assets/js/consentAdmin.js
rename modules/consentAdmin/www/{includes => assets/js}/consentSimpleAjax.js (100%)
diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php
index ce3386c4c..94407b456 100644
--- a/modules/consentAdmin/templates/consentadmin.php
+++ b/modules/consentAdmin/templates/consentadmin.php
@@ -1,55 +1,10 @@
-<?php $this->includeAtTemplateBase('includes/header.php'); ?>
-<!-- default theme -->
-
-<script>
- function setConsentText(consentStatus, show_spid) {
- document.getElementById("consentText" + show_spid).innerHTML = consentStatus;
- }
-</script>
-
-<script src="includes/consentSimpleAjax.js"></script>
-
-<style>
-.caSPName {
- font-weight: bold;
-}
-
-td.caSPName {
- vertical-align: top;
-}
-
-.caAllowed {
-
-}
-
-td.caAllowed {
- vertical-align: top;
-}
-
-td.caAttributes {
-
-}
-
-tr.row0 td {
- background-color: #888888;
- color: black;
-}
-
-tr.row1 td {
- background-color: #aaaaaa;
- color: black;
-}
-
-a.orange {
- color: #ffd633;
-}
-
-span.showhide {
-
-}
-</style>
-
-
+<?php
+ $this->data['head'] = '<link rel="stylesheet" type="text/css" href="' . SimpleSAML\Module::getModuleURL("consentAdmin/assets/css/consentAdmin.css") . '" />' . "\n";
+ $this->data['head'] .= '<script src="' . SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentAdmin.js") .'"></script>';
+ $this->data['head'] .= '<script src="' . SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentSimpleAjax.js") .'"></script>';
+ // default theme
+ $this->includeAtTemplateBase('includes/header.php');
+?>
<!-- <h2><?php if (isset($this->data['header'])) { echo $this->t($this->data['header']); } else { echo "Some error occurred"; } ?></h2> -->
<h2><?php echo $this->t('{consentAdmin:consentadmin:consentadmin_header}') ?></h2>
<p>
diff --git a/modules/consentAdmin/www/assets/css/consentAdmin.css b/modules/consentAdmin/www/assets/css/consentAdmin.css
new file mode 100644
index 000000000..867350254
--- /dev/null
+++ b/modules/consentAdmin/www/assets/css/consentAdmin.css
@@ -0,0 +1,22 @@
+.caSPName {
+ font-weight: bold;
+}
+td.caSPName {
+ vertical-align: top;
+}
+td.caAllowed {
+ vertical-align: top;
+}
+td.caAttributes {
+}
+tr.row0 td {
+ background-color: #888888;
+ color: black;
+}
+tr.row1 td {
+ background-color: #aaaaaa;
+ color: black;
+}
+a.orange {
+ color: #ffd633;
+}
diff --git a/modules/consentAdmin/www/assets/js/consentAdmin.js b/modules/consentAdmin/www/assets/js/consentAdmin.js
new file mode 100644
index 000000000..cfe0fb71a
--- /dev/null
+++ b/modules/consentAdmin/www/assets/js/consentAdmin.js
@@ -0,0 +1,3 @@
+function setConsentText(consentStatus, show_spid) {
+ document.getElementById("consentText" + show_spid).innerHTML = consentStatus;
+}
diff --git a/modules/consentAdmin/www/includes/consentSimpleAjax.js b/modules/consentAdmin/www/assets/js/consentSimpleAjax.js
similarity index 100%
rename from modules/consentAdmin/www/includes/consentSimpleAjax.js
rename to modules/consentAdmin/www/assets/js/consentSimpleAjax.js
--
GitLab