diff U3 comment_mover.module.org comment_mover.module
--- comment_mover.module.org Thu Aug 03 13:35:56 2006
+++ comment_mover.module Tue Aug 22 07:46:06 2006
@@ -60,14 +60,18 @@
if ($type == 'comment' && user_access('administer comments')) {
$prune = comment_mover_pruning();
if ($prune) {
- // Display graft link when
- if (comment_mover_allows_grafting('comment', $object) && // grafting is allowed on the node type
- $prune->cid != $object->cid && // comment is not the pruned comment
- !($prune->nid == $object->nid && $prune->cid == 0) && // comment is not a child of the pruned node
- !in_array($object->cid, comment_mover_get_children($prune->cid))) { // comment is not a child of the pruned comment
-
- $links[] = l(t('graft'), "comment/graft/$object->nid/$object->cid");
+ // If grafting is allowed on the node type
+ if (comment_mover_allows_grafting('comment', $object) ) {
+ // If comment is not the pruned comment AND comment is not a child of the pruned node AND comment is not a child of the pruned comment
+ if( $prune->cid != $object->cid && !($prune->nid == $object->nid && $prune->cid == 0) && !in_array($object->cid, comment_mover_get_children($prune->cid))) {
+ $links[] = l(t('graft'), "comment/graft/$object->nid/$object->cid");
+ }
+ // If comment is the pruned comment AND user can create forum topics
+ else if( $prune->cid == $object->cid && node_access('create', 'forum') ) {
+ $links[] .= l(t('convert'), 'comment/move/'. $prune->nid .'/'. $prune->cid);
+ }
}
+ $links[] .= l(t('cancel'), 'comment/cancel', NULL, drupal_get_destination());
}
else if (comment_mover_allows_grafting('comment', $object)) {
$links[] = l(t('prune'), "comment/prune/$object->nid/$object->cid");
@@ -82,6 +86,7 @@
!($prune->nid == $object->nid && $prune->pid == 0)) { // node is not the direct parent of pruned comment
$links[] = l(t('graft'), "comment/graft/$object->nid");
}
+ $links[] .= l(t('cancel'), 'comment/cancel', NULL, drupal_get_destination());
}
else if (node_access('update', $object) && user_access('administer comments') && comment_mover_allows_pruning('node', $object)) {
$links[] = l(t('prune'), "comment/prune/$object->nid", NULL, drupal_get_destination());
@@ -118,6 +123,7 @@
$form['nid'] = array('#type' => 'hidden', '#value' => $nid);
$form['cid'] = array('#type' => 'hidden', '#value' => $cid);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
+ $form['cancel'] = array('#value' =>l(t('cancel'), 'comment/cancel', NULL, drupal_get_destination() ));
return drupal_get_form('comment_mover_promote', $form);
}
else {
@@ -327,12 +333,12 @@
switch ($object['comment_mover']) {
case COMMENT_MOVER_COMMENT_TO_COMMENT:
// If we moved the comment to another node, add a redirector.
- $object['comment'] = t('This comment has been moved here.', array('%url' => url('node/'. $nid, NULL, 'comment-'. $new_comment['cid'], TRUE)));
+ $object['comment'] = t('This content has been moved here.', array('%url' => url('node/'. $nid, NULL, 'comment-'. $new_comment['cid'], TRUE)));
comment_mover_comment_post($object);
break;
case COMMENT_MOVER_NODE_TO_COMMENT:
$object['format'] = 2;
- $object['body'] = "";
+ $object['body'] = t('This content has been moved here.', array('%url' => url('node/'. $comment['nid'], NULL, 'comment-'. $new_comment['cid'], TRUE)));
// for some reason this is needed.
unset($object['0']);
$object = (object) $object;