diff -upr site_map.orig/site_map.admin.inc site_map/site_map.admin.inc
--- site_map.orig/site_map.admin.inc 2009-04-07 00:42:22.000000000 -0700
+++ site_map/site_map.admin.inc 2009-06-28 15:25:20.000000000 -0700
@@ -154,6 +154,20 @@ function site_map_admin_settings() {
'#maxlength' => 10,
'#description' => t('Specify how many subcategories should be included on the categorie page. Enter "all" to include all subcategories,"0" to include no subcategories, or "-1" not to append the depth at all.'),
);
+ $form['site_map_content_options']['site_map_count_threshold'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Category count threshold'),
+ '#default_value' => variable_get('site_map_count_threshold', 0),
+ '#size' => 3,
+ '#description' => t('Only show categories whose node counts are greater than this threshold. Set to -1 to disable')
+ );
+ $form['site_map_content_options']['site_map_forum_threshold'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Forum count threshold'),
+ '#default_value' => variable_get('site_map_forum_threshold', -1),
+ '#size' => 3,
+ '#description' => t('Only show forums whose node counts are greater than this threshold. Set to -1 to disable')
+ );
$form['site_map_rss_options'] = array(
'#type' => 'fieldset',
@@ -166,6 +180,13 @@ function site_map_admin_settings() {
'#default_value' => variable_get('site_map_show_rss_links', 1),
'#description' => t('When enabled, this option will show links to the RSS feeds for each category and blog.'),
);
+ $form['site_map_rss_options']['site_map_rss_links_before'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Align RSS links on the left'),
+ '#return_value' => 1,
+ '#default_value' => variable_get('site_map_rss_links_before', 1),
+ '#description' => t('When enabled, this option will put RSS feed links to the left side of lines, which makes them align nicely.'),
+ );
$form['site_map_rss_options']['site_map_rss_depth'] = array(
'#type' => 'textfield',
'#title' => t('RSS feed depth'),
diff -upr site_map.orig/site_map.install site_map/site_map.install
--- site_map.orig/site_map.install 2008-08-17 13:27:21.000000000 -0700
+++ site_map/site_map.install 2009-06-28 15:22:05.000000000 -0700
@@ -17,6 +17,9 @@ function site_map_uninstall() {
variable_del('site_map_categories_depth');
variable_del('site_map_show_rss_links');
variable_del('site_map_rss_depth');
+ variable_del('site_map_rss_links_before');
+ variable_del('site_map_count_threshold');
+ variable_del('site_map_forum_threshold');
if (function_exists('locale')) {
$langs = locale_language_list();
diff -upr site_map.orig/site_map.module site_map/site_map.module
--- site_map.orig/site_map.module 2009-04-21 21:59:38.000000000 -0700
+++ site_map/site_map.module 2009-06-28 15:26:09.000000000 -0700
@@ -107,11 +107,12 @@ function theme_site_map_display() {
$output = '';
if (variable_get('site_map_show_rss_links', 1)) {
- $output .= '
'. t('This is a link to a content RSS feed');
+ $output .= '
'. t('Link to a content RSS feed');
if (module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) {
- $output .= '
'. t('This is a link to a comment RSS feed');
+ $output .= '
'. t('Link to a comment RSS feed');
}
$output .= '
';
+ $output = theme('fieldset',array('#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => t('Legend'), '#value' => $output));
}
if (variable_get('site_map_show_front', 1)) {
@@ -163,7 +164,7 @@ function theme_site_map_display() {
* A string containing the box output.
*/
function theme_site_map_box($title, $content, $class = '') {
- return ''. $title .'
'. $content .'
';
+ return "\n".''. $title .'
'. $content .'
';
}
function theme_site_map_feed_icon($url, $type = 'node') {
@@ -189,14 +190,22 @@ function theme_site_map_feed_icon($url,
function _site_map_front_page() {
$title = t('Front page');
- $output = l(t("Front page of %sn", array("%sn" => variable_get('site_name', 'Drupal'))), '', array('html' => TRUE));
+ if (variable_get('site_map_show_rss_links', 1) && variable_get('site_map_rss_links_before', 1)) {
+ $output .= theme('site_map_feed_icon', url(variable_get('site_map_rss_front', 'rss.xml')));
+ if (module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) {
+ $output .= ' '. theme('site_map_feed_icon', url('crss'), 'comment');
+ }
+ $output .= ' ';
+ }
+ $output .= l(t("Front page of %sn", array("%sn" => variable_get('site_name', 'Drupal'))), '', array('html' => TRUE));
- if (variable_get('site_map_show_rss_links', 1)) {
+ if (variable_get('site_map_show_rss_links', 1) && !variable_get('site_map_rss_links_before', 1)) {
$output .= ' '. theme('site_map_feed_icon', url(variable_get('site_map_rss_front', 'rss.xml')));
if (module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) {
$output .= ' '. theme('site_map_feed_icon', url('crss'), 'comment');
}
}
+ $output = '' . $output . '
';
return theme('site_map_box', $title, $output, 'sitemap-front');
}
@@ -211,7 +220,12 @@ function _site_map_blogs() {
$output = ''. t("Community blog and recent blog authors at %sn.", array("%sn" => variable_get('site_name', 'Drupal'))) .'
';
$blogs = array();
- $blogs[] .= l(t('All blogs'), 'blog') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('blog/feed')) : '');
+ if (variable_get('site_map_rss_links_before', 1)) {
+ $blogs[] .= (variable_get('site_map_show_rss_links', 1) ? theme('site_map_feed_icon', url('blog/feed')) . ' ' : '') . l(t('All blogs'), 'blog');
+ }
+ else {
+ $blogs[] .= l(t('All blogs'), 'blog') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('blog/feed')) : '');
+ }
$sql = "SELECT DISTINCT u.uid, u.name, count(u.uid) AS numitems
FROM {node} n
INNER JOIN {users} u ON u.uid = n.uid
@@ -219,8 +233,15 @@ function _site_map_blogs() {
GROUP BY u.uid
ORDER BY numitems DESC, u.name";
$result = db_query_range($sql, 0, 10);
- while ($blog = db_fetch_object($result)) {
- $blogs[] = l(t("!s's blog", array("!s" => $blog->name)), "blog/$blog->uid") .' ('. $blog->numitems .')'. (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url("blog/$blog->uid/feed")) : '');
+ if (variable_get('site_map_rss_links_before', 1)) {
+ while ($blog = db_fetch_object($result)) {
+ $blogs[] = (variable_get('site_map_show_rss_links', 1) ? theme('site_map_feed_icon', url("blog/$blog->uid/feed")) . ' ' : '') . l(t("!s's blog", array("!s" => $blog->name)), "blog/$blog->uid") .' ('. $blog->numitems .')';
+ }
+ }
+ else {
+ while ($blog = db_fetch_object($result)) {
+ $blogs[] = l(t("!s's blog", array("!s" => $blog->name)), "blog/$blog->uid") .' ('. $blog->numitems .')'. (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url("blog/$blog->uid/feed")) : '');
+ }
}
$output .= theme('item_list', $blogs);
$output = theme('site_map_box', $title, $output, 'sitemap-blog');
@@ -233,7 +254,12 @@ function _site_map_audio() {
$output = '';
if (module_exists('audio')) {
$title = t('Audio');
- $output = l(t('Audio content'), 'audio') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('audio/feed')) : '');
+ if (variable_get('site_map_rss_links_before', 1)) {
+ $output = (variable_get('site_map_show_rss_links', 1) ? theme('site_map_feed_icon', url('audio/feed')) . ' ' : '') . l(t('Audio content'), 'audio');
+ }
+ else {
+ $output = l(t('Audio content'), 'audio') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('audio/feed')) : '');
+ }
$output = theme('site_map_box', $title, $output, 'sitemap-audio');
}
@@ -244,7 +270,12 @@ function _site_map_video() {
$output = '';
if (module_exists('video')) {
$title = t('Video');
- $output = l(t('Video content'), 'video') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('video/feed')) : '');
+ if (variable_get('site_map_rss_links_before', 1)) {
+ $output = (variable_get('site_map_show_rss_links', 1) ? theme('site_map_feed_icon', url('video/feed')) . ' ' : '') . l(t('Video content'), 'video');
+ }
+ else {
+ $output = l(t('Video content'), 'video') . (variable_get('site_map_show_rss_links', 1) ? ' '. theme('site_map_feed_icon', url('video/feed')) : '');
+ }
$output = theme('site_map_box', $title, $output, 'sitemap-video');
}
@@ -348,9 +379,11 @@ function _site_map_taxonomy_tree($vid, $
$output = '';
if ($vid == variable_get('forum_nav_vocabulary', '')) {
$title = l($name, 'forum');
+ $threshold = variable_get('site_map_forum_threshold', -1);
}
else {
$title = $name ? check_plain(t($name)) : '';
+ $threshold = variable_get('site_map_count_threshold', 0);
}
$title .= (module_exists('commentrss') && variable_get('commentrss_term', FALSE) ? ' '. theme('site_map_feed_icon', url("crss/vocab/$vid"), 'comment') : '');
@@ -370,6 +403,11 @@ function _site_map_taxonomy_tree($vid, $
// taxonomy_get_tree() honors access controls
$tree = taxonomy_get_tree($vid);
foreach ($tree as $term) {
+ $term->count = taxonomy_term_count_nodes($term->tid);
+ if ($term->count <= $threshold) {
+ continue;
+ }
+
// Adjust the depth of the based on the change
// in $term->depth since the $last_depth.
if ($term->depth > $last_depth) {
@@ -387,7 +425,11 @@ function _site_map_taxonomy_tree($vid, $
}
// Display the $term.
$output .= "\n- ";
- $term->count = taxonomy_term_count_nodes($term->tid);
+ if (variable_get('site_map_show_rss_links', 1) && variable_get('site_map_rss_links_before', 1)) {
+ $output .= theme('site_map_feed_icon', url("taxonomy/term/$term->tid/$rss_depth/feed"));
+ $output .= (module_exists('commentrss') && variable_get('commentrss_term', FALSE) ? ' ' . theme('site_map_feed_icon', url("crss/term/$term->tid"), 'comment') : '');
+ $output .= ' ';
+ }
if ($term->count) {
$output .= l($term->name, ($cat_depth < 0) ? taxonomy_term_path($term) : "taxonomy/term/$term->tid/$cat_depth", array('attributes' => array('title' => $term->description)));
}
@@ -397,7 +439,7 @@ function _site_map_taxonomy_tree($vid, $
if (variable_get('site_map_show_count', 1)) {
$output .= " ($term->count)";
}
- if (variable_get('site_map_show_rss_links', 1)) {
+ if (variable_get('site_map_show_rss_links', 1) && !variable_get('site_map_rss_links_before', 1)) {
$output .= ' '. theme('site_map_feed_icon', url("taxonomy/term/$term->tid/$rss_depth/feed"));
$output .= (module_exists('commentrss') && variable_get('commentrss_term', FALSE) ? ' '. theme('site_map_feed_icon', url("crss/term/$term->tid"), 'comment') : '');
}