? follow-D7-538172-9.patch
? follow-D7-619276-10.patch
? follow-D7-619276-16.patch
? follow-D7-619276-17.patch
? follow-D7-619276-9.patch
Index: follow.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/follow/follow.install,v
retrieving revision 1.2
diff -u -p -r1.2 follow.install
--- follow.install	30 Oct 2009 21:09:28 -0000	1.2
+++ follow.install	2 Nov 2009 20:25:31 -0000
@@ -10,7 +10,16 @@
  * Implementation of hook_install().
  */
 function follow_install() {
-  drupal_install_schema('follow');
+  return;
+  // @todo: Add a default link to this site's node RSS feed.
+  db_insert('follow_links')
+    ->fields(array(
+      'name' => 'self',
+      'url' => 'rss.xml',
+      'uid' => 0,
+      'weight' => 0,
+    ))
+    ->execute();
 }
 
 /**
@@ -18,20 +27,20 @@ function follow_install() {
  */
 function follow_schema() {
   $schema['follow_links'] = array(
-    'description' => t('Stores sitewide and user follow links.'),
+    'description' => 'Stores sitewide and user follow links.',
     'fields' => array(
       'lid' => array(
         'type' => 'serial',
         'unsigned' => TRUE,
         'not null' => TRUE,
-        'description' => t('Unique identifier for the {follow_links}.'),
+        'description' => 'Unique identifier for the {follow_links}.',
       ),
       'name' => array(
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'default' => '',
-        'description' => t("The machine name of the {follow_links}."),
+        'description' => "The machine name of the {follow_links}.",
       ),
       'uid' => array(
         'type' => 'int',
@@ -51,7 +60,7 @@ function follow_schema() {
         'not null' => TRUE,
         'default' => 0,
         'size' => 'tiny',
-        'description' => t('The weight of this {follow_links}.'),
+        'description' => 'The weight of this {follow_links}.',
       ),
     ),
     'primary key' => array('lid'),
@@ -66,9 +75,13 @@ function follow_schema() {
  * Implementation of hook_uninstall().
  */
 function follow_uninstall() {
-  drupal_uninstall_schema('follow');
   variable_del('follow_user_block_title');
   variable_del('follow_site_block_title');
   variable_del('follow_site_block_user');
+}
+
+function follow_update_7000() {
   cache_clear_all('follow:networks', 'cache');
+  return array();
 }
+
Index: follow.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/follow/follow.module,v
retrieving revision 1.5
diff -u -p -r1.5 follow.module
--- follow.module	30 Oct 2009 22:00:08 -0000	1.5
+++ follow.module	2 Nov 2009 20:25:31 -0000
@@ -104,7 +104,7 @@ function follow_theme() {
   $items = array();
 
   $items['follow_links_form'] = array(
-    'variables' => array('form' => array()),
+    'render element' => 'form',
   );
   $items['follow_links'] = array(
     'variables' => array('links' => array(), 'networks' => array()),
@@ -259,7 +259,7 @@ function _follow_block_content($uid = 0)
   $output = '';
 
   if ($links = follow_links_load($uid)) {
-    $output = theme('follow_links', $links, follow_networks_load());
+    $output = theme('follow_links', array('links' => $links, 'networks' => follow_networks_load($uid)));
     $output .= _follow_block_config_links($uid);
   }
 
@@ -279,11 +279,11 @@ function _follow_block_content($uid = 0)
 function theme_follow_links($variables) {
   $links = $variables['links'];
   $networks = $variables['networks'];
-  $output = '<div class="follow-links clear-block">';
+  $output = '<div class="follow-links clearfix">';
 
   foreach($links as $link) {
     $title = $networks[$link->name];
-    $output .= theme('follow_link', $link, $title);
+    $output .= theme('follow_link', array('link' => $link, 'title' => $title));
   }
 
   $output .= '</div>';
@@ -363,14 +363,14 @@ function _follow_block_config_links($uid
  *
  * @ingroup forms
  */
- function follow_links_form($form, &$form_state, $uid = 0) {
+function follow_links_form($form, &$form_state, $uid = 0) {
   $form = array();
 
   $form['uid'] = array('#type' => 'hidden', '#value' => $uid);
   $form['follow_links']['#tree'] = TRUE;
 
   $links = follow_links_load($uid);
-  $networks = follow_networks_load(TRUE);
+  $networks = follow_networks_load($uid, TRUE);
 
   // Put all our existing links at the top, sorted by weight.
   if (is_array($links)) {
@@ -399,8 +399,7 @@ function _follow_links_form_link($link, 
   $elements = array();
 
   $elements['name'] = array(
-    '#type' => 'markup',
-    '#value' => $title,
+    '#markup' => $title,
   );
   if (isset($link->lid)) {
     $elements['lid'] = array(
@@ -409,7 +408,7 @@ function _follow_links_form_link($link, 
     );
     $elements['weight'] = array(
       '#type' => 'weight',
-      '#default_value' => $links->weight,
+      '#default_value' => $link->weight,
     );
   }
   $elements['url'] = array(
@@ -468,27 +467,26 @@ function follow_links_form_submit($form,
  * @ingroup themeable
  * @ingroup forms
  */
-function theme_follow_links_form($form) {
-  $form = $form['form'];
+function theme_follow_links_form($variables) {
+  $form = $variables['form'];
   $rows = array();
   $disabled_rows = array();
 
   foreach (element_children($form['follow_links']) as $key) {
     $row = array();
-    $disabled_row = array();
 
     if (isset($form['follow_links'][$key]['weight'])) {
       $row[] = drupal_render($form['follow_links'][$key]['lid']) . drupal_render($form['follow_links'][$key]['name']);
       $row[] = drupal_render($form['follow_links'][$key]['url']);
 
       // Now, render the weight row.
-      $form['follow_links'][$key]['weight']['#attributes']['class'] = 'follow-links-weight';
+      $form['follow_links'][$key]['weight']['#attributes']['class'][] = 'follow-links-weight';
       $row[] = drupal_render($form['follow_links'][$key]['weight']);
 
       // Add the new row to our collection of rows, and give it the 'draggable' class.
       $rows[] = array(
         'data' => $row,
-        'class' => 'draggable',
+        'class' => array('draggable'),
       );
     }
     else {
@@ -507,7 +505,7 @@ function theme_follow_links_form($form) 
   if (count($disabled_rows)) {
     $output .= theme('table', array('header' => $disabled_header, 'rows' => $disabled_rows));
   }
-  $output .= drupal_render($form);
+  $output .= drupal_render_children($form);
 
   drupal_add_tabledrag('follow-links-weighted-form', 'order', 'self', 'follow-links-weight');
 
@@ -575,7 +573,6 @@ function follow_link_delete($lid) {
     ->execute();
 }
 
-
 /**
  * Loads all follow networks
  *
@@ -585,29 +582,22 @@ function follow_link_delete($lid) {
  * @return
  *   An array of network names, keys are machine names, values are visible titles.
  */
-function follow_networks_load($reset = FALSE) {
+function follow_networks_load($uid, $reset = FALSE) {
   static $networks = array();
 
   // Clear cache if $reset is TRUE;
   if ($reset) {
     $networks = array();
-    cache_clear_all('follow:networks', 'cache');
   }
   // Return presets if the array is populated.
-  if (!empty($networks)) {
-    return $networks;
+  if (empty($networks[$uid])) {
+    // We call hook_follow_networks_alter() to allow other modules to create
+    // or alter networks.
+    $networks[$uid] = follow_default_networks($uid);
+    drupal_alter('follow_networks', $networks, $uid);
   }
 
-  // Grab from cache or build the array of networks.
-  if (($cache = cache_get('follow:networks', 'cache')) && is_array($cache->data)) {
-    $networks = $cache->data;
-  }
-  else {
-    // We don't have an API to create new networks yet, so for now, we only call hook_follow_networks().
-    $networks = module_invoke_all('follow_networks');
-    cache_set('follow:networks', $networks);
-  }
-  return $networks;
+  return $networks[$uid];
 }
 
 /**
@@ -616,8 +606,8 @@ function follow_networks_load($reset = F
  * @return
  *   An array of network names, keys are machine names, values are visible titles.
  */
-function follow_follow_networks() {
-  return array(
+function follow_default_networks($uid) {
+  $networks = array(
     'facebook'  => t('Facebook'),
     'virb'      => t('Virb'),
     'myspace'   => t('MySpace'),
@@ -632,4 +622,8 @@ function follow_follow_networks() {
     'delicious' => t('Delicious'),
     'tumblr'    => t('Tumblr'),
   );
+  if ($uid == 0) {
+    $networks['self'] = t('This site');
+  }
+  return $networks;
 }
