### Eclipse Workspace Patch 1.0
#P revisiontags
Index: revisiontags_views.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags_views.info,v
retrieving revision 1.2
diff -u -r1.2 revisiontags_views.info
--- revisiontags_views.info	22 Feb 2007 13:04:43 -0000	1.2
+++ revisiontags_views.info	3 Mar 2008 13:59:34 -0000
@@ -1,4 +1,7 @@
+; $Id$
 name = Revision tag views
 description = Views integration for the Revision tags module
-dependencies = views revisiontags
+dependencies[] = views
+dependencies[] = revisiontags
 package = "Revision tags"
+core = 6.x
\ No newline at end of file
Index: revisiontags.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.module,v
retrieving revision 1.3
diff -u -r1.3 revisiontags.module
--- revisiontags.module	22 Feb 2007 13:04:22 -0000	1.3
+++ revisiontags.module	3 Mar 2008 13:59:34 -0000
@@ -1,236 +1,258 @@
-<?php
-
-/**
- * hook_menu
- */
-function revisiontags_menu($may_cache) {
-  if (!$may_cache) {
-    if ('node' == arg(0) && is_numeric(arg(1))) {
-      // various permissions
-      $administer_nodes = user_access('administer nodes');
-      $tag_revisions = user_access('tag revisions');
-      $view_tagged_revisions = user_access('view tagged revisions');
-      $more_than_one = (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', arg(1))) > 1);
-
-      // determine access
-      $access = FALSE;
-      if (is_numeric(arg(3)) && 'view' ==  arg(4)) {
-        $access = $view_tagged_revisions;
-      }
-      else {
-        $access = ($administer_nodes || $tag_revisions) && $more_than_one;
-      }
-
-      $items[] = array('path' => 'node/'. arg(1) .'/revision_tags', 'title' => t('Revision tags'),
-        'callback' => 'revisiontags_localtask',
-        'access'   => $access,
-        'weight'   => 3,
-        'callback arguments' => array(arg(1), arg(3) ? arg(3) : NULL, arg(4) ? arg(4) : 'overview'),
-        'type'     => $tag_revisions ? MENU_LOCAL_TASK : MENU_CALLBACK);
-    }
-  }
-  return $items;
-}
-
-/**
- * hook perm
- */
-function revisiontags_perm() {
-  return array('tag revisions', 'view tagged revisions');
-}
-
-/**
- * Callback for the revision tags tab on node pages.
- */
-function revisiontags_localtask($nid, $vid = NULL, $op = 'overview') {
-  if ('view' == $op) {
-    if (!user_access('view tagged revisions')) {
-      drupal_access_denied();
-      return;
-    }
-  }
-  else if (!user_access('administer nodes') && !user_access('tag revisions')) {
-    drupal_access_denied();
-    return;
-  }
-
-  switch ($op) {
-    case 'overview':
-      $node = node_load($nid);
-      return revisiontags_overview($node);
-    case 'view':
-      if (is_numeric($vid)) {
-        $node = node_load($nid, $vid);
-        if ($node->nid) {
-          if (node_access('view', $node)) {
-            $revisiontag = _get_revision_tag($node->nid, $vid);
-            if (!empty($revisiontag) && !empty($revisiontag->tag)) {
-              drupal_set_title(t('%title (Tag: %tag)', array('%title' => $node->title, '%tag' => $revisiontag->tag)));
-            }
-            else {
-              drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))));
-            }
-            // The second argument to node_show is the comment id... so we give it NULL. This defaults to
-            // 0 when it reaches comment_render. Death to node_show!
-            return node_show($node, NULL);
-          }
-          drupal_access_denied();
-          return;
-        }
-      }
-      break;
-    case 'edit':
-      if (is_numeric($vid)) {
-        $node = node_load($nid);
-        if (!empty($node->nid)) {
-          $revisiontag = _get_revision_tag($node->nid, $vid);
-          $revisiontag->current_vid = $node->vid;
-          if (!empty($revisiontag->tag)) {
-            drupal_set_title(t('%title (Tag: %tag)', array('%title' => $node->title, '%tag' => $revisiontag->tag)));
-          }
-          else {
-            drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))));
-          }
-          return drupal_get_form('revisiontags_edit', $revisiontag);
-        }
-      }
-      break;
-  }
-}
-
-function revisiontags_overview($node) {
-  drupal_set_title(t('Revisions for %title', array('%title' => $node->title)));
-
-  $header = array(t('Revision'), t('Tag'), t('Public'), array('data' => t('Operations'), 'colspan' => 2));
-
-  $revisions = node_revision_list($node);
-  $rows = array();
-  foreach ($revisions as $revision) {
-    $row = array();
-    $operations = array();
-    $tag = array('');
-    $public = array('');
-    $revisiontag = _get_revision_tag($node->nid, $revision->vid);
-    if (!empty($revisiontag)) {
-      $tag = array($revisiontag->tag);
-      if (!empty($revisiontag->tag) && $revisiontag->public == 1) {
-        $public = array(t('public'));
-      }
-    }
-    $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', $revision)))
-             . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : '');
-    $operations[] = l(t('edit'), "node/$node->nid/revision_tags/$revision->vid/edit");
-    $rows[] = array_merge($row, $tag, $public, $operations);
-  }
-  $output .= theme('table', $header, $rows);
-
-  return $output;
-}
-
-/**
- * revision tag editing form
- */
-function revisiontags_edit($revisiontag) {
-  $form['tag'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Tag of the revision'),
-    '#default_value' => $revisiontag->tag,
-  );
-  $form['public'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Is this a tagged revision that is available to the public?'),
-    '#description'   => t('The current revision will always be public'),
-    '#default_value' => isset($revisiontag->public) ? $revisiontag->public : 1,
-  );
-  if ($revisiontag->current_vid == arg(3)) {
-    $form['public']['#default_value'] = 1;
-    $form['public']['#disabled'] = TRUE;
-  }
-  $form['submit'] = array(
-    '#type'          => 'submit',
-    '#default_value' => t('Save'),
-  );
-  $form['#redirect'] = arg(0) .'/'. arg(1) .'/'. arg(2) .'/'. arg(3);
-  return $form;
-}
-
-function revisiontags_edit_submit($form_id, $form) {
-  $node = node_load(arg(1));
-  if ($node->vid == arg(3)) {
-    $form['public'] = 1;
-  }
-
-  // If revision_tags_unique is TRUE, enforce the uniqueness of this tag
-  if (variable_get('revision_tags_unique', TRUE)) {
-    db_query("DELETE FROM {revision_tags} WHERE nid = %d AND tag = '%s'", arg(1), $form['tag']);
-  }
-
-  $revisiontag = _get_revision_tag(arg(1), arg(3));
-  if (empty($revisiontag)) {
-    db_query("INSERT INTO {revision_tags} (nid, vid, tag, public) VALUES(%d, %d, '%s', %d)", arg(1), arg(3), $form['tag'], $form['public']);
-  }
-  else {
-    db_query("UPDATE {revision_tags} SET tag = '%s', public = %d WHERE nid = %d AND vid = %d", $form['tag'], $form['public'], arg(1), arg(3));
-  }
-}
-
-function revisiontags_block($op = 'list', $delta = 0, $edit = array()) {
-  if ($op == 'list') {
-    $blocks[0] = array('info' => t('Tagged revisions'));
-    return $blocks;
-  }
-  else if ($op == 'view' && (user_access('tag revisions') || user_access('view tagged revisions'))) {
-    switch($delta) {
-      case 0:
-        // try to infer the nid from the path
-        if (arg(0) == 'node' && is_numeric(arg(1))) {
-          $nid = arg(1);
-        }
-        else {
-          // we didn't figure it out, so get out of here
-          return;
-        }
-
-        // Load the node to get the current revision (the node is getting loaded
-        // anyway, so it will be pulled from the static cache)
-        $node = node_load($nid);
-
-        // Get the revision tags
-        $rs = db_query("SELECT vid, tag FROM {revision_tags} WHERE nid = %d AND public = 1", $nid);
-        $list = array();
-        while($row = db_fetch_object($rs)) {
-          if ($row->vid == $node->vid) {
-            $list[] = l($row->tag, "node/$nid");
-          }
-          else {
-            $list[] = l($row->tag, "node/$nid/revision_tags/$row->vid/view");
-          }
-        }
-
-        // generate the content for the block
-        $content = '';
-        if (count($list) > 1) {
-          $content = theme('revisiontags_tags', $list);
-        }
-        $block = array('subject' => t('Versions available'),
-          'content' => $content);
-        break;
-    }
-    return $block;
-  }
-}
-
-function theme_revisiontags_tags($list) {
-  return theme('item_list', $list);
-}
-
-/**
- * Gives back the tag of a revision
- */
-function _get_revision_tag($nid, $vid) {
-  $result = db_fetch_object(db_query("SELECT tag, public FROM {revision_tags} WHERE nid = %d AND vid = %d", $nid, $vid));
-  if (!empty($result)) {
-    $result->tag = trim($result->tag);
-  }
-  return $result;
-}
+<?php
+// $Id$
+
+/**
+ * hook_menu
+ */
+function revisiontags_menu() {
+  $items['node/%node/revision_tags'] = array(
+    'title' => 'Revision tags',
+    'page callback' => 'revisiontags_localtask',
+    'page arguments' => array(1, 3, 4),
+    'access callback' => 'revisiontags_access',
+    'access arguments' => array(1),
+    'type'     => MENU_LOCAL_TASK
+  );
+  $items['node/%node/revision_tags/%/view'] = array(
+    'title' => 'View Revision tags',
+    'page callback' => 'revisiontags_localtask',
+    'page arguments' => array(1, 3, 4),
+    'access callback' => 'revisiontags_access',
+    'access arguments' => array(1,4),
+    'type'     => MENU_CALLBACK
+  );
+  return $items;
+}
+
+/**
+ * hook perm
+ */
+function revisiontags_perm() {
+  return array('tag revisions', 'view tagged revisions');
+}
+
+function revisiontags_access($node, $op = NULL) {
+  $administer_nodes = user_access('administer nodes');
+  $tag_revisions = user_access('tag revisions');
+  $view_tag_revisions = user_access('view tagged revisions');
+  if ($op == 'view') {
+    $access = ($administer_nodes || $view_tag_revisions);
+    }
+  else {
+    // various permissions
+    $more_than_one = (db_result(db_query('SELECT COUNT(*) FROM {node_revisions} WHERE nid = %d', $node->nid)) > 1);
+    $access = ($administer_nodes || $tag_revisions) && $more_than_one;
+    }
+  return $access;
+}
+
+
+/**
+ * Callback for the revision tags tab on node pages.
+ */
+function revisiontags_localtask($node, $vid = NULL, $op = 'overview') {
+  $nid = $node->nid;
+  if ($op == '') $op = 'overview';
+  if ('view' == $op) {
+    if (!user_access('view tagged revisions')) {
+      drupal_access_denied();
+      return;
+    }
+  }
+  else if (!user_access('administer nodes') && !user_access('tag revisions')) {
+    drupal_access_denied();
+    return;
+  }
+
+  switch ($op) {
+    case 'overview':
+      $node = node_load($nid);
+      return revisiontags_overview($node);
+    case 'view':
+      if (is_numeric($vid)) {
+        $node = node_load($nid, $vid);
+        if ($node->nid) {
+          if (node_access('view', $node)) {
+            $revisiontag = _get_revision_tag($node->nid, $vid);
+            if (!empty($revisiontag) && !empty($revisiontag->tag)) {
+              drupal_set_title(t('%title (Tag: %tag)', array('%title' => $node->title, '%tag' => $revisiontag->tag)));
+            }
+            else {
+              drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))));
+            }
+            // The second argument to node_show is the comment id... so we give it NULL. This defaults to
+            // 0 when it reaches comment_render. Death to node_show!
+            return node_show($node, NULL);
+          }
+          drupal_access_denied();
+          return;
+        }
+      }
+      break;
+    case 'edit':
+      if (is_numeric($vid)) {
+        $node = node_load($nid);
+        if (!empty($node->nid)) {
+          $revisiontag = _get_revision_tag($node->nid, $vid);
+          $revisiontag->current_vid = $node->vid;
+          if (!empty($revisiontag->tag)) {
+            drupal_set_title(t('%title (Tag: %tag)', array('%title' => $node->title, '%tag' => $revisiontag->tag)));
+          }
+          else {
+            drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))));
+          }
+          return drupal_get_form('revisiontags_edit', $revisiontag);
+        }
+      }
+      break;
+  }
+}
+
+function revisiontags_overview($node) {
+  drupal_set_title(t('Revisions for %title', array('%title' => $node->title)));
+
+  $header = array(t('Revision'), t('Tag'), t('Public'), array('data' => t('Operations'), 'colspan' => 2));
+
+  $revisions = node_revision_list($node);
+  $rows = array();
+  foreach ($revisions as $revision) {
+    $row = array();
+    $operations = array();
+    $tag = array('');
+    $public = array('');
+    $revisiontag = _get_revision_tag($node->nid, $revision->vid);
+    if (!empty($revisiontag)) {
+      $tag = array($revisiontag->tag);
+      if (!empty($revisiontag->tag) && $revisiontag->public == 1) {
+        $public = array(t('public'));
+      }
+    }
+    $row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'small'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', $revision)))
+             . (($revision->log != '') ? '<p class="revision-log">'. filter_xss($revision->log) .'</p>' : '');
+    $operations[] = l(t('edit'), "node/$node->nid/revision_tags/$revision->vid/edit");
+    $rows[] = array_merge($row, $tag, $public, $operations);
+  }
+  $output .= theme('table', $header, $rows);
+
+  return $output;
+}
+
+/**
+ * revision tag editing form
+ */
+function revisiontags_edit($form_id, $revisiontag) {
+  $form['tag'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Tag of the revision'),
+    '#default_value' => $revisiontag->tag,
+  );
+  $form['public'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Is this a tagged revision that is available to the public?'),
+    '#description'   => t('The current revision will always be public'),
+    '#default_value' => isset($revisiontag->public) ? $revisiontag->public : 1,
+  );
+  if ($revisiontag->current_vid == arg(3)) {
+    $form['public']['#default_value'] = 1;
+    $form['public']['#disabled'] = TRUE;
+  }
+  $form['submit'] = array(
+    '#type'          => 'submit',
+    '#default_value' => t('Save'),
+  );
+  $form['#redirect'] = arg(0) .'/'. arg(1) .'/'. arg(2) .'/'. arg(3);
+  return $form;
+}
+
+function revisiontags_edit_submit($form_id, $form) {
+  $node = node_load(arg(1));
+  if ($node->vid == arg(3)) {
+    $form['values']['public'] = 1;
+  }
+
+  // If revision_tags_unique is TRUE, enforce the uniqueness of this tag
+  if (variable_get('revision_tags_unique', TRUE)) {
+    db_query("DELETE FROM {revision_tags} WHERE nid = %d AND tag = '%s'", arg(1), $form['values']['tag']);
+  }
+
+  $revisiontag = _get_revision_tag(arg(1), arg(3));
+  if (empty($revisiontag)) {
+    db_query("INSERT INTO {revision_tags} (nid, vid, tag, public) VALUES(%d, %d, '%s', %d)", arg(1), arg(3), $form['values']['tag'], $form['values']['public']);
+  }
+  else {
+    db_query("UPDATE {revision_tags} SET tag = '%s', public = %d WHERE nid = %d AND vid = %d", $form['values']['tag'], $form['values']['public'], arg(1), arg(3));
+  }
+}
+
+function revisiontags_block($op = 'list', $delta = 0, $edit = array()) {
+  if ($op == 'list') {
+    $blocks[0] = array('info' => t('Tagged revisions'));
+    return $blocks;
+  }
+  else if ($op == 'view' && (user_access('tag revisions') || user_access('view tagged revisions'))) {
+    switch($delta) {
+      case 0:
+        // try to infer the nid from the path
+        if (arg(0) == 'node' && is_numeric(arg(1))) {
+          $nid = arg(1);
+        }
+        else {
+          // we didn't figure it out, so get out of here
+          return;
+        }
+
+        // Load the node to get the current revision (the node is getting loaded
+        // anyway, so it will be pulled from the static cache)
+        $node = node_load($nid);
+
+        // Get the revision tags
+        $rs = db_query("SELECT vid, tag FROM {revision_tags} WHERE nid = %d AND public = 1", $nid);
+        $list = array();
+        while($row = db_fetch_object($rs)) {
+          if ($row->vid == $node->vid) {
+            $list[] = l($row->tag, "node/$nid");
+          }
+          else {
+            $list[] = l($row->tag, "node/$nid/revision_tags/$row->vid/view");
+          }
+        }
+
+        // generate the content for the block
+        $content = '';
+        if (count($list) > 1) {
+          $content = theme('revisiontags_tags', $list);
+        }
+        $block = array('subject' => t('Versions available'),
+          'content' => $content);
+        break;
+    }
+    return $block;
+  }
+}
+
+function theme_revisiontags_tags($list) {
+  return theme('item_list', $list);
+}
+
+/**
+ * Implementation of hook_theme()
+ */
+function revisiontags_theme() {
+  return array(
+    'revisiontags_tags' => array(
+      'function'  => 'theme_revisiontags_tags',
+      'arguments' => array('list' => NULL),
+    ),
+  );
+}
+
+/**
+ * Gives back the tag of a revision
+ */
+function _get_revision_tag($nid, $vid) {
+  $result = db_fetch_object(db_query("SELECT tag, public FROM {revision_tags} WHERE nid = %d AND vid = %d", $nid, $vid));
+  if (!empty($result)) {
+    $result->tag = trim($result->tag);
+  }
+  return $result;
+}
Index: revisiontags.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.info,v
retrieving revision 1.1
diff -u -r1.1 revisiontags.info
--- revisiontags.info	12 Feb 2007 21:06:50 -0000	1.1
+++ revisiontags.info	3 Mar 2008 13:59:33 -0000
@@ -1,2 +1,5 @@
+; $Id$
 name = Revision Tags
