diff --git a/docs/simplesamlphp-theming.txt b/docs/simplesamlphp-theming.txt index 5a95272a251543ef22b229c0e0feeccd1fcae147..b4a2be98bc0e08de51d234857f1fafe87903c99d 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 d9186cd99b220f78a720242f4893cdc2efd1d735..e56316fe8fe5de2e2dc304c825fec56910833985 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