From 5ecbcd15784fe5151c79eddfbf86fd718deda041 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 26 Jan 2009 21:36:44 +0000
Subject: [PATCH] Simplifying the folder layout of theming and templates...
 Will send an email regarding this..

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1186 44740490-163a-0410-bde0-09ae8108e29a
---
 docs/simplesamlphp-theming.txt                 | 11 +++++------
 lib/SimpleSAML/XHTML/Template.php              | 18 ++++++++----------
 .../templates/{default => }/login-infocard.php |  0
 .../templates/{default => }/list.php           |  0
 .../templates/{default => }/yubikeylogin.php   |  0
 .../templates/{default => }/consentform.php    |  0
 .../templates/{default => }/noconsent.php      |  0
 .../templates/{default => }/loginuserpass.php  |  0
 .../templates/{default => }/croninfo-tpl.php   |  0
 .../templates/{default => }/disco-tpl.php      |  0
 .../templates/{default => }/ldapstatus.php     |  0
 .../templates/{default => }/logpeek.php        |  0
 .../templates/{default => }/modlist.php        |  0
 .../templates/{default => }/consumer.php       |  0
 .../templates/{default => }/warning.php        |  0
 .../templates/{default => }/check-tpl.php      |  0
 .../templates/{default => }/statistics-tpl.php |  0
 templates/{default => }/admin-config.php       |  0
 templates/{default => }/admin-metadatalist.php |  0
 templates/{default => }/error.php              |  0
 templates/{default => }/errorreport.php        |  0
 templates/{default => }/frontpage.php          |  0
 templates/{default => }/httpredirect-debug.php |  0
 templates/{default => }/includes/footer.php    |  0
 templates/{default => }/includes/header.php    |  0
 templates/{default => }/login-feide.php        |  0
 templates/{default => }/login-ldapmulti.php    |  0
 templates/{default => }/login.php              |  0
 templates/{default => }/logout-iframe.php      |  0
 templates/{default => }/logout.php             |  0
 templates/{default => }/metadata-converter.php |  0
 templates/{default => }/metadata.php           |  0
 templates/{default => }/metashare-add.php      |  0
 templates/{default => }/metashare-list.php     |  0
 templates/{default => }/no_access.php          |  0
 templates/{default => }/openid-about.php       |  0
 templates/{default => }/openid-sites.php       |  0
 templates/{default => }/openid-trust.php       |  0
 templates/{default => }/post-debug.php         |  0
 templates/{default => }/post.php               |  0
 templates/{default => }/selectidp-dropdown.php |  0
 templates/{default => }/selectidp-links.php    |  0
 templates/{default => }/status-table.php       |  0
 templates/{default => }/status.php             |  0
 44 files changed, 13 insertions(+), 16 deletions(-)
 rename modules/InfoCard/templates/{default => }/login-infocard.php (100%)
 rename modules/aggregator/templates/{default => }/list.php (100%)
 rename modules/authYubiKey/templates/{default => }/yubikeylogin.php (100%)
 rename modules/consent/templates/{default => }/consentform.php (100%)
 rename modules/consent/templates/{default => }/noconsent.php (100%)
 rename modules/core/templates/{default => }/loginuserpass.php (100%)
 rename modules/cron/templates/{default => }/croninfo-tpl.php (100%)
 rename modules/discopower/templates/{default => }/disco-tpl.php (100%)
 rename modules/ldapstatus/templates/{default => }/ldapstatus.php (100%)
 rename modules/logpeek/templates/{default => }/logpeek.php (100%)
 rename modules/modinfo/templates/{default => }/modlist.php (100%)
 rename modules/openid/templates/{default => }/consumer.php (100%)
 rename modules/preprodwarning/templates/{default => }/warning.php (100%)
 rename modules/sanitycheck/templates/{default => }/check-tpl.php (100%)
 rename modules/statistics/templates/{default => }/statistics-tpl.php (100%)
 rename templates/{default => }/admin-config.php (100%)
 rename templates/{default => }/admin-metadatalist.php (100%)
 rename templates/{default => }/error.php (100%)
 rename templates/{default => }/errorreport.php (100%)
 rename templates/{default => }/frontpage.php (100%)
 rename templates/{default => }/httpredirect-debug.php (100%)
 rename templates/{default => }/includes/footer.php (100%)
 rename templates/{default => }/includes/header.php (100%)
 rename templates/{default => }/login-feide.php (100%)
 rename templates/{default => }/login-ldapmulti.php (100%)
 rename templates/{default => }/login.php (100%)
 rename templates/{default => }/logout-iframe.php (100%)
 rename templates/{default => }/logout.php (100%)
 rename templates/{default => }/metadata-converter.php (100%)
 rename templates/{default => }/metadata.php (100%)
 rename templates/{default => }/metashare-add.php (100%)
 rename templates/{default => }/metashare-list.php (100%)
 rename templates/{default => }/no_access.php (100%)
 rename templates/{default => }/openid-about.php (100%)
 rename templates/{default => }/openid-sites.php (100%)
 rename templates/{default => }/openid-trust.php (100%)
 rename templates/{default => }/post-debug.php (100%)
 rename templates/{default => }/post.php (100%)
 rename templates/{default => }/selectidp-dropdown.php (100%)
 rename templates/{default => }/selectidp-links.php (100%)
 rename templates/{default => }/status-table.php (100%)
 rename templates/{default => }/status.php (100%)