-description = Tag node revisions and provide an interface for browsing them.
\ No newline at end of file
+description = Tag node revisions and provide an interface for browsing them.
+package = "Revision tags"
+core = 6.x
\ No newline at end of file
Index: revisiontags.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.install,v
retrieving revision 1.1
diff -u -r1.1 revisiontags.install
--- revisiontags.install	12 Feb 2007 21:06:50 -0000	1.1
+++ revisiontags.install	3 Mar 2008 13:59:33 -0000
@@ -1,16 +1,45 @@
-<?php
-
-function revisiontags_install() {
-  db_query('CREATE TABLE {revision_tags} (
-    nid      INT UNSIGNED NOT NULL,
-    vid      INT UNSIGNED NOT NULL,
-    tag      VARCHAR(127) NOT NULL,
-    public   TINYINT UNSIGNED NOT NULL DEFAULT 0,
-    PRIMARY KEY (nid, vid)
-    )'
-  );
-}
-
-function revisiontags_uninstall() {
-  db_query('DROP TABLE {revision_tags}');
-}
+<?php
+// $Id$
+
+function revisiontags_schema() {
+  $schema['revision_tags'] = array(
+    'description' => t('The table for revisiontags.'),
+    'fields' => array(
+      'nid' => array(
+        'description' => t('The primary identifier for a node.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE),
+      'vid' => array(
+        'description' => t('The current {node_revisions}.vid version identifier.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE),
+      'tag' => array(
+        'description' => t('The {tag} of this revision.'),
+        'type' => 'varchar',
+        'length' => 127,
+        'not null' => TRUE,
+        'default' => ''),
+      'public' => array(
+        'description' => t('The visibility of the revision tag.'),
+        'type' => 'int',
+        'size' => 'tiny',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      ),
+    'primary key' => array('nid', 'vid'),
+  );
+  return $schema;
+}
+
+function revisiontags_install() {
+  // Create my tables.
+  drupal_install_schema('revisiontags');
+}
+
+function revisiontags_uninstall() {
+  // Drop my tables.
+  drupal_uninstall_schema('revisiontags');
+}
