? revisiontags/LICENSE.txt
Index: revisiontags/revisiontags.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.info,v
retrieving revision 1.1
diff -u -w -r1.1 revisiontags.info
--- revisiontags/revisiontags.info	12 Feb 2007 21:06:50 -0000	1.1
+++ revisiontags/revisiontags.info	25 Feb 2008 15:06:05 -0000
@@ -1,2 +1,6 @@
+; $Id: content.info,v 1.6 2007/07/04 23:46:29 yched Exp $
 name = Revision Tags
 description = Tag node revisions and provide an interface for browsing them.
\ No newline at end of file
+package = "Revision tags"
+core = 6.x
+
Index: revisiontags/revisiontags.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.install,v
retrieving revision 1.1
diff -u -w -r1.1 revisiontags.install
--- revisiontags/revisiontags.install	12 Feb 2007 21:06:50 -0000	1.1
+++ revisiontags/revisiontags.install	25 Feb 2008 15:42:52 -0000
@@ -1,16 +1,44 @@
 <?php

+// ; $Id: content.info,v 1.6 2007/07/04 23:46:29 yched Exp $
+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() {

-  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)

-    )'

-  );

+  // Create my tables.
+  drupal_install_schema('revisiontags');
 }

 

 function revisiontags_uninstall() {

-  db_query('DROP TABLE {revision_tags}');

+  // Drop my tables.
+  drupal_uninstall_schema('revisiontags');
 }

Index: revisiontags/revisiontags.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.module,v
retrieving revision 1.3
diff -u -w -r1.3 revisiontags.module
--- revisiontags/revisiontags.module	22 Feb 2007 13:04:22 -0000	1.3
+++ revisiontags/revisiontags.module	26 Feb 2008 12:50:13 -0000
@@ -1,34 +1,27 @@
 <?php

+// ; $Id: content.info,v 1.6 2007/07/04 23:46:29 yched Exp $
 

 /**

  * 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;

-      }

+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
+  );
 

-      $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;

 }

 

@@ -39,10 +32,28 @@
   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($nid, $vid = NULL, $op = 'overview') {

+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();

@@ -130,7 +141,7 @@
 /**

  * revision tag editing form

  */

-function revisiontags_edit($revisiontag) {

+function revisiontags_edit($form_id, $revisiontag) {
   $form['tag'] = array(

     '#type'          => 'textfield',

     '#title'         => t('Tag of the revision'),

@@ -157,20 +168,20 @@
 function revisiontags_edit_submit($form_id, $form) {

   $node = node_load(arg(1));

   if ($node->vid == arg(3)) {

-    $form['public'] = 1;

+    $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['tag']);

+    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['tag'], $form['public']);

+    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['tag'], $form['public'], arg(1), arg(3));

+    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));
   }

 }

 

@@ -225,6 +236,19 @@
 }

 

 /**

+ * 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) {

Index: revisiontags/revisiontags_views.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags_views.info,v
retrieving revision 1.2
diff -u -w -r1.2 revisiontags_views.info
--- revisiontags/revisiontags_views.info	22 Feb 2007 13:04:43 -0000	1.2
+++ revisiontags/revisiontags_views.info	26 Feb 2008 06:16:10 -0000
@@ -1,4 +1,8 @@
+; $Id: content.info,v 1.6 2007/07/04 23:46:29 yched Exp $
 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
+
