nid) { case 322: // Mailing list subscription $extra = drupal_get_form('lists_subscribe_form'); break; case 13355: // Site maintainers $extra = drupalorg_handbook_site_maintainers(); break; case 109372: // Handbook maintainers $extra = drupalorg_handbook_maintainers(); break; case 263594: // Revision maintainers $extra = drupalorg_handbook_revision_maintainers(); break; case 23192: // Recent updates $extra = drupalorg_handbook_display_recent_updates(); break; } $node->content['body']['#value'] .= $extra; if (drupalorg_crosssite_section() === 'documentation' && isset($node->book['bid'])) { // Prepend the handbook meta data to book bodies. $node->content['body']['#value'] = drupalorg_handbook_meta_data($node) . $node->content['body']['#value']; } } elseif (($op == 'update' || $op == 'insert') && !empty($node->book) && !empty($node->book['bid'])) { // Remove all cached versions of recently updated data (home & node 23192). cache_clear_all('drupalorg_handbook_recent_updates_', 'cache', TRUE); } } /** * Implementation of hook_form_alter(). */ function drupalorg_handbook_form_alter(&$form, $form_state, $form_id) { // Force a revision log entry when editing existing book nodes. if ($form_id == 'book_node_form' && isset($form['revision_information']['log']) && arg(1) != 'add') { $form['revision_information']['log']['#required'] = TRUE; $form['revision_information']['#collapsed'] = FALSE; } } /** * Gather information for the top of handbook pages. * * @param $node * The node object. * @return * The HTML code for the book meta information. */ function drupalorg_handbook_meta_data($node) { $info = array(); if (count($node->taxonomy)) { $vocabularies = taxonomy_get_vocabularies(); // Group the terms by vid. $taxonomy = array(); foreach ($node->taxonomy as $term_id => $term) { if (isset($vocabularies[$term->vid])) { $term->rendered = TRUE; if ($term_id !== 125) { // No known problems is uninteresting $taxonomy[$term->vid][] = $term; } } } foreach ($vocabularies as $vocabulary) { if (isset($taxonomy[$vocabulary->vid])) { $links = array(); foreach ($taxonomy[$vocabulary->vid] as $term) { $options = array(); if ($vocabulary->vid === '31') { // Page status $options['attributes'] = array('class' => 'alert'); } $links[] = l($term->name, taxonomy_term_path($term), $options); } $info[check_plain($vocabulary->name)] = implode(', ', $links); } } } $modified = format_date($node->changed, 'custom', 'F j, Y'); return theme('drupalorg_handbook_meta_data', $info, $modified); } /** * List usernames with site maintainer role. */ function drupalorg_handbook_site_maintainers() { $output = 'If you have been around for a while, and you want to help maintain Drupal.org and are willing to accept the added responsibilities that come with it, sign up on the Infrastructure team list.'; $output .= '
If you are interested in helping maintain/update/correct the documentation on Drupal.org, read up on the many ways to get involved.
'; $output .= 'Note: Many of our site maintainers also participate on the documentation team and are not listed here. Due to their broader responsibilities on drupal.org, site maintainers are listed separately.
'; $output .= '' . t('The Drupal.org online documentation is written by the Drupal community in co-operation with the Documentation Team. When you are logged in, you can:', array('@docteam_url' => url('node/24572'))) . '
' . '' . t('Edit most Documentation pages by clicking “Edit” at the top of the page.') . '
' . '' . t('Add new pages by using the “add a child page” link at the bottom of the page.') . '
' . '' . t('Use the Documentation issue queue to propose major changes and report problems.', array('@issues-url' => url('project/issues/documentation'))) . '
' ); break; } } } /** * Check whether the current node is a block module. * * Based on Drupal 6 code from book_block(). */ function drupalorg_handbook_block_is_visible() { return ($node = menu_get_object()) && !empty($node->book['bid']); } /** * Implementation of hook_theme(). */ function drupalorg_handbook_theme($existing, $type, $theme, $path) { return array( 'drupalorg_handbook_meta_data' => array( 'arguments' => array( 'info' => NULL, 'modified' => NULL, ), 'template' => 'handbook-meta-data', ), ); } /** * Implementation of template_preprocess_drupalorg_home(). * * @todo * Add caching. */ function drupalorg_handbook_preprocess_drupalorg_home(&$vars) { // Represents the number of results to retrieve. Also utilized for cache field name. $count = 5; if ($cache = cache_get('drupalorg_handbook_recent_updates_' . $count)) { $recent_updates = $cache->data; } else { $result = drupalorg_handbook_get_recent_updates($count); $recent_updates = ''; while ($node = db_fetch_object($result)) { // Fake the created time for the theme function, so we can easily theme it. $node->created = $node->changed; $recent_updates .= ''. theme('node_submitted', $node) .'
'; } $recent_updates .= '' . l(t('More updates…'), 'handbook/updates') .'
'; cache_set('drupalorg_handbook_recent_updates_' . $count, $recent_updates); } // We have no place to link this to in a nice way. // $fresh_news .= ''. l(t('More documentation updates...'), '...') .'
'; $vars['tab_content_docs'] = $recent_updates; }