Index: site-map.tpl.php =================================================================== RCS file: site-map.tpl.php diff -N site-map.tpl.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ site-map.tpl.php 22 May 2010 06:39:44 -0000 @@ -0,0 +1,79 @@ + + +
+ +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ +
Index: site_map.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/site_map/site_map.admin.inc,v retrieving revision 1.1.2.7.2.4 diff -u -p -u -p -r1.1.2.7.2.4 site_map.admin.inc --- site_map.admin.inc 7 May 2010 11:16:29 -0000 1.1.2.7.2.4 +++ site_map.admin.inc 22 May 2010 06:39:45 -0000 @@ -21,6 +21,7 @@ function site_map_admin_settings() { '#rows' => 5, '#description' => t('Define a message to be displayed above the site map.'), ); + $form['site_map_message_format'] = filter_form(variable_get('site_map_message_format', FILTER_FORMAT_DEFAULT)); $form['site_map_content'] = array( '#type' => 'fieldset', Index: site_map.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/site_map/site_map.css,v retrieving revision 1.3.2.3.2.2 diff -u -p -u -p -r1.3.2.3.2.2 site_map.css --- site_map.css 7 May 2010 11:20:33 -0000 1.3.2.3.2.2 +++ site_map.css 22 May 2010 06:39:45 -0000 @@ -1,32 +1,28 @@ /* $Id: site_map.css,v 1.3.2.3.2.2 2010/05/07 11:20:33 frjo Exp $ */ -.sitemap-box { - margin-bottom: 1em; -} - #site-map .description { margin-bottom: 0.5em; } -#site-map ul.menu { - padding-left: 1.5em; +#site-map .site-map-box { + margin-bottom: 1em; } -#site-map .sitemap-terms ul { +#site-map .site-map-box ul { padding-left: 1.5em; } /* Styles when RSS icons are displayed on the left. */ -#site-map .sitemap-rss-left ul { +#site-map .site-map-rss-left ul { padding-left: 0; } -#site-map .sitemap-rss-left li { +#site-map .site-map-rss-left li { list-style-type: none; list-style-image: none; background-image: none; margin: 0; padding: 0; } -#site-map .sitemap-rss-left ul li li { +#site-map .site-map-rss-left ul li li { padding-left: 1.5em; } Index: site_map.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/site_map/site_map.module,v retrieving revision 1.39.2.17.2.7 diff -u -p -u -p -r1.39.2.17.2.7 site_map.module --- site_map.module 7 May 2010 11:22:23 -0000 1.39.2.17.2.7 +++ site_map.module 22 May 2010 06:39:45 -0000 @@ -2,7 +2,8 @@ // $Id: site_map.module,v 1.39.2.17.2.7 2010/05/07 11:22:23 frjo Exp $ /** - * @file + * @file site_map.module + * * Original author: Nic Ivy * Now maintained by by Fredrik Jonsson fredrik at combonet dot se */ @@ -19,20 +20,30 @@ function site_map_perm() { */ function site_map_theme() { return array( - 'site_map_display' => array( + 'site_map' => array( 'arguments' => array(), + 'template' => 'site-map', + 'file' => 'site_map.theme.inc', ), 'site_map_box' => array( 'arguments' => array('title' => NULL, 'content' => NULL, 'class' => NULL), + 'file' => 'site_map.theme.inc', ), 'site_map_feed_icon' => array( 'arguments' => array('url' => NULL, 'type' => 'node'), + 'file' => 'site_map.theme.inc', ), 'site_map_menu_tree' => array( 'arguments' => array('tree' => NULL), + 'file' => 'site_map.theme.inc', ), 'site_map_menu_item' => array( 'arguments' => array('link' => NULL, 'has_children' => NULL, 'menu' => NULL), + 'file' => 'site_map.theme.inc', + ), + 'site_map_rss_legend' => array( + 'arguments' => array(), + 'file' => 'site_map.theme.inc', ), ); } @@ -95,152 +106,7 @@ function site_map_page() { drupal_add_css(drupal_get_path('module', 'site_map') .'/site_map.css'); } - return theme('site_map_display'); -} - -/** - * Return a themed site map. - * - * @return - * A string containing the site map output. - */ -function theme_site_map_display() { - $output = ''; - - $message = filter_xss_admin(variable_get('site_map_message', '')); - $output .= $message ? '

'. $message .'

' : ''; - - if ((variable_get('site_map_show_rss_links', 1) != 0) && module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) { - $output .= '

'. t('Legend:') .'
'; - $output .= ''. theme('site_map_feed_icon', NULL) .' '. t('Link to a content RSS feed'); - $output .= '
'. theme('site_map_feed_icon', NULL, 'comment') .' '. t('Link to a comment RSS feed'); - $output .= '

'; - } - - if (variable_get('site_map_show_front', 1)) { - $output .= _site_map_front_page(); - } - - if (variable_get('site_map_show_blogs', 1)) { - $output .= _site_map_blogs(); - } - -/* $output .= _site_map_audio(); */ - -/* $output .= _site_map_video(); */ - - // Compile the books trees. - $output .= _site_map_books(); - - // Compile the menu trees. - $output .= _site_map_menus(); - - if (variable_get('site_map_show_faq', 1)) { - $output .= _site_map_faq(); - } - - // Compile the vocabulary trees. - $output .= _site_map_taxonomys(); - - // Invoke all custom modules and get themed HTML to be integrated into the site map. - $additional = module_invoke_all('site_map'); - foreach ($additional as $themed_site_map_code) { - $output .= $themed_site_map_code; - } - - $output = '
'. $output .'
'; - - return $output; -} - -/** - * Return a themed sitemap box. - * - * @param $title - * The subject of the box. - * @param $content - * The content of the box. - * @param $class - * Optional extra class for the box. - * @return - * A string containing the box output. - */ -function theme_site_map_box($title, $content, $class = '') { - $output = ''; - if ($title || $content) { - $class = $class ? 'sitemap-box '. $class : 'sitemap-box'; - $output .= '
'; - if ($title) { - $output .= '

'. $title .'

'; - } - if ($content) { - $output .= '
'. $content .'
'; - } - $output .= '
'; - } - - return $output; -} - -/** - * Return a themed feed icon. - * - * @param $url - * The feed URL. - * @param $type - * The type of feed icon. - * @return - * A string containing the linked image. - */ -function theme_site_map_feed_icon($url, $type = 'node') { - $output = ''; - - switch ($type) { - case 'node': - $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small.png'), t('Syndicate content'), t('Syndicate content')); - break; - case 'comment': - $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small-comment.png'), t('Syndicate comments'), t('Syndicate comments')); - break; - } - - if ($url) { - $output = l($output, $url, array('attributes' => array('class' => 'feed-link'), 'html' => TRUE)); - } - - return $output; -} - -/** - * This is a clone of the core theme_menu_tree() function with the exception of - * the site_map specific class name used in the UL that also allow themers to - * override the function only for the sitemap page. - * - * Generate the HTML output for a menu tree - * - * @ingroup themeable - */ -function theme_site_map_menu_tree($tree) { - return ''; -} - -/** - * This is a one by one clone of the core theme_menu_item() function that allows - * custom theming of the sitemap page items. - * - * Generate the HTML output for a menu item and submenu. - * - * @ingroup themeable - */ -function theme_site_map_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { - $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); - if (!empty($extra_class)) { - $class .= ' '. $extra_class; - } - if ($in_active_trail) { - $class .= ' active-trail'; - } - return '
  • '. $link . $menu ."
  • \n"; + return theme('site_map'); } function _site_map_front_page() { @@ -258,12 +124,12 @@ function _site_map_front_page() { $output .= ' '. $rss_link; } else { - $class = ' sitemap-rss-left'; + $class = ' site-map-rss-left'; $output = $rss_link .' '. $output; } } - return theme('site_map_box', $title, $output, 'sitemap-front'. $class); + return theme('site_map_box', $title, $output, 'site-map-front-box'. $class); } /** @@ -283,7 +149,7 @@ function _site_map_blogs() { $blog_link .= ' '. $rss_link; } else { - $class = ' sitemap-rss-left'; + $class = ' site-map-rss-left'; $blog_link = $rss_link .' '. $blog_link; } } @@ -311,7 +177,7 @@ function _site_map_blogs() { $blogs[] = $blog_item; } $output .= theme('item_list', $blogs); - $output = theme('site_map_box', $title, $output, 'sitemap-blog'. $class); + $output = theme('site_map_box', $title, $output, 'site-map-blog-box'. $class); } return $output; @@ -329,11 +195,11 @@ function _site_map_audio() { $output .= ' '. $rss_link; } else { - $class = ' sitemap-rss-left'; + $class = ' site-map-rss-left'; $output = $rss_link .' '. $output; } } - $output = theme('site_map_box', $title, $output, 'sitemap-audio'. $class); + $output = theme('site_map_box', $title, $output, 'site-map-audio-box'. $class); } return $output; @@ -351,11 +217,11 @@ function _site_map_video() { $output .= ' '. $rss_link; } else { - $class = ' sitemap-rss-left'; + $class = ' site-map-rss-left'; $output = $rss_link .' '. $output; } } - $output = theme('site_map_box', $title, $output, 'sitemap-video'. $class); + $output = theme('site_map_box', $title, $output, 'site-map-video-box'. $class); } return $output; @@ -380,7 +246,7 @@ function _site_map_books() { } if ($output) { - $output = theme('site_map_box', $title, $description . $output, 'sitemap-book'); + $output = theme('site_map_box', $title, $description . $output, 'site-map-book-box'); } } @@ -405,7 +271,7 @@ function _site_map_menus() { $menu_display = _site_map_menu_tree_output($tree); if (!empty($menu_display)) { $title = $menu['title']; - $output .= theme('site_map_box', $title, $menu_display, 'sitemap-menu'); + $output .= theme('site_map_box', $title, $menu_display, 'site-map-menu-box'); } } } @@ -418,7 +284,7 @@ function _site_map_faq() { if (module_exists('faq')) { $title = variable_get('faq_title', t('Frequently Asked Questions')); $output = faq_get_faq_list(); - $output = theme('site_map_box', $title, $output, 'sitemap-faq'); + $output = theme('site_map_box', $title, $output, 'site-map-faq-box'); } return $output; @@ -529,7 +395,7 @@ function _site_map_taxonomy_tree($vid, $ $term_item .= ' '. $rss_link; } else { - $class = ' sitemap-rss-left'; + $class = ' site-map-rss-left'; $term_item = $rss_link .' '. $term_item; } } @@ -546,7 +412,7 @@ function _site_map_taxonomy_tree($vid, $ $output .= "\n\n"; } } - $output = theme('site_map_box', $title, $output, 'sitemap-terms sitemap-terms-'. $vid . $class); + $output = theme('site_map_box', $title, $output, 'site-map-terms-box site-map-terms-box-'. $vid . $class); return $output; } Index: site_map.theme.inc =================================================================== RCS file: site_map.theme.inc diff -N site_map.theme.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ site_map.theme.inc 22 May 2010 06:39:45 -0000 @@ -0,0 +1,150 @@ +'. t('Legend:') .'
    '; + $output .= ''. theme('site_map_feed_icon', NULL) .' '. t('Link to a content RSS feed'); + $output .= '
    '. theme('site_map_feed_icon', NULL, 'comment') .' '. t('Link to a comment RSS feed'); + $output .= '

    '; + + return $output; +} + +/** + * Return a themed site map box. + * + * @param $title + * The subject of the box. + * @param $content + * The content of the box. + * @param $class + * Optional extra class for the box. + * @return + * A string containing the box output. + */ +function theme_site_map_box($title, $content, $class = '') { + $output = ''; + if ($title || $content) { + $class = $class ? 'site-map-box '. $class : 'site-map-box'; + $output .= '
    '; + if ($title) { + $output .= '

    '. $title .'

    '; + } + if ($content) { + $output .= '
    '. $content .'
    '; + } + $output .= '
    '; + } + + return $output; +} + +/** + * Return a themed feed icon. + * + * @param $url + * The feed URL. + * @param $type + * The type of feed icon. + * @return + * A string containing the linked image. + */ +function theme_site_map_feed_icon($url, $type = 'node') { + $output = ''; + + switch ($type) { + case 'node': + $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small.png'), t('Syndicate content'), t('Syndicate content')); + break; + case 'comment': + $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small-comment.png'), t('Syndicate comments'), t('Syndicate comments')); + break; + } + + if ($url) { + $output = l($output, $url, array('attributes' => array('class' => 'feed-link'), 'html' => TRUE)); + } + + return $output; +} + +/** + * This is a clone of the core theme_menu_tree() function with the exception of + * the site_map specific class name used in the UL that also allow themers to + * override the function only for the site map page. + * + * Generate the HTML output for a menu tree + * + * @ingroup themeable + */ +function theme_site_map_menu_tree($tree) { + return ''; +} + +/** + * This is a one by one clone of the core theme_menu_item() function that allows + * custom theming of the site map page items. + * + * Generate the HTML output for a menu item and submenu. + * + * @ingroup themeable + */ +function theme_site_map_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { + $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); + if (!empty($extra_class)) { + $class .= ' '. $extra_class; + } + if ($in_active_trail) { + $class .= ' active-trail'; + } + return '
  • '. $link . $menu ."
  • \n"; +} + +/** + * Process variables for site-map.tpl.php. + * + * @see site-map.tpl.php + */ +function template_preprocess_site_map(&$variables) { + $variables['message'] = check_markup(variable_get('site_map_message', ''), variable_get('site_map_message_format', FILTER_FORMAT_DEFAULT)); + + if ((variable_get('site_map_show_rss_links', 1) != 0) && module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) { + $variables['rss_legend'] = theme('site_map_rss_legend'); + } + + if (variable_get('site_map_show_front', 1)) { + $variables['front_page'] = _site_map_front_page(); + } + + if (variable_get('site_map_show_blogs', 1)) { + $variables['blogs'] = _site_map_blogs(); + } + + // Compile the books trees. + if (module_exists('books')) { + $variables['books'] = _site_map_books(); + } + + // Compile the menu trees. + $variables['menus'] = _site_map_menus(); + + if (variable_get('site_map_show_faq', 1)) { + $variables['faq'] = _site_map_faq(); + } + + // Compile the vocabulary trees. + $variables['taxonomys'] = _site_map_taxonomys(); + + // Invoke all custom modules and get themed HTML to be integrated into the site map. + $additional = module_invoke_all('site_map'); + foreach ($additional as $themed_site_map_code) { + $variables['additional'] .= $themed_site_map_code; + } +}