diff -urpN nodecomment.old/nodecomment.info nodecomment/nodecomment.info
--- nodecomment.old/nodecomment.info 2008-07-25 02:09:08.000000000 +0200
+++ nodecomment/nodecomment.info 2008-09-25 19:58:03.000000000 +0200
@@ -2,10 +2,4 @@
name = Node Comment
description = Allows users to comment on and discuss published content using nodes.
dependencies[] = views
-core = 6.x
-; Information added by drupal.org packaging script on 2008-07-25
-version = "6.x-1.x-dev"
-core = "6.x"
-project = "nodecomment"
-datestamp = "1216944548"
-
+core = 6.x
\ No newline at end of file
diff -urpN nodecomment.old/nodecomment.install nodecomment/nodecomment.install
--- nodecomment.old/nodecomment.install 2008-07-22 19:38:20.000000000 +0200
+++ nodecomment/nodecomment.install 2008-09-25 19:58:03.000000000 +0200
@@ -1,5 +1,5 @@
'drupal_get_form',
'page arguments' => array('nodecomment_admin_settings'),
'access arguments' => array('administer comments'),
- 'description' => t("Administer your site's comment settings."),
+ 'description' => "Administer your site's comment settings.",
);
$items['node/%node/%node'] = array(
@@ -705,7 +705,7 @@ function nodecomment_form_box($node, $ti
function _nodecomment_delete_thread($comment) {
if (!is_object($comment) || !is_numeric($comment->cid)) {
- watchdog('content', t('Can not delete non-existent comment.'), WATCHDOG_WARNING);
+ watchdog('content', 'Can not delete non-existent comment.', WATCHDOG_WARNING);
return;
}
diff -urpN nodecomment.old/nodecomment.views.inc nodecomment/nodecomment.views.inc
--- nodecomment.old/nodecomment.views.inc 2008-07-22 22:38:33.000000000 +0200
+++ nodecomment/nodecomment.views.inc 1970-01-01 01:00:00.000000000 +0100
@@ -1,320 +0,0 @@
- array(
- 'left_field' => 'nid',
- 'field' => 'cid',
- ),
- );
-
- // ----------------------------------------------------------------
- // node_comments table -- fields
-
- $data['node_comments']['cid'] = array(
- 'title' => t('Nid'),
- 'help' => t('The node ID of the comment.'),
- 'argument' => array(
- 'handler' => 'views_handler_argument_node_nid',
- 'name field' => 'title',
- 'numeric' => TRUE,
- 'validate type' => 'nid',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
-
- $data['node_comments']['nid'] = array(
- 'title' => t('Original Parent Nid'),
- 'help' => t('The original node the comment is a reply to.'),
- 'relationship' => array(
- 'base' => 'node',
- 'field' => 'nid',
- 'handler' => 'views_handler_relationship',
- 'label' => t('Node'),
- ),
- );
-
- $data['node_comments']['pid'] = array(
- 'title' => t('Parent Nid'),
- 'help' => t('The node of the parent comment. Could be another comment.'),
- 'field' => array(
- 'handler' => 'views_handler_field',
- ),
- 'relationship' => array(
- 'title' => t('Parent comment'),
- 'help' => t('The parent comment.'),
- 'base' => 'comments',
- 'field' => 'cid',
- 'handler' => 'views_handler_relationship',
- 'label' => t('Parent comment'),
- ),
- );
-
- $data['node_comments']['name'] = array(
- 'title' => t('Author'),
- 'help' => t('The name of the poster.'),
- 'field' => array(
- 'handler' => 'views_handler_field_username_comment',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_string',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_string',
- ),
- );
-
- $data['node_comments']['homepage'] = array(
- 'title' => t("Author's website"),
- 'help' => t("The website address of the comment's author. Can be a link. The homepage can also be linked with the Name field. Will be empty if posted by a registered user."),
- 'field' => array(
- 'handler' => 'views_handler_field_url',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_string',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_string',
- ),
- );
-
- $data['node_comments']['thread'] = array(
- 'field' => array(
- 'title' => t('Depth'),
- 'help' => t('Display the depth of the comment if it is threaded.'),
- 'handler' => 'views_handler_field_comment_depth',
- ),
- 'sort' => array(
- 'title' => t('Thread'),
- 'help' => t('Sort by the threaded order. This will keep child comments together with their parents.'),
- 'handler' => 'views_handler_sort_comment_thread',
- ),
- );
-
- // link to reply to comment
- $data['node_comments']['replyto_comment'] = array(
- 'field' => array(
- 'title' => t('Reply-to link'),
- 'help' => t('Provide a simple link to reply to the comment.'),
- 'handler' => 'views_handler_field_comment_link_reply',
- ),
- );
-
- return $data;
-}
-
-/**
- * Field handler to allow linking to a user account or homepage
- */
-class views_handler_field_username_comment extends views_handler_field {
- /**
- * Override init function to add uid and homepage fields.
- */
- function init(&$view, &$data) {
- parent::init($view, $data);
- $this->additional_fields['uid'] = 'uid';
- $this->additional_fields['homepage'] = 'homepage';
- }
-
- function option_definition() {
- $options = parent::option_definition();
- $options['link_to_user'] = array('default' => TRUE);
- return $options;
- }
-
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
- $form['link_to_user'] = array(
- '#title' => t("Link this field to its user or an author's homepage"),
- '#type' => 'checkbox',
- '#default_value' => $this->options['link_to_user'],
- );
- }
-
- function render_link($data, $values) {
- $account->uid = $values->{$this->aliases['uid']};
- $account->name = $values->{$this->field_alias};
- $account->homepage = $values->{$this->aliases['homepage']};
-
- if (!empty($this->options['link_to_user'])) {
- return theme('username', $account);
- }
- else {
- return $data;
- }
- }
-
- function render($values) {
- return $this->render_link(check_plain($values->{$this->field_alias}), $values);
- }
-
-}
-
-/**
- * Field handler to display the depth of a comment
- */
-class views_handler_field_comment_depth extends views_handler_field {
- /**
- * Work out the depth of this comment
- */
- function render($values) {
- return count(explode('.', $values->comments_thread)) - 1;
- }
-}
-
-/**
- * Sort handler for ordering by thread
- */
-class views_handler_sort_comment_thread extends views_handler_sort {
- function query() {
- $this->ensure_my_table();
-
- //Read comment_render() in comment.module for an explanation of the
- //thinking behind this sort.
- if ($this->options['order'] == 'DESC') {
- $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
- }
- else {
- $alias = $this->table_alias . '_' . $this->real_field . 'asc';
- //@todo is this secure?
- $this->query->add_orderby(NULL, "SUBSTRING({$this->table_alias}.{$this->real_field}, 1, (LENGTH({$this->table_alias}.{$this->real_field}) - 1))", $this->options['order'], $alias);
- }
- }
-}
-
-/**
- * Base field handler to present a link.
- */
-class views_handler_field_comment_link extends views_handler_field {
- function construct() {
- parent::construct();
- $this->additional_fields['cid'] = 'cid';
- $this->additional_fields['nid'] = 'nid';
- }
-
- function option_definition() {
- $options = parent::option_definition();
- $options['text'] = array('default' => '', 'translatable' => TRUE);
- return $options;
- }
-
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
- $form['text'] = array(
- '#type' => 'textfield',
- '#title' => t('Text to display'),
- '#default_value' => $this->options['text'],
- );
- }
-
- function query() {
- $this->ensure_my_table();
- $this->add_additional_fields();
- }
-
- function render($values) {
- $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
- return l($text, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE, 'fragment' => "comment-" . $values->{$this->aliases['cid']}));
- }
-}
-
-/**
- * Field handler to present a link to delete a node.
- */
-class views_handler_field_comment_link_reply extends views_handler_field_comment_link {
- function render($values) {
- //check for permission to reply to comments
- if (!user_access('post comments')) {
- return;
- }
- $text = !empty($this->options['text']) ? $this->options['text'] : t('reply');
- return l($text, "node/add/comment/" . $values->{$this->aliases['nid']} . '/' . $values->{$this->aliases['cid']});
- }
-}
-
-/**
- * Implementation of hook_views_plugins
- */
-function nodecomment_views_plugins() {
- return array(
- 'style' => array(
- 'nodecomment_threaded' => array(
- 'title' => t('Comments threaded'),
- 'help' => t('Display the comment with a threaded comment view.'),
- 'handler' => 'nodecomment_plugin_style_threaded',
- 'theme' => 'nodecomment_threaded',
- 'uses row plugin' => TRUE,
- 'type' => 'normal',
- ),
- ),
- );
-}
-
-class nodecomment_plugin_style_threaded extends views_plugin_style {
- function render() {
- $divs = 0;
- $last_depth = 0;
- drupal_add_css(drupal_get_path('module', 'comment') .'/comment.css');
-
- foreach ($this->view->result as $n) {
- $node = node_load($n->nid);
- $node->depth = count(explode('.', $node->thread)) - 1;
-
- if ($node->depth > $last_depth) {
- $divs++;
- $output .= '
';
- $last_depth++;
- }
- else {
- while ($node->depth < $last_depth) {
- $divs--;
- $output .= '
';
- $last_depth--;
- }
- }
- $output .= node_view($node);
- }
-
- for ($i = 0; $i < $divs; $i++) {
- $output .= '';
- }
-
- return $output;
- }
-}
-
diff -urpN nodecomment.old/nodecomment.views_default.inc nodecomment/nodecomment.views_default.inc
--- nodecomment.old/nodecomment.views_default.inc 2008-07-22 22:38:33.000000000 +0200
+++ nodecomment/nodecomment.views_default.inc 1970-01-01 01:00:00.000000000 +0100
@@ -1,280 +0,0 @@
-name = 'nodecomments';
- $view->description = 'Node comments flat';
- $view->tag = '';
- $view->view_php = '';
- $view->base_table = 'node';
- $view->is_cacheable = FALSE;
- $view->api_version = 2;
- $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
- $handler = $view->new_display('default', 'nodecomments', 'default');
- $handler->override_option('relationships', array(
- 'nid' => array(
- 'label' => 'Node',
- 'required' => 0,
- 'id' => 'nid',
- 'table' => 'node_comments',
- 'field' => 'nid',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('fields', array(
- 'title' => array(
- 'label' => 'Title',
- 'link_to_node' => 0,
- 'exclude' => 0,
- 'id' => 'title',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'none',
- ),
- 'name' => array(
- 'label' => 'Author',
- 'link_to_user' => 1,
- 'exclude' => 0,
- 'id' => 'name',
- 'table' => 'node_comments',
- 'field' => 'name',
- 'relationship' => 'none',
- ),
- 'thread' => array(
- 'label' => 'Depth',
- 'exclude' => 0,
- 'id' => 'thread',
- 'table' => 'node_comments',
- 'field' => 'thread',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('arguments', array(
- 'nid' => array(
- 'default_action' => 'not found',
- 'style_plugin' => 'default_summary',
- 'style_options' => array(),
- 'wildcard' => 'all',
- 'wildcard_substitution' => 'All',
- 'title' => '',
- 'default_argument_type' => 'fixed',
- 'default_argument' => '',
- 'validate_type' => 'none',
- 'validate_fail' => 'not found',
- 'break_phrase' => 0,
- 'not' => 0,
- 'id' => 'nid',
- 'table' => 'node',
- 'field' => 'nid',
- 'relationship' => 'nid',
- 'default_options_div_prefix' => '',
- 'default_argument_user' => 0,
- 'default_argument_fixed' => '',
- 'default_argument_php' => '',
- 'validate_argument_node_type' => array(
- 'comment' => 0,
- 'page' => 0,
- 'story' => 0,
- ),
- 'validate_argument_node_access' => 0,
- 'validate_argument_nid_type' => 'nid',
- 'validate_argument_vocabulary' => array(),
- 'validate_argument_type' => 'tid',
- 'validate_argument_php' => '',
- ),
- ));
- $handler->override_option('filters', array(
- 'status' => array(
- 'operator' => '=',
- 'value' => 1,
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'status',
- 'table' => 'node',
- 'field' => 'status',
- 'relationship' => 'none',
- ),
- 'type' => array(
- 'operator' => 'in',
- 'value' => array(
- 'comment' => 'comment',
- ),
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'type',
- 'table' => 'node',
- 'field' => 'type',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('access', array(
- 'type' => 'none',
- 'role' => array(),
- 'perm' => '',
- ));
- $handler->override_option('items_per_page', 0);
- $handler->override_option('style_options', array(
- 'grouping' => '',
- ));
- $handler->override_option('row_plugin', 'node');
- $handler->override_option('row_options', array(
- 'teaser' => 0,
- 'links' => 1,
- ));
- $views[$view->name] = $view;
-
- $view = new view;
- $view->name = 'nodecomments_threaded';
- $view->description = 'Node comments threaded';
- $view->tag = '';
- $view->view_php = '';
- $view->base_table = 'node';
- $view->is_cacheable = FALSE;
- $view->api_version = 2;
- $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
- $handler = $view->new_display('default', 'nodecomments', 'default');
- $handler->override_option('relationships', array(
- 'nid' => array(
- 'label' => 'Node',
- 'required' => 0,
- 'id' => 'nid',
- 'table' => 'node_comments',
- 'field' => 'nid',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('fields', array(
- 'title' => array(
- 'label' => 'Title',
- 'link_to_node' => 0,
- 'exclude' => 0,
- 'id' => 'title',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'none',
- ),
- 'name' => array(
- 'label' => 'Author',
- 'link_to_user' => 1,
- 'exclude' => 0,
- 'id' => 'name',
- 'table' => 'node_comments',
- 'field' => 'name',
- 'relationship' => 'none',
- ),
- 'thread' => array(
- 'label' => 'Depth',
- 'exclude' => 0,
- 'id' => 'thread',
- 'table' => 'node_comments',
- 'field' => 'thread',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('sorts', array(
- 'thread' => array(
- 'order' => 'ASC',
- 'id' => 'thread',
- 'table' => 'node_comments',
- 'field' => 'thread',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('arguments', array(
- 'nid' => array(
- 'default_action' => 'not found',
- 'style_plugin' => 'default_summary',
- 'style_options' => array(),
- 'wildcard' => 'all',
- 'wildcard_substitution' => 'All',
- 'title' => '',
- 'default_argument_type' => 'fixed',
- 'default_argument' => '',
- 'validate_type' => 'none',
- 'validate_fail' => 'not found',
- 'break_phrase' => 0,
- 'not' => 0,
- 'id' => 'nid',
- 'table' => 'node',
- 'field' => 'nid',
- 'relationship' => 'nid',
- 'default_options_div_prefix' => '',
- 'default_argument_user' => 0,
- 'default_argument_fixed' => '',
- 'default_argument_php' => '',
- 'validate_argument_node_type' => array(
- 'comment' => 0,
- 'page' => 0,
- 'story' => 0,
- ),
- 'validate_argument_node_access' => 0,
- 'validate_argument_nid_type' => 'nid',
- 'validate_argument_vocabulary' => array(),
- 'validate_argument_type' => 'tid',
- 'validate_argument_php' => '',
- ),
- ));
- $handler->override_option('filters', array(
- 'status' => array(
- 'operator' => '=',
- 'value' => 1,
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'status',
- 'table' => 'node',
- 'field' => 'status',
- 'relationship' => 'none',
- ),
- 'type' => array(
- 'operator' => 'in',
- 'value' => array(
- 'comment' => 'comment',
- ),
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'type',
- 'table' => 'node',
- 'field' => 'type',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('access', array(
- 'type' => 'none',
- 'role' => array(),
- 'perm' => '',
- ));
- $handler->override_option('items_per_page', 0);
- $handler->override_option('style_plugin', 'nodecomment_threaded');
- $handler->override_option('row_plugin', 'node');
- $handler->override_option('row_options', array(
- 'teaser' => 1,
- 'links' => 1,
- ));
- $views[$view->name] = $view;
-
- return $views;
-}
diff -urpN nodecomment.old/views/nodecomment.views.inc nodecomment/views/nodecomment.views.inc
--- nodecomment.old/views/nodecomment.views.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/nodecomment.views.inc 2008-09-29 13:12:34.000000000 +0200
@@ -0,0 +1,190 @@
+ array(
+ 'path' => drupal_get_path('module', 'nodecomment') .'/views',
+ ),
+ 'handlers' => array(
+ 'views_handler_field_username_comment' => array(
+ 'parent' => 'views_handler_field',
+ ),
+ 'views_handler_field_comment_depth' => array(
+ 'parent' => 'views_handler_field'
+ ),
+ 'views_handler_field_username_comment' => array(
+ 'parent' => 'views_handler_field'
+ ),
+ 'views_handler_field_comment_link' => array(
+ 'parent' => 'views_handler_field'
+ ),
+ 'views_handler_field_comment_link_reply' => array(
+ 'parent' => 'views_handler_field_comment_link'
+ ),
+ 'views_handler_sort_comment_thread' => array(
+ 'parent' => 'views_handler_sort'
+ ),
+ ),
+ );
+}
+
+/**
+ * Implementation of hook_views_data()
+ */
+function nodecomment_views_data() {
+ // since comments are nodes we keep with the Node group
+ $data['node_comments']['table']['group'] = t('Node');
+
+ // ----------------------------------------------------------------
+ // node table -- basic table information.
+
+ $data['node_comments']['table']['join'] = array(
+ // node_comments links to node
+ 'node' => array(
+ 'left_field' => 'nid',
+ 'field' => 'cid',
+ ),
+ );
+
+ // ----------------------------------------------------------------
+ // node_comments table -- fields
+
+ $data['node_comments']['cid'] = array(
+ 'title' => t('Nid'),
+ 'help' => t('The node ID of the comment.'),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_node_nid',
+ 'name field' => 'title',
+ 'numeric' => TRUE,
+ 'validate type' => 'nid',
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter_numeric',
+ ),
+ 'sort' => array(
+ 'handler' => 'views_handler_sort',
+ ),
+ );
+
+ $data['node_comments']['nid'] = array(
+ 'title' => t('Original Parent Nid'),
+ 'help' => t('The original node the comment is a reply to.'),
+ 'relationship' => array(
+ 'base' => 'node',
+ 'field' => 'nid',
+ 'handler' => 'views_handler_relationship',
+ 'label' => t('Node'),
+ ),
+ );
+
+ $data['node_comments']['pid'] = array(
+ 'title' => t('Parent Nid'),
+ 'help' => t('The node of the parent comment. Could be another comment.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field',
+ ),
+ 'relationship' => array(
+ 'title' => t('Parent comment'),
+ 'help' => t('The parent comment.'),
+ 'base' => 'comments',
+ 'field' => 'cid',
+ 'handler' => 'views_handler_relationship',
+ 'label' => t('Parent comment'),
+ ),
+ );
+
+ $data['node_comments']['name'] = array(
+ 'title' => t('Author'),
+ 'help' => t('The name of the poster.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field_username_comment',
+ 'click sortable' => TRUE,
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter_string',
+ ),
+ 'sort' => array(
+ 'handler' => 'views_handler_sort',
+ ),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_string',
+ ),
+ );
+
+ $data['node_comments']['homepage'] = array(
+ 'title' => t("Author's website"),
+ 'help' => t("The website address of the comment's author. Can be a link. The homepage can also be linked with the Name field. Will be empty if posted by a registered user."),
+ 'field' => array(
+ 'handler' => 'views_handler_field_url',
+ 'click sortable' => TRUE,
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter_string',
+ ),
+ 'sort' => array(
+ 'handler' => 'views_handler_sort',
+ ),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_string',
+ ),
+ );
+
+ $data['node_comments']['thread'] = array(
+ 'field' => array(
+ 'title' => t('Depth'),
+ 'help' => t('Display the depth of the comment if it is threaded.'),
+ 'handler' => 'views_handler_field_comment_depth',
+ ),
+ 'sort' => array(
+ 'title' => t('Thread'),
+ 'help' => t('Sort by the threaded order. This will keep child comments together with their parents.'),
+ 'handler' => 'views_handler_sort_comment_thread',
+ ),
+ );
+
+ // link to reply to comment
+ $data['node_comments']['replyto_comment'] = array(
+ 'field' => array(
+ 'title' => t('Reply-to link'),
+ 'help' => t('Provide a simple link to reply to the comment.'),
+ 'handler' => 'views_handler_field_comment_link_reply',
+ ),
+ );
+
+ return $data;
+}
+
+
+/**
+ * Implementation of hook_views_plugins
+ */
+function nodecomment_views_plugins() {
+ return array(
+ 'style' => array(
+ 'nodecomment_threaded' => array(
+ 'path' => drupal_get_path('module', 'nodecomment') .'/views',
+ 'theme path' => drupal_get_path('module', 'nodecomment') .'/views',
+ 'title' => t('Comments threaded'),
+ 'help' => t('Display the comment with a threaded comment view.'),
+ 'handler' => 'nodecomment_plugin_style_threaded',
+ 'theme' => 'nodecomment_threaded',
+ 'uses row plugin' => TRUE,
+ 'type' => 'normal',
+ ),
+ ),
+ );
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/nodecomment.views_default.inc nodecomment/views/nodecomment.views_default.inc
--- nodecomment.old/views/nodecomment.views_default.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/nodecomment.views_default.inc 2008-09-25 20:08:55.000000000 +0200
@@ -0,0 +1,264 @@
+name = 'nodecomments';
+ $view->description = 'Node comments flat';
+ $view->tag = '';
+ $view->view_php = '';
+ $view->base_table = 'node';
+ $view->is_cacheable = FALSE;
+ $view->api_version = 2;
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+ $handler = $view->new_display('default', 'nodecomments', 'default');
+ $handler->override_option('relationships', array(
+ 'nid' => array(
+ 'label' => 'Node',
+ 'required' => 0,
+ 'id' => 'nid',
+ 'table' => 'node_comments',
+ 'field' => 'nid',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('fields', array(
+ 'title' => array(
+ 'label' => 'Title',
+ 'link_to_node' => 0,
+ 'exclude' => 0,
+ 'id' => 'title',
+ 'table' => 'node',
+ 'field' => 'title',
+ 'relationship' => 'none',
+ ),
+ 'name' => array(
+ 'label' => 'Author',
+ 'link_to_user' => 1,
+ 'exclude' => 0,
+ 'id' => 'name',
+ 'table' => 'node_comments',
+ 'field' => 'name',
+ 'relationship' => 'none',
+ ),
+ 'thread' => array(
+ 'label' => 'Depth',
+ 'exclude' => 0,
+ 'id' => 'thread',
+ 'table' => 'node_comments',
+ 'field' => 'thread',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('arguments', array(
+ 'nid' => array(
+ 'default_action' => 'not found',
+ 'style_plugin' => 'default_summary',
+ 'style_options' => array(),
+ 'wildcard' => 'all',
+ 'wildcard_substitution' => 'All',
+ 'title' => '',
+ 'default_argument_type' => 'fixed',
+ 'default_argument' => '',
+ 'validate_type' => 'none',
+ 'validate_fail' => 'not found',
+ 'break_phrase' => 0,
+ 'not' => 0,
+ 'id' => 'nid',
+ 'table' => 'node',
+ 'field' => 'nid',
+ 'relationship' => 'nid',
+ 'default_options_div_prefix' => '',
+ 'default_argument_user' => 0,
+ 'default_argument_fixed' => '',
+ 'default_argument_php' => '',
+ 'validate_argument_node_type' => array(
+ 'comment' => 0,
+ 'page' => 0,
+ 'story' => 0,
+ ),
+ 'validate_argument_node_access' => 0,
+ 'validate_argument_nid_type' => 'nid',
+ 'validate_argument_vocabulary' => array(),
+ 'validate_argument_type' => 'tid',
+ 'validate_argument_php' => '',
+ ),
+ ));
+ $handler->override_option('filters', array(
+ 'status' => array(
+ 'operator' => '=',
+ 'value' => 1,
+ 'group' => '0',
+ 'exposed' => FALSE,
+ 'expose' => array(
+ 'operator' => FALSE,
+ 'label' => '',
+ ),
+ 'id' => 'status',
+ 'table' => 'node',
+ 'field' => 'status',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('access', array(
+ 'type' => 'none',
+ 'role' => array(),
+ 'perm' => '',
+ ));
+ $handler->override_option('items_per_page', 0);
+ $handler->override_option('style_options', array(
+ 'grouping' => '',
+ ));
+ $handler->override_option('row_plugin', 'node');
+ $handler->override_option('row_options', array(
+ 'teaser' => 0,
+ 'links' => 1,
+ ));
+ $views[$view->name] = $view;
+
+ $view = new view;
+ $view->name = 'nodecomments_threaded';
+ $view->description = 'Node comments threaded';
+ $view->tag = '';
+ $view->view_php = '';
+ $view->base_table = 'node';
+ $view->is_cacheable = FALSE;
+ $view->api_version = 2;
+ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+ $handler = $view->new_display('default', 'nodecomments', 'default');
+ $handler->override_option('relationships', array(
+ 'nid' => array(
+ 'label' => 'Node',
+ 'required' => 0,
+ 'id' => 'nid',
+ 'table' => 'node_comments',
+ 'field' => 'nid',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('fields', array(
+ 'title' => array(
+ 'label' => 'Title',
+ 'link_to_node' => 0,
+ 'exclude' => 0,
+ 'id' => 'title',
+ 'table' => 'node',
+ 'field' => 'title',
+ 'relationship' => 'none',
+ ),
+ 'name' => array(
+ 'label' => 'Author',
+ 'link_to_user' => 1,
+ 'exclude' => 0,
+ 'id' => 'name',
+ 'table' => 'node_comments',
+ 'field' => 'name',
+ 'relationship' => 'none',
+ ),
+ 'thread' => array(
+ 'label' => 'Depth',
+ 'exclude' => 0,
+ 'id' => 'thread',
+ 'table' => 'node_comments',
+ 'field' => 'thread',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('sorts', array(
+ 'thread' => array(
+ 'order' => 'ASC',
+ 'id' => 'thread',
+ 'table' => 'node_comments',
+ 'field' => 'thread',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('arguments', array(
+ 'nid' => array(
+ 'default_action' => 'not found',
+ 'style_plugin' => 'default_summary',
+ 'style_options' => array(),
+ 'wildcard' => 'all',
+ 'wildcard_substitution' => 'All',
+ 'title' => '',
+ 'default_argument_type' => 'fixed',
+ 'default_argument' => '',
+ 'validate_type' => 'none',
+ 'validate_fail' => 'not found',
+ 'break_phrase' => 0,
+ 'not' => 0,
+ 'id' => 'nid',
+ 'table' => 'node',
+ 'field' => 'nid',
+ 'relationship' => 'nid',
+ 'default_options_div_prefix' => '',
+ 'default_argument_user' => 0,
+ 'default_argument_fixed' => '',
+ 'default_argument_php' => '',
+ 'validate_argument_node_type' => array(
+ 'comment' => 0,
+ 'page' => 0,
+ 'story' => 0,
+ ),
+ 'validate_argument_node_access' => 0,
+ 'validate_argument_nid_type' => 'nid',
+ 'validate_argument_vocabulary' => array(),
+ 'validate_argument_type' => 'tid',
+ 'validate_argument_php' => '',
+ ),
+ ));
+ $handler->override_option('filters', array(
+ 'status' => array(
+ 'operator' => '=',
+ 'value' => 1,
+ 'group' => '0',
+ 'exposed' => FALSE,
+ 'expose' => array(
+ 'operator' => FALSE,
+ 'label' => '',
+ ),
+ 'id' => 'status',
+ 'table' => 'node',
+ 'field' => 'status',
+ 'relationship' => 'none',
+ ),
+ 'type' => array(
+ 'operator' => 'in',
+ 'value' => array(
+ 'comment' => 'comment',
+ ),
+ 'group' => '0',
+ 'exposed' => FALSE,
+ 'expose' => array(
+ 'operator' => FALSE,
+ 'label' => '',
+ ),
+ 'id' => 'type',
+ 'table' => 'node',
+ 'field' => 'type',
+ 'relationship' => 'none',
+ ),
+ ));
+ $handler->override_option('access', array(
+ 'type' => 'none',
+ 'role' => array(),
+ 'perm' => '',
+ ));
+ $handler->override_option('items_per_page', 0);
+ $handler->override_option('style_plugin', 'nodecomment_threaded');
+ $handler->override_option('row_plugin', 'node');
+ $handler->override_option('row_options', array(
+ 'teaser' => 1,
+ 'links' => 1,
+ ));
+ $views[$view->name] = $view;
+
+ return $views;
+}
diff -urpN nodecomment.old/views/nodecomment_plugin_style_threaded.inc nodecomment/views/nodecomment_plugin_style_threaded.inc
--- nodecomment.old/views/nodecomment_plugin_style_threaded.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/nodecomment_plugin_style_threaded.inc 2008-09-29 09:53:35.000000000 +0200
@@ -0,0 +1,36 @@
+view->result as $n) {
+ $node = node_load($n->nid);
+ $node->depth = count(explode('.', $node->thread)) - 1;
+
+ if ($node->depth > $last_depth) {
+ $divs++;
+ $output .= '';
+ $last_depth++;
+ }
+ else {
+ while ($node->depth < $last_depth) {
+ $divs--;
+ $output .= '
';
+ $last_depth--;
+ }
+ }
+ $output .= node_view($node);
+ }
+
+ for ($i = 0; $i < $divs; $i++) {
+ $output .= '';
+ }
+
+ return $output;
+ }
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/views_handler_field_comment_depth.inc nodecomment/views/views_handler_field_comment_depth.inc
--- nodecomment.old/views/views_handler_field_comment_depth.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/views_handler_field_comment_depth.inc 2008-09-29 09:44:08.000000000 +0200
@@ -0,0 +1,15 @@
+comments_thread)) - 1;
+ }
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/views_handler_field_comment_link.inc nodecomment/views/views_handler_field_comment_link.inc
--- nodecomment.old/views/views_handler_field_comment_link.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/views_handler_field_comment_link.inc 2008-09-29 09:45:40.000000000 +0200
@@ -0,0 +1,39 @@
+additional_fields['cid'] = 'cid';
+ $this->additional_fields['nid'] = 'nid';
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['text'] = array('default' => '', 'translatable' => TRUE);
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+ $form['text'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Text to display'),
+ '#default_value' => $this->options['text'],
+ );
+ }
+
+ function query() {
+ $this->ensure_my_table();
+ $this->add_additional_fields();
+ }
+
+ function render($values) {
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
+ return l($text, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE, 'fragment' => "comment-" . $values->{$this->aliases['cid']}));
+ }
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/views_handler_field_comment_link_reply.inc nodecomment/views/views_handler_field_comment_link_reply.inc
--- nodecomment.old/views/views_handler_field_comment_link_reply.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/views_handler_field_comment_link_reply.inc 2008-09-29 09:46:31.000000000 +0200
@@ -0,0 +1,17 @@
+options['text']) ? $this->options['text'] : t('reply');
+ return l($text, "node/add/comment/" . $values->{$this->aliases['nid']} . '/' . $values->{$this->aliases['cid']});
+ }
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/views_handler_field_username_comment.inc nodecomment/views/views_handler_field_username_comment.inc
--- nodecomment.old/views/views_handler_field_username_comment.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/views_handler_field_username_comment.inc 2008-09-29 09:39:07.000000000 +0200
@@ -0,0 +1,50 @@
+additional_fields['uid'] = 'uid';
+ $this->additional_fields['homepage'] = 'homepage';
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['link_to_user'] = array('default' => TRUE);
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+ $form['link_to_user'] = array(
+ '#title' => t("Link this field to its user or an author's homepage"),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['link_to_user'],
+ );
+ }
+
+ function render_link($data, $values) {
+ $account->uid = $values->{$this->aliases['uid']};
+ $account->name = $values->{$this->field_alias};
+ $account->homepage = $values->{$this->aliases['homepage']};
+
+ if (!empty($this->options['link_to_user'])) {
+ return theme('username', $account);
+ }
+ else {
+ return $data;
+ }
+ }
+
+ function render($values) {
+ return $this->render_link(check_plain($values->{$this->field_alias}), $values);
+ }
+
+}
+
+?>
\ No newline at end of file
diff -urpN nodecomment.old/views/views_handler_sort_comment_thread.inc nodecomment/views/views_handler_sort_comment_thread.inc
--- nodecomment.old/views/views_handler_sort_comment_thread.inc 1970-01-01 01:00:00.000000000 +0100
+++ nodecomment/views/views_handler_sort_comment_thread.inc 2008-09-29 09:44:55.000000000 +0200
@@ -0,0 +1,23 @@
+ensure_my_table();
+
+ //Read comment_render() in comment.module for an explanation of the
+ //thinking behind this sort.
+ if ($this->options['order'] == 'DESC') {
+ $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
+ }
+ else {
+ $alias = $this->table_alias . '_' . $this->real_field . 'asc';
+ //@todo is this secure?
+ $this->query->add_orderby(NULL, "SUBSTRING({$this->table_alias}.{$this->real_field}, 1, (LENGTH({$this->table_alias}.{$this->real_field}) - 1))", $this->options['order'], $alias);
+ }
+ }
+}
+
+?>
\ No newline at end of file