? cyg-rev.patch Index: revisiontags.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.info,v retrieving revision 1.1 diff -u -p -r1.1 revisiontags.info --- revisiontags.info 12 Feb 2007 21:06:50 -0000 1.1 +++ revisiontags.info 13 Mar 2008 11:11:49 -0000 @@ -1,2 +1,5 @@ -name = Revision Tags -description = Tag node revisions and provide an interface for browsing them. \ No newline at end of file +; $Id$ +name = Revision Tags +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 -p -r1.1 revisiontags.install --- revisiontags.install 12 Feb 2007 21:06:50 -0000 1.1 +++ revisiontags.install 13 Mar 2008 11:11:49 -0000 @@ -1,16 +1,45 @@ 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() { - db_query('DROP TABLE {revision_tags}'); + // Drop my tables. + drupal_uninstall_schema('revisiontags'); } Index: revisiontags.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags.module,v retrieving revision 1.3 diff -u -p -r1.3 revisiontags.module --- revisiontags.module 22 Feb 2007 13:04:22 -0000 1.3 +++ revisiontags.module 13 Mar 2008 11:11:50 -0000 @@ -1,34 +1,26 @@ 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); - } - } +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; } @@ -39,10 +31,28 @@ 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($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(); @@ -99,6 +109,7 @@ function revisiontags_localtask($nid, $v } function revisiontags_overview($node) { + $output = ''; 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)); @@ -130,7 +141,7 @@ function revisiontags_overview($node) { /** * 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($revisiontag) 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,18 @@ function theme_revisiontags_tags($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) { Index: revisiontags_views.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/revisiontags/revisiontags_views.info,v retrieving revision 1.2 diff -u -p -r1.2 revisiontags_views.info --- revisiontags_views.info 22 Feb 2007 13:04:43 -0000 1.2 +++ revisiontags_views.info 13 Mar 2008 11:11:50 -0000 @@ -1,4 +1,7 @@ -name = Revision tag views -description = Views integration for the Revision tags module -dependencies = views revisiontags -package = "Revision tags" +; $Id$ +name = Revision tag views +description = Views integration for the Revision tags module +dependencies[] = views +dependencies[] = revisiontags +package = "Revision tags" +core = 6.x \ No newline at end of file