diff --git a/docs/simplesamlphp-theming.txt b/docs/simplesamlphp-theming.txt
index 5a95272a2..b4a2be98b 100644
--- a/docs/simplesamlphp-theming.txt
+++ b/docs/simplesamlphp-theming.txt
@@ -22,18 +22,17 @@ If you want to customize the UI, the right way to do that is to create a new **t
 
 ### Configuring which theme to use
 
-In `config.php` there is two configuration parameters that controls theming. Here is an example:
+In `config.php` there is a configuration option that controls theming. Here is an example:
 
-	'theme.use' 		=> 'fancytheme',
-	'theme.base' 		=> 'default',
+	'theme.use' 		=> 'fancymodule:fancytheme',
 
-The `theme.use` parameter points to which theme that will be used. If some functionality in simpleSAMLphp needs to present UI in example with the `logout.php` template, it will first look for `logout.php` in the `theme.use` theme, and if not found it will all fallback to look for the template in the `theme.base` theme. 
+The `theme.use` parameter points to which theme that will be used. If some functionality in simpleSAMLphp needs to present UI in example with the `logout.php` template, it will first look for `logout.php` in the `theme.use` theme, and if not found it will all fallback to look for the base templates. 
 
-All required templates SHOULD be available in the `theme.base` theme named `default`, and you SHOULD never change the base theme, or any templates within it. To customize UI, add a new theme that overrides the `default` base theme, instead of modifying it.
+All required templates SHOULD be available as a base in the `templates` folder, and you SHOULD never change the base templates. To customize UI, add a new theme within a module that overrides the base templates, instead of modifying it.
 
 ### Templates that includes other files
 
