Only in /Users/cweagans/Sites/podcasting.dev/sites/default/files/coder_upgrade/old/spaces: CVS
Only in images: CVS
Only in includes: CVS
Only in plugins: CVS
diff -up -r spaces.info spaces.info
--- spaces.info	2008-10-06 15:56:40.000000000 -0600
+++ spaces.info	2011-02-21 19:48:10.000000000 -0700
@@ -2,7 +2,7 @@
 name = "Spaces"
 description = "Provides a customizable spaces layer on top of Drupal."
 package = "Spaces"
-core = "6.x"
+core = 7.x
 dependencies[] = views
 dependencies[] = context
 dependencies[] = context_ui
diff -up -r spaces.install spaces.install
--- spaces.install	2008-10-06 15:56:40.000000000 -0600
+++ spaces.install	2011-02-21 19:48:10.000000000 -0700
@@ -2,17 +2,25 @@
 // $Id: spaces.install,v 1.3 2008/10/06 21:56:40 yhahn Exp $
 
 /**
- * Implementaton of hook_install().
+ * @file
+ * Install, update and uninstall functions for the spaces module.
+ *
+ */
+
+/**
+ * Implements hook_install().
  */
 function spaces_install() {
-  drupal_install_schema('spaces');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_install_schema('spaces')
 }
 
 /**
- * Implementation of hook_uninstall()
+ * Implements hook_uninstall().
  */
 function spaces_uninstall() {
-  drupal_uninstall_schema('spaces');
+  // TODO The drupal_(un)install_schema functions are called automatically in D7.
+  // drupal_uninstall_schema('spaces')
 
   // Delete variables
   $variables = array();
@@ -22,15 +30,15 @@ function spaces_uninstall() {
 }
 
 /**
- * Implementation of hook_schema()
+ * Implements hook_schema().
  */
 function spaces_schema() {
   $schema = array();
   $schema['spaces'] = array(
-    'description' => t('spaces.'),
+    'description' => 'spaces.',
     'fields' => array(
       'sid' => array(
-        'description' => t('The space id.'),
+        'description' => 'The space id.',
         'type' => 'int',
         'size' => 'tiny',
         'unsigned' => TRUE,
@@ -38,19 +46,19 @@ function spaces_schema() {
         'default' => 0,
       ),
       'type' => array(
-        'description' => t('The space type.'),
+        'description' => 'The space type.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'preset' => array(
-        'description' => t('The space preset.'),
+        'description' => 'The space preset.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'customizer' => array(
-        'description' => t('The spaces customizer stored as a serialized array.'),
+        'description' => 'The spaces customizer stored as a serialized array.',
         'type' => 'text',
         'size' => 'big',
       ),
@@ -60,33 +68,33 @@ function spaces_schema() {
     ),
   );
   $schema['spaces_presets'] = array(
-    'description' => t('spaces presets.'),
+    'description' => 'spaces presets.',
     'fields' => array(
       'type' => array(
-        'description' => t('The space type for which this preset applies.'),
+        'description' => 'The space type for which this preset applies.',
         'type' => 'varchar',
         'length' => '64',
         'not null' => TRUE,
       ),
       'id' => array(
-        'description' => t('The preset string identifier.'),
+        'description' => 'The preset string identifier.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'name' => array(
-        'description' => t('The human-readable name for this preset.'),
+        'description' => 'The human-readable name for this preset.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'description' => array(
-        'description' => t('The description for this preset.'),
+        'description' => 'The description for this preset.',
         'type' => 'text',
         'size' => 'big',
       ),
       'value' => array(
-        'description' => t('A serialized array that represents this preset\'s definition.'),
+        'description' => 'A serialized array that represents this preset\'s definition.',
         'type' => 'text',
         'size' => 'big',
       ),
@@ -96,10 +104,10 @@ function spaces_schema() {
     ),
   );
   $schema['spaces_settings'] = array(
-    'description' => t('spaces settings.'),
+    'description' => 'spaces settings.',
     'fields' => array(
       'sid' => array(
-        'description' => t('The space id.'),
+        'description' => 'The space id.',
         'type' => 'int',
         'size' => 'tiny',
         'unsigned' => TRUE,
@@ -107,18 +115,18 @@ function spaces_schema() {
         'default' => 0,
       ),
       'type' => array(
-        'description' => t('The space type.'),
+        'description' => 'The space type.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'id' => array(
-        'description' => t('The spaces setting identifer.'),
+        'description' => 'The spaces setting identifer.',
         'type' => 'text',
         'size' => 'big',
       ),
       'value' => array(
-        'description' => t('A serialized array that represents this setting\'s custom value(s).'),
+        'description' => 'A serialized array that represents this setting\'s custom value(s).',
         'type' => 'text',
         'size' => 'big',
       ),
@@ -128,10 +136,10 @@ function spaces_schema() {
     ),
   );
   $schema['spaces_features'] = array(
-    'description' => t('spaces features.'),
+    'description' => 'spaces features.',
     'fields' => array(
       'sid' => array(
-        'description' => t('The space id.'),
+        'description' => 'The space id.',
         'type' => 'int',
         'size' => 'tiny',
         'unsigned' => TRUE,
@@ -139,18 +147,18 @@ function spaces_schema() {
         'default' => 0,
       ),
       'type' => array(
-        'description' => t('The space type.'),
+        'description' => 'The space type.',
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
       ),
       'id' => array(
-        'description' => t('The spaces feature identifer.'),
+        'description' => 'The spaces feature identifer.',
         'type' => 'text',
         'size' => 'big',
       ),
       'value' => array(
-        'description' => t('A serialized array that represents this feature\'s custom value(s).'),
+        'description' => 'A serialized array that represents this feature\'s custom value(s).',
         'type' => 'text',
         'size' => 'big',
       ),
diff -up -r spaces.module spaces.module
--- spaces.module	2008-10-06 15:56:40.000000000 -0600
+++ spaces.module	2011-02-21 19:48:11.000000000 -0700
@@ -3,33 +3,38 @@
 
 // include_once(drupal_get_path('module', 'spaces') .'/spaces_views.inc');
 
-define('SPACES_ARCHIVE_TIMESTAMP', 60*60*24*14); // 2 weeks
+define('SPACES_ARCHIVE_TIMESTAMP', 60 * 60 * 24 * 14); // 2 weeks
 define('SPACES_FEATURE_DISABLED', 0);
 
 /**
- * Implementation of hook_init().
+ * Implements hook_init().
  */
 function spaces_init() {
   spaces_router('menu');
-  if ((strpos($_GET['q'], 'admin/build/spaces') === 0)) {
-    include_once(drupal_get_path('module', 'spaces') .'/spaces_admin.inc');
+  if ((strpos($_GET['q'], 'admin/structure/spaces') === 0)) {
+    include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'spaces') . '/spaces_admin.inc';
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function spaces_perm() {
-  return array('administer spaces');
+function spaces_permission() {
+  return array(
+    'administer spaces' => array(
+      'title' => t('administer spaces'),
+      'description' => t('TODO Add a description for \'administer spaces\''),
+    ),
+  );
 }
 
 /**
- * Implementation of hook_context_prefix_provider().
+ * Implements hook_context_prefix_provider().
  */
 function spaces_context_prefix_provider() {
   $items = array();
-  foreach(spaces_types() as $type => $info) {
-    $items['spaces_'. $type] = array(
+  foreach (spaces_types() as $type => $info) {
+    $items['spaces_' . $type] = array(
       'name' => $info['title'],
       'description' => t('Sets a spaces context.'),
       'callback' => 'spaces_init_context',
@@ -60,48 +65,48 @@ function spaces_init_context($type, $sid
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function spaces_menu() {
   $items = array();
-  $items['admin/build/spaces'] = array(
+  $items['admin/structure/spaces'] = array(
     'title' => t('Spaces presets'),
     'description' => t('Create and configure spaces for your site.'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_preset_default_form'),
     'access callback' => 'user_access',
     'access arguments' => array('administer spaces'),
-    'file' => 'spaces_admin.inc',    
+    'file' => 'spaces_admin.inc',
     'type' => MENU_NORMAL_ITEM,
   );
-  $items['admin/build/spaces/presets'] = array(
+  $items['admin/structure/spaces/presets'] = array(
     'title' => t('Presets'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_preset_default_form'),
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -1,
   );
-  $items['admin/build/spaces/presets/add'] = array(
+  $items['admin/structure/spaces/presets/add'] = array(
     'title' => t('Add'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_preset_form', 'add'),
     'type' => MENU_CALLBACK,
   );
-  $items['admin/build/spaces/presets/edit'] = array(
+  $items['admin/structure/spaces/presets/edit'] = array(
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_preset_form', 'edit'),
     'type' => MENU_CALLBACK,
   );
-  $items['admin/build/spaces/presets/delete'] = array(
+  $items['admin/structure/spaces/presets/delete'] = array(
     'page callback' => 'drupal_get_form',
     'age arguments' => array('spaces_preset_delete_form'),
     'type' => MENU_CALLBACK,
   );
-  $items['admin/build/spaces/presets/disable'] = array(
+  $items['admin/structure/spaces/presets/disable'] = array(
     'page callback' => '_spaces_preset_disable_page',
     'type' => PAGE_CALLBACK,
   );
-  $items['admin/build/spaces/presets/enable'] = array(
+  $items['admin/structure/spaces/presets/enable'] = array(
     'page callback' => '_spaces_preset_enable_page',
     'type' => PAGE_CALLBACK,
   );
@@ -109,7 +114,7 @@ function spaces_menu() {
 }
 
 /**
- *  Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function spaces_theme() {
   $items = array();
@@ -123,60 +128,75 @@ function spaces_theme() {
 }
 
 /**
- *  Implementation of hook_user().
+ * Implements hook_user().
  */
-function spaces_user($op, &$edit, &$account, $category = NULL) {
+function spaces_user_OLD($op, &$edit, &$account, $category = NULL) {
+  // TODO Remaining code in this function needs to be moved to the appropriate new hook function.
   if (in_array($op, array('view', 'form'))) {
     spaces_router('user view', $account);
   }
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_node_view().
  */
-function spaces_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  switch ($op) {
-    case 'view':
-      if ($page && !$teaser && arg(0) == 'node' && arg(1) == $node->nid) {
-        spaces_router('node view', $node);
-      }
-      break;
+function spaces_node_view($node, $view_mode = 'full') {
+  if ($page && !$teaser && arg(0) == 'node' && arg(1) == $node->nid) {
+    spaces_router('node view', $node);
   }
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_nodeapi().
+ */
+function spaces_nodeapi_OLD(&$node, $op, $teaser = NULL, $page = NULL) { }
+
+/**
+ * Implements hook_form_alter().
  */
 function spaces_form_alter(&$form, $form_state, $form_id) {
-  if ($form['#id'] == 'node-form' && (arg(0) .'/'. arg(1) != 'admin/content')) {
+  if ($form['#id'] == 'node-form' && (arg(0) . '/' . arg(1) != 'admin/content')) {
     spaces_router('node form', $form['#node']);
   }
 }
 
 /**
- * Implementation of hook_block()
+ * Implements hook_block_info().
  */
-function spaces_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[1]['info'] = t('Spaces: Contextual Tools');
-    $blocks[2]['info'] = t('Spaces: Navigation');
-    $blocks[3]['info'] = t('Spaces: Utility links');
+function spaces_block_info() {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
+    $blocks['delta-1']['info'] = t('Spaces: Contextual Tools');
+    $blocks['delta-2']['info'] = t('Spaces: Navigation');
+    $blocks['delta-3']['info'] = t('Spaces: Utility links');
     return $blocks;
   }
-  else if ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function spaces_block_view($delta) {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
     switch ($delta) {
-      case 1:
+      case 'delta-1':
         return _spaces_block_tools();
-      case 2:
+      case 'delta-2':
         return _spaces_block_nav();
-      case 3:
+      case 'delta-3':
         return _spaces_block_utility_links();
     }
   }
 }
 
 /**
- * Implementation of hook_context_define()
+ * Implements hook_block().
+ */
+function spaces_block_OLD($op = 'list', $delta = 0) { }
+
+/**
+ * Implements hook_context_define().
  *
  *  hook_context_define provides a central method to define contextual behavior. The spaces
  *  module extends this hook in the "spaces" key namespace. Available attributes are:
@@ -191,7 +211,7 @@ function spaces_context_define() {
 }
 
 /**
- * Implementation of hook_spaces_settings().
+ * Implements hook_spaces_settings().
  */
 function spaces_spaces_settings() {
   return array(
@@ -200,7 +220,7 @@ function spaces_spaces_settings() {
 }
 
 /**
- * Implementation of hook_spaces_customizers().
+ * Implements hook_spaces_customizers().
  */
 function spaces_spaces_customizers() {
   return array(
@@ -210,7 +230,7 @@ function spaces_spaces_customizers() {
 }
 
 /**
- * Implementation of hook_views_pre_query().
+ * Implements hook_views_pre_query().
  */
 function spaces_views_pre_query(&$view) {
   // Make spaces filter'd views non-cacheable
@@ -343,7 +363,7 @@ interface space {
    *
    * @param $values
    *   The submitted values.
-   * 
+   *
    * @return array
    *   An array of values.
    */
@@ -415,7 +435,7 @@ class space_setting_home implements spac
     // Exclude space "prototypes" (like that used for the preset form)
     if ($space->sid) {
       if (!$value && is_array($space->features) && (array_sum($space->features) != 0)) {
-        form_set_error('settings]['. $this->id, t('You must select a homepage for this space.'));
+        form_set_error('settings][' . $this->id, t('You must select a homepage for this space.'));
       }
     }
   }
@@ -559,7 +579,7 @@ class space_customizer_views implements 
  *
  * @param $type
  *   The type of the space to be loaded. Must be one of the keys in the
- *   array returned by spaces_types(). 
+ *   array returned by spaces_types().
  * @param $sid
  *   The id of the space to be loaded. If omitted, a "prototype" space
  *   will be constructed.
@@ -570,57 +590,62 @@ class space_customizer_views implements 
  * @return
  *   The requested space object or FALSE if something went wrong.
  */
-function spaces_load($type, $sid = NULL, $is_active = FALSE) {
-  $types = spaces_types();
-  if (isset($types[$type])) {
-    $class = $types[$type]['class'];
+function spaces_load($types, $sid = NULL, $is_active = FALSE) {
+  foreach ($types as $nid => &$type) {
+    $types = spaces_types();
+    if (isset($types[$type])) {
+      $class = $types[$type]['class'];
 
-    // Create a new space object
-    $space = new $class($type, $sid, $is_active);
+      // Create a new space object
+      $space = new $class($type, $sid, $is_active);
 
-    // Initialize various space variables
-    $space->type = $type;
-    $space->features = array();
-    $space->settings = array();
-    $space->customizer = array();
-
-    // Initialize space specific settings if $sid is provided
-    if ($sid) {
-      $space->sid = $sid;
-      if ($prefix = context_prefix_api('load', array('provider' => 'spaces_'. $type, 'id' => $sid))) {
-        $space->prefix = $prefix['prefix'];
-      }
+      // Initialize various space variables
+      $space->type = $type;
+      $space->features = array();
+      $space->settings = array();
+      $space->customizer = array();
+
+      // Initialize space specific settings if $sid is provided
+      if ($sid) {
+        $space->sid = $sid;
+        if ($prefix = context_prefix_api('load', array('provider' => 'spaces_' . $type, 'id' => $sid))) {
+          $space->prefix = $prefix['prefix'];
+        }
 
-      // Load features
-      $result = db_query('SELECT id, value FROM {spaces_features} WHERE sid = %d AND type = "%s"', $sid, $type);
-      while ($row = db_fetch_object($result)) {
-        $space->features[$row->id] = $row->value;
-      }
+        // Load features
+        $result = db_query('SELECT id, value FROM {spaces_features} WHERE sid = :sid AND type = :type', array(':sid' => $sid, ':type' => $type));
+        while ($row = db_fetch_object($result)) {
+          $space->features[$row->id] = $row->value;
+        }
 
-      // Load settings
-      $result = db_query('SELECT id, value FROM {spaces_settings} WHERE sid = %d AND type = "%s"', $sid, $type);
-      while ($row = db_fetch_object($result)) {
-        $space->settings[$row->id] = unserialize($row->value);
-      }
+        // Load settings
+        $result = db_query('SELECT id, value FROM {spaces_settings} WHERE sid = :sid AND type = :type', array(':sid' => $sid, ':type' => $type));
+        while ($row = db_fetch_object($result)) {
+          $space->settings[$row->id] = unserialize($row->value);
+        }
 
-      // Load customizer & preset
-      $row = db_fetch_object(db_query("SELECT customizer, preset FROM {spaces} WHERE sid = %d AND type = '%s'", $space->sid, $space->type));
-      $space->customizer = $row->customizer ? unserialize($row->customizer) : array();
-
-      // Enforce preset or use default if not found
-      $default_presets = variable_get('spaces_default_presets', array());
-      if ($row->preset) {
-        $space->preset = $row->preset;
-      }
-      else if ($space->preset == NULL && isset($default_presets[$type])) {
-        $space->preset = $default_presets[$type];
-        spaces_preset_enforce($space);
+        // Load customizer & preset
+        $row = db_fetch_object(db_query("SELECT customizer, preset FROM {spaces} WHERE sid = :sid AND type = :type", array(':sid' => $space->sid, ':type' => $space->type)));
+        $space->customizer = $row->customizer ? unserialize($row->customizer) : array();
+
+        // Enforce preset or use default if not found
+        $default_presets = variable_get('spaces_default_presets', array());
+        if ($row->preset) {
+          $space->preset = $row->preset;
+        }
+        else if ($space->preset == NULL && isset($default_presets[$type])) {
+          $space->preset = $default_presets[$type];
+          spaces_preset_enforce($space);
+        }
       }
-    }
 
-    return $space;
+      return $space;
+    }
+    $node_additions = false;
+    foreach ($node_additions as $property => &$value) {
+      $type->$property = $value;
+    }
   }
-  return false;
 }
 
 /**
@@ -638,33 +663,72 @@ function spaces_save($space) {
     spaces_preset_enforce($space);
 
     // Update features
-    db_query("DELETE FROM {spaces_features} WHERE sid = %d AND type = '%s'", $space->sid, $space->type);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {spaces_features} WHERE sid = %d AND type = '%s'", $space->sid, $space->type) */
+    db_delete('spaces_features')
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
     $valid = spaces_features($space->type);
     foreach ($space->features as $feature => $value) {
       if (isset($valid[$feature])) {
         $values = array($space->sid, $space->type, $feature, $value);
-        db_query('INSERT INTO {spaces_features} (sid, type, id, value) VALUES (%d, "%s", "%s", "%s")', $values);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('INSERT INTO {spaces_features} (sid, type, id, value) VALUES (%d, "%s", "%s", "%s")', $values) */
+        $id = db_insert('spaces_features')
+  ->fields(array(
+          'sid' => $values['0'],
+          'type' => $values['1'],
+          'id' => $values['2'],
+          'value' => $values['3'],
+        ))
+  ->execute();
       }
     }
 
     // Update settings
-    db_query("DELETE FROM {spaces_settings} WHERE sid = %d AND type = '%s'", $space->sid, $space->type);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("DELETE FROM {spaces_settings} WHERE sid = %d AND type = '%s'", $space->sid, $space->type) */
+    db_delete('spaces_settings')
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
     $valid = spaces_settings();
     foreach ($space->settings as $setting => $value) {
       if (isset($valid[$setting])) {
         $value = serialize($value);
         $values = array($space->sid, $space->type, $setting, $value);
-        db_query('INSERT INTO {spaces_settings} (sid, type, id, value) VALUES (%d, "%s", "%s", "%s")', $values);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('INSERT INTO {spaces_settings} (sid, type, id, value) VALUES (%d, "%s", "%s", "%s")', $values) */
+        $id = db_insert('spaces_settings')
+  ->fields(array(
+          'sid' => $values['0'],
+          'type' => $values['1'],
+          'id' => $values['2'],
+          'value' => $values['3'],
+        ))
+  ->execute();
       }
     }
 
     // Update preset & customizer
-    $exists = db_result(db_query("SELECT count(sid) FROM {spaces} WHERE sid = %d AND type = '%s'", $space->sid, $space->type));
+    $exists = db_query("SELECT count(sid) FROM {spaces} WHERE sid = :sid AND type = :type", array(':sid' => $space->sid, ':type' => $space->type))->fetchField();
     if ($exists) {
-      db_query("UPDATE {spaces} SET preset = '%s', customizer = '%s' WHERE sid = %d AND type = '%s'", $space->preset, serialize($space->customizer), $space->sid, $space->type);
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {spaces} SET preset = '%s', customizer = '%s' WHERE sid = %d AND type = '%s'", $space->preset, serialize($space->customizer), $space->sid, $space->type) */
+      db_update('spaces')
+  ->fields(array(
+        'preset' => $space->preset,
+        'customizer' => serialize($space->customizer),
+      ))
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
     }
     else {
-      db_query("INSERT INTO {spaces} (sid, type, preset, customizer) VALUES(%d, '%s', '%s', '%s')", $space->sid, $space->type, $space->preset, serialize($space->customizer));
+      // TODO Please convert this statement to the D7 database API syntax.
+      /* db_query("INSERT INTO {spaces} (sid, type, preset, customizer) VALUES(%d, '%s', '%s', '%s')", $space->sid, $space->type, $space->preset, serialize($space->customizer)) */
+      NULL;
     }
 
     // Save context prefix if space type allows prefix customization
@@ -674,12 +738,12 @@ function spaces_save($space) {
       // We need to concatenate the type/sid so that collisions between
       // space types do not occur.
       $prefix = array(
-        'provider' => 'spaces_'. $space->type,
+        'provider' => 'spaces_' . $space->type,
         'id' => $space->sid,
       );
       context_prefix_api('delete', $prefix);
       $prefix['prefix'] = $space->prefix;
-      context_prefix_api('insert', $prefix);      
+      context_prefix_api('insert', $prefix);
     }
 
     // Allow space type to do its own saving
@@ -701,12 +765,30 @@ function spaces_save($space) {
  */
 function spaces_delete($space) {
   // Remove all features and settings
-  db_query("DELETE FROM {spaces} WHERE sid = %d AND type = '%s'", $space->sid, $space->type);
-  db_query("DELETE FROM {spaces_features} WHERE sid = %d AND type = '%s'", $space->sid, $space->type);
-  db_query("DELETE FROM {spaces_settings} WHERE sid = %d AND type = '%s'", $space->sid, $space->type);
-  
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {spaces} WHERE sid = %d AND type = '%s'", $space->sid, $space->type) */
+  db_delete('spaces')
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {spaces_features} WHERE sid = %d AND type = '%s'", $space->sid, $space->type) */
+  db_delete('spaces_features')
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {spaces_settings} WHERE sid = %d AND type = '%s'", $space->sid, $space->type) */
+  db_delete('spaces_settings')
+  ->condition('sid', $space->sid)
+  ->condition('type', $space->type)
+  ->execute();
+
   // Clear the prefix path from the context_prefix table
-  $prefix = array('provider' => 'spaces_'. $space->type, 'id'   => $space->sid);
+  $prefix = array(
+    'provider' => 'spaces_' . $space->type,
+    'id' => $space->sid,
+  );
   context_prefix_api('delete', $prefix);
 
   // Allow space type to do its own deleting
@@ -726,7 +808,7 @@ function spaces_preset_enforce(&$space) 
     // Enforce features
     if (is_array($preset['features'])) {
       foreach ($preset['features'] as $feature => $value) {
-        if ($preset['locked']['features'][$feature] || !isset($space->features[$feature])) {        
+        if ($preset['locked']['features'][$feature] || !isset($space->features[$feature])) {
           $space->features[$feature] = $value;
         }
       }
@@ -735,14 +817,14 @@ function spaces_preset_enforce(&$space) 
     // Enforce settings
     if (is_array($preset['settings'])) {
       foreach ($preset['settings'] as $setting => $value) {
-        if ($preset['locked']['settings'][$setting] || !isset($space->features[$setting])) {        
+        if ($preset['locked']['settings'][$setting] || !isset($space->features[$setting])) {
           $space->settings[$setting] = $value;
         }
       }
     }
 
     // Type-specific presets
-    $space->preset_enforce($preset);    
+    $space->preset_enforce($preset);
   }
 }
 
@@ -815,9 +897,9 @@ function spaces_presets($type = NULL, $i
     }
 
     // Collect presets provided by modules in code
-    foreach(module_implements('spaces_presets') as $module) {
-      $items = call_user_func($module .'_spaces_presets');
-      foreach($items as $id => $preset) {
+    foreach (module_implements('spaces_presets') as $module) {
+      $items = call_user_func($module . '_spaces_presets');
+      foreach ($items as $id => $preset) {
         $presets[$preset['type']][$id] = array(
           'name' => $preset['name'],
           'description' => $preset['description'],
@@ -839,7 +921,7 @@ function spaces_presets($type = NULL, $i
       }
     }
   }
-  
+
   if ($type) {
     return isset($return[$type]) ? $return[$type] : array();
   }
@@ -982,7 +1064,7 @@ function spaces_settings($reset = FALSE)
   if (!isset($settings) || $reset) {
     $settings = array();
     foreach (module_implements('spaces_settings') as $module) {
-      $function = $module .'_spaces_settings';
+      $function = $module . '_spaces_settings';
       $settings = array_merge($settings, $function());
     }
   }
@@ -1012,7 +1094,7 @@ function spaces_customizers($reset = FAL
  *
  * @param $reset
  *   Optional boolean flag for resetting the static cache.
- * 
+ *
  * @return
  *   Keyed array where $nodetype => $feature.
  */
@@ -1020,7 +1102,7 @@ function spaces_content_types($reset = F
   static $map;
   if (!isset($map) || $reset) {
     $map = array();
-    $features = spaces_features();    
+    $features = spaces_features();
     foreach ($features as $id => $feature) {
       if (is_array($feature->node)) {
         foreach ($feature->node as $type) {
@@ -1084,7 +1166,7 @@ function spaces_features_menu() {
       while ($depth >= 1) {
         foreach ($menu as $path => $item) {
           if ($item['depth'] == $depth) {
-            $args = implode('/', array_slice($item['args'], 0, ($depth-1)));
+            $args = implode('/', array_slice($item['args'], 0, ($depth -1)));
             if ($depth > 1) {
               if (isset($menu[$args])) {
                 unset($item['depth']);
@@ -1095,7 +1177,7 @@ function spaces_features_menu() {
             }
             else {
               unset($menu[$path]['args']);
-              unset($menu[$path]['depth']); 
+              unset($menu[$path]['depth']);
             }
           }
         }
@@ -1187,10 +1269,10 @@ function spaces_admin_access($type = NUL
  */
 function spaces_active_space_menu($type, $local_tasks = FALSE, $path_prefix = '') {
   $types = spaces_types();
-  $path_prefix = !empty($path_prefix) ? $path_prefix .'/' : '';
+  $path_prefix = !empty($path_prefix) ? $path_prefix . '/' : '';
 
   if ($local_tasks == FALSE) {
-    $items[$path_prefix. 'spaces'] = array(
+    $items[$path_prefix . 'spaces'] = array(
       'title' => t('!space_type settings', array('!space_type' => $types[$space->type]['title'])),
       'page callback' => 'drupal_get_form',
       'page arguments' => array('spaces_basic_form'),
@@ -1201,7 +1283,7 @@ function spaces_active_space_menu($type,
     );
   }
   else {
-    $items[$path_prefix. 'spaces'] = array(
+    $items[$path_prefix . 'spaces'] = array(
       'title' => t('Spaces'),
       'page callback' => 'drupal_get_form',
       'page arguments' => array('spaces_basic_form'),
@@ -1212,7 +1294,7 @@ function spaces_active_space_menu($type,
       'weight' => 1,
     );
   }
-  $items[$path_prefix. 'spaces/setup'] = array(
+  $items[$path_prefix . 'spaces/setup'] = array(
     'title' => t('Basic setup'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_basic_form'),
@@ -1222,7 +1304,7 @@ function spaces_active_space_menu($type,
     'file' => 'spaces_admin.inc',
     'weight' => 0,
   );
-  $items[$path_prefix. 'spaces/features'] = array(
+  $items[$path_prefix . 'spaces/features'] = array(
     'title' => t('Features'),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('spaces_features_form'),
@@ -1232,7 +1314,7 @@ function spaces_active_space_menu($type,
     'file' => 'spaces_admin.inc',
     'weight' => 1,
   );
-  $items[$path_prefix. 'spaces/customize'] = array(
+  $items[$path_prefix . 'spaces/customize'] = array(
     'title' => t('Customize'),
     'page callback' => 'spaces_customize',
     'page arguments' => array(),
@@ -1282,7 +1364,7 @@ function spaces_node_links() {
       }
     }
   }
-  foreach(module_implements('spaces_node_links_alter') as $module) {
+  foreach (module_implements('spaces_node_links_alter') as $module) {
     // It would be best to use_call_user_func(), but this makes most
     // sense passed by reference...
     $function = $module . '_spaces_node_links_alter';
@@ -1294,7 +1376,8 @@ function spaces_node_links() {
 /**
  * Theme function for spaces_node_links
  */
-function theme_spaces_node_links($links) {
+function theme_spaces_node_links() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   $output = '';
   foreach ($links as $link) {
     $options = array(
@@ -1305,7 +1388,7 @@ function theme_spaces_node_links($links)
       $output .= l($link['title'], $link['href'], $options);
     }
     else if (!empty($link)) {
-      $output .= l('+ '. t('Add !type', array('!type' => $link['title'])), $link['href'], $options);
+      $output .= l('+ ' . t('Add !type', array('!type' => $link['title'])), $link['href'], $options);
     }
   }
   return $output;
@@ -1314,7 +1397,8 @@ function theme_spaces_node_links($links)
 /**
  * Form theme function for spaces presets.
  */
-function theme_spaces_form_presets($form) {
+function theme_spaces_form_presets() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   $output = '';
   // Render presets in a table
   $rows = array();
@@ -1326,7 +1410,10 @@ function theme_spaces_form_presets($form
     );
     $rows[] = $row;
   }
-  $output .= theme('table', array(array('data' => $form['preset']['#title'], 'colspan' => 2)), $rows);
+  $output .= theme('table', array('header' => array(array(
+        'data' => $form['preset']['#title'],
+        'colspan' => 2,
+      )), 'rows' => $rows));
   drupal_render($form['preset']); // Throw out the rest of this element
 
   $output .= drupal_render($form);
@@ -1354,7 +1441,7 @@ function _spaces_block_nav() {
   if ($space = spaces_get_space()) {
     $links = spaces_features_menu();
     $block['subject'] = $space->title;
-    $block['content'] = theme('links', $links);    
+    $block['content'] = theme('links', array('links' => $links));
   }
   return $block;
 }
@@ -1365,7 +1452,7 @@ function _spaces_block_nav() {
 function _spaces_block_utility_links() {
   $block = array();
   if ($space = spaces_get_space()) {
-    
+
   }
   return $block;
 }
diff -up -r spaces_admin.inc spaces_admin.inc
--- spaces_admin.inc	2008-10-06 15:56:40.000000000 -0600
+++ spaces_admin.inc	2011-02-21 19:48:11.000000000 -0700
@@ -4,7 +4,7 @@
  * Page callback for generating a list of spaces presets.
  * (admin/build/spaces)
  */
-function spaces_preset_default_form(&$form_state) {
+function spaces_preset_default_form($form, &$form_state) {
   $default_presets = variable_get('spaces_default_presets', array());
 
   $form = array(
@@ -23,7 +23,7 @@ function spaces_preset_default_form(&$fo
         '#type' => 'radios',
         '#options' => array(),
       );
-      foreach ($presets as $id => $preset) {      
+      foreach ($presets as $id => $preset) {
         // Add radio for use when choosing default
         if (!$preset['disabled']) {
           $form['types'][$type]['default']['#options'][$id] = $preset['name'];
@@ -37,12 +37,12 @@ function spaces_preset_default_form(&$fo
         // Build links for each preset
         $links = array();
         if (isset($preset['module'])) {
-          $links[] = $preset['disabled'] ? l(t('Enable'), 'admin/build/spaces/presets/enable/'. $type .'/'. $id) : l(t('Disable'), 'admin/build/spaces/presets/disable/'. $type .'/'. $id);
+          $links[] = $preset['disabled'] ? l(t('Enable'), 'admin/structure/spaces/presets/enable/' . $type . '/' . $id) : l(t('Disable'), 'admin/structure/spaces/presets/disable/' . $type . '/' . $id);
         }
         else {
-          $links[] = l(t('Edit'), 'admin/build/spaces/presets/edit/'. $type .'/'. $id);
-          $links[] = $preset['disabled'] ? l(t('Enable'), 'admin/build/spaces/presets/enable/'. $type .'/'. $id) : l(t('Disable'), 'admin/build/spaces/presets/disable/'. $type .'/'. $id);
-          $links[] = l(t('Delete'), 'admin/build/spaces/presets/delete/'. $type .'/'. $id);
+          $links[] = l(t('Edit'), 'admin/structure/spaces/presets/edit/' . $type . '/' . $id);
+          $links[] = $preset['disabled'] ? l(t('Enable'), 'admin/structure/spaces/presets/enable/' . $type . '/' . $id) : l(t('Disable'), 'admin/structure/spaces/presets/disable/' . $type . '/' . $id);
+          $links[] = l(t('Delete'), 'admin/structure/spaces/presets/delete/' . $type . '/' . $id);
         }
         $links = implode(' | ', $links);
 
@@ -79,7 +79,7 @@ function spaces_preset_default_form(&$fo
  */
 function spaces_preset_default_form_submit($form, &$form_state) {
   $default_presets = variable_get('spaces_default_presets', array());
-  
+
   foreach (spaces_types() as $type => $dummy) {
     if (isset($form_state['values']['types'][$type]['default']) && !empty($form_state['values']['types'][$type]['default'])) {
       $default_presets[$type] = $form_state['values']['types'][$type]['default'];
@@ -103,8 +103,9 @@ function spaces_preset_default_form_rese
 /**
  * Theme function for spaces_preset_default_form().
  */
-function theme_spaces_preset_default_form($form) {
-  drupal_add_css(drupal_get_path('module', 'spaces') .'/spaces.css');
+function theme_spaces_preset_default_form() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
+  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
   $output = '';
   foreach (element_children($form['types']) as $type) {
     // Build table rows
@@ -128,15 +129,15 @@ function theme_spaces_preset_default_for
           $form['types'][$type]['info'][$preset]['#value']['description'],
           $form['types'][$type]['info'][$preset]['#value']['links'],
         ),
-        'class' =>  $disabled ? 'disabled' : '',
+        'class' => $disabled ? 'disabled' : '',
       );
 
       $rows[] = $row;
     }
 
     // Add type heading and preset table to output
-    $output .= "<h3>". $form['types'][$type]['#title'] ."</h3>";
-    $output .= theme('table', array(t('Default'), t('ID'), t('Description'), ''), $rows, array('class' => 'spaces-admin'));
+    $output .= "<h3>" . $form['types'][$type]['#title'] . "</h3>";
+    $output .= theme('table', array('header' => array(t('Default'), t('ID'), t('Description'), ''), 'rows' => $rows, 'attributes' => array('class' => 'spaces-admin')));
   }
   $output .= "<div class='buttons'>";
   $output .= drupal_render($form['submit']) . drupal_render($form['reset']);
@@ -158,7 +159,7 @@ function theme_spaces_preset_default_for
  * @return
  *   A FormAPI array.
  */
-function spaces_preset_form($op = 'add', $type, $preset_id = NULL) {
+function spaces_preset_form($form, $op = 'add', $type, $preset_id = NULL) {
   $form = array();
   $space = spaces_load($type);
 
@@ -178,7 +179,7 @@ function spaces_preset_form($op = 'add',
         $presets = spaces_presets($type);
         $preset = $presets[$preset_id];
       }
-      break;    
+      break;
   }
 
   // Preset fields
@@ -203,12 +204,12 @@ function spaces_preset_form($op = 'add',
     '#type' => 'textfield',
     '#title' => t('Description'),
     '#description' => t('Enter a description for your preset. It should help users understand what the preset provides.'),
-  );  
+  );
 
   // Features/settings form
   $form['features_form'] = _spaces_features_form($space);
   $form['features_form']['#tree'] = FALSE;
-  $form['features_form']['#theme'] = 'spaces_features_form';  
+  $form['features_form']['#theme'] = 'spaces_features_form';
 
   // Add locks to features/settings
   $form['features_form']['locked'] = array(
@@ -238,7 +239,7 @@ function spaces_preset_form($op = 'add',
     $form['preset']['name']['#default_value'] = $preset['name'];
     $form['preset']['description']['#default_value'] = $preset['description'];
 
-    foreach (element_children($form['features_form']['features']) as $id) {      
+    foreach (element_children($form['features_form']['features']) as $id) {
       $form['features_form']['locked']['features'][$id]['#default_value'] = isset($preset['preset']['locked']['features'][$id]) ? $preset['preset']['locked']['features'][$id] : 0;
     }
     foreach (element_children($form['features_form']['settings']) as $id) {
@@ -272,7 +273,7 @@ function spaces_preset_form_validate($fo
   spaces_features_form_validate($form_id, $form_values);
 
   // Allow the space type to run its own validations
-  $space->validate($form_values);  
+  $space->validate($form_values);
 }
 
 /**
@@ -302,13 +303,13 @@ function spaces_preset_form_submit($form
   $settings = spaces_settings();
   foreach ($form_state['values']['settings'] as $setting => $value) {
     $preset['settings'][$setting] = $settings[$setting]->submit($space, $value);
-  }  
+  }
 
   // Allow space_type to have its own preset values
   $preset[$space->type] = $space->submit($form_state['values']);
 
   spaces_preset_save($space->type, $form_state['values']['preset']['id'], $preset);
-  $form_state['redirect'] = 'admin/build/spaces';
+  $form_state['redirect'] = 'admin/structure/spaces';
 }
 
 /**
@@ -327,13 +328,25 @@ function spaces_preset_save($type, $id, 
   unset($values['name']);
   unset($values['description']);
 
-  $exists = db_result(db_query("SELECT count(id) FROM {spaces_presets} WHERE type = '%s' AND id = '%s'", $type, $id));
+  $exists = db_query("SELECT count(id) FROM {spaces_presets} WHERE type = :type AND id = :id", array(':type' => $type, ':id' => $id))->fetchField();
   $success = false;
   if ($exists) {
-    $success = db_query("UPDATE {spaces_presets} SET name = '%s', description = '%s', value = '%s' WHERE type = '%s' AND id = '%s'", $name, $description, serialize($values), $type, $id);
+    // TODO Please review the conversion of this statement to the D7 database API syntax.
+    /* db_query("UPDATE {spaces_presets} SET name = '%s', description = '%s', value = '%s' WHERE type = '%s' AND id = '%s'", $name, $description, serialize($values), $type, $id) */
+    $success = db_update('spaces_presets')
+  ->fields(array(
+    'name' => $name,
+    'description' => $description,
+    'value' => serialize($values),
+  ))
+  ->condition('type', $type)
+  ->condition('id', $id)
+  ->execute();
   }
   else {
-    $success = db_query("INSERT INTO {spaces_presets} (type, id, name, description, value) VALUES('%s', '%s', '%s', '%s', '%s')", $type, $id, $name, $description, serialize($values));
+    // TODO Please convert this statement to the D7 database API syntax.
+    /* db_query("INSERT INTO {spaces_presets} (type, id, name, description, value) VALUES('%s', '%s', '%s', '%s', '%s')", $type, $id, $name, $description, serialize($values)) */
+    $success = NULL;
   }
   if ($success) {
     drupal_set_message(t('The preset !preset was saved successfully.', array('!preset' => $id)));
@@ -352,7 +365,7 @@ function spaces_preset_save($type, $id, 
  *   The preset identifier string.
  */
 function spaces_preset_load($type, $id) {
-  $value = db_result(db_query("SELECT value FROM {spaces_presets} WHERE type = '%s' AND id = '%s'", $type, $id));
+  $value = db_query("SELECT value FROM {spaces_presets} WHERE type = :type AND id = :id", array(':type' => $type, ':id' => $id))->fetchField();
   if ($value) {
     return unserialize($value);
   }
@@ -362,12 +375,25 @@ function spaces_preset_load($type, $id) 
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_preset_delete($type, $preset) {
-  $success = db_query("DELETE FROM {spaces_presets} WHERE type = '%s' AND id = '%s'", $type, $preset);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query("DELETE FROM {spaces_presets} WHERE type = '%s' AND id = '%s'", $type, $preset) */
+  $success = db_delete('spaces_presets')
+  ->condition('type', $type)
+  ->condition('id', $preset)
+  ->execute();
   $message = $success ? t('The preset !preset was deleted successfully.', array('!preset' => $preset)) : t('An error occurred while trying to delete !preset.', array('!preset' => $preset));
   drupal_set_message($message);
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_preset_disable($type, $preset) {
   $disabled = variable_get('spaces_disabled_presets', array());
   if (!isset($disabled[$type])) {
@@ -379,6 +405,10 @@ function spaces_preset_disable($type, $p
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_preset_enable($type, $preset) {
   $disabled = variable_get('spaces_disabled_presets', array());
   if (!isset($disabled[$type])) {
@@ -395,7 +425,7 @@ function spaces_preset_enable($type, $pr
  */
 function _spaces_preset_disable_page($type, $preset) {
   spaces_preset_disable($type, $preset);
-  drupal_goto('admin/build/spaces');
+  drupal_goto('admin/structure/spaces');
 }
 
 /**
@@ -403,9 +433,13 @@ function _spaces_preset_disable_page($ty
  */
 function _spaces_preset_enable_page($type, $preset) {
   spaces_preset_enable($type, $preset);
-  drupal_goto('admin/build/spaces');
+  drupal_goto('admin/structure/spaces');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_preset_delete_form($type, $preset_id) {
   // @TODO: proper check for preset existence
   $presets = spaces_presets(null, TRUE);
@@ -421,24 +455,33 @@ function spaces_preset_delete_form($type
     );
     $question = t('Are you sure you want to delete !preset?', array('!preset' => $preset['name']));
     $description = t('Any spaces using this preset will need to reset.');
-    $form = confirm_form($form, $question, 'admin/build/spaces', $description);
+    $form = confirm_form($form, $question, 'admin/structure/spaces', $description);
     return $form;
   }
   return '';
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_preset_delete_form_submit($form, &$form_state) {
   $type = $form_state['values']['type'];
   $preset = $form_state['values']['preset'];
   spaces_preset_delete($type, $preset);
-  $form_state['redirect'] = 'admin/build/spaces';
+  $form_state['redirect'] = 'admin/structure/spaces';
 }
 
 /**
  * BASIC FORM =========================================================
  */
 
-function theme_spaces_form($form, $output = '') {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function theme_spaces_form() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   if (
     (isset($form['submit']) && $form['submit']['#type'] == 'submit') ||
     (isset($form['reset']) && $form['reset']['#type'] == 'submit')
@@ -448,11 +491,15 @@ function theme_spaces_form($form, $outpu
     $buttons .= isset($form['reset']) ? drupal_render($form['reset']) : '';
     $buttons .= "</div>";
   }
-  
+
   $output .= drupal_render($form) . $buttons;
   return $output;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_basic_form(&$form_state, $space = NULL) {
   // Attempt to get current space if not provided
   $space = !isset($space) ? spaces_get_space() : $space;
@@ -467,7 +514,7 @@ function spaces_basic_form(&$form_state,
   $types = spaces_types();
   if (isset($types[$space->type]['custom prefixes']) && $types[$space->type]['custom prefixes'] != FALSE) {
     // Add context prefix form
-    $form['context_prefix'] = context_prefix_form('spaces', $space->type .':'. $space->sid, $space->prefix);
+    $form['context_prefix'] = context_prefix_form('spaces', $space->type . ':' . $space->sid, $space->prefix);
   }
 
   // Add preset form
@@ -484,6 +531,10 @@ function spaces_basic_form(&$form_state,
   return $form;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_basic_form_submit($form, &$form_state) {
   $space = $form_state['values']['space'];
 
@@ -503,6 +554,10 @@ function spaces_basic_form_submit($form,
  * FEATURE SETTINGS ===================================================
  */
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_features_form(&$form_state, $space = NULL) {
   // Attempt to get current space if not provided
   $space = !isset($space) ? spaces_get_space() : $space;
@@ -520,7 +575,7 @@ function spaces_features_form(&$form_sta
     if (isset($space->features[$id]) && ($space->features[$id] != SPACES_FEATURE_DISABLED)) {
       $form['customize'][$id] = array(
         '#type' => 'markup',
-        '#value' => l(t('Customize'), 'spaces/customize/'. $id),
+        '#value' => l(t('Customize'), 'spaces/customize/' . $id),
       );
     }
   }
@@ -636,8 +691,9 @@ function spaces_features_form_submit($fo
 /**
  * Theme for spaces featuers/settings form.
  */
-function theme_spaces_features_form($form) {
-  drupal_add_css(drupal_get_path('module', 'spaces') .'/spaces.css');
+function theme_spaces_features_form() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
+  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
   $output = '';
   foreach (array('features', 'settings') as $type) {
     $header = array(
@@ -648,14 +704,14 @@ function theme_spaces_features_form($for
     );
     $rows = array();
     foreach (element_children($form[$type]) as $element) {
-      $feature_name = "<strong>". $form[$type][$element]['#title'] ."</strong>";
-      $description = "<div class='description'>". $form[$type][$element]['#description'] ."</div>";
+      $feature_name = "<strong>" . $form[$type][$element]['#title'] . "</strong>";
+      $description = "<div class='description'>" . $form[$type][$element]['#description'] . "</div>";
       $customize = isset($form['customize'][$element]) ? drupal_render($form['customize'][$element]) : '';
       $locked = isset($form['locked']) ? drupal_render($form['locked'][$type][$element]) : '';
       unset($form[$type][$element]['#title']);
       unset($form[$type][$element]['#description']);
 
-      $row = array(      
+      $row = array(
         'name' => $feature_name,
         'option' => drupal_render($form[$type][$element]),
         'description' => $description,
@@ -676,9 +732,9 @@ function theme_spaces_features_form($for
         'class' => $class,
       );
     }
-    $output .= "<h3>". $form[$type]['#title'] ."</h3>";
-    $output .= "<div class='description'>". $form[$type]['#description'] ."</div>";
-    $output .= theme('table', $header, $rows, array('class' => 'spaces-'. $type));
+    $output .= "<h3>" . $form[$type]['#title'] . "</h3>";
+    $output .= "<div class='description'>" . $form[$type]['#description'] . "</div>";
+    $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => 'spaces-' . $type)));
 
     // Prevent section from being rendered by drupal_render().
     unset($form[$type]);
@@ -689,7 +745,7 @@ function theme_spaces_features_form($for
     $output .= drupal_render($form['submit']);
     $output .= "</div>";
   }
-  
+
   $output .= drupal_render($form);
   return $output;
 }
@@ -714,22 +770,22 @@ function spaces_customize($space = NULL,
     $rows = array();
     foreach (spaces_features($space->type) as $id => $feature) {
       if (isset($space->features[$id]) && ($space->features[$id] != SPACES_FEATURE_DISABLED)) {
-        $label = "<strong>". $feature->spaces['label'] ."</strong>";
-        $description = "<div class='description'>". $feature->spaces['description'] ."</div>";
+        $label = "<strong>" . $feature->spaces['label'] . "</strong>";
+        $description = "<div class='description'>" . $feature->spaces['description'] . "</div>";
         $rows[] = array(
           $label . $description,
-          l(t('Customize'), 'spaces/customize/'. $id),
+          l(t('Customize'), 'spaces/customize/' . $id),
         );
       }
     }
-    return theme('table', array(t('Available features'), ''), $rows);
+    return theme('table', array('header' => array(t('Available features'), ''), 'rows' => $rows));
   }
 }
 
 /**
  * Feature customization form.
  */
-function spaces_customize_form($space, $feature) {
+function spaces_customize_form($form, $space, $feature) {
   $form = array();
 
   $form['space'] = array(
@@ -813,7 +869,8 @@ function spaces_customize_form_reset($fo
 /**
  * Form theme function for customization items.
  */
-function theme_spaces_customize_item($form) {
+function theme_spaces_customize_item() {
+  // TODO Number of parameters in this theme funcion does not match number of parameters found in hook_theme.
   $output = '';
   $rows = array();
   foreach (element_children($form) as $element) {
@@ -827,6 +884,6 @@ function theme_spaces_customize_item($fo
       );
     }
   }
-  $output .= theme('table', array(), $rows);
+  $output .= theme('table', array('header' => array(), 'rows' => $rows));
   return $output;
 }
Only in spaces_announce: CVS
diff -up -r spaces_announce/spaces_announce.info spaces_announce/spaces_announce.info
--- spaces_announce/spaces_announce.info	2008-07-23 20:33:32.000000000 -0600
+++ spaces_announce/spaces_announce.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,6 @@
 name = Spaces Announcements
 description = "Provides an announcements broadcasting for spaces."
 package = Spaces
-dependencies = spaces
\ No newline at end of file
+dependencies = spaces
+files[] = spaces_announce.install
+files[] = spaces_announce.module
diff -up -r spaces_announce/spaces_announce.install spaces_announce/spaces_announce.install
--- spaces_announce/spaces_announce.install	2008-07-23 20:33:32.000000000 -0600
+++ spaces_announce/spaces_announce.install	2011-02-21 19:48:11.000000000 -0700
@@ -2,13 +2,26 @@
 // $Id: spaces_announce.install,v 1.1 2008/07/24 02:33:32 jmiccolis Exp $
 
 /**
- * Implementaton of hook_install().
+ * @file
+ * Install, update and uninstall functions for the spaces_announce module.
+ *
+ */
+
+/**
+ * Implements hook_install().
  */
 function spaces_announce_install() {
   switch ($GLOBALS['db_type']) {
     case 'mysqli':
     case 'mysql':
-      db_query("UPDATE {system} SET weight = 25 WHERE name = 'spaces_announce'");
+      // TODO Please review the conversion of this statement to the D7 database API syntax.
+      /* db_query("UPDATE {system} SET weight = 25 WHERE name = 'spaces_announce'") */
+      db_update('system')
+  ->fields(array(
+    'weight' =>  25,
+  ))
+  ->condition('name', 'spaces_announce')
+  ->execute();
       db_query("CREATE TABLE {spaces_announce} (
                 nid int(10) NOT NULL default '0',
                 gid int(10) NOT NULL default '0',
@@ -30,4 +43,4 @@ function spaces_announce_install() {
 function spaces_announce_uninstall() {
   db_query('DROP TABLE {spaces_announce}');
   db_query('DROP TABLE {spaces_announce_log}');
-}
\ No newline at end of file
+}
diff -up -r spaces_announce/spaces_announce.module spaces_announce/spaces_announce.module
--- spaces_announce/spaces_announce.module	2008-10-06 15:56:40.000000000 -0600
+++ spaces_announce/spaces_announce.module	2011-02-21 19:48:11.000000000 -0700
@@ -4,27 +4,30 @@
 /**
  * Announcement module lets spaces broadcast to each other.
  *
- * TODO 
+ * TODO
  * - Evaluate removing the annoucement log in favor or using statistics module (we'll use the
  *   ability to measure if a post was viewed outsite of the primary group, but I'm not sure that's
  *   really even valuable.)
  * - Complete views argument support.
  */
- 
-define(ANNOUNCE_LOG_LENGTH, 60*60*24*14); // Two weeks.
+
+define(ANNOUNCE_LOG_LENGTH, 60 * 60 * 24 * 14); // Two weeks.
 
 /**
- * Implementation of hook_spaces_settings
+ * Implements hook_spaces_settings().
  */
 function spaces_announce_spaces_settings() {
   $items = array();
-  $content_types = node_get_types('types');
+  $content_types = node_type_get_types();
   foreach ($content_types as $k => $type) {
-    if (variable_get('spaces_announce_'. $k, false)) {
-      $items[$k .'_announce'] = array(
+    if (variable_get('spaces_announce_' . $k, false)) {
+      $items[$k . '_announce'] = array(
         'label' => t('!type Announcements', array('!type' => $type->name)),
         'description' => t("Accept incoming !type annoucements", array('!type' => $type->name)),
-        'options' => array('0' => 'Off', 1 => 'On'),
+        'options' => array(
+          '0' => 'Off',
+          1 => 'On',
+        ),
       );
     }
   }
@@ -32,36 +35,40 @@ function spaces_announce_spaces_settings
 }
 
 /**
- * Implementation of hook_nodeapi
+ * Implements hook_nodeapi().
  *
  * Log viewing on view, and save primary gid relation on update and insert.
  */
-function spaces_announce_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  if (variable_get('spaces_announce_'. $node->type, false)) {
+function spaces_announce_nodeapi_OLD(&$node, $op, $teaser = NULL, $page = NULL) {
+  // TODO Remaining code in this function needs to be moved to the appropriate new hook function.
+  if (variable_get('spaces_announce_' . $node->type, false)) {
     switch ($op) {
       case 'view':
         $space = spaces_get_space();
         if ($gid = spaces_announce_primary_gid($node->nid)) {
           if ($space->sid != $gid) {
             if ($page) {
-              // If this is not the primary group than then node is being 
+              // If this is not the primary group than then node is being
               // recieved, so we do two things; log the view, and set context.
-              db_query("UPDATE {spaces_announce_log} a SET a.count = a.count + 1, a.viewed = %d WHERE a.nid = %d", time(), $node->nid);
+              // TODO Please convert this statement to the D7 database API syntax.
+              /* db_query("UPDATE {spaces_announce_log} a SET a.count = a.count + 1, a.viewed = %d WHERE a.nid = %d", REQUEST_TIME, $node->nid) */
+              NULL;
               context_set('spaces', 'annoucement', $node->type);
-              
+
               // If a ' NODETYPE_announcement' feature is defined give it the chance to
               // become the active feature.
               $context = new StdClass();
               $context->space = 'spaces';
               $context->key = 'feature';
-              $context->value = $node->type .'_announcement';
+              $context->value = $node->type . '_announcement';
               if ($context = context_ui_context('load', $context)) {
                 context_set($context->space, $context->key, $context->value);
               }
             }
             // Add "from" text to content.
             $group = node_load($gid);
-            $group_name = spaces_is_member($gid) ? l($group->title, 'node/'. $gid) : $group->title;
+            $group_name = spaces_is_member($gid) ? l($group->title, 'node/' . $gid) : $group->title;
+            // TODO Please change this theme call to use an associative array for the $variables parameter.
             $node->content['announce_primary_group'] = array(
               '#value' => theme('announce_group_label', $group_name),
               '#weight' => -100,
@@ -69,33 +76,54 @@ function spaces_announce_nodeapi(&$node,
           }
         }
         break;
-        case 'update':
-          // If the annoucement settings have been changed for a root book page
-          //  push those changes to the rest of the book.
-          if ($node->type == 'book' && $node->parent == 0) {
-            _spaces_announce_apply_book_perms($node);
-          }
-          
-          // Check to see if the post has a primary_gid, if it doesn't cascade 
-          // into the 'insert' case so that the primary_gid is silently corrected.
-          if (spaces_announce_primary_gid($node->nid)) {
-            break;
-          }
+      case 'update':
+        // If the annoucement settings have been changed for a root book page
+        //  push those changes to the rest of the book.
+        if ($node->type == 'book' && $node->parent == 0) {
+          _spaces_announce_apply_book_perms($node);
+        }
+
+        // Check to see if the post has a primary_gid, if it doesn't cascade
+        // into the 'insert' case so that the primary_gid is silently corrected.
+        if (spaces_announce_primary_gid($node->nid)) {
+          break;
+        }
       case 'insert':
         $space = spaces_get_space();
-        db_query('INSERT INTO {spaces_announce} (nid, gid) VALUES (%d, %d)', $node->nid, $space->sid);
-        db_query('INSERT INTO {spaces_announce_log} (nid) VALUES (%d)', $node->nid);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('INSERT INTO {spaces_announce} (nid, gid) VALUES (%d, %d)', $node->nid, $space->sid) */
+        $id = db_insert('spaces_announce')
+  ->fields(array(
+    'nid' => $node->nid,
+    'gid' => $space->sid,
+  ))
+  ->execute();
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('INSERT INTO {spaces_announce_log} (nid) VALUES (%d)', $node->nid) */
+        $id = db_insert('spaces_announce_log')
+  ->fields(array(
+    'nid' => $node->nid,
+  ))
+  ->execute();
         break;
       case 'delete':
-        db_query('DELETE FROM {spaces_announce} WHERE nid = %d', $node->nid);
-        db_query('DELETE FROM {spaces_announce_log} WHERE nid = %d', $node->nid);
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('DELETE FROM {spaces_announce} WHERE nid = %d', $node->nid) */
+        db_delete('spaces_announce')
+  ->condition('nid', $node->nid)
+  ->execute();
+        // TODO Please review the conversion of this statement to the D7 database API syntax.
+        /* db_query('DELETE FROM {spaces_announce_log} WHERE nid = %d', $node->nid) */
+        db_delete('spaces_announce_log')
+  ->condition('nid', $node->nid)
+  ->execute();
         break;
     }
   }
 }
 
 /**
- * Implementation of hook_form_alter.
+ * Implements hook_form_alter().
  */
 function spaces_announce_form_alter($form_id, &$form) {
   // Add check box to nodetype forms
@@ -103,19 +131,19 @@ function spaces_announce_form_alter($for
     $form['workflow']['spaces_announce'] = array(
       '#type' => 'checkbox',
       '#title' => t('Enable announcements'),
-      '#default_value' => variable_get('spaces_announce_'. $form['#node_type']->type, 0),
-      '#description' => t('Allow this content type to be broadcast from one group to another.'), 
-    );  
+      '#default_value' => variable_get('spaces_announce_' . $form['#node_type']->type, 0),
+      '#description' => t('Allow this content type to be broadcast from one group to another.'),
+    );
   }
   // Add group checkboxes to node forms.
-  if (isset($form['type']) && ($form['type']['#value'] .'_node_form') && variable_get('spaces_announce_'. $form['type']['#value'], 0)) {    
+  if (isset($form['type']) && ($form['type']['#value'] . '_node_form') && variable_get('spaces_announce_' . $form['type']['#value'], 0)) {
     global $user;
     $space = spaces_get_space();
     $gid = $space->sid;
     // Retrieve the primary_gid for exiting nodes.
     if (is_numeric($form['#node']->nid)) {
       $primary_gid = spaces_announce_primary_gid($form['#node']->nid);
-      
+
       // It's possible that a post doesn't have an assigned primary gid, so if it's in the
       // current group we assume that the current group is the primary one, and set the
       // primary_gid so that it can be respected and saved on form submission.
@@ -127,13 +155,13 @@ function spaces_announce_form_alter($for
     if (!isset($primary_gid) || $primary_gid == $gid) {
       // Retrieve groups which the current user is a member and where the announce setting is enabled.
       $gids = array();
-      // If the user has admin nodes they can edit annoucements they didn't author and will need be 
+      // If the user has admin nodes they can edit annoucements they didn't author and will need be
       // able to post posts in any groups which can recieve posts.
       if (user_access('administer nodes')) {
-        $result = db_query("SELECT DISTINCT(gid), title FROM {spaces_features} i INNER JOIN {og_uid} og ON i.gid = og.nid INNER JOIN {node} n ON og.nid = n.nid WHERE i.id ='%s' AND i.type = 1 AND i.value <> 0", $form['type']['#value'] .'_announce');
+        $result = db_query("SELECT DISTINCT(gid), title FROM {spaces_features} i INNER JOIN {og_uid} og ON i.gid = og.nid INNER JOIN {node} n ON og.nid = n.nid WHERE i.id = :i.id AND i.type = :i.type AND i.value <> :i.value", array(':i.id' => $form['type']['#value'] . '_announce', ':i.type' => 1, ':i.value' => 0));
       }
       else {
-        $result = db_query("SELECT DISTINCT(gid), title FROM {spaces_features} i INNER JOIN {og_uid} og ON i.gid = og.nid INNER JOIN {node} n ON og.nid = n.nid WHERE i.id ='%s' AND i.type = 1 AND i.value <> 0 AND og.uid = %d", $form['type']['#value'] .'_announce', $user->uid);
+        $result = db_query("SELECT DISTINCT(gid), title FROM {spaces_features} i INNER JOIN {og_uid} og ON i.gid = og.nid INNER JOIN {node} n ON og.nid = n.nid WHERE i.id = :i.id AND i.type = :i.type AND i.value <> :i.value AND og.uid = :og.uid", array(':i.id' => $form['type']['#value'] . '_announce', ':i.type' => 1, ':i.value' => 0, ':og.uid' => $user->uid));
       }
       while ($row = db_fetch_object($result)) {
         $gids[$row->gid] = $row->title;
@@ -148,13 +176,13 @@ function spaces_announce_form_alter($for
       else {
         $active_gids = array();
       }
-      
+
       if (isset($form['parent']) && $form['parent']['#default_value'] !== null) {
         $parent = node_load($form['parent']['#default_value']);
         $active_gids = array_merge($active_gids, $parent->og_groups);
         $parent_set = true;
       }
-      
+
       if (count($gids)) {
         if ($parent_set) {
           $form['announce_display'] = array(
@@ -181,12 +209,12 @@ function spaces_announce_form_alter($for
           );
         }
 
-        // Add after_build function to save extra og relations. 
+        // Add after_build function to save extra og relations.
         $form['#after_build'][] = 'spaces_announce_group_save';
       }
     }
     else {
-      $link = cl(t('Click here'), spaces_group_path($primary_gid) .'/node/'. $form['#node']->nid, array(), null, null, false, false, true);
+      $link = cl(t('Click here'), spaces_group_path($primary_gid) . '/node/' . $form['#node']->nid, array(), null, null, false, false, true);
       drupal_set_message(t('This !type was not authored in this group and should not be edited here. !click_here to edit where it was created.', array('!type' => $form['type']['#value'], '!click_here' => $link)));
     }
   }
@@ -209,7 +237,7 @@ function spaces_announce_group_save($for
     elseif (isset($form['#post']['announce_hidden'])) {
       $announce_gids = unserialize($form['#post']['announce_hidden']);
     }
-    
+
     if (is_array($announce_gids)) {
       foreach ($announce_gids as $value) {
         $gids[$value] = $value;
@@ -227,12 +255,12 @@ function spaces_announce_group_save($for
  *   A skeletal node object, needs the following properties; nid, og_groups, og_public
  */
 function _spaces_announce_apply_book_perms($node) {
-  $result = db_query('SELECT b.nid, n.type FROM {book} b INNER JOIN {node} n ON b.vid = n.vid WHERE parent = %d', $node->nid);
+  $result = db_query('SELECT b.nid, n.type FROM {book} b INNER JOIN {node} n ON b.vid = n.vid WHERE parent = :parent', array(':parent' => $node->nid));
   while ($child = db_fetch_object($result)) {
     // Add groups and privacy setting from parent.
     $child->og_groups = $node->og_groups;
     $child->og_public = $node->og_public;
-    
+
     // Save new group relations.
     og_save_ancestry($child);
     // Process access changes.
@@ -244,7 +272,7 @@ function _spaces_announce_apply_book_per
 
 /**
  * Retrieve the primary gid for a node.
- * 
+ *
  * @param $nid
  *   The node id of the item
  *
@@ -252,18 +280,18 @@ function _spaces_announce_apply_book_per
  *   Gid ie node id of the primary group.
  */
 function spaces_announce_primary_gid($nid) {
-  return db_result(db_query('SELECT gid FROM {spaces_announce} WHERE nid = %d', $nid));
+  return db_query('SELECT gid FROM {spaces_announce} WHERE nid = :nid', array(':nid' => $nid))->fetchField();
 }
 
 /**
  * Retrieve the view log for a announcement
  */
 function spaces_announce_log($nid) {
-  return db_fetch_object(db_query('SELECT count, viewed FROM {spaces_announce_log} WHERE nid = %d', $nid));
+  return db_fetch_object(db_query('SELECT count, viewed FROM {spaces_announce_log} WHERE nid = :nid', array(':nid' => $nid)));
 }
 
 /**
- * Implementation of hook_views_tables.
+ * Implements hook_views_tables().
  */
 function spaces_announce_views_tables() {
   $tables['spaces_announce'] = array(
@@ -272,11 +300,11 @@ function spaces_announce_views_tables() 
     'join' => array(
       'left' => array(
         'table' => 'node',
-        'field' => 'nid'
+        'field' => 'nid',
       ),
       'right' => array(
-        'field' => 'nid'
-      )
+        'field' => 'nid',
+      ),
     ),
     'filters' => array(
       'announce_cg' => array(
@@ -295,37 +323,37 @@ function spaces_announce_views_tables() 
     'join' => array(
       'left' => array(
         'table' => 'node',
-        'field' => 'nid'
+        'field' => 'nid',
       ),
       'right' => array(
-        'field' => 'nid'
-      )
+        'field' => 'nid',
+      ),
     ),
     'fields' => array(
-          'count' => array(
-            'name' => t('Announce: Views Count'),
-            'sortable' => true,
-            'help' => t('This will display the number of times a node has been read.'),
-          ),
-          'viewed' => array(
-            'name' => t('Announce: Last Viewed Time'),
-            'sortable' => true,
-            'handler' => views_handler_field_dates(),
-            'option' => 'string',
-            'help' => t('Display the time the node was last read.'),
-          ),
-        ),
+      'count' => array(
+        'name' => t('Announce: Views Count'),
+        'sortable' => true,
+        'help' => t('This will display the number of times a node has been read.'),
+      ),
+      'viewed' => array(
+        'name' => t('Announce: Last Viewed Time'),
+        'sortable' => true,
+        'handler' => views_handler_field_dates(),
+        'option' => 'string',
+        'help' => t('Display the time the node was last read.'),
+      ),
+    ),
   );
   return $tables;
 }
 
 /**
- * Implementation of hook_views_arguments()
+ * Implements hook_views_arguments().
  */
 function spaces_announce_views_arguments() {
   $args = array(
     'announce_gid' => array(
-      'name' => t("Announce: Primary group nid(s)"), 
+      'name' => t("Announce: Primary group nid(s)"),
       'handler' => 'spaces_announce_handler_argument_gid',
       'help' => t('Filter for posts by primary group.'),
     ),
@@ -347,12 +375,12 @@ function spaces_announce_handler_argumen
     case 'sort':
       // TODO implement sort op for summary view
       break;
-    case 'filter':    
+    case 'filter':
       $query->ensure_table('spaces_announce');
       $query->add_where('spaces_announce.gid = %d', $arg);
       break;
     case 'title':
-      return db_result(db_query_range('SELECT title FROM {node} WHERE nid = %d', $query, 0, 1));;
+      return db_query_range('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $query))->fetchField();
   }
 }
 
@@ -363,9 +391,14 @@ function spaces_announce_handler_argumen
  **/
 function spaces_announce_handler_filter_cg($op, $filter, $filterinfo, &$query) {
   $query->ensure_table('spaces_announce');
-  $query->add_where("spaces_announce.gid ". $filter['operator'] ." ***CURRENT_GID***");
+  $query->add_where("spaces_announce.gid " . $filter['operator'] . " ***CURRENT_GID***");
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function theme_announce_group_label($link) {
-  return "<p class='announcement-label'><strong>". t('Announcement from ') . $link ."</strong></p>";
+  // TODO: Should this theme announce_group_label be declared in hook_theme()?
+  return "<p class='announcement-label'><strong>" . t('Announcement from ') . $link . "</strong></p>";
 }
Only in spaces_blog: CVS
Only in spaces_calendar: CVS
diff -up -r spaces_calendar/spaces_calendar.info spaces_calendar/spaces_calendar.info
--- spaces_calendar/spaces_calendar.info	2008-05-22 15:03:32.000000000 -0600
+++ spaces_calendar/spaces_calendar.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,5 @@
 name = Spaces Calendar
 description = Provides spaces features and customizations for the Calendar module.
 package = Spaces
-dependencies = spaces views calendar date
\ No newline at end of file
+dependencies = spaces views calendar date
+files[] = spaces_calendar.module
diff -up -r spaces_calendar/spaces_calendar.module spaces_calendar/spaces_calendar.module
--- spaces_calendar/spaces_calendar.module	2008-10-06 15:56:40.000000000 -0600
+++ spaces_calendar/spaces_calendar.module	2011-02-21 19:48:12.000000000 -0700
@@ -3,19 +3,19 @@
 
 
 /**
- * TODO Make setup easier. Currenly you need to manually create three content types 'event', 
+ * TODO Make setup easier. Currenly you need to manually create three content types 'event',
  * 'feed_ical', 'feed_ical_item' that has a field called 'field_date' for this module to work.
  * We need to document the feed api integration as well.
  */
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_menu().
  */
 function spaces_calendar_menu($may_cache) {
   $items = array();
   if ($may_cache) {
     $items[] = array(
-      'path' => 'admin/settings/spaces/calendar',
+      'path' => 'admin/config/spaces/calendar',
       'title' => t('Spaces calendar settings'),
       'description' => t('Spaces calendar feature defaults.'),
       'callback' => 'drupal_get_form',
@@ -23,22 +23,22 @@ function spaces_calendar_menu($may_cache
       'access' => user_access('administer group features'),
       'type' => MENU_LOCAL_TASK,
       'weight' => 1,
-    );    
+    );
   }
   return $items;
 }
 
 /**
- * Implementation of hook_help()
+ * Implements hook_help().
  */
 function spaces_calendar_help($page) {
   if (context_get('spaces', 'feature') == 'calendar') {
-    return "<p>". t('The calendar displays all events in this group. You can add events directly to the calendar or aggregate additional items using iCal feeds.') ."</p>";
+    return "<p>" . t('The calendar displays all events in this group. You can add events directly to the calendar or aggregate additional items using iCal feeds.') . "</p>";
   }
 }
 
 /**
- * Implementation of hook_context_define()
+ * Implements hook_context_define().
  */
 function spaces_calendar_context_define() {
   $items = array();
@@ -78,10 +78,10 @@ function spaces_calendar_context_define(
 }
 
 /**
- * Implementation of hook_nodeapi()
+ * Implements hook_node_view().
  */
-function spaces_calendar_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  if ($op == 'view' && !$teaser && $page) {
+function spaces_calendar_node_view($node, $view_mode = 'full') {
+  if (TRUE && !$teaser && $page) {
     _spaces_calendar_alter_links();
     if ($node->type == variable_get('spaces_calendar_feed_nodetype', '')) {
       $view = views_get_view('spaces_calendar_ical_items');
@@ -93,7 +93,7 @@ function spaces_calendar_nodeapi(&$node,
         );
       }
       $node->content['buttons'] = array(
-        '#value' => "<div class='buttons'>". l(t('View calendar'), 'calendar', array('class' => 'button')) ."</div>",
+        '#value' => "<div class='buttons'>" . l(t('View calendar'), 'calendar', array('class' => 'button')) . "</div>",
         '#weight' => 5,
       );
     }
@@ -101,36 +101,45 @@ function spaces_calendar_nodeapi(&$node,
 }
 
 /**
- * Implementation of hook_form_alter()
+ * Implements hook_nodeapi().
+ */
+function spaces_calendar_nodeapi_OLD(&$node, $op, $teaser = NULL, $page = NULL) { }
+
+/**
+ * Implements hook_form_alter().
  */
 function spaces_calendar_form_alter($form_id, &$form) {
   if (_spaces_calendar_enabled()) {
     _spaces_calendar_alter_links();
     switch ($form_id) {
       // TODO: use content types in features array to determine calendar node form id
-      case (variable_get('spaces_calendar_nodetype', '') .'_node_form'):
+      case (variable_get('spaces_calendar_nodetype', '') . '_node_form'):
         // add a submit handler to send user to view of submitted event
         $form['#submit']['spaces_calendar_event_submit'] = array();
     }
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_calendar_settings_form() {
   if (_spaces_calendar_ical_enabled()) {
     $feedtype = variable_get('spaces_calendar_feed_nodetype', '');
-    if (!variable_get('feedapi_mapper_mapping_'. $feedtype, array())) {
+    if (!variable_get('feedapi_mapper_mapping_' . $feedtype, array())) {
       $mapping = array(
         serialize(array('raw', 'DTSTART', 'datetime')) => serialize(array('date', variable_get('spaces_calendar_datefield', ''), 'from')),
         serialize(array('raw', 'DTEND', 'datetime')) => serialize(array('date', variable_get('spaces_calendar_datefield', ''), 'to')),
       );
-      variable_set('feedapi_mapper_mapping_'. $feedtype, $mapping);
+      variable_set('feedapi_mapper_mapping_' . $feedtype, $mapping);
       drupal_set_message(t('iCal feed mappings have been set up.'));
     }
   }
 
   $form = array();
   $types = array();
-  $nodetypes = node_get_types();
+  $nodetypes = node_type_get_types();
   foreach ($nodetypes as $ntype => $nname) {
     $types[$ntype] = $nname->name;
   }
@@ -138,14 +147,14 @@ function spaces_calendar_settings_form()
   $fields = content_fields();
   $fieldtypes = array();
   foreach ($fields as $field) {
-    $fieldtypes[$field['field_name']] = t($field['widget']['label']) .' ('. $field['field_name'] .')';
+    $fieldtypes[$field['field_name']] = t($field['widget']['label']) . ' (' . $field['field_name'] . ')';
   }
 
   $form['spaces_calendar_default_settings'] = array(
     '#type' => 'fieldset',
     '#title' => 'Spaces calendar default settings',
   );
-  
+
   $form['spaces_calendar_default_settings']['spaces_calendar_nodetype'] = array(
     '#type' => 'select',
     '#title' => t('Event node types'),
@@ -154,7 +163,7 @@ function spaces_calendar_settings_form()
     '#default_value' => variable_get('spaces_calendar_nodetype', ''),
     '#multiple' => FALSE,
   );
-  
+
   $form['spaces_calendar_default_settings']['spaces_calendar_datefield'] = array(
     '#type' => 'select',
     '#title' => t('Event date field'),
@@ -170,7 +179,7 @@ function spaces_calendar_settings_form()
       '#type' => 'fieldset',
       '#title' => 'Spaces calendar feedapi/ical integration settings',
     );
-  
+
     $form['spaces_calendar_feedapi_settings']['spaces_calendar_feed_nodetype'] = array(
       '#type' => 'select',
       '#title' => t('FeedAPI feed node type'),
@@ -189,12 +198,12 @@ function spaces_calendar_settings_form()
       '#multiple' => FALSE,
     );
   }
-  
+
   return system_settings_form($form);
 }
 
 /**
- *  Implementation of hook_default_views
+ * Implements hook_default_views().
  */
 function spaces_calendar_views_default_views() {
   $default_views = array();
@@ -216,11 +225,19 @@ function spaces_calendar_views_default_v
 }
 
 // Implementation of hook_views_post_view().
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_calendar_views_post_view(&$view) {
   _spaces_calendar_alter_links();
 }
 
 // Push user to the calendar view of their submitted event
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_calendar_event_submit($form_id, $form_values) {
   $n = node_submit($form_values);
   if ($date = $n->field_date[0]['value']) {
@@ -239,20 +256,19 @@ function _spaces_calendar_feed_links() {
   $space = spaces_get_space();
   $feedtype = variable_get('spaces_calendar_feed_nodetype', '');
   if ($space && $feedtype) {
-    $results = db_query(
-      "SELECT nr.title, n.nid
+    $results = db_query("SELECT nr.title, n.nid
       FROM {node} n
         LEFT JOIN {node_revisions} nr ON n.vid = nr.vid
         JOIN {og_ancestry} og ON n.nid = og.nid
-      WHERE n.type = '%s'
-        AND n.status = 1
-        AND og.group_nid = %d
-      ORDER BY nr.title ASC",
-      $feedtype, $space->sid);
+      WHERE n.type = :n.type
+        AND n.status = :n.status
+        AND og.group_nid = :og.group_nid
+      ORDER BY nr.title ASC", array(':n.type' => $feedtype, ':n.status' => 1, ':og.group_nid' => $space->sid));
     while ($feed = db_fetch_object($results)) {
+      // TODO Please change this theme call to use an associative array for the $variables parameter.
       $crayon = theme('crayon', $feed->nid);
       $links[] = array(
-        'title' => "<span class='crayon-marker crayon-$crayon'></span> ". $feed->title,
+        'title' => "<span class='crayon-marker crayon-$crayon'></span> " . $feed->title,
         'html' => true,
       );
     }
@@ -280,7 +296,7 @@ function _spaces_calendar_views_calendar
   $view->nodes_per_page = '100';
   $view->sort = array();
   $view->argument = array(
-    array (
+    array(
       'type' => 'calendar_year',
       'argdefault' => '2',
       'title' => '',
@@ -288,7 +304,7 @@ function _spaces_calendar_views_calendar
       'wildcard' => '',
       'wildcard_substitution' => '',
     ),
-    array (
+    array(
       'type' => 'calendar_month',
       'argdefault' => '2',
       'title' => '',
@@ -297,49 +313,49 @@ function _spaces_calendar_views_calendar
       'wildcard_substitution' => '',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', '') .'_value',
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
       'label' => '',
       'handler' => 'content_views_field_handler_ungroup',
       'options' => 'short',
     ),
   );
   if (_spaces_calendar_ical_enabled() && module_exists('feedapi_node_views')) {
-    $view->field[] = array (
+    $view->field[] = array(
       'tablename' => 'feedapi_node_item_feed',
       'field' => 'feed_nid',
       'label' => '',
       'options' => 'nolink',
     );
   }
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => variable_get('spaces_calendar_nodetype', ''),
         1 => variable_get('spaces_calendar_feed_itemtype', ''),
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -347,7 +363,7 @@ function _spaces_calendar_views_calendar
       'value' => 'all',
     ),
   );
-  $view->requires = array('node', 'node_data_'. variable_get('spaces_calendar_datefield', ''), 'og_ancestry');
+  $view->requires = array('node', 'node_data_' . variable_get('spaces_calendar_datefield', ''), 'og_ancestry');
   return $view;
 }
 
@@ -360,61 +376,61 @@ function _spaces_calendar_views_calendar
   $view->page = FALSE;
   $view->block = TRUE;
   $view->block_title = t('Upcoming Events');
-  $view->block_empty = '<p>'. t('No upcoming events found.') .'</p>';
+  $view->block_empty = '<p>' . t('No upcoming events found.') . '</p>';
   $view->block_empty_format = '2';
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '5';
   $view->argument = array();
-  $view->sort = array (
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', '') .'_value',
+  $view->sort = array(
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
       'sortorder' => 'ASC',
       'options' => '',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', ''). '_value',
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
       'label' => '',
       'handler' => 'content_views_field_handler_ungroup',
       'options' => 'default',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => variable_get('spaces_calendar_nodetype', ''),
         1 => variable_get('spaces_calendar_feed_itemtype', ''),
       ),
     ),
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', '') .'_value_default',
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value_default',
       'operator' => '>',
       'options' => 'now',
       'value' => '',
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -422,8 +438,8 @@ function _spaces_calendar_views_calendar
       'value' => 'all',
     ),
   );
-  $view->exposed_filter = array ();
-  $view->requires = array('node_data_'. variable_get('spaces_calendar_datefield', ''), 'node');
+  $view->exposed_filter = array();
+  $view->requires = array('node_data_' . variable_get('spaces_calendar_datefield', ''), 'node');
   return $view;
 }
 
@@ -431,7 +447,7 @@ function _spaces_calendar_views_calendar
   $view = new stdClass();
   $view->name = 'spaces_calendar_feeds';
   $view->description = 'Displays ical feeds and allows users to administer them';
-  $view->access = array ();
+  $view->access = array();
   $view->view_args_php = '';
   $view->page = TRUE;
   $view->page_title = 'Calendar feeds';
@@ -448,56 +464,56 @@ function _spaces_calendar_views_calendar
   $view->menu_tab_default_parent_type = 'tab';
   $view->menu_parent_tab_weight = '0';
   $view->menu_parent_title = '';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'sortorder' => 'ASC',
       'options' => '',
     ),
   );
-  $view->argument = array (
+  $view->argument = array(
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Feed',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => 'Created On',
       'handler' => 'views_handler_field_date_custom',
       'options' => 'M j, Y',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'edit',
       'label' => '',
       'handler' => 'views_handler_node_edit_destination',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'feed_ical',
       ),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -505,7 +521,7 @@ function _spaces_calendar_views_calendar
       'value' => 'all',
     ),
   );
-  $view->exposed_filter = array ();
+  $view->exposed_filter = array();
   $view->requires = array(node, og_ancestry);
   return $view;
 }
@@ -514,23 +530,23 @@ function _spaces_calendar_views_calendar
   $view = new stdClass();
   $view->name = 'spaces_calendar_ical_items';
   $view->description = 'Listing of ical items for the node view of feeds.';
-  $view->access = array ();
+  $view->access = array();
   $view->view_args_php = '';
   $view->page = TRUE;
   $view->page_type = 'table';
   $view->url = '';
   $view->use_pager = TRUE;
   $view->nodes_per_page = '10';
-  $view->sort = array (
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', '') .'_value',
+  $view->sort = array(
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
       'sortorder' => 'DESC',
       'options' => '',
     ),
   );
-  $view->argument = array (
-    array (
+  $view->argument = array(
+    array(
       'type' => 'feed_nid',
       'argdefault' => '1',
       'title' => '',
@@ -539,42 +555,42 @@ function _spaces_calendar_views_calendar
       'wildcard_substitution' => '',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
-      'tablename' => 'node_data_'. variable_get('spaces_calendar_datefield', ''),
-      'field' => variable_get('spaces_calendar_datefield', '') .'_value',
+    array(
+      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
+      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
       'label' => 'Date',
       'handler' => 'content_views_field_handler_group',
       'options' => 'default',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => variable_get('spaces_calendar_feed_itemtype', ''),
       ),
     ),
   );
-  $view->exposed_filter = array ();
-  $view->requires = array('node_data_'. variable_get('spaces_calendar_datefield', ''), 'node');
+  $view->exposed_filter = array();
+  $view->requires = array('node_data_' . variable_get('spaces_calendar_datefield', ''), 'node');
   return $view;
 }
 
Only in spaces_casetracker: CVS
diff -up -r spaces_casetracker/spaces_casetracker.info spaces_casetracker/spaces_casetracker.info
--- spaces_casetracker/spaces_casetracker.info	2008-05-22 15:03:32.000000000 -0600
+++ spaces_casetracker/spaces_casetracker.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,5 @@
 name = Spaces Casetracker
 description = Provides spaces features and customizations for the Casetracker module.
 package = Spaces
-dependencies = spaces views casetracker
\ No newline at end of file
+dependencies = spaces views casetracker
+files[] = spaces_casetracker.module
diff -up -r spaces_casetracker/spaces_casetracker.module spaces_casetracker/spaces_casetracker.module
--- spaces_casetracker/spaces_casetracker.module	2008-10-06 15:56:40.000000000 -0600
+++ spaces_casetracker/spaces_casetracker.module	2011-02-21 19:48:12.000000000 -0700
@@ -2,7 +2,7 @@
 // $Id: spaces_casetracker.module,v 1.7 2008/10/06 21:56:40 yhahn Exp $
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_menu().
  */
 function spaces_casetracker_menu($may_cache) {
   $items = array();
@@ -19,34 +19,43 @@ function spaces_casetracker_menu($may_ca
 }
 
 /**
- * Implementation of hook_help()
+ * Implements hook_help().
  */
 function spaces_casetracker_help($page) {
   if (context_get('spaces', 'feature') == 'casetracker') {
     if (strpos('node/add', $page) === 0) {
     }
     else {
-      return "<p>". t('The casetracker allows you to file tickets for other team members and keep track of tasks that others have filed for you.') ."</p>";
+      return "<p>" . t('The casetracker allows you to file tickets for other team members and keep track of tasks that others have filed for you.') . "</p>";
     }
   }
 }
 
 /**
- * Implementation of hook_block()
+ * Implements hook_block_info().
  */
-function spaces_casetracker_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
+function spaces_casetracker_block_info() {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
     $blocks = array();
-    $blocks[1]['info'] = t('Spaces: User Casetracker Stats');
+    $blocks['delta-1']['info'] = t('Spaces: User Casetracker Stats');
     return $blocks;
   }
-  else if ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function spaces_casetracker_block_view($delta) {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
     switch ($delta) {
-      case 1:
+      case 'delta-1':
         $u = (object) array('uid' => arg(1));
         $u = user_load($u);
         $space = spaces_get_space();
         $block['subject'] = t('Case Stats for @user', array('@user' => $u->name));
+        // TODO Please change this theme call to use an associative array for the $variables parameter.
         $block['content'] = theme('spaces_casestats', spaces_casetracker_case_stats(arg(1), $space->sid), $u->name);
         return $block;
     }
@@ -54,7 +63,12 @@ function spaces_casetracker_block($op = 
 }
 
 /**
- * Implementation of hook_form_alter()
+ * Implements hook_block().
+ */
+function spaces_casetracker_block_OLD($op = 'list', $delta = 0) { }
+
+/**
+ * Implements hook_form_alter().
  */
 function spaces_casetracker_form_alter($form_id, &$form) {
   switch ($form_id) {
@@ -77,8 +91,11 @@ function spaces_casetracker_form_alter($
         $pid = ($form_id == 'casetracker_basic_case_node_form' ? 'pid' : 'prid'); // "sigh." see casetracker_form_alter() for details.
         if (is_array($form['casetracker_project_information'][$pid]['#options'])) {
           foreach ($form['casetracker_project_information'][$pid]['#options'] as $key => $value) {
-            $node = array('nid' => $key, 'type' => 'casetracker_basic_project');
-            $groups = og_get_node_groups((object)($node));
+            $node = array(
+              'nid' => $key,
+              'type' => 'casetracker_basic_project',
+            );
+            $groups = og_get_node_groups((object) ($node));
             if (!array_key_exists($space->sid, $groups)) {
               unset($form['casetracker_project_information'][$pid]['#options'][$key]);
             }
@@ -87,10 +104,10 @@ function spaces_casetracker_form_alter($
       }
 
       // Change the autocomplete callback to limit by group
-      $form['casetracker_case_information']['assign_to']['#autocomplete_path'] = 'spaces/team/autocomplete/'. $space->sid;
-      break;    
-    // Views filters
-    // Handle exposed casetracker filters, sadly case tracker is dumb to og.
+      $form['casetracker_case_information']['assign_to']['#autocomplete_path'] = 'spaces/team/autocomplete/' . $space->sid;
+      break;
+      // Views filters
+      // Handle exposed casetracker filters, sadly case tracker is dumb to og.
     case 'views_filters':
       switch ($form['#view_name']) {
         case 'spaces_cases_my':
@@ -110,7 +127,7 @@ function spaces_casetracker_form_alter($
           $form['filter1']['#options'] = spaces_casetracker_user_options();
           break;
       }
-      break; 
+      break;
   }
 }
 
@@ -123,19 +140,20 @@ function _spaces_casetracker_node_form_s
     $query = array();
     if (module_exists('prepopulate')) {
       if (isset($form_values['assign_to'])) {
-        $query[] = 'edit[casetracker_case_information][assign_to]='. $form_values['assign_to'];
+        $query[] = 'edit[casetracker_case_information][assign_to]=' . $form_values['assign_to'];
       }
       if (isset($form_values['pid'])) {
-        $query[] = 'edit[casetracker_project_information][pid]='. $form_values['pid'];
+        $query[] = 'edit[casetracker_project_information][pid]=' . $form_values['pid'];
       }
     }
     $query = implode('&', $query);
-    drupal_goto('node/add/casetracker-basic-case', $query);
+    // TODO $query needs to be an array of keys and values instead of a string.
+    drupal_goto('node/add/casetracker-basic-case', array('query' => $query));
   }
 }
 
 /**
- *  Implementation of hook_default_views
+ * Implements hook_default_views().
  */
 function spaces_casetracker_views_default_views() {
   $default_views = array(
@@ -168,7 +186,7 @@ function spaces_casetracker_views_defaul
  */
 function spaces_casetracker_context_define() {
   $items = array();
-  $items[] = array(  
+  $items[] = array(
     'namespace' => 'spaces',
     'attribute' => 'feature',
     'value' => 'casetracker',
@@ -199,7 +217,7 @@ function spaces_casetracker_context_defi
     ),
   );
   if (module_exists('spaces_user')) {
-    $items[] = array(  
+    $items[] = array(
       'namespace' => 'spaces',
       'attribute' => 'feature',
       'value' => 'user_cases',
@@ -239,7 +257,7 @@ function _spaces_casetracker_views() {
 }
 
 /**
- * Implementation of hook_views_pre_query()
+ * Implements hook_views_pre_query().
  */
 function spaces_casetracker_views_pre_query(&$view) {
   // Switch the assigned to filter to the userspace
@@ -253,12 +271,12 @@ function spaces_casetracker_views_pre_qu
           break;
         }
       }
-    }    
+    }
   }
 }
 
 /**
- * Implementation of hook_views_post_view()
+ * Implements hook_views_post_view().
  */
 function spaces_casetracker_views_post_view(&$view) {
   if ($view->build_type == 'page' && in_array($view->name, _spaces_casetracker_views())) {
@@ -272,14 +290,15 @@ function spaces_casetracker_views_post_v
 function spaces_casetracker_project_options() {
   if ($space = spaces_get_space()) {
     $return = array();
-    $results = db_query(db_rewrite_sql("SELECT ct.project_number, n.title FROM {node} n INNER JOIN {casetracker_project} ct ON n.nid = ct.nid INNER JOIN {og_ancestry} og ON n.nid = og.nid WHERE n.type IN (".str_pad('', count(array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project')))) * 5 - 1, "'%s',").") AND og.group_nid = %d AND n.status = 1 ORDER BY n.title"), 
+    // TODO Please convert this statement to the D7 database API syntax.
+    $results = db_query(db_rewrite_sql("SELECT ct.project_number, n.title FROM {node} n INNER JOIN {casetracker_project} ct ON n.nid = ct.nid INNER JOIN {og_ancestry} og ON n.nid = og.nid WHERE n.type IN (" . str_pad('', count(array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project')))) * 5 - 1, "'%s',") . ") AND og.group_nid = %d AND n.status = 1 ORDER BY n.title"),
       array_merge(
-        array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project'))), 
+        array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project'))),
         array($space->sid)
       )
     );
     while ($row = db_fetch_object($results)) {
-     $return[$row->project_number] = $row->project_number ." - ". $row->title;
+      $return[$row->project_number] = $row->project_number . " - " . $row->title;
     }
     return $return;
   }
@@ -301,11 +320,11 @@ function spaces_casetracker_user_options
  */
 function spaces_casetracker_users_autocomplete($gid, $string) {
   $matches = array();
-  $result = db_query_range("SELECT name FROM {users} u INNER JOIN {og_uid} og ON u.uid = og.uid WHERE og.nid = %d AND LOWER(u.name) LIKE LOWER('%s%%')", $gid, $string, 0, 10);
+  $result = db_query_range("SELECT name FROM {users} u INNER JOIN {og_uid} og ON u.uid = og.uid WHERE og.nid = :og.nid AND LOWER(u.name) LIKE LOWER('%s%%')", array(':og.nid' => $gid, '' => $string));
   while ($user = db_fetch_object($result)) {
     $matches[$user->name] = check_plain($user->name);
   }
-  print drupal_to_js($matches);
+  print drupal_json_encode($matches);
   exit();
 }
 
@@ -315,9 +334,9 @@ function spaces_casetracker_users_autoco
 function spaces_casetracker_case_stats($uid, $gid = NULL) {
   $status_closed = 7;
   $status_open   = 6;
-  $week = time() - 7*24*3600;
+  $week = REQUEST_TIME - 7 * 24 * 3600;
   $args = array();
-  
+
   // ASSIGNED
   if ($gid) {
     $args[] = $gid;
@@ -326,9 +345,9 @@ function spaces_casetracker_case_stats($
   else {
     $q = "SELECT COUNT(nid) AS count FROM {casetracker_case} WHERE case_status_id = %d AND assign_to = %d";
   }
-  
-  $stats['assigned']['total_open']   = db_result(db_query($q, array_merge($args, array($status_open, $uid))));
-  $stats['assigned']['total_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid))));
+
+  $stats['assigned']['total_open']   = db_query("SELECT COUNT(nid) AS count FROM {casetracker_case} WHERE case_status_id = :case_status_id AND assign_to = :assign_to", array(':case_status_id' => array_merge($args, array($status_open, $uid))))->fetchField();
+  $stats['assigned']['total_closed'] = db_query("SELECT COUNT(nid) AS count FROM {casetracker_case} WHERE case_status_id = :case_status_id AND assign_to = :assign_to", array(':case_status_id' => array_merge($args, array($status_closed, $uid))))->fetchField();
 
   if ($gid) {
     $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND c.case_status_id = %d AND c.assign_to = %d AND n.created > %d";
@@ -336,25 +355,25 @@ function spaces_casetracker_case_stats($
   else {
     $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = %d AND c.assign_to = %d AND n.created > %d";
   }
-  
-  $stats['assigned']['week_open']   = db_result(db_query($q, array_merge($args, array($status_open, $uid, $week))));
-  $stats['assigned']['week_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid, $week))));
+
+  $stats['assigned']['week_open']   = db_query("SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = :c.case_status_id AND c.assign_to = :c.assign_to AND n.created > :n.created", array(':c.case_status_id' => array_merge($args, array($status_open, $uid, $week))))->fetchField();
+  $stats['assigned']['week_closed'] = db_query("SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = :c.case_status_id AND c.assign_to = :c.assign_to AND n.created > :n.created", array(':c.case_status_id' => array_merge($args, array($status_closed, $uid, $week))))->fetchField();
 
   // CREATED
   if ($gid) {
     $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND c.case_status_id = %d AND n.uid = %d";
   }
-  else{
+  else {
     $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = %d AND n.uid = %d";
   }
 
-  $stats['created']['total_open']    = db_result(db_query($q, array_merge($args, array($status_open, $uid))));
-  $stats['created']['total_closed']  = db_result(db_query($q, array_merge($args, array($status_closed, $uid))));
+  $stats['created']['total_open']    = db_query("SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = :c.case_status_id AND n.uid = :n.uid", array(':c.case_status_id' => array_merge($args, array($status_open, $uid))))->fetchField();
+  $stats['created']['total_closed']  = db_query("SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = :c.case_status_id AND n.uid = :n.uid", array(':c.case_status_id' => array_merge($args, array($status_closed, $uid))))->fetchField();
 
   $q .= " AND n.created > %d";
 
-  $stats['created']['week_open']    = db_result(db_query($q, array_merge($args, array($status_open, $uid, $week))));
-  $stats['created']['week_closed']  = db_result(db_query($q, array_merge($args, array($status_closed, $uid, $week))));
+  $stats['created']['week_open']    = db_query($q, array_merge($args, array($status_open, $uid, $week)))->fetchField();
+  $stats['created']['week_closed']  = db_query($q, array_merge($args, array($status_closed, $uid, $week)))->fetchField();
 
   if ($gid) {
     $q = "SELECT COUNT(c.case_type_id) AS count, cs.case_state_name AS name FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {casetracker_case_states} cs ON c.case_type_id = cs.csid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND n.uid = %d GROUP BY c.case_type_id";
@@ -363,9 +382,9 @@ function spaces_casetracker_case_stats($
     $q = "SELECT COUNT(c.case_type_id) AS count, cs.case_state_name AS name FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {casetracker_case_states} cs ON c.case_type_id = cs.csid WHERE n.uid = %d GROUP BY c.case_type_id";
   }
 
-  $result = db_query($q, array_merge($args, array($uid)));
-  
-  while($type = db_fetch_array($result)) {
+  $result = db_query("SELECT COUNT(c.case_type_id) AS count, cs.case_state_name AS name FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {casetracker_case_states} cs ON c.case_type_id = cs.csid WHERE n.uid = :n.uid GROUP BY c.case_type_id", array(':n.uid' => array_merge($args, array($uid))));
+
+  while ($type = db_fetch_array($result)) {
     $stats['created']['breakdown'][$type['name']] = $type['count'];
   }
 
@@ -383,67 +402,78 @@ function _spaces_casestats_count($label,
 /*
  *  Theme out casestats
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function theme_spaces_casestats($stats, $username) {
+  // TODO: Should this theme spaces_casestats be declared in hook_theme()?
   drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
   $labels = array(
     array(
-      'data'    =>t('Assigned to !user', array('!user'=>$username)),
-      'colspan' =>2,
-      'class'   =>'halfpoint',
+      'data' => t('Assigned to !user', array('!user' => $username)),
+      'colspan' => 2,
+      'class' => 'halfpoint',
     ),
     array(
-      'data'=>t('Created by !user', array('!user'=>$username)),
-      'colspan'=>2,
+      'data' => t('Created by !user', array('!user' => $username)),
+      'colspan' => 2,
     ),
   );
   $rows[] = array(
     array(
-      'data'    =>t('This Week'),
-      'colspan' =>2,
-      'class'   =>'header halfpoint',
+      'data' => t('This Week'),
+      'colspan' => 2,
+      'class' => 'header halfpoint',
     ),
     array(
-      'data'    =>t('This Week'),
-      'colspan' =>2,
-      'class'   =>'header',
+      'data' => t('This Week'),
+      'colspan' => 2,
+      'class' => 'header',
     ),
   );
   $rows[] = array(
-    _spaces_casestats_count(t('Open'),   $stats['assigned']['week_open']),
-    array('data'=>_spaces_casestats_count(t('Closed'), $stats['assigned']['week_closed']), 'class'=>'halfpoint'),
-    _spaces_casestats_count(t('Open'),   $stats['created']['week_open']),
+    _spaces_casestats_count(t('Open'),    $stats['assigned']['week_open']),
+    array(
+      'data' => _spaces_casestats_count(t('Closed'), $stats['assigned']['week_closed']),
+      'class' => 'halfpoint',
+    ),
+    _spaces_casestats_count(t('Open'),    $stats['created']['week_open']),
     _spaces_casestats_count(t('Closed'), $stats['created']['week_closed']),
   );
   $rows[] = array(
     array(
-      'data'    =>t('Total'),
-      'colspan' =>2,
-      'class'   =>'header halfpoint',
+      'data' => t('Total'),
+      'colspan' => 2,
+      'class' => 'header halfpoint',
     ),
     array(
-      'data'    =>t('Total'),
-      'colspan' =>2,
-      'class'   =>'header',
+      'data' => t('Total'),
+      'colspan' => 2,
+      'class' => 'header',
     ),
   );
   $rows[] = array(
-    _spaces_casestats_count(t('Open'),   $stats['assigned']['total_open']),
-    array('data'=>_spaces_casestats_count(t('Closed'), $stats['assigned']['total_closed']), 'class'=>'halfpoint'),
-    _spaces_casestats_count(t('Open'),   $stats['created']['total_open']),
+    _spaces_casestats_count(t('Open'),    $stats['assigned']['total_open']),
+    array(
+      'data' => _spaces_casestats_count(t('Closed'), $stats['assigned']['total_closed']),
+      'class' => 'halfpoint',
+    ),
+    _spaces_casestats_count(t('Open'),    $stats['created']['total_open']),
     _spaces_casestats_count(t('Closed'), $stats['created']['total_closed']),
   );
 
-  $o = theme('table', $labels, $rows, array('class'=>'casestats'));
-  
+  $o = theme('table', array('header' => $labels, 'rows' => $rows, 'attributes' => array('class' => 'casestats')));
+
   /*** Breakdown ***/
   if ($stats['created']['breakdown']) {
     $total = array_sum($stats['created']['breakdown']);
     foreach ($stats['created']['breakdown'] as $label => $count) {
-      $pct = floor($count/$total * 1000)*.1;
-      $breakdown[] = "<span class='pct'>$pct%</span> ".t('in')." $label";     
+      $pct = floor($count / $total * 1000) * .1;
+      $breakdown[] = "<span class='pct'>$pct%</span> " . t('in') . " $label";
     }
     $breakdown = implode(', ', $breakdown) . ".";
-    $breakdown = "<div class='case-breakdown'><span class='label'>".t('Cases created:')."</span>$breakdown</div>";
+    $breakdown = "<div class='case-breakdown'><span class='label'>" . t('Cases created:') . "</span>$breakdown</div>";
   }
 
   return $o . $breakdown;
@@ -462,42 +492,42 @@ function _spaces_casetracker_views_base(
   $view->page_type = 'table';
   $view->use_pager = TRUE;
   $view->nodes_per_page = '50';
-  $view->sort = array ();
+  $view->sort = array();
   $view->argument = array();
-  $view->field = array (
-    'project' => array (
+  $view->field = array(
+    'project' => array(
       'tablename' => 'casetracker_case',
       'field' => 'pid',
       'label' => 'Project',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'casetracker',
       'sortable' => '1',
-    ),    
-    'title' => array (
+    ),
+    'title' => array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    'status' => array (
+    'status' => array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'label' => 'Status',
     ),
-    'assigned' => array (
+    'assigned' => array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'label' => 'Assigned',
       'sortable' => '1',
     ),
-    'priority' => array (
+    'priority' => array(
       'tablename' => 'casetracker_case',
       'field' => 'case_priority_id',
       'label' => 'Priority',
       'sortable' => '1',
     ),
-    'changed' => array (
+    'changed' => array(
       'tablename' => 'node',
       'field' => 'changed',
       'label' => 'Updated',
@@ -506,31 +536,31 @@ function _spaces_casetracker_views_base(
       'defaultsort' => 'DESC',
     ),
   );
-  $view->filter = array (
-    'type' => array (
+  $view->filter = array(
+    'type' => array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'casetracker_basic_case',
       ),
     ),
-    'status' => array (
+    'status' => array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    'spaces' => array (
+    'spaces' => array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
       'options' => '',
       'value' => 'all',
     ),
-  );  
+  );
   $view->exposed_filter = array();
   $view->requires = array(node, casetracker_case);
   return $view;
@@ -548,8 +578,8 @@ function _spaces_casetracker_views_cases
   $view->page_title = t('Cases');
   $view->url = 'cases';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -575,44 +605,44 @@ function _spaces_casetracker_views_cases
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '5';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'sortorder' => 'DESC',
       'options' => 'normal',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'og_node_data',
       'field' => 'title',
       'label' => 'Group',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'og',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Case',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => 'Created On',
       'handler' => 'views_handler_field_since',
       'options' => 1,
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'label' => 'Assigned To',
     ),
   );
 
-  $view->filter['og'] = array (
+  $view->filter['og'] = array(
     'tablename' => 'og_uid_node',
     'field' => 'currentuid',
     'operator' => '=',
@@ -624,7 +654,7 @@ function _spaces_casetracker_views_cases
     'tablename' => 'node',
     'field' => 'changed',
     'operator' => '>',
-    'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+    'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
     'value' => 'now',
   );
 
@@ -634,7 +664,7 @@ function _spaces_casetracker_views_cases
 
 function _spaces_casetracker_views_cases_bystatus() {
   $view = _spaces_casetracker_views_base();
-  
+
   $view->name = 'spaces_cases_bystatus';
   $view->description = t('Filter cases by status.');
 
@@ -645,8 +675,8 @@ function _spaces_casetracker_views_cases
   $view->page_title = t('Cases by status');
   $view->url = 'cases/by-status';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -654,18 +684,18 @@ function _spaces_casetracker_views_cases
     ),
   );
 
-  $view->filter['status_id'] = array (
+  $view->filter['status_id'] = array(
     'tablename' => 'casetracker_case',
     'field' => 'case_status_id',
     'operator' => 'OR',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '6',
     ),
   );
 
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'label' => t('Status'),
@@ -681,7 +711,7 @@ function _spaces_casetracker_views_cases
 
 function _spaces_casetracker_views_cases_byuser() {
   $view = _spaces_casetracker_views_base();
-  
+
   $view->name = 'spaces_cases_byuser';
   $view->description = t('Filter cases by user.');
 
@@ -693,7 +723,7 @@ function _spaces_casetracker_views_cases
   $view->url = 'cases/by-user';
 
   $view->sort = array(
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -701,18 +731,18 @@ function _spaces_casetracker_views_cases
     ),
   );
 
-  $view->filter['assign'] = array (
+  $view->filter['assign'] = array(
     'tablename' => 'casetracker_case',
     'field' => 'assign_to',
     'operator' => 'OR',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '29',
     ),
   );
 
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'label' => 'User',
@@ -741,7 +771,7 @@ function _spaces_casetracker_views_cases
   $view->url = 'cases/my';
 
   $view->sort = array(
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -749,25 +779,25 @@ function _spaces_casetracker_views_cases
     ),
   );
 
-  $view->filter['user'] = array (
+  $view->filter['user'] = array(
     'tablename' => 'casetracker_case',
     'field' => 'assign_to_currentuid',
     'operator' => '=',
     'options' => '',
     'value' => '***CURRENT_USER***',
   );
-  $view->filter['project'] = array (
+  $view->filter['project'] = array(
     'tablename' => 'casetracker_project',
     'field' => 'project_number',
     'operator' => 'OR',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '100',
     ),
   );
 
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_project',
       'field' => 'project_number',
       'label' => 'Project',
@@ -785,7 +815,7 @@ function _spaces_casetracker_views_cases
   $view = new stdClass();
   $view->name = 'spaces_cases_myblock';
   $view->description = t('Provides a block listing of cases assigned to current user.');
-  $view->access = array ();
+  $view->access = array();
   $view->view_args_php = '';
   $view->page = FALSE;
   $view->block = TRUE;
@@ -794,8 +824,8 @@ function _spaces_casetracker_views_cases
   $view->block_empty_format = '2';
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '10';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'sortorder' => 'DESC',
@@ -803,48 +833,48 @@ function _spaces_casetracker_views_cases
     ),
   );
   $view->argument = array();
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'label' => '',
       'handler' => 'views_handler_field_since',
       'options' => 1,
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'users',
       'field' => 'name',
       'label' => t('Author'),
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to_currentuid',
       'operator' => '=',
       'options' => '',
       'value' => '***CURRENT_USER***',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '6',
         1 => '8',
         2 => '9',
         3 => '10',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -852,14 +882,14 @@ function _spaces_casetracker_views_cases
       'value' => 'all',
     ),
   );
-  $view->exposed_filter = array ();
+  $view->exposed_filter = array();
   $view->requires = array(node_comment_statistics, node, casetracker_case);
   return $view;
 }
 
 function _spaces_casetracker_views_cases_byproject() {
   $view = _spaces_casetracker_views_base();
-  
+
   $view->name = 'spaces_cases_byproject';
   $view->description = t('Filter cases by project.');
 
@@ -871,7 +901,7 @@ function _spaces_casetracker_views_cases
   $view->url = 'cases/by-project';
 
   $view->sort = array(
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -879,18 +909,18 @@ function _spaces_casetracker_views_cases
     ),
   );
 
-  $view->filter['project'] = array (
+  $view->filter['project'] = array(
     'tablename' => 'casetracker_project',
     'field' => 'project_number',
     'operator' => 'OR',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '100',
     ),
   );
 
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_project',
       'field' => 'project_number',
       'label' => 'Project',
@@ -907,7 +937,7 @@ function _spaces_casetracker_views_cases
 }
 
 function _spaces_casetracker_views_cases_mycreated() {
-  $view = _spaces_casetracker_views_base();  
+  $view = _spaces_casetracker_views_base();
 
   $view->name = 'spaces_cases_mycreated';
   $view->description = t('A view of all cases made by the current user.');
@@ -919,8 +949,8 @@ function _spaces_casetracker_views_cases
   $view->page_title = t('Created by me');
   $view->url = 'cases/mycreated';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -928,25 +958,25 @@ function _spaces_casetracker_views_cases
     ),
   );
 
-  $view->filter['user'] = array (
+  $view->filter['user'] = array(
     'tablename' => 'node',
     'field' => 'currentuid',
     'operator' => '=',
     'options' => '',
     'value' => '***CURRENT_USER***',
   );
-  $view->filter['project'] = array (
+  $view->filter['project'] = array(
     'tablename' => 'casetracker_project',
     'field' => 'project_number',
     'operator' => 'OR',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '100',
     ),
   );
 
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_project',
       'field' => 'project_number',
       'label' => 'Project',
@@ -977,48 +1007,48 @@ function _spaces_casetracker_views_cases
   $view->use_pager = TRUE;
   $view->nodes_per_page = '100';
   $view->argument = array();
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
       'options' => 'normal',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'pid',
       'label' => 'Project',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'casetracker',
       'sortable' => '1',
-    ),  
-    array (
+    ),
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'label' => 'Status',
-    ),    
-    array (
+    ),
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'label' => 'Assigned',
       'sortable' => '1',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_priority_id',
       'label' => 'Priority',
       'sortable' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'label' => 'Updated',
@@ -1027,69 +1057,69 @@ function _spaces_casetracker_views_cases
       'defaultsort' => 'DESC',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'casetracker_basic_case',
       ),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_project',
       'field' => 'project_number',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '100',
       ),
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '1',
       ),
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_type_id',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '11',
       ),
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_priority_id',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '1',
       ),
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '6',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -1097,8 +1127,8 @@ function _spaces_casetracker_views_cases
       'value' => 'all',
     ),
   );
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'casetracker_project',
       'field' => 'project_number',
       'label' => 'Project',
@@ -1107,7 +1137,7 @@ function _spaces_casetracker_views_cases
       'operator' => '1',
       'single' => '0',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'assign_to',
       'label' => 'For',
@@ -1116,7 +1146,7 @@ function _spaces_casetracker_views_cases
       'operator' => '1',
       'single' => '0',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_type_id',
       'label' => 'Type',
@@ -1125,7 +1155,7 @@ function _spaces_casetracker_views_cases
       'operator' => '1',
       'single' => '0',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_priority_id',
       'label' => 'Priority',
@@ -1134,7 +1164,7 @@ function _spaces_casetracker_views_cases
       'operator' => '1',
       'single' => '0',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'label' => 'Status',
@@ -1145,7 +1175,7 @@ function _spaces_casetracker_views_cases
     ),
   );
   $view->requires = array(node, casetracker_case, casetracker_project);
-  return $view; 
+  return $view;
 }
 
 function _spaces_casetracker_views_cases_projects() {
@@ -1165,53 +1195,53 @@ function _spaces_casetracker_views_cases
   $view->use_pager = TRUE;
   $view->nodes_per_page = '99';
   $view->argument = array();
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'sortorder' => 'ASC',
       'options' => '',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Project',
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => '',
       'handler' => 'views_handler_field_date_custom',
       'options' => 'F j, Y',
     ),
-    array (
+    array(
       'tablename' => 'casetracker_case_node',
       'field' => 'nid',
       'label' => '',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'casetracker_basic_project',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -1219,14 +1249,14 @@ function _spaces_casetracker_views_cases
       'value' => 'all',
     ),
   );
-  $view->exposed_filter = array ();
+  $view->exposed_filter = array();
   $view->requires = array(node, casetracker_case_node);
   return $view;
 }
 
 function _spaces_casetracker_views_user_cases() {
-  $view = _spaces_casetracker_views_base();  
-  
+  $view = _spaces_casetracker_views_base();
+
   $view->name = 'spaces_user_cases';
   $view->description = 'A view of all cases by date.';
 
@@ -1234,8 +1264,8 @@ function _spaces_casetracker_views_user_
   $view->page_title = 'Cases';
   $view->url = 'user-cases';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
@@ -1243,12 +1273,12 @@ function _spaces_casetracker_views_user_
     ),
   );
 
-  $view->filter['assign'] = array (
+  $view->filter['assign'] = array(
     'tablename' => 'casetracker_case',
     'field' => 'assign_to',
     'operator' => 'AND',
     'options' => '',
-    'value' => array (
+    'value' => array(
       0 => '1',
     ),
   );
@@ -1258,7 +1288,7 @@ function _spaces_casetracker_views_user_
 }
 
 function _spaces_casetracker_views_user_cases_created() {
-  $view = _spaces_casetracker_views_base();  
+  $view = _spaces_casetracker_views_base();
 
   $view->name = 'spaces_user_cases_created';
   $view->description = 'A view of all cases by date.';
@@ -1273,8 +1303,8 @@ function _spaces_casetracker_views_user_
   $view->page_title = 'Cases created by';
   $view->url = 'user-cases/created';
 
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'casetracker_case',
       'field' => 'case_status_id',
       'sortorder' => 'ASC',
Only in spaces_contacts: CVS
diff -up -r spaces_contacts/spaces_contacts.info spaces_contacts/spaces_contacts.info
--- spaces_contacts/spaces_contacts.info	2008-05-22 15:03:32.000000000 -0600
+++ spaces_contacts/spaces_contacts.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,5 @@
 name = Spaces Contacts
 description = Provides a contacts listing per Spaces of users and their contact information
 package = Spaces
-dependencies = spaces
\ No newline at end of file
+dependencies = spaces
+files[] = spaces_contacts.module
diff -up -r spaces_contacts/spaces_contacts.module spaces_contacts/spaces_contacts.module
--- spaces_contacts/spaces_contacts.module	2008-10-06 15:56:41.000000000 -0600
+++ spaces_contacts/spaces_contacts.module	2011-02-21 19:48:13.000000000 -0700
@@ -2,11 +2,11 @@
 // $Id: spaces_contacts.module,v 1.7 2008/10/06 21:56:41 yhahn Exp $
 
 /**
- * Implementation of hook_context_define()
+ * Implements hook_context_define().
  */
 function spaces_contacts_context_define() {
   $items = array();
-  $items[] = array(  
+  $items[] = array(
     'namespace' => 'spaces',
     'attribute' => 'feature',
     'value' => 'contacts',
@@ -31,14 +31,20 @@ function spaces_contacts_context_define(
 }
 
 /**
- * Implementation of hook_block()
+ * Implements hook_block_info().
  */
-function spaces_contacts_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
+function spaces_contacts_block_info() {
+  if (TRUE) {
     $blocks['contact_list']['info'] = t('Spaces Contacts: Contact List');
     return $blocks;
   }
-  else if ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function spaces_contacts_block_view($delta) {
+  if (TRUE) {
     switch ($delta) {
       case 'contact_list':
         $users = _spaces_contacts_users();
@@ -46,13 +52,14 @@ function spaces_contacts_block($op = 'li
         if ($users) {
           foreach ($users as $account) {
             $item = new stdClass();
-            $item->title = theme('username', $account);
+            $item->title = theme('username', array('account' => $account));
+            // TODO Please change this theme call to use an associative array for the $variables parameter.
             $items[] = theme('datetime_view_style_item', $item);
           }
-          $block['content'] = theme('item_list', $items);
+          $block['content'] = theme('item_list', array('items' => $items));
         }
         else {
-          $block['content'] = "<p>". t('No contacts found.') ."</p>";
+          $block['content'] = "<p>" . t('No contacts found.') . "</p>";
         }
         $block['subject'] = t('Contacts');
         return $block;
@@ -61,7 +68,12 @@ function spaces_contacts_block($op = 'li
 }
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_block().
+ */
+function spaces_contacts_block_OLD($op = 'list', $delta = 0) { }
+
+/**
+ * Implements hook_menu().
  */
 function spaces_contacts_menu($may_cache) {
   $items = array();
@@ -79,18 +91,19 @@ function spaces_contacts_menu($may_cache
 }
 
 /**
- * Implementation of hook_help()
+ * Implements hook_help().
  */
 function spaces_contacts_help($page) {
   if (context_get('spaces', 'feature') == 'contacts') {
-    return "<p>". t('Contacts shows the team members that are part of this group and any additional contact information if they have provided it.') ."</p>";
+    return "<p>" . t('Contacts shows the team members that are part of this group and any additional contact information if they have provided it.') . "</p>";
   }
 }
 
 /**
- * Implementation of hook_user()
+ * Implements hook_user().
  */
-function spaces_contacts_user($op, &$edit, &$account, $category = NULL) {
+function spaces_contacts_user_OLD($op, &$edit, &$account, $category = NULL) {
+  // TODO Remaining code in this function needs to be moved to the appropriate new hook function.
   if (in_array($op, array('view', 'form')) && spaces_get_space()) {
     context_set('spaces', 'feature', 'contacts');
   }
@@ -107,10 +120,10 @@ function spaces_contacts_pageview() {
   $users = _spaces_contacts_users();
   foreach ($users as $account) {
     $row = array(
-      theme('user_picture', $account),
-      theme('username', $account),
-      l($account->mail, 'mailto:'. $account->mail)
-    );        
+      theme('user_picture', array('account' => $account)),
+      theme('username', array('account' => $account)),
+      l($account->mail, 'mailto:' . $account->mail),
+    );
     if (module_exists('profile')) {
       $row[] = $account->profile_organization ? $account->profile_organization : null;
     }
@@ -121,7 +134,7 @@ function spaces_contacts_pageview() {
     $labels[] = t('Organization');
   }
   // wrap the table as if it were produced by a view
-  return "<div class='view-content'>". theme('table', $labels, $rows, array('class' => 'userlist')) ."</div>";
+  return "<div class='view-content'>" . theme('table', array('header' => $labels, 'rows' => $rows, 'attributes' => array('class' => 'userlist'))) . "</div>";
 }
 
 /**
@@ -135,7 +148,7 @@ function _spaces_contacts_users() {
       profile_load_profile($account);
       // Replace username listing with real name if possible
       if ($account->profile_givenname && $account->profile_familyname) {
-        $account->name = $account->profile_givenname .' '. $account->profile_familyname;
+        $account->name = $account->profile_givenname . ' ' . $account->profile_familyname;
       }
       else if ($account->profile_givenname) {
         $account->name = $account->profile_givenname;
Only in spaces_core: CVS
diff -up -r spaces_core/spaces_core.info spaces_core/spaces_core.info
--- spaces_core/spaces_core.info	2008-10-06 15:56:41.000000000 -0600
+++ spaces_core/spaces_core.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,7 +2,7 @@
 name = "Spaces Core Features"
 description = "Provides spaces features and customizations for the following core modules: Blog, Book, Comment, Taxonomy."
 package = "Spaces"
-core = "6.x"
+core = 7.x
 dependencies[] = spaces
 dependencies[] = blog
 dependencies[] = book
@@ -10,3 +10,5 @@ dependencies[] = comment
 ; dependencies[] = tagadelic
 ; dependencies[] = tagadelic_views
 ; dependencies[] = book_restrict
+
+files[] = spaces_core.module
diff -up -r spaces_core/spaces_core.module spaces_core/spaces_core.module
--- spaces_core/spaces_core.module	2008-10-06 15:56:41.000000000 -0600
+++ spaces_core/spaces_core.module	2011-02-21 19:48:13.000000000 -0700
@@ -2,7 +2,7 @@
 // $Id: spaces_core.module,v 1.16 2008/10/06 21:56:41 yhahn Exp $
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function spaces_core_menu() {
   $items = array();
@@ -32,27 +32,33 @@ function spaces_core_menu() {
 }
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function spaces_core_help($page) {
   switch (context_get('spaces', 'feature')) {
     case 'blog':
-      return "<p>". t('The blog is a team discussion place where you can post and discuss information relevant to your team.') ."</p>";
+      return "<p>" . t('The blog is a team discussion place where you can post and discuss information relevant to your team.') . "</p>";
     case 'book':
-      return "<p>". t('The book provides a place for you to post documents and other reference material.') ."</p>";
+      return "<p>" . t('The book provides a place for you to post documents and other reference material.') . "</p>";
   }
 }
 
 /**
- * Implementation of hook_block().
+ * Implements hook_block_info().
  */
-function spaces_core_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
+function spaces_core_block_info() {
+  if (TRUE) {
     $blocks['tags']['info'] = t('Spaces Core: Tag chart');
     $blocks['book']['info'] = t('Spaces Core: Book navigation');
     return $blocks;
   }
-  else if ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function spaces_core_block_view($delta) {
+  if (TRUE) {
     switch ($delta) {
       case 'tags':
         return _spaces_core_block_tags();
@@ -63,7 +69,12 @@ function spaces_core_block($op = 'list',
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_block().
+ */
+function spaces_core_block_OLD($op = 'list', $delta = 0) { }
+
+/**
+ * Implements hook_form_alter().
  */
 function spaces_core_form_alter($form_id, &$form) {
   switch ($form_id) {
@@ -71,53 +82,58 @@ function spaces_core_form_alter($form_id
       unset($form['og_settings']); // Remove the og email settings.
       break;
     case 'comment_form':
-      if (!drupal_get_title()) drupal_set_title(t('Reply'));
+      if (!drupal_get_title()) {
+        drupal_set_title(t('Reply'));
+      }
       break;
   }
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_node_view().
  */
-function spaces_core_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  switch ($op) {
-    case "view":
-      switch ($node->type) {
-        case 'book':
-          // Hide top book navigation if page is unusually short
-          if (strlen(strip_tags($node->content['body']['#value'])) > 1000) {
-            $node->content['spaces_book'] = array(
-              '#value' => theme('book_navigation', $node, false),
-              '#weight' => -100,
-            );
-          }
-          break;
+function spaces_core_node_view($node, $view_mode = 'full') {
+  switch ($node->type) {
+    case 'book':
+      // Hide top book navigation if page is unusually short
+      if (strlen(strip_tags($node->content['body']['#value'])) > 1000) {
+        // TODO Please change this theme call to use an associative array for the $variables parameter.
+        $node->content['spaces_book'] = array(
+          '#value' => theme('book_navigation', $node, false),
+          '#weight' => -100,
+        );
       }
       break;
   }
 }
 
 /**
- *  Implementation of hook_user().
+ * Implements hook_nodeapi().
  */
-function spaces_core_user($op, &$edit, &$account, $category = NULL) {
-  switch ($op) {
-    case 'view':
-      global $user;
-      context_set('spaces', 'user', $account->uid);
-      if ($user->uid == $account->uid) {
-        $links = array();
-        $links['user']['title'] = t('Edit my account');
-        $links['user']['href'] = 'user/'. $account->uid .'/edit';
-        $links['user']['custom'] = true;
-        context_set('spaces', 'links', $links);
-      }
-      break;
+function spaces_core_nodeapi_OLD(&$node, $op, $a3 = NULL, $a4 = NULL) { }
+
+/**
+ * Implements hook_user_view().
+ */
+function spaces_core_user_view($account, $view_mode) {
+  global $user;
+  context_set('spaces', 'user', $account->uid);
+  if ($user->uid == $account->uid) {
+    $links = array();
+    $links['user']['title'] = t('Edit my account');
+    $links['user']['href'] = 'user/' . $account->uid . '/edit';
+    $links['user']['custom'] = true;
+    context_set('spaces', 'links', $links);
   }
 }
 
 /**
- *  Implementation of hook_default_views().
+ * Implements hook_user().
+ */
+function spaces_core_user_OLD($op, &$edit, &$account, $category = NULL) { }
+
+/**
+ * Implements hook_default_views().
  */
 function spaces_core_views_default_views() {
   $default_views = array(
@@ -140,7 +156,7 @@ function spaces_core_views_default_views
 }
 
 /**
- * Implementation of hook_context_define().
+ * Implements hook_context_define().
  */
 function spaces_core_context_define() {
   $items = array();
@@ -163,7 +179,10 @@ function spaces_core_context_define() {
         'label' => t('Blog'),
         'description' => t('A member blog and team discussion space.'),
         'menu' => array(
-          'blog' => array('title' => t('Blog'), 'weight' => -5),
+          'blog' => array(
+            'title' => t('Blog'),
+            'weight' => -5,
+          ),
         ),
       ),
     );
@@ -193,7 +212,7 @@ function spaces_core_context_define() {
     );
   }
   if (module_exists('taxonomy')) {
-    $items[] = array(  
+    $items[] = array(
       'namespace' => 'spaces',
       'attribute' => 'feature',
       'value' => 'taxonomy',
@@ -214,6 +233,10 @@ function spaces_core_context_define() {
 /*
  * This function acts as a fallback in case users delete or re-path the root book page at 'documents'
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_core_documents() {
   // og version of the book root lookup
   if ($space = spaces_get_space()) {
@@ -223,7 +246,7 @@ function spaces_core_documents() {
       $view->execute();
       if (is_array($view->result) && count($view->result)) {
         $row = array_shift($view->result);
-        drupal_goto('node/'. $row->nid);
+        drupal_goto('node/' . $row->nid);
       }
     }
     context_ui_set('node', 'book');
@@ -237,12 +260,12 @@ function spaces_core_documents() {
 /**
  * @TODO: Abstract this into a hook -- we will not always be testing
  * against OG conditions!
- * 
+ *
  * Page call back to handle taxonomy listing
  *
  * If a term is requested in a group context we use a group aware page
- * when then term's vocabulary is related to any group targeted node 
- * types. If it is from a vocab that doesn't relate to any group aware 
+ * when then term's vocabulary is related to any group targeted node
+ * types. If it is from a vocab that doesn't relate to any group aware
  * content or is request outsite of a group contexts we use a group
  * agnostic listing.
  *
@@ -253,7 +276,7 @@ function spaces_core_documents() {
  *   A themed taxonomy listing page.
  */
 function spaces_core_taxonomy($tid) {
-  if (is_numeric($tid) && $t = taxonomy_get_term($tid)) {
+  if (is_numeric($tid) && $t = taxonomy_term_load($tid)) {
     $v = taxonomy_get_vocabulary($t->vid);
   }
   if ($v && $t) {
@@ -261,9 +284,9 @@ function spaces_core_taxonomy($tid) {
     $content = views_build_view('page', $view, array($tid), true, 25);
 
     if (is_object($t) && is_object($v)) {
-      drupal_set_title($v->name .': '. $t->name);
-      
-      // set taxonomy context 
+      drupal_set_title($v->name . ': ' . $t->name);
+
+      // set taxonomy context
       context_set('taxonomy', array('vid' => $t->vid, 'tid' => $t->tid));
       if ($use_gid) {
         context_set('taxonomy', 'group_vocab', true);
@@ -271,18 +294,19 @@ function spaces_core_taxonomy($tid) {
     }
     return $content;
   }
-  return drupal_not_found(); exit;
+  return drupal_not_found();
+  exit;
 }
 
 /**
- * Implementation of hook_spaces_node_links_alter();
+ * Implements hook_spaces_node_links_alter();().
  */
 function spaces_core_spaces_node_links_alter(&$links) {
   if (isset($links['book'])) {
     if ($space = spaces_get_space()) {
       if ($space->feature_access('book') && arg(0) == 'node' && is_numeric(arg(1))) {
         $pid = arg(1);
-        $links['book']['href'] = 'node/add/book/parent/'. $pid;
+        $links['book']['href'] = 'node/add/book/parent/' . $pid;
       }
     }
   }
@@ -296,7 +320,7 @@ function _spaces_core_block_tags() {
   if (context_get('spaces', 'feature') == 'taxonomy') {
     $terms = taxonomy_terms_parse_string(arg(2));
     $tid = $terms['tids'][0];
-    if ($term = taxonomy_get_term($tid)) {
+    if ($term = taxonomy_term_load($tid)) {
       $vocab = taxonomy_get_vocabulary($term->vid);
       $view = views_get_view('spaces_tags');
       $view->filter[1]['value'] = array($term->vid);
@@ -318,7 +342,8 @@ function _spaces_core_block_book() {
       $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid'];
     }
     // Only display this block when the user is browsing a book.
-    $title = db_result(db_query(db_rewrite_sql('SELECT n.title FROM {node} n WHERE n.nid = %d'), $node->book['bid']));
+    // TODO Please convert this statement to the D7 database API syntax.
+    $title = db_query(db_rewrite_sql('SELECT n.title FROM {node} n WHERE n.nid = %d'), $node->book['bid'])->fetchField();
 
     // Only show the block if the user has view access for the top-level node.
     if ($title) {
@@ -334,7 +359,7 @@ function _spaces_core_block_book() {
         $view->set_items_per_page(0);
         $view->execute();
         if (is_array($view->result) && count($view->result)) {
-          foreach($view->result as $row) {
+          foreach ($view->result as $row) {
             $tree = menu_tree_all_data(book_menu_name($row->nid), $node->book);
             $output .= menu_tree_output($tree);
           }
@@ -354,6 +379,7 @@ function _spaces_core_book_tree($parent 
     $sid = $space->sid;
   }
   if ($sid) {
+    // TODO Please convert this statement to the D7 database API syntax.
     $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid JOIN {og_ancestry} og ON og.nid = b.nid WHERE n.status = 1 AND og.group_nid = %d ORDER BY b.weight, n.title'), $sid);
 
     while ($node = db_fetch_object($result)) {
@@ -363,7 +389,7 @@ function _spaces_core_book_tree($parent 
     }
 
     if ($tree = book_tree_recurse($parent, $depth, $children, $unfold)) {
-      return '<ul class="menu">'. $tree .'</ul>';
+      return '<ul class="menu">' . $tree . '</ul>';
     }
   }
   else {
@@ -396,16 +422,16 @@ function _spaces_core_views_blog() {
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '3';
   $view->block_more = TRUE;
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'sortorder' => 'DESC',
       'options' => 'normal',
     ),
   );
-  $view->argument = array (
-    array (
+  $view->argument = array(
+    array(
       'type' => 'uid',
       'argdefault' => '2',
       'title' => '%1\'s Blog',
@@ -413,7 +439,7 @@ function _spaces_core_views_blog() {
       'wildcard' => 'all',
       'wildcard_substitution' => '',
     ),
-    array (
+    array(
       'type' => 'node_feed',
       'argdefault' => '2',
       'title' => 'Blog',
@@ -422,14 +448,14 @@ function _spaces_core_views_blog() {
       'wildcard_substitution' => '',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => '',
       'handler' => 'views_handler_field_date_small',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
@@ -437,24 +463,24 @@ function _spaces_core_views_blog() {
       'options' => 'link',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'blog',
       ),
-    ),    
-    array (
+    ),
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -480,8 +506,8 @@ function _spaces_core_views_blog_comment
   $view->block_empty_format = '1';
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '5';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'sortorder' => 'DESC',
@@ -489,69 +515,69 @@ function _spaces_core_views_blog_comment
     ),
   );
   $view->argument = array();
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'comments',
       'field' => 'subject',
       'label' => t('Comment'),
       'handler' => 'views_handler_field_commentlink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'comments',
       'field' => 'name',
       'label' => t('By'),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => t('On Post'),
       'handler' => 'views_handler_field_nodelink',
       'options' => 'nolink',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'label' => t('Date'),
       'handler' => 'views_handler_field_date_small',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'comment_count',
       'operator' => '>',
       'options' => '',
       'value' => '0',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'blog',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
       'options' => '',
       'value' => 'all',
-    ),   
-    array (
+    ),
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'operator' => '>',
-      'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
       'value' => 'now',
     ),
   );
@@ -572,8 +598,8 @@ function _spaces_core_views_ref_blog2boo
   $view->block_title = t('Discussions');
   $view->block_type = 'table';
   $view->nodes_per_block = '50';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'sortorder' => 'DESC',
@@ -586,37 +612,37 @@ function _spaces_core_views_ref_blog2boo
       'argdefault' => '1',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => t('Title'),
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'users',
       'field' => 'name',
       'label' => t('Author'),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => t('Posted'),
       'handler' => 'views_handler_field_date_small',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'blog',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -636,7 +662,7 @@ function _spaces_core_views_user_posts()
   $view->view_args_php = '';
   $view->page = TRUE;
   $view->page_title = t('Recent Posts');
-  $view->page_empty = '<p class="views-empty">'.t('No recent posts found').'</p>';
+  $view->page_empty = '<p class="views-empty">' . t('No recent posts found') . '</p>';
   $view->page_empty_format = '2';
   $view->page_type = 'table';
   $view->url = 'userposts';
@@ -644,13 +670,13 @@ function _spaces_core_views_user_posts()
   $view->nodes_per_page = '25';
   $view->block = TRUE;
   $view->block_title = t('Recent Posts');
-  $view->block_empty = '<p class="views-empty">'.t('No recent posts found').'</p>';
+  $view->block_empty = '<p class="views-empty">' . t('No recent posts found') . '</p>';
   $view->block_empty_format = '1';
   $view->block_type = 'table';
   $view->nodes_per_block = '10';
   $view->block_more = TRUE;
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'sortorder' => 'DESC',
@@ -658,32 +684,32 @@ function _spaces_core_views_user_posts()
     ),
   );
   $view->argument = array(
-    array (
+    array(
       'type' => 'uidtouch',
       'argdefault' => '7',
       'title' => "%1's Posts",
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
       'handler' => 'views_handler_field_nodelink_with_mark',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'label' => 'Type',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'comment_count',
       'label' => 'Replies',
       'handler' => 'views_handler_comments',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'label' => 'Last Post',
@@ -691,22 +717,22 @@ function _spaces_core_views_user_posts()
       'options' => 1,
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'NOR',
       'options' => '',
       'value' => array_merge(og_get_types('group'), array('shout')),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'all',
@@ -737,42 +763,42 @@ function _spaces_core_views_changes() {
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '5';
   $view->argument = array();
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'sortorder' => 'DESC',
       'options' => 'normal',
     ),
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'og_node_data',
       'field' => 'title',
       'label' => 'Group',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'og',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => t('Title'),
       'handler' => 'views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'label' => t('Changed'),
       'handler' => 'views_handler_field_since',
       'options' => 1,
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'label' => t('Type'),
     ),
-    array (
+    array(
       'tablename' => 'users',
       'field' => 'name',
       'label' => t('Author'),
@@ -784,33 +810,33 @@ function _spaces_core_views_changes() {
   else {
     $excluded = array('shout');
   }
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'NOR',
       'options' => '',
       'value' => array_merge(og_get_types('group'), $excluded),
     ),
-    array (
+    array(
       'tablename' => 'og_uid_node',
       'field' => 'currentuid',
       'operator' => '=',
       'options' => '',
       'value' => '***CURRENT_USER***',
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'active',
       'options' => '',
       'value' => 'all',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'operator' => '>',
-      'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
       'value' => 'now',
     ),
   );
@@ -827,7 +853,7 @@ function _spaces_core_views_comments() {
   $view->view_args_php = '';
   $view->page = TRUE;
   $view->page_title = t('Recent Comments');
-  $view->page_empty = '<p class="views-empty">'. t('No recent comments found.') .'</p>';
+  $view->page_empty = '<p class="views-empty">' . t('No recent comments found.') . '</p>';
   $view->page_empty_format = '2';
   $view->page_type = 'table';
   $view->url = 'comments';
@@ -835,12 +861,12 @@ function _spaces_core_views_comments() {
   $view->nodes_per_page = '25';
   $view->block = TRUE;
   $view->block_title = t('Recent Comments');
-  $view->block_empty = "<p class='views-empty'>". t('No recent comments.') ."</p>";
+  $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
   $view->block_empty_format = '1';
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '5';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'sortorder' => 'DESC',
@@ -848,81 +874,81 @@ function _spaces_core_views_comments() {
     ),
   );
   $view->argument = array();
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'og_node_data',
       'field' => 'title',
       'label' => 'Group',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'og',
     ),
-    array (
+    array(
       'tablename' => 'comments',
       'field' => 'subject',
       'label' => t('Comment'),
       'handler' => 'views_handler_field_commentlink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'comments',
       'field' => 'name',
       'label' => t('By'),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => t('On Post'),
       'handler' => 'views_handler_field_nodelink',
       'options' => 'nolink',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'label' => t('Type'),
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'label' => t('Date'),
       'handler' => 'views_handler_field_date_small',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'comment_count',
       'operator' => '>',
       'options' => '',
       'value' => '0',
     ),
-    array (
+    array(
       'tablename' => 'og_uid_node',
       'field' => 'currentuid',
       'operator' => '=',
       'options' => '',
       'value' => '***CURRENT_USER***',
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'active',
       'options' => '',
       'value' => 'all',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_timestamp',
       'operator' => '>',
-      'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
       'value' => 'now',
-    ),    
+    ),
   );
   $view->exposed_filter = array();
   $view->requires = array(node_comment_statistics, comments, node, og_node_data, og_uid_node);
@@ -933,15 +959,15 @@ function _spaces_core_views_taxonomy() {
   $view = new stdClass();
   $view->name = 'spaces_taxonomy';
   $view->description = t('Spaces taxonomy override.');
-  $view->access = $view->field = $view->exposed_filter = array ();
+  $view->access = $view->field = $view->exposed_filter = array();
   $view->page = TRUE;
-  $view->page_empty = '<p>'. t('No entries found.') . '</p>';
+  $view->page_empty = '<p>' . t('No entries found.') . '</p>';
   $view->page_empty_format = '2';
   $view->page_type = 'table';
   $view->use_pager = TRUE;
   $view->nodes_per_page = '20';
   $view->field = array(
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
@@ -949,7 +975,7 @@ function _spaces_core_views_taxonomy() {
       'sortable' => '1',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'label' => 'Date',
@@ -957,16 +983,16 @@ function _spaces_core_views_taxonomy() {
       'sortable' => '1',
       'defaultsort' => 'DESC',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'label' => 'Type',
       'sortable' => '1',
     ),
   );
-  $view->sort = array ();
-  $view->argument = array (
-    array (
+  $view->sort = array();
+  $view->argument = array(
+    array(
       'type' => 'taxid',
       'argdefault' => '1',
       'options' => '0',
@@ -974,15 +1000,15 @@ function _spaces_core_views_taxonomy() {
       'wildcard_substitution' => '',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'active',
@@ -1002,29 +1028,29 @@ function _spaces_core_views_tags() {
   $view->page = FALSE;
   $view->block = TRUE;
   $view->block_title = t('Tags');
-  $view->block_empty = '<p>'. t('No tags found.') .'</p>';
+  $view->block_empty = '<p>' . t('No tags found.') . '</p>';
   $view->block_empty_format = '1';
   $view->block_type = 'tagadelic';
   $view->nodes_per_block = '20';
-  $view->sort = array ();
-  $view->filter = array (
-    array (
+  $view->sort = array();
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
-      'tablename' => 'term_data',
+    array(
+      'tablename' => 'taxonomy_term_data',
       'field' => 'vid',
       'operator' => 'AND',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => '11',
       ),
     ),
-    array (
+    array(
       'tablename' => 'spaces',
       'field' => 'type',
       'operator' => 'active',
@@ -1032,10 +1058,10 @@ function _spaces_core_views_tags() {
       'value' => 'all',
     ),
   );
-  $view->argument = array ();
-  $view->field = array (
-    array (
-      'tablename' => 'term_node',
+  $view->argument = array();
+  $view->field = array(
+    array(
+      'tablename' => 'taxonomy_term_node',
       'field' => 'name',
       'label' => '',
       'options' => 'link',
Only in spaces_customtext: CVS
Only in spaces_customtext/plugins: CVS
Only in spaces_dashboard: CVS
diff -up -r spaces_dashboard/spaces_dashboard.info spaces_dashboard/spaces_dashboard.info
--- spaces_dashboard/spaces_dashboard.info	2008-05-22 15:03:33.000000000 -0600
+++ spaces_dashboard/spaces_dashboard.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,5 @@
 name = Spaces Dashboard
 description = "Provides a per-group and sitewide dashboard for the Spaces package. Also provides sitewide user administration through the Spaces package."
 package = Spaces
-dependencies = spaces
\ No newline at end of file
+dependencies = spaces
+files[] = spaces_dashboard.module
diff -up -r spaces_dashboard/spaces_dashboard.module spaces_dashboard/spaces_dashboard.module
--- spaces_dashboard/spaces_dashboard.module	2008-10-06 15:56:41.000000000 -0600
+++ spaces_dashboard/spaces_dashboard.module	2011-02-21 19:48:13.000000000 -0700
@@ -4,6 +4,10 @@
 /*
  * Implementation of hook_menu()
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_dashboard_menu($may_cache) {
   if ($may_cache) {
     $items[] = array(
@@ -19,27 +23,27 @@ function spaces_dashboard_menu($may_cach
         'path' => 'group_dashboard/team',
         'title' => t('Users'),
         'description' => t('A full listing of users on the spaces.'),
-        'callback' => 'spaces_dashboard_team', 
+        'callback' => 'spaces_dashboard_team',
         'access' => user_access('create users'),
         'type' => MENU_NORMAL_ITEM,
       );
-    }    
+    }
   }
   return $items;
 }
 
 /**
- * Implementation of hook_help()
+ * Implements hook_help().
  */
 function spaces_dashboard_help($page) {
   switch ($page) {
     case 'group_dashboard':
     case 'group_dashboard/dashboard':
-      return "<p>". t('The group dashboard shows you the latest content across all of your groups. You can limit the listing by using the dropdown filter.') ."</p>";
+      return "<p>" . t('The group dashboard shows you the latest content across all of your groups. You can limit the listing by using the dropdown filter.') . "</p>";
     case 'group_dashboard/group_directory':
-      return "<p>". t('The directory lists all groups you have access to. You may join groups that interest you if they allow others to join or request membership.') ."</p>";
+      return "<p>" . t('The directory lists all groups you have access to. You may join groups that interest you if they allow others to join or request membership.') . "</p>";
     case 'group_dashboard/team':
-      return "<p>". t('You can manage user accounts and group membership from this page. Select multiple users to add or remove them from a group.') ."</p>";
+      return "<p>" . t('You can manage user accounts and group membership from this page. Select multiple users to add or remove them from a group.') . "</p>";
       break;
   }
 }
@@ -47,6 +51,10 @@ function spaces_dashboard_help($page) {
 /*
  * Implementation of hook_form_alter()
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_dashboard_form_alter($form_id, &$form) {
   switch ($form_id) {
     case 'ucreate_user_form':
@@ -57,7 +65,7 @@ function spaces_dashboard_form_alter($fo
       if ($form['view']['#value']->name == 'spaces_group_dashboard') {
         global $user;
         $options = array(
-          '**ALL**' => '-- '. t('All of my groups') .' --',
+          '**ALL**' => '-- ' . t('All of my groups') . ' --',
         );
         foreach ($user->og_groups as $gid => $group) {
           $options[$gid] = truncate_utf8($group['title'], 30, false, true);
@@ -74,7 +82,7 @@ function spaces_dashboard_form_alter($fo
 }
 
 /**
- * Implementation of hook_context_define()
+ * Implements hook_context_define().
  */
 function spaces_dashboard_context_define() {
   global $user;
@@ -99,13 +107,13 @@ function spaces_dashboard_context_define
 }
 
 /**
- *  Implementation of hook_default_views
+ * Implements hook_default_views().
  */
 function spaces_dashboard_views_default_views() {
   $default_views = array(
     '_spaces_dashboard_views_group_dashboard',
     '_spaces_dashboard_views_group_directory',
-    '_spaces_dashboard_views_group_my'
+    '_spaces_dashboard_views_group_my',
   );
   foreach ($default_views as $v) {
     $view = call_user_func($v);
@@ -135,7 +143,7 @@ function spaces_dashboard_group_dashboar
       context_ui_set('views', 'spaces_group_dashboard');
 
       // Check whether any 'joinable' groups exist
-      $group_count = db_result(db_query("SELECT count(n.nid) FROM {node} n JOIN {og} og ON n.nid = og.nid WHERE n.status = 1 AND og.selective = 0"));
+      $group_count = db_query("SELECT count(n.nid) FROM {node} n JOIN {og} og ON n.nid = og.nid WHERE n.status = :n.status AND og.selective = :og.selective", array(':n.status' => 1, ':og.selective' => 0))->fetchField();
 
       // There are groups to join
       if ($group_count) {
@@ -167,6 +175,10 @@ function spaces_dashboard_group_dashboar
 /*
  * A user listing page
  */
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_dashboard_team($gid = null) {
   context_set('spaces', 'feature', 'group_dashboard');
 
@@ -180,8 +192,8 @@ function spaces_dashboard_team($gid = nu
     context_set('spaces', 'links', $links);
   }
 
-  drupal_add_css(drupal_get_path('module', 'spaces_dashboard') .'/spaces_dashboard.css');
-  drupal_add_js(drupal_get_path('module', 'spaces_dashboard') .'/spaces_dashboard.js');
+  drupal_add_css(drupal_get_path('module', 'spaces_dashboard') . '/spaces_dashboard.css');
+  drupal_add_js(drupal_get_path('module', 'spaces_dashboard') . '/spaces_dashboard.js');
 
   $output .= drupal_get_form('spaces_dashboard_users');
   return $output;
@@ -194,12 +206,16 @@ function spaces_views_handler_field_node
   return l($value, "node/$data->nid");
 }
 
-function spaces_dashboard_users() {
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
+function spaces_dashboard_users($form) {
   $form = array();
 
   $form['groups'] = array(
     '#title' => t('Group'),
-    '#type' => 'select', 
+    '#type' => 'select',
     '#options' => array('---') + og_all_groups_options(),
   );
   $form['actions'] = array(
@@ -229,11 +245,11 @@ function spaces_dashboard_users() {
     $account = user_load($account);
     $form['username'][$account->uid] = array(
       '#type' => 'markup',
-      '#value' => theme('username', $account),
+      '#value' => theme('username', array('account' => $account)),
     );
     $form['email'][$account->uid] = array(
       '#type' => 'markup',
-      '#value' => l($account->mail, 'mailto:'. $account->mail),
+      '#value' => l($account->mail, 'mailto:' . $account->mail),
     );
     $form['#accounts'][$account->uid] = $account;
     $users[$account->uid] = '';
@@ -242,11 +258,15 @@ function spaces_dashboard_users() {
     '#type' => 'checkboxes',
     '#options' => $users,
   );
-  $form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
+  $form['pager'] = array('#value' => theme('pager', array('tags' => NULL, 'element' => 0)));
   $form['#theme'] = 'spaces_dashboard_users';
   return $form;
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_dashboard_users_submit($form_id, $form_values) {
   $gid = $form_values['groups'];
   $action = $form_values['actions'];
@@ -266,7 +286,7 @@ function _spaces_dashboard_user_batch($o
     case 'block':
       $status = ($op == 'active') ? 1 : 0;
       foreach ($users as $uid) {
-        $account = user_load(array('uid' => $uid));
+        $account = user_load($uid);
         user_save($account, array('status' => $status));
       }
       return true;
@@ -275,7 +295,7 @@ function _spaces_dashboard_user_batch($o
       if (is_numeric($gid) && $node = node_load($gid)) {
         if (og_is_group_type($node->type)) {
           foreach ($users as $uid) {
-            $account = user_load(array('uid' => $uid));
+            $account = user_load($uid);
             if (!isset($account->og_groups[$gid])) {
               og_save_subscription($gid, $uid, array('is_active' => 1));
             }
@@ -289,7 +309,7 @@ function _spaces_dashboard_user_batch($o
       if (is_numeric($gid) && $node = node_load($gid)) {
         if (og_is_group_type($node->type)) {
           foreach ($users as $uid) {
-            $account = user_load(array('uid' => $uid));
+            $account = user_load($uid);
             if (isset($account->og_groups[$gid])) {
               og_delete_subscription($gid, $uid);
             }
@@ -301,7 +321,12 @@ function _spaces_dashboard_user_batch($o
   }
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function theme_spaces_dashboard_users($form) {
+  // TODO: Should this theme spaces_dashboard_users be declared in hook_theme()?
   $row = array();
   $labels[] = $form['groups']['#title'];
   $labels[] = $form['actions']['#title'];
@@ -311,22 +336,26 @@ function theme_spaces_dashboard_users($f
   $row[] = drupal_render($form['groups']);
   $row[] = drupal_render($form['actions']);
   $row[] = drupal_render($form['submit']);
-  $output .= theme('table', $labels, array($row));
+  $output .= theme('table', array('header' => $labels, 'rows' => array($row)));
 
   // Overview table:
+  // TODO Please change this theme call to use an associative array for the $variables parameter.
   $header = array(theme('table_select_header_cell'), t('Name'), t('User Info'));
   if (isset($form['username']) && is_array($form['username'])) {
     foreach (element_children($form['username']) as $key) {
       $groups = $groupnames = array();
       foreach ($form['#accounts'][$key]->og_groups as $gid => $node) {
         $groupnames[] = $node['title'];
-        $groups[] = 'og-'. $gid;
+        $groups[] = 'og-' . $gid;
       }
       $groups = implode(' ', $groups);
-      $groupnames = "<div class='groupnames'>". implode(', ', $groupnames) ."</div>";
+      $groupnames = "<div class='groupnames'>" . implode(', ', $groupnames) . "</div>";
       $row = array();
       $row[] = drupal_render($form['users'][$key]);
-      $row[] = array('data' => drupal_render($form['username'][$key]), 'class' => 'name');
+      $row[] = array(
+        'data' => drupal_render($form['username'][$key]),
+        'class' => 'name',
+      );
       $row[] = drupal_render($form['email'][$key]) . $groupnames;
       // $row[] = $form['#accounts'][$key]->status ? t('Active') : t('Blocked');
       $rows[] = array(
@@ -336,11 +365,14 @@ function theme_spaces_dashboard_users($f
     }
 
   }
-  else  {
-    $rows[] = array(array('data' => t('No users found.'), 'colspan' => '4'));
+  else {
+    $rows[] = array(array(
+        'data' => t('No users found.'),
+        'colspan' => '4',
+      ));
   }
 
-  $output .= theme('table', $header, $rows);
+  $output .= theme('table', array('header' => $header, 'rows' => $rows));
   if ($form['pager']['#value']) {
     $output .= drupal_render($form['pager']);
   }
@@ -381,50 +413,50 @@ function _spaces_dashboard_views_group_d
   $view = new stdClass();
   $view->name = 'spaces_group_dashboard';
   $view->description = '';
-  $view->access = array ();  
+  $view->access = array();
   $view->view_args_php = '';
   $view->page = TRUE;
   $view->page_title = 'Group Dashboard';
-  $view->page_empty = '<p>'. t('No posts found in your groups.') .'</p>';
+  $view->page_empty = '<p>' . t('No posts found in your groups.') . '</p>';
   $view->page_empty_format = '4';
   $view->page_type = 'table';
   $view->use_pager = TRUE;
   $view->nodes_per_page = '25';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_changed',
       'sortorder' => 'DESC',
       'options' => 'normal',
     ),
   );
-  $view->argument = array ();
-  $view->field = array (
-    array (
+  $view->argument = array();
+  $view->field = array(
+    array(
       'tablename' => 'og_node_data',
       'field' => 'title',
       'label' => 'Group',
       'handler' => 'spaces_views_handler_crayon_name',
       'options' => 'og',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Title',
       'handler' => 'spaces_views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'label' => 'Type',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_comment_name',
       'label' => 'Last post',
     ),
-    array (
+    array(
       'tablename' => 'node_comment_statistics',
       'field' => 'last_changed',
       'label' => 'On',
@@ -438,15 +470,15 @@ function _spaces_dashboard_views_group_d
   else {
     $excluded = array('shout');
   }
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'NOR',
@@ -456,21 +488,21 @@ function _spaces_dashboard_views_group_d
         $excluded
       ),
     ),
-    array (
+    array(
       'tablename' => 'og_uid_node',
       'field' => 'currentuid',
       'operator' => '=',
       'options' => '',
       'value' => '***CURRENT_USER***',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'operator' => '>',
-      'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
       'value' => 'now',
     ),
-    array (
+    array(
       'tablename' => 'og_ancestry',
       'field' => 'gid',
       'operator' => '=',
@@ -478,8 +510,8 @@ function _spaces_dashboard_views_group_d
       'value' => '',
     ),
   );
-  $view->exposed_filter = array (
-    array (
+  $view->exposed_filter = array(
+    array(
       'tablename' => 'og_ancestry',
       'field' => 'gid',
       'label' => 'Posts in my groups',
@@ -497,41 +529,41 @@ function _spaces_dashboard_views_group_m
   $view = new stdClass();
   $view->name = 'spaces_group_my';
   $view->description = '';
-  $view->access = array ();
+  $view->access = array();
   $view->view_args_php = '';
   $view->page = FALSE;
   $view->block = TRUE;
   $view->block_title = 'My Groups';
-  $view->block_empty = '<p>'. t('No groups found') .'</p>';
+  $view->block_empty = '<p>' . t('No groups found') . '</p>';
   $view->block_empty_format = '2';
   $view->block_type = 'spaces_datetitle';
   $view->nodes_per_block = '99';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'sortorder' => 'ASC',
       'options' => '',
     ),
   );
-  $view->argument = array (
+  $view->argument = array(
   );
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
       'handler' => '_spaces_dashboard_views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'og',
       'field' => 'private',
       'label' => '',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'og_uid',
       'field' => 'currentuidsimple',
       'operator' => '=',
@@ -539,7 +571,7 @@ function _spaces_dashboard_views_group_m
       'value' => '***CURRENT_USER***',
     ),
   );
-  $view->exposed_filter = array ();
+  $view->exposed_filter = array();
   $view->requires = array(node, og_uid);
   return $view;
 }
@@ -548,7 +580,7 @@ function _spaces_dashboard_views_group_d
   $view = new stdClass();
   $view->name = 'spaces_group_directory';
   $view->description = '';
-  $view->access = array ();
+  $view->access = array();
   $view->view_args_php = '';
   $view->menu = TRUE;
   $view->menu_title = t('Directory');
@@ -558,44 +590,44 @@ function _spaces_dashboard_views_group_d
   $view->url = 'group_dashboard/group_directory';
   $view->use_pager = TRUE;
   $view->nodes_per_page = '25';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'sortorder' => 'ASC',
       'options' => '',
     ),
   );
-  $view->argument = array ();
-  $view->field = array (
-    array (
+  $view->argument = array();
+  $view->field = array(
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => 'Group',
       'handler' => '_spaces_dashboard_views_handler_field_nodelink',
       'options' => 'link',
     ),
-    array (
+    array(
       'tablename' => 'og',
       'field' => 'private',
       'handler' => '_spaces_dashboard_views_handler_field_private',
       'label' => 'Privacy',
     ),
-    array (
+    array(
       'tablename' => 'og',
       'field' => 'count',
       'label' => 'Members',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
@@ -603,7 +635,7 @@ function _spaces_dashboard_views_group_d
       'value' => og_get_types('group'),
     ),
   );
-  $view->exposed_filter = array ();
+  $view->exposed_filter = array();
   $view->requires = array(node, og);
   return $view;
 }
Only in spaces_dashboard/tests: CVS
Only in spaces_design: CVS
Only in spaces_og: CVS
Only in spaces_og/plugins: CVS
Only in spaces_og/tests: CVS
Only in spaces_og/views: CVS
Only in spaces_shoutbox: CVS
diff -up -r spaces_shoutbox/spaces_shoutbox.info spaces_shoutbox/spaces_shoutbox.info
--- spaces_shoutbox/spaces_shoutbox.info	2008-05-22 15:03:33.000000000 -0600
+++ spaces_shoutbox/spaces_shoutbox.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,5 @@
 name = Spaces Shoutbox
 description = Provides Shoutbox for the Spaces package
 package = Spaces
-dependencies = spaces
\ No newline at end of file
+dependencies = spaces
+files[] = spaces_shoutbox.module
diff -up -r spaces_shoutbox/spaces_shoutbox.module spaces_shoutbox/spaces_shoutbox.module
--- spaces_shoutbox/spaces_shoutbox.module	2008-10-06 15:56:41.000000000 -0600
+++ spaces_shoutbox/spaces_shoutbox.module	2011-02-21 19:48:14.000000000 -0700
@@ -2,7 +2,7 @@
 // $Id: spaces_shoutbox.module,v 1.8 2008/10/06 21:56:41 yhahn Exp $
 
 /**
- * Implementation of hook_context_define().
+ * Implements hook_context_define().
  */
 function spaces_shoutbox_context_define() {
   $items = array();
@@ -20,21 +20,21 @@ function spaces_shoutbox_context_define(
 }
 
 /**
- * Implementation of hook_node_info()
+ * Implements hook_node_info().
  */
 function spaces_shoutbox_node_info() {
   return array(
     'shout' => array(
-      'name'        => t('Shout'),
-      'module'      => 'spaces_shoutbox',
+      'name' => t('Shout'),
+      'base' => 'spaces_shoutbox',
       'description' => t('A shoutbox shout.'),
-      'locked'      => true,
-    )
+      'locked' => true,
+    ),
   );
 }
 
 /**
- * Implementation of hook_form()
+ * Implements hook_form().
  */
 function spaces_shoutbox_form(&$node) {
   $form['title'] = array(
@@ -47,7 +47,7 @@ function spaces_shoutbox_form(&$node) {
 }
 
 /**
- * Implementation of hook_menu()
+ * Implements hook_menu().
  */
 function spaces_shoutbox_menu($may_cache) {
   $items = array();
@@ -74,8 +74,8 @@ function spaces_shoutbox_ajax() {
       $node->uid  = $user->uid;
       $node->title = $_GET['shout'];
       $node->type  = 'shout';
-      $node->status= 1;
-      
+      $node->status = 1;
+
       if ($gid = $space->sid) {
         $node->og_groups = array($gid);
         $node->og_public = 0;
@@ -83,7 +83,8 @@ function spaces_shoutbox_ajax() {
 
       node_validate($node);
       node_save($node);
-      print theme('spaces_shout', array('name' => theme('username', $user), 'title' => $node->title));
+      // TODO Please change this theme call to use an associative array for the $variables parameter.
+      print theme('spaces_shout', array('name' => theme('username', array('account' => $user)), 'title' => $node->title));
       exit;
     }
   }
@@ -91,32 +92,40 @@ function spaces_shoutbox_ajax() {
 }
 
 /**
- * Implementation of hook_block()
+ * Implements hook_block_info().
  */
-function spaces_shoutbox_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[1] = array(
-      'info' =>  t('Spaces: Shoutbox'),
+function spaces_shoutbox_block_info() {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
+    $blocks['delta-1'] = array(
+      'info' => t('Spaces: Shoutbox'),
       'region' => 'right',
       'status' => 1,
     );
     return $blocks;
   }
-  else if ($op == 'view') {
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function spaces_shoutbox_block_view($delta) {
+  // TODO Rename block deltas (e.g. delta-0) to readable strings.
+  if (TRUE) {
     switch ($delta) {
-      case 1:
+      case 'delta-1':
         // If this isn't a groups site, or if it is and the shoutbox feature is enabled...
         $space = spaces_get_space();
         if ($space && ($space->features['shoutbox'] != SPACES_FEATURE_DISABLED) && $space->feature_access('shoutbox')) {
-          drupal_add_css(drupal_get_path('module', 'spaces_shoutbox') .'/spaces_shoutbox.css');
-          drupal_add_js(drupal_get_path('module', 'spaces_shoutbox') .'/spaces_shoutbox.js');
+          drupal_add_css(drupal_get_path('module', 'spaces_shoutbox') . '/spaces_shoutbox.css');
+          drupal_add_js(drupal_get_path('module', 'spaces_shoutbox') . '/spaces_shoutbox.js');
 
           $shoutbox_url = url('js/shoutbox');
           $js = "Drupal.extend({shout: {shout_url:'$shoutbox_url'}})";
-          drupal_add_js($js, 'inline');
+          drupal_add_js($js, array('type' => 'inline', 'scope' => JS_DEFAULT));
 
           $view = views_get_view('spaces_shouts');
-          $block['content'] = "<div id='spaces-shouts'>". views_build_view('block', $view, array(), false, $view->nodes_per_block) ."</div>";
+          $block['content'] = "<div id='spaces-shouts'>" . views_build_view('block', $view, array(), false, $view->nodes_per_block) . "</div>";
           $block['content'] .= drupal_get_form('spaces_shoutbox_ajaxform');
           $block['subject'] = t('Shoutbox');
           return $block;
@@ -127,19 +136,24 @@ function spaces_shoutbox_block($op = 'li
 }
 
 /**
+ * Implements hook_block().
+ */
+function spaces_shoutbox_block_OLD($op = 'list', $delta = 0) { }
+
+/**
  * Shoutbox form definition
  */
-function spaces_shoutbox_ajaxform() {
+function spaces_shoutbox_ajaxform($form) {
   $form = array(
     '#action' => null,
     'shout' => array(
-      '#type'     => 'textfield',
-      '#size'     => 20,
-      '#required' => true,      
+      '#type' => 'textfield',
+      '#size' => 20,
+      '#required' => true,
     ),
     'submit' => array(
-      '#type'   => 'button',
-      '#value'  => t('Shout'),
+      '#type' => 'button',
+      '#value' => t('Shout'),
     ),
   );
   $form['#theme'] = ''; // force default renderer
@@ -150,6 +164,7 @@ function spaces_shoutbox_ajaxform() {
  *  Shoutbox markup
  */
 function theme_spaces_shout($vars) {
+  // TODO: Should this theme spaces_shout be declared in hook_theme()?
   extract($vars);
   $title = _filter_url($title, 'shout'); // link shout urls
   return "<div class='shout'><span class='name'>$name</span> $title</div>";
@@ -159,6 +174,7 @@ function theme_spaces_shout($vars) {
  *  Custom spaces shout theme f()
  */
 function theme_views_view_list_spaces_shouts($view, $nodes, $type) {
+  // TODO: Should this theme views_view_list_spaces_shouts be declared in hook_theme()?
   $fields = _views_get_fields();
   $items = array();
   foreach ($nodes as $node) {
@@ -168,13 +184,14 @@ function theme_views_view_list_spaces_sh
         $item[$field['field']] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
       }
     }
+    // TODO Please change this theme call to use an associative array for the $variables parameter.
     $items[] = theme('spaces_shout', $item);
   }
   return implode("\n", $items);
 }
 
 /**
- *  Implementation hook_views_default_views()
+ * Implements hook_views_default_views().
  */
 function spaces_shoutbox_views_default_views() {
   $views = array();
@@ -191,12 +208,12 @@ function _spaces_shoutbox_views_shouts()
   $view->view_args_php = '';
   $view->block = TRUE;
   $view->block_title = t('Shoutbox');
-  $view->block_empty = '<p class="views-empty">'.t('There are no shouts to view.').'</p>';
+  $view->block_empty = '<p class="views-empty">' . t('There are no shouts to view.') . '</p>';
   $view->block_empty_format = '1';
   $view->block_type = 'list';
   $view->nodes_per_block = '10';
-  $view->sort = array (
-    array (
+  $view->sort = array(
+    array(
       'tablename' => 'node',
       'field' => 'created',
       'sortorder' => 'DESC',
@@ -204,13 +221,13 @@ function _spaces_shoutbox_views_shouts()
     ),
   );
   $view->argument = array();
-  $view->field = array (
-    array (
+  $view->field = array(
+    array(
       'tablename' => 'users',
       'field' => 'name',
       'label' => '',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'title',
       'label' => '',
@@ -218,35 +235,35 @@ function _spaces_shoutbox_views_shouts()
       'options' => 'nolink',
     ),
   );
-  $view->filter = array (
-    array (
+  $view->filter = array(
+    array(
       'tablename' => 'node',
       'field' => 'type',
       'operator' => 'OR',
       'options' => '',
-      'value' => array (
+      'value' => array(
         0 => 'shout',
       ),
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'status',
       'operator' => '=',
       'options' => '',
       'value' => '1',
     ),
-    array (
+    array(
       'tablename' => 'og_ancestry',
       'field' => 'picg',
       'operator' => '=',
       'options' => '',
       'value' => '***CURRENT_GID***',
     ),
-    array (
+    array(
       'tablename' => 'node',
       'field' => 'changed',
       'operator' => '>',
-      'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
+      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
       'value' => 'now',
     ),
   );
Only in spaces_site: CVS
Only in spaces_taxonomy: CVS
Only in spaces_taxonomy/plugins: CVS
Only in spaces_ui: CVS
Only in spaces_ui/export_ui: CVS
diff -up -r spaces_ui.info spaces_ui.info
--- spaces_ui.info	2008-08-09 17:33:49.000000000 -0600
+++ spaces_ui.info	2011-02-21 19:48:14.000000000 -0700
@@ -2,4 +2,10 @@
 name = Spaces UI
 description = Provides a UI for building custom Spaces features in Drupal.
 package = Spaces
-dependencies = spaces
\ No newline at end of file
+dependencies = spaces
+files[] = spaces.install
+files[] = spaces.module
+files[] = spaces_admin.inc
+files[] = spaces_ui.install
+files[] = spaces_ui.module
+files[] = tests/spaces.test
diff -up -r spaces_ui.install spaces_ui.install
--- spaces_ui.install	2008-10-06 15:56:40.000000000 -0600
+++ spaces_ui.install	2011-02-21 19:48:14.000000000 -0700
@@ -2,7 +2,13 @@
 // $Id: spaces_ui.install,v 1.2 2008/10/06 21:56:40 yhahn Exp $
 
 /**
- * Implementaton of hook_install().
+ * @file
+ * Install, update and uninstall functions for the spaces module.
+ *
+ */
+
+/**
+ * Implements hook_install().
  */
 function spaces_ui_install() {
   switch ($GLOBALS['db_type']) {
@@ -17,17 +23,27 @@ function spaces_ui_install() {
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function spaces_ui_uninstall() {
   // Drop database table
   db_query('DROP TABLE {spaces_features_ui}');
 }
 
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
 function spaces_ui_update_1() {
   $update = array();
-  $update[] = update_sql("ALTER TABLE {spaces_features_ui} DROP COLUMN label");
-  $update[] = update_sql("ALTER TABLE {spaces_features_ui} DROP COLUMN description");
-  $update[] = update_sql("ALTER TABLE {spaces_features_ui} ADD COLUMN value longtext NOT NULL default '' AFTER feature");
-  return $update;
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $update[] = array() /* update_sql("ALTER TABLE {spaces_features_ui} DROP COLUMN label") */;
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $update[] = array() /* update_sql("ALTER TABLE {spaces_features_ui} DROP COLUMN description") */;
+  // TODO update_sql has been removed. Use the database API for any schema or data changes.
+  $update[] = array() /* update_sql("ALTER TABLE {spaces_features_ui} ADD COLUMN value longtext NOT NULL default '' AFTER feature") */;
+  // hook_update_N() no longer returns a $ret array. Instead, return
+  // nothing or a translated string indicating the update ran successfully.
+  // See http://drupal.org/node/224333#update_sql.
+  return t('TODO Add a descriptive string here to show in the UI.') /* $update */;
 }
diff -up -r spaces_ui.module spaces_ui.module
--- spaces_ui.module	2008-10-06 15:56:40.000000000 -0600
+++ spaces_ui.module	2011-02-21 19:48:14.000000000 -0700
@@ -1,22 +1,22 @@
 <?php
 
 /**
- * Implementation of hook_init().
+ * Implements hook_init().
  */
 function spaces_ui_init() {
-  if (arg(0) .'/'. arg(1) .'/'. arg(2) .'/'. arg(3) == 'admin/build/spaces/features') {
-    include_once(drupal_get_path("module", "context_ui") ."/context_ui_admin.inc");
+  if (arg(0) . '/' . arg(1) . '/' . arg(2) . '/' . arg(3) == 'admin/structure/spaces/features') {
+    include_once DRUPAL_ROOT . '/' . drupal_get_path("module", "context_ui") . "/context_ui_admin.inc";
   }
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function spaces_ui_menu($may_cache) {
   $items = array();
   if ($may_cache) {
     $items[] = array(
-      'path' => 'admin/build/spaces/features',
+      'path' => 'admin/structure/spaces/features',
       'title' => t('Features'),
       'description' => t('Page listing spaces features.'),
       'callback' => 'spaces_ui_features',
@@ -24,7 +24,7 @@ function spaces_ui_menu($may_cache) {
       'type' => MENU_LOCAL_TASK,
     );
     $items[] = array(
-      'path' => 'admin/build/spaces/features/list',
+      'path' => 'admin/structure/spaces/features/list',
       'title' => t('List'),
       'description' => t('Page listing spaces features.'),
       'callback' => 'spaces_ui_features',
@@ -33,7 +33,7 @@ function spaces_ui_menu($may_cache) {
       'weight' => 0,
     );
     $items[] = array(
-      'path' => 'admin/build/spaces/features/add',
+      'path' => 'admin/structure/spaces/features/add',
       'title' => t('Add'),
       'description' => t('Add a new feature.'),
       'callback' => 'drupal_get_form',
@@ -47,7 +47,7 @@ function spaces_ui_menu($may_cache) {
 }
 
 /**
- * Implementation of hook_context_define().
+ * Implements hook_context_define().
  */
 function spaces_ui_context_define() {
   $items = array();
@@ -73,7 +73,7 @@ function spaces_ui_context_define() {
 }
 
 /**
- * Implementation of hook_form_alter()
+ * Implements hook_form_alter().
  */
 function spaces_ui_form_alter($form_id, &$form) {
   switch ($form_id) {
@@ -102,7 +102,7 @@ function spaces_ui_form_alter($form_id, 
       // to code definition.
       if (!empty($form['value']['#default_value'])) {
         $id = $form['value']['#default_value'];
-        $row = db_fetch_object(db_query('SELECT * FROM {spaces_features_ui} WHERE feature = "%s"', $id));
+        $row = db_fetch_object(db_query('SELECT * FROM {spaces_features_ui} WHERE feature = :feature', array(':feature' => $id)));
         if ($row) {
           $feature = unserialize($row->value);
         }
@@ -169,7 +169,7 @@ function spaces_ui_form_alter($form_id, 
         $form['feature']['menu'][$i]['title'] = array(
           '#type' => 'textfield',
           '#size' => 30,
-        );        
+        );
         $form['feature']['menu'][$i]['path']['#default_value'] = isset($menu_paths[$i]) ? $menu_paths[$i] : '';
         $form['feature']['menu'][$i]['title']['#default_value'] = isset($menu_items[$i]['title']) ? $menu_items[$i]['title'] : '';
       }
@@ -183,7 +183,7 @@ function spaces_ui_form_alter($form_id, 
       $form['#submit']['spaces_ui_feature_form_submit'] = array();
       $form['#submit'] = array_reverse($form['#submit']);
 
-      $form['#redirect'] = 'admin/build/spaces/features';
+      $form_state['#redirect'] = 'admin/structure/spaces/features';
       break;
   }
 }
@@ -210,14 +210,25 @@ function spaces_ui_feature_form_submit($
   foreach ($form_values['feature']['menu'] as $item) {
     if (!empty($item['title']) && !empty($item['path'])) {
       $settings['menu'][$item['path']] = array(
-        'title' => $item['title']
+        'title' => $item['title'],
       );
     }
   }
   ksort($settings['menu']);
 
-  db_query('DELETE FROM {spaces_features_ui} WHERE feature = "%s"', $feature);
-  db_query('INSERT INTO {spaces_features_ui} (feature, value) VALUES ("%s", "%s")', $feature, serialize($settings));
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {spaces_features_ui} WHERE feature = "%s"', $feature) */
+  db_delete('spaces_features_ui')
+  ->condition('feature', $feature)
+  ->execute();
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('INSERT INTO {spaces_features_ui} (feature, value) VALUES ("%s", "%s")', $feature, serialize($settings)) */
+  $id = db_insert('spaces_features_ui')
+  ->fields(array(
+    'feature' => $feature,
+    'value' => serialize($settings),
+  ))
+  ->execute();
 }
 
 /**
@@ -226,7 +237,11 @@ function spaces_ui_feature_form_submit($
  */
 function spaces_ui_feature_delete($form_id, $form_values) {
   $feature = $form_values['spaces_feature'];
-  db_query('DELETE FROM {spaces_features_ui} WHERE feature = "%s"', $feature);
+  // TODO Please review the conversion of this statement to the D7 database API syntax.
+  /* db_query('DELETE FROM {spaces_features_ui} WHERE feature = "%s"', $feature) */
+  db_delete('spaces_features_ui')
+  ->condition('feature', $feature)
+  ->execute();
 }
 
 /**
@@ -247,8 +262,8 @@ function spaces_ui_features() {
     $context = context_ui_context('load', $feature);
 
     // Basic information about this feature
-    $label = "<strong>". $feature->spaces['label'] ."</strong>";
-    $label .= "<div class='description'>". $feature->spaces['description'] ."</div>";
+    $label = "<strong>" . $feature->spaces['label'] . "</strong>";
+    $label .= "<div class='description'>" . $feature->spaces['description'] . "</div>";
 
     // Generate action links for this item
     // @TODO: currently, override contexts also have a "Delete" link --
@@ -258,11 +273,11 @@ function spaces_ui_features() {
     // (in context_ui).
     $links = array();
     if ($context->system == 0) {
-      $links[] = l(t('Edit'), 'admin/build/context/edit/'. $context->cid);
-      $links[] = l(t('Delete'), 'admin/build/context/delete/'. $context->cid, array(), 'destination=admin/build/spaces/features');
+      $links[] = l(t('Edit'), 'admin/structure/context/edit/' . $context->cid);
+      $links[] = l(t('Delete'), 'admin/structure/context/delete/' . $context->cid, array(), 'destination=admin/build/spaces/features');
     }
     else {
-      $links[] = l(t('Override'), 'admin/build/context/clone/'. $context->cid);
+      $links[] = l(t('Override'), 'admin/structure/context/clone/' . $context->cid);
     }
     $links = implode(' | ', $links);
 
@@ -282,8 +297,8 @@ function spaces_ui_features() {
   }
 
   $header = array(t('Feature'), t('Usable for'), t('Actions'));
-  $output .= theme('table', $header, $rows);
-  
+  $output .= theme('table', array('header' => $header, 'rows' => $rows));
+
   return $output;
 }
 
@@ -291,8 +306,9 @@ function spaces_ui_features() {
  * Custom form theming for spaces feature menu.
  */
 function theme_spaces_ui_feature_form_menu($form) {
-  drupal_add_js(drupal_get_path('module', 'spaces_ui') .'/spaces_ui.js');
-  drupal_add_css(drupal_get_path('module', 'spaces_ui') .'/spaces.css');
+  // TODO: Should this theme spaces_ui_feature_form_menu be declared in hook_theme()?
+  drupal_add_js(drupal_get_path('module', 'spaces_ui') . '/spaces_ui.js');
+  drupal_add_css(drupal_get_path('module', 'spaces_ui') . '/spaces.css');
 
   // Render help markup first
   $output = drupal_render($form['help']);
@@ -322,8 +338,9 @@ function theme_spaces_ui_feature_form_me
     ),
   );
 
-  $output .= theme('table', array(t('Title'), t('Path'), ''), $rows, array('class' => 'spaces-admin'));
+  $output .= theme('table', array('header' => array(t('Title'), t('Path'), ''), 'rows' => $rows, 'attributes' => array('class' => 'spaces-admin')));
   return $output;
 }
 
 ?>
+
Only in spaces_user: CVS
Only in spaces_user/plugins: CVS
Only in tests: CVS
