? form-license-130054-11.patch
? form-license-130054-9.patch
? no-php-nodes.patch
Index: drupalorg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.module,v
retrieving revision 1.19
diff -u -p -r1.19 drupalorg.module
--- drupalorg.module	12 Apr 2008 19:57:55 -0000	1.19
+++ drupalorg.module	26 May 2008 23:41:35 -0000
@@ -153,3 +153,100 @@ function drupalorg_project_page_link_alt
   // Link to security handbook page.
   $all_links['support']['links']['report_security_issue'] = l(t('Report a security issue'), 'security-team');
 }
+
+/**
+ * Implemenation of hook_nodeapi().
+ *
+ * Generate dynamic content for certain node pages, so as to avoid using PHP
+ * format nodes.
+ */
+function drupalorg_nodeapi(&$node, $op, $teaser, $page) {
+  
+  if ($op == 'view' && !$teaser) {
+    $output = '';
+    $function = 'drupalorg_'. $node->nid .'_view';
+    if (function_exists($function)) {
+      $output .= $function($function, $node, $teaser, $page);
+    }
+    if ($output) {
+      $node->content['drupalorg'] = array(
+        '#value' => $output,
+        '#weight' => 10,
+      );
+    }
+  }
+  elseif (($op == 'insert' || $op == 'update') && $node->type == 'book') {
+    cache_clear_all('handbook:drupalorg', 'cache', TRUE);
+  }
+}
+
+/**
+ * Generate the list of handbook contributors to append to node/14205.
+ */
+function drupalorg_14205_view($function) {
+  $cid = 'handbook:'. $function;
+  $saved = cache_get($cid);
+  if (isset($saved->data)) {
+    $output = $saved->data;
+  }
+  else {
+    $result = db_query("SELECT u.uid, u.name, COUNT(n.nid) AS pages FROM node n INNER JOIN users u ON n.uid = u.uid WHERE n.type = 'book' AND n.status = 1 GROUP BY u.uid ORDER BY pages DESC");
+    $list = array();
+    while ($contributor = db_fetch_object($result)) {
+      $list[] = theme('username', $contributor) ." (". format_plural($contributor->pages, "1 page", "$contributor->pages pages") .")";
+    }
+    $output = theme('item_list', $list);
+    cache_set($cid, 'cache', $output);
+  }
+  return $output;
+}
+
+/**
+ * Generate the list of Most popular handbook pages to append to node/43639.
+ */
+function drupalorg_43639_view($function) {
+  $cid = 'handbook:'. $function;
+  $saved = cache_get($cid);
+  if (isset($saved->data)) {
+    $output = $saved->data;
+  }
+  else {
+    // TODO
+    cache_set($cid, 'cache', $output);
+  }
+  return $output;
+}
+
+/**
+ * Generate the list of Handbook pages with comments to append to node/43633.
+ */
+function drupalorg_43633_view($function) {
+  $cid = 'handbook:'. $function;
+  $saved = cache_get($cid);
+  if (isset($saved->data)) {
+    $output = $saved->data;
+  }
+  else {
+    // TODO
+    cache_set($cid, 'cache', $output);
+  }
+  
+  return $output;
+}
+
+/**
+ * Generate the Coding standards to append to node/318.
+ */
+function drupalorg_318_view($function) {
+  $cid = 'handbook:'. $function;
+  $saved = cache_get($cid);
+  if (isset($saved->data)) {
+    $output = $saved->data;
+  }
+  else {
+    // TODO
+    cache_set($cid, 'cache', $output);
+  }
+  return $output;
+}
+