-A template file may *include* other files. In example all the default theme templates will include a header and footer. In example the `login.php` template will first include `includes/header.php` then present the login page, and then include `includes/footer.php`.
+A template file may *include* other files. In example all the default templates will include a header and footer. In example the `login.php` template will first include `includes/header.php` then present the login page, and then include `includes/footer.php`.
 
 SimpleSAMLphp allows themes to override the included templates files only, if needed. That means you can create a new theme `fancytheme` that includes only a header and footer. The header file refers to the CSS files, which means that a simple way of making a new look on simpleSAMLphp is to create a new theme, and copy the existing header, but point to your own CSS instead of the default CSS.
 
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index d9186cd99..e56316fe8 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -507,16 +507,15 @@ class SimpleSAML_XHTML_Template {
 		if ($themeModule !== NULL) {
 			/* .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName> */
 
-			$filename = SimpleSAML_Module::getModuleDir($themeModule) . '/themes/' . $themeName . '/' .
-				$templateModule . '/' . $templateName;
+			$filename = SimpleSAML_Module::getModuleDir($themeModule) . '/themes/' . $themeName . '/' . $templateModule . '/' . $templateName;
+			
 		} elseif ($templateModule !== 'default') {
 			/* .../module/<templateModule>/templates/<themeName>/<templateName> */
-			$filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' .
-				$themeName . '/' . $templateName;
+			$filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName;
+			
 		} else {
 			/* .../templates/<theme>/<templateName> */
-			$filename = $this->configuration->getPathValue('templatedir') . $themeName . '/' .
-				$templateName;
+			$filename = $this->configuration->getPathValue('templatedir') . $templateName;
 		}
 
 		if (file_exists($filename)) {
@@ -533,12 +532,11 @@ class SimpleSAML_XHTML_Template {
 		$baseTheme = $this->configuration->getValue('theme.base');
 		if ($templateModule !== 'default') {
 			/* .../module/<templateModule>/templates/<baseTheme>/<templateName> */
-			$filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' .
-				$baseTheme . '/' . $templateName;
+			$filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName;
+			
 		} else {
 			/* .../templates/<baseTheme>/<templateName> */
-			$filename = $this->configuration->getPathValue('templatedir') . $baseTheme . '/' .
-				$templateName;
+			$filename = $this->configuration->getPathValue('templatedir') . '/' . $templateName;
 		}
 
 		if (file_exists($filename)) {
diff --git a/modules/InfoCard/templates/default/login-infocard.php b/modules/InfoCard/templates/login-infocard.php
similarity index 100%
rename from modules/InfoCard/templates/default/login-infocard.php
rename to modules/InfoCard/templates/login-infocard.php
diff --git a/modules/aggregator/templates/default/list.php b/modules/aggregator/templates/list.php
similarity index 100%
rename from modules/aggregator/templates/default/list.php
rename to modules/aggregator/templates/list.php
diff --git a/modules/authYubiKey/templates/default/yubikeylogin.php b/modules/authYubiKey/templates/yubikeylogin.php
similarity index 100%
rename from modules/authYubiKey/templates/default/yubikeylogin.php
rename to modules/authYubiKey/templates/yubikeylogin.php
diff --git a/modules/consent/templates/default/consentform.php b/modules/consent/templates/consentform.php
similarity index 100%
rename from modules/consent/templates/default/consentform.php
rename to modules/consent/templates/consentform.php
diff --git a/modules/consent/templates/default/noconsent.php b/modules/consent/templates/noconsent.php
similarity index 100%
rename from modules/consent/templates/default/noconsent.php
rename to modules/consent/templates/noconsent.php
diff --git a/modules/core/templates/default/loginuserpass.php b/modules/core/templates/loginuserpass.php
similarity index 100%
rename from modules/core/templates/default/loginuserpass.php
rename to modules/core/templates/loginuserpass.php
diff --git a/modules/cron/templates/default/croninfo-tpl.php b/modules/cron/templates/croninfo-tpl.php
similarity index 100%
rename from modules/cron/templates/default/croninfo-tpl.php
rename to modules/cron/templates/croninfo-tpl.php
diff --git a/modules/discopower/templates/default/disco-tpl.php b/modules/discopower/templates/disco-tpl.php
similarity index 100%
rename from modules/discopower/templates/default/disco-tpl.php
rename to modules/discopower/templates/disco-tpl.php
diff --git a/modules/ldapstatus/templates/default/ldapstatus.php b/modules/ldapstatus/templates/ldapstatus.php
similarity index 100%
rename from modules/ldapstatus/templates/default/ldapstatus.php
rename to modules/ldapstatus/templates/ldapstatus.php
diff --git a/modules/logpeek/templates/default/logpeek.php b/modules/logpeek/templates/logpeek.php
similarity index 100%
rename from modules/logpeek/templates/default/logpeek.php
rename to modules/logpeek/templates/logpeek.php
diff --git a/modules/modinfo/templates/default/modlist.php b/modules/modinfo/templates/modlist.php
similarity index 100%
rename from modules/modinfo/templates/default/modlist.php
rename to modules/modinfo/templates/modlist.php
diff --git a/modules/openid/templates/default/consumer.php b/modules/openid/templates/consumer.php
similarity index 100%
rename from modules/openid/templates/default/consumer.php
rename to modules/openid/templates/consumer.php
diff --git a/modules/preprodwarning/templates/default/warning.php b/modules/preprodwarning/templates/warning.php
similarity index 100%
rename from modules/preprodwarning/templates/default/warning.php
rename to modules/preprodwarning/templates/warning.php
diff --git a/modules/sanitycheck/templates/default/check-tpl.php b/modules/sanitycheck/templates/check-tpl.php
similarity index 100%
rename from modules/sanitycheck/templates/default/check-tpl.php
rename to modules/sanitycheck/templates/check-tpl.php
diff --git a/modules/statistics/templates/default/statistics-tpl.php b/modules/statistics/templates/statistics-tpl.php
similarity index 100%
rename from modules/statistics/templates/default/statistics-tpl.php
rename to modules/statistics/templates/statistics-tpl.php
diff --git a/templates/default/admin-config.php b/templates/admin-config.php
similarity index 100%
rename from templates/default/admin-config.php
rename to templates/admin-config.php
diff --git a/templates/default/admin-metadatalist.php b/templates/admin-metadatalist.php
similarity index 100%
rename from templates/default/admin-metadatalist.php
rename to templates/admin-metadatalist.php
diff --git a/templates/default/error.php b/templates/error.php
similarity index 100%
rename from templates/default/error.php
rename to templates/error.php
diff --git a/templates/default/errorreport.php b/templates/errorreport.php
similarity index 100%
rename from templates/default/errorreport.php
rename to templates/errorreport.php
diff --git a/templates/default/frontpage.php b/templates/frontpage.php
similarity index 100%
rename from templates/default/frontpage.php
rename to templates/frontpage.php
diff --git a/templates/default/httpredirect-debug.php b/templates/httpredirect-debug.php
similarity index 100%
rename from templates/default/httpredirect-debug.php
rename to templates/httpredirect-debug.php
diff --git a/templates/default/includes/footer.php b/templates/includes/footer.php
similarity index 100%
rename from templates/default/includes/footer.php
rename to templates/includes/footer.php
diff --git a/templates/default/includes/header.php b/templates/includes/header.php
similarity index 100%
rename from templates/default/includes/header.php
rename to templates/includes/header.php
diff --git a/templates/default/login-feide.php b/templates/login-feide.php
similarity index 100%
rename from templates/default/login-feide.php
rename to templates/login-feide.php
diff --git a/templates/default/login-ldapmulti.php b/templates/login-ldapmulti.php
similarity index 100%
rename from templates/default/login-ldapmulti.php
rename to templates/login-ldapmulti.php
diff --git a/templates/default/login.php b/templates/login.php
similarity index 100%
rename from templates/default/login.php
rename to templates/login.php
diff --git a/templates/default/logout-iframe.php b/templates/logout-iframe.php
similarity index 100%
rename from templates/default/logout-iframe.php
rename to templates/logout-iframe.php
diff --git a/templates/default/logout.php b/templates/logout.php
similarity index 100%
rename from templates/default/logout.php
rename to templates/logout.php
diff --git a/templates/default/metadata-converter.php b/templates/metadata-converter.php
similarity index 100%
rename from templates/default/metadata-converter.php
rename to templates/metadata-converter.php
diff --git a/templates/default/metadata.php b/templates/metadata.php
similarity index 100%
rename from templates/default/metadata.php
rename to templates/metadata.php
diff --git a/templates/default/metashare-add.php b/templates/metashare-add.php
similarity index 100%
rename from templates/default/metashare-add.php
rename to templates/metashare-add.php
diff --git a/templates/default/metashare-list.php b/templates/metashare-list.php
similarity index 100%
rename from templates/default/metashare-list.php
rename to templates/metashare-list.php
diff --git a/templates/default/no_access.php b/templates/no_access.php
similarity index 100%
rename from templates/default/no_access.php
rename to templates/no_access.php
diff --git a/templates/default/openid-about.php b/templates/openid-about.php
similarity index 100%
rename from templates/default/openid-about.php
rename to templates/openid-about.php
diff --git a/templates/default/openid-sites.php b/templates/openid-sites.php
similarity index 100%
rename from templates/default/openid-sites.php
rename to templates/openid-sites.php
diff --git a/templates/default/openid-trust.php b/templates/openid-trust.php
similarity index 100%
rename from templates/default/openid-trust.php
rename to templates/openid-trust.php
diff --git a/templates/default/post-debug.php b/templates/post-debug.php
similarity index 100%
rename from templates/default/post-debug.php
rename to templates/post-debug.php
diff --git a/templates/default/post.php b/templates/post.php
similarity index 100%
rename from templates/default/post.php
rename to templates/post.php
diff --git a/templates/default/selectidp-dropdown.php b/templates/selectidp-dropdown.php
similarity index 100%
rename from templates/default/selectidp-dropdown.php
rename to templates/selectidp-dropdown.php
diff --git a/templates/default/selectidp-links.php b/templates/selectidp-links.php
similarity index 100%
rename from templates/default/selectidp-links.php
rename to templates/selectidp-links.php
diff --git a/templates/default/status-table.php b/templates/status-table.php
similarity index 100%
rename from templates/default/status-table.php
rename to templates/status-table.php
diff --git a/templates/default/status.php b/templates/status.php
similarity index 100%
rename from templates/default/status.php
rename to templates/status.php
-- 
GitLab