diff -up site_map/README.txt site_map/README.txt
--- site_map/README.txt 2009-09-07 16:37:09.000000000 +0200
+++ site_map/README.txt 2009-09-16 20:11:03.000000000 +0200
@@ -41,6 +41,21 @@ Installation:
6. Visit http://example.com/sitemap.
+Adding your own CSS skins:
+-------------------------
+If you want to add your own CSS to your site map, create a directory
+at sites/all/libraries/site_map/css
+
+Any .css files you place in this directory will be available to select,
+next to 'default' and 'none', in Administer -> Site configuration -> Site map
+
+A good example is the slick-map.css file you can find in this issue:
+http://drupal.org/node/514436
+
+If you do not create the directory, the module still functions but your
+only CSS options are either 'none' or 'default'.
+
+
Site map term path (and Pathauto):
-------------------------------
There is a "depth" setting on the Site map settings page where you can adjust
diff -up site_map/site_map.admin.inc site_map/site_map.admin.inc
--- site_map/site_map.admin.inc 2009-06-29 21:12:54.000000000 +0200
+++ site_map/site_map.admin.inc 2009-09-16 20:00:50.000000000 +0200
@@ -125,12 +125,29 @@ function site_map_admin_settings() {
'#multiple' => TRUE,
'#description' => t('Ctrl-click (Windows) or Command-click (Mac) to select more than one value.'),
);
- $form['site_map_content']['site_map_css'] = array(
- '#type' => 'checkbox',
- '#title' => t('Do not include site map CSS file'),
- '#default_value' => variable_get('site_map_css', 0),
- '#description' => t('If you don\'t want to load the included CSS file you can check this box.'),
- );
+ // CSS selector
+ if (_site_map_get_css()) {
+ // call helper function in site_map.module to get CSS files
+ $css_options = _site_map_get_css();
+ array_unshift($css_options, 'none', 'default');
+ $form['site_map_content']['site_map_css_selector'] = array(
+ '#type' => 'select',
+ '#title' => t('Site map CSS file'),
+ '#default_value' => variable_get('site_map_css_selector', 1),
+ '#options' => $css_options,
+ '#description' => t('Select a CSS file to use for your site map.'),
+ );
+ }
+ else {
+ $css_options = array('none', 'default');
+ $form['site_map_content']['site_map_css_selector'] = array(
+ '#type' => 'select',
+ '#title' => t('Site map CSS file'),
+ '#default_value' => variable_get('site_map_css_selector', 1),
+ '#options' => $css_options,
+ '#description' => t('Select a CSS file to use for your site map.'),
+ );
+ }
$form['site_map_taxonomy_options'] = array(
'#type' => 'fieldset',
diff -up site_map/site_map.install site_map/site_map.install
--- site_map/site_map.install 2009-06-29 21:12:54.000000000 +0200
+++ site_map/site_map.install 2009-09-16 20:04:59.000000000 +0200
@@ -20,6 +20,7 @@ function site_map_uninstall() {
variable_del('site_map_css');
variable_del('site_map_term_threshold');
variable_del('site_map_forum_threshold');
+ variable_del('site_map_css_selector');
if (function_exists('locale')) {
$langs = locale_language_list();
diff -up site_map/site_map.module site_map/site_map.module
--- site_map/site_map.module 2009-08-21 08:58:49.000000000 +0200
+++ site_map/site_map.module 2009-09-16 19:48:21.000000000 +0200
@@ -96,8 +96,17 @@ function site_map_block($op = 'list', $d
* Menu callback for the site map.
*/
function site_map_page() {
- if (variable_get('site_map_css', 0) != 1) {
- drupal_add_css(drupal_get_path('module', 'site_map') .'/site_map.css');
+ // make sure we haven't set the value 'none' in admin
+ if (variable_get('site_map_css_selector', 1) != '0') {
+ // if specified, use default site map CSS
+ if (variable_get('site_map_css_selector', 1) == '1') {
+ drupal_add_css(drupal_get_path('module', 'site_map') .'/site_map.css');
+ }
+ // otherwise, load selected css file from libraries
+ else {
+ $path = 'sites/all/libraries/site_map/css/' . variable_get('site_map_css_selector', 1);
+ drupal_add_css($path);
+ }
}
return theme('site_map_display');
@@ -534,3 +543,32 @@ function _sitemap_get_message($lang_code
return $message;
}
+
+/**
+ * Load CSS files from sites/all/libraries/site_map/css
+ *
+ * @return
+ * Array of CSS files available or FALSE if directory does not exist.
+ */
+function _site_map_get_css() {
+ $path = realpath('./') . '/sites/all/libraries/site_map/css';
+ // make sure the css directory exists
+ if (is_dir($path)) {
+ if ($handle = opendir($path)) {
+ $css = array();
+ // loop through all files
+ while (false !== ($file = readdir($handle))) {
+ // we only want .css files
+ if (substr($file, -4, 4) == '.css') {
+ // build array of available files
+ $css[$file] = $file;
+ }
+ }
+ closedir($handle);
+ return $css;
+ }
+ }
+ else {
+ return FALSE;
+ }
+}
Common subdirectories: site_map/translations and site_map/translations