From 740c26f7651ffb948961ba91b3efbf865e5944be Mon Sep 17 00:00:00 2001 From: stevetruckstuff Date: Fri, 29 Sep 2006 22:13:17 +0000 Subject: [PATCH] Add tempalte config for alternate stylesheets git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11777 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/template/Template.class.php | 29 ++++++++++++++++++++++++++++- templates/default/config.php | 8 ++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/class/template/Template.class.php b/class/template/Template.class.php index 509604e6..5e561a2b 100644 --- a/class/template/Template.class.php +++ b/class/template/Template.class.php @@ -98,6 +98,15 @@ class Template */ var $required_js_files = array(); + /** + * Alternate stylesheets provided by the template. This is defined in the + * template config file so that we can provide pretty names in the display + * preferences + * + * @var array + **/ + var $alternate_stylesehets = array(); + /** * Constructor * @@ -190,6 +199,9 @@ class Template require($template_config_file); $this->required_js_files = is_array($required_js_files) ? $required_js_files : array(); + $this->alternate_stylesheets = is_array($alternate_stylesheets) ? + $alternate_stylesheets : + array(); } @@ -470,7 +482,6 @@ class Template $files = list_files($directory, '.css', !$full_path); // need to leave out "rtl.css" - // $return_array = array(); foreach ($files as $file) { @@ -486,6 +497,22 @@ class Template } + /** + * Return all alternate stylesheets provided by template. These + * sheets are defined in the template config file so that we cna display + * pretty names in the Display Preferences. The CSS files are located in + * $this->template_dir/css/alternatives/ + * + * @return array alternate style sheets + **/ + function get_alternative_stylesheets () { + $a = array(); + foreach ($this->alternate_stylesheets as $css) { + $a[] = strtolower(basename($css)); + } + return $a; + } + /** * Generate links to all this template set's standard stylesheets * diff --git a/templates/default/config.php b/templates/default/config.php index d8bc5458..a0f23e4e 100644 --- a/templates/default/config.php +++ b/templates/default/config.php @@ -26,4 +26,12 @@ $required_js_files = array ( 'default.js', ); +/** + * Alternate stylesheets provided by this template. Format detailed below. + **/ +$alternate_stylesheets = array ( + # CSS File Stlye Name +# 'example.css' => 'My Example Style', + ); + -- 2.25.1