summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2012-08-14 13:29:52 (GMT)
committerTorsten Grote <grote@kolabsys.com>2012-08-14 13:29:52 (GMT)
commit8a7a4f8e58df35a10fda833a9904eb8fd961a1ca (patch)
tree35e2f907372d637f76c0e3c3ac1c0f27f2dc1391 /kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment
parent146e20fc2d0941a6783641f26b3ea074dc03fc84 (diff)
downloadkolab.org-www-8a7a4f8e58df35a10fda833a9904eb8fd961a1ca.tar.gz
upgrade to drupal 7.15
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc56
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment.inc67
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_depth.inc15
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link.inc63
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc31
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_delete.inc23
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_edit.inc46
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_reply.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_node_link.inc59
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_username.inc52
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_last_comment_timestamp.inc23
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_comment_name.inc49
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_updated.inc13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_comment.inc21
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_new_comments.inc110
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_comment_user_uid.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_ncs_last_updated.inc19
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_node_comment.inc16
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_comment_thread.inc20
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_comment_name.inc24
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_updated.inc13
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_rss.inc151
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_view.inc96
23 files changed, 1015 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc
new file mode 100644
index 0000000..11144a9
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_argument_comment_user_uid.inc
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * Argument handler to accept a user id to check for nodes that
+ * user posted or commented on.
+ *
+ * @ingroup views_argument_handlers
+ */
+class views_handler_argument_comment_user_uid extends views_handler_argument {
+ function title() {
+ if (!$this->argument) {
+ $title = variable_get('anonymous', t('Anonymous'));
+ }
+ else {
+ $title = db_query('SELECT u.name FROM {users} u WHERE u.uid = :uid', array(':uid' => $this->argument))->fetchField();
+ }
+ if (empty($title)) {
+ return t('No user');
+ }
+
+ return check_plain($title);
+ }
+
+ function default_actions($which = NULL) {
+ // Disallow summary views on this argument.
+ if (!$which) {
+ $actions = parent::default_actions();
+ unset($actions['summary asc']);
+ unset($actions['summary desc']);
+ return $actions;
+ }
+
+ if ($which != 'summary asc' && $which != 'summary desc') {
+ return parent::default_actions($which);
+ }
+ }
+
+ function query($group_by = FALSE) {
+ $this->ensure_my_table();
+
+ $subselect = db_select('comment', 'c');
+ $subselect->addField('c', 'cid');
+ $subselect->condition('c.uid', $this->argument);
+ $subselect->where("c.nid = $this->table_alias.nid");
+
+ $condition = db_or()
+ ->condition("$this->table_alias.uid", $this->argument, '=')
+ ->exists($subselect);
+
+ $this->query->add_where(0, $condition);
+ }
+
+ function get_sort_name() {
+ return t('Numerical', array(), array('context' => 'Sort order'));
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment.inc
new file mode 100644
index 0000000..b855b63
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment.inc
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Field handler to allow linking to a comment.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment extends views_handler_field {
+ /**
+ * Override init function to provide generic option to link to comment.
+ */
+ function init(&$view, &$options) {
+ parent::init($view, $options);
+ if (!empty($this->options['link_to_comment'])) {
+ $this->additional_fields['cid'] = 'cid';
+ $this->additional_fields['nid'] = 'nid';
+ }
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['link_to_comment'] = array('default' => TRUE);
+ $options['link_to_node'] = array('default' => FALSE);
+
+ return $options;
+ }
+
+ /**
+ * Provide link-to-comment option
+ */
+ function options_form(&$form, &$form_state) {
+ $form['link_to_comment'] = array(
+ '#title' => t('Link this field to its comment'),
+ '#description' => t("Enable to override this field's links."),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['link_to_comment'],
+ );
+ $form['link_to_node'] = array(
+ '#title' => t('Link field to the node if there is no comment.'),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['link_to_node'],
+ );
+ parent::options_form($form, $form_state);
+ }
+
+ function render_link($data, $values) {
+ if (!empty($this->options['link_to_comment'])) {
+ $this->options['alter']['make_link'] = TRUE;
+ $nid = $this->get_value($values, 'nid');
+ $cid = $this->get_value($values, 'cid');
+ if (!empty($cid)) {
+ $this->options['alter']['path'] = "comment/" . $cid;
+ $this->options['alter']['fragment'] = "comment-" . $cid;
+ }
+ // If there is no comment link to the node.
+ else if ($this->options['link_to_node']) {
+ $this->options['alter']['path'] = "node/" . $nid;
+ }
+ }
+
+ return $data;
+ }
+
+ function render($values) {
+ $value = $this->get_value($values);
+ return $this->render_link($this->sanitize_value($value), $values);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_depth.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_depth.inc
new file mode 100644
index 0000000..8872a6a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_depth.inc
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Field handler to display the depth of a comment.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_depth extends views_handler_field {
+ /**
+ * Work out the depth of this comment
+ */
+ function render($values) {
+ $comment_thread = $this->get_value($values);
+ return count(explode('.', $comment_thread)) - 1;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link.inc
new file mode 100644
index 0000000..e0e0ba7
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link.inc
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Base field handler to present a link.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link extends views_handler_field_entity {
+ function construct() {
+ parent::construct();
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['text'] = array('default' => '', 'translatable' => TRUE);
+ $options['link_to_node'] = array('default' => FALSE);
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ $form['text'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Text to display'),
+ '#default_value' => $this->options['text'],
+ );
+ $form['link_to_node'] = array(
+ '#title' => t('Link field to the node if there is no comment.'),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['link_to_node'],
+ );
+ parent::options_form($form, $form_state);
+ }
+
+ function query() {
+ $this->ensure_my_table();
+ $this->add_additional_fields();
+ }
+
+ function render($values) {
+ $value = $this->get_value($values, 'cid');
+ return $this->render_link($this->sanitize_value($value), $values);
+ }
+
+ function render_link($data, $values) {
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
+ $comment = $this->get_value($values);
+ $nid = $comment->nid;
+ $cid = $comment->cid;
+
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['html'] = TRUE;
+
+ if (!empty($cid)) {
+ $this->options['alter']['path'] = "comment/" . $cid;
+ $this->options['alter']['fragment'] = "comment-" . $cid;
+ }
+ // If there is no comment link to the node.
+ else if ($this->options['link_to_node']) {
+ $this->options['alter']['path'] = "node/" . $nid;
+ }
+
+ return $text;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
new file mode 100644
index 0000000..8063e20
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
@@ -0,0 +1,31 @@
+<?php
+/**
+ * @file
+ * Provides a comment approve link.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link_approve extends views_handler_field_comment_link {
+ function access() {
+ //needs permission to administer comments in general
+ return user_access('administer comments');
+ }
+
+ function render_link($data, $values) {
+ $status = $this->get_value($values, 'status');
+
+ // Don't show an approve link on published nodes.
+ if ($status == COMMENT_PUBLISHED) {
+ return;
+ }
+
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('approve');
+ $cid = $this->get_value($values, 'cid');
+
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['path'] = "comment/" . $cid . "/approve";
+ $this->options['alter']['query'] = drupal_get_destination() + array('token' => drupal_get_token("comment/$cid/approve"));
+
+ return $text;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_delete.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_delete.inc
new file mode 100644
index 0000000..b74661b
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_delete.inc
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Field handler to present a link to delete a node.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link_delete extends views_handler_field_comment_link {
+ function access() {
+ //needs permission to administer comments in general
+ return user_access('administer comments');
+ }
+
+ function render_link($data, $values) {
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
+ $cid = $this->get_value($values, 'cid');
+
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['path'] = "comment/" . $cid . "/delete";
+ $this->options['alter']['query'] = drupal_get_destination();
+
+ return $text;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_edit.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_edit.inc
new file mode 100644
index 0000000..ffd1f93
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_edit.inc
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Field handler to present a link node edit.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link_edit extends views_handler_field_comment_link {
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['destination'] = array('default' => FALSE);
+
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+
+ $form['destination'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use destination'),
+ '#description' => t('Add destination to the link'),
+ '#default_value' => $this->options['destination'],
+ '#fieldset' => 'more',
+ );
+ }
+
+ function render_link($data, $values) {
+ parent::render_link($data, $values);
+ // ensure user has access to edit this comment.
+ $comment = $this->get_value($values);
+ if (!comment_access('edit', $comment)) {
+ return;
+ }
+
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
+ unset($this->options['alter']['fragment']);
+
+ if (!empty($this->options['destination'])) {
+ $this->options['alter']['query'] = drupal_get_destination();
+ }
+
+ $this->options['alter']['path'] = "comment/" . $comment->cid . "/edit";
+
+ return $text;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_reply.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_reply.inc
new file mode 100644
index 0000000..1564164
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_reply.inc
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * Field handler to present a link to delete a node.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link_reply extends views_handler_field_comment_link {
+ function access() {
+ //check for permission to reply to comments
+ return user_access('post comments');
+ }
+
+ function render_link($data, $values) {
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('reply');
+ $nid = $this->get_value($values, 'nid');
+ $cid = $this->get_value($values, 'cid');
+
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['path'] = "comment/reply/" . $nid . '/' . $cid;
+
+ return $text;
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_node_link.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_node_link.inc
new file mode 100644
index 0000000..0e4f610
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_node_link.inc
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Handler for showing comment module's node link.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_node_link extends views_handler_field_entity {
+ function construct() {
+ parent::construct();
+
+ // Add the node fields that comment_link will need..
+ $this->additional_fields['nid'] = array(
+ 'field' => 'nid',
+ );
+ $this->additional_fields['type'] = array(
+ 'field' => 'type',
+ );
+ $this->additional_fields['comment'] = array(
+ 'field' => 'comment',
+ );
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['teaser'] = array('default' => 0);
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ $form['teaser'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Show teaser-style link'),
+ '#default_value' => $this->options['teaser'],
+ '#description' => t('Show the comment link in the form used on standard node teasers, rather than the full node form.'),
+ '#fieldset' => 'more',
+ );
+
+ parent::options_form($form, $form_state);
+ }
+
+ function query() {
+ $this->ensure_my_table();
+ $this->add_additional_fields();
+ }
+
+ function render($values) {
+ // Build fake $node.
+ $node = $this->get_value($values);
+
+ // Call comment.module's hook_link: comment_link($type, $node = NULL, $teaser = FALSE)
+ // Call node by reference so that something is changed here
+ comment_node_view($node, $this->options['teaser'] ? 'teaser' : 'full');
+ // question: should we run these through: drupal_alter('link', $links, $node);
+ // might this have unexpected consequences if these hooks expect items in $node that we don't have?
+
+ // Only render the links, if they are defined.
+ return !empty($node->content['links']['comment']) ? drupal_render($node->content['links']['comment']) : '';
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_username.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_username.inc
new file mode 100644
index 0000000..6b6186e
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_username.inc
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Field handler to allow linking to a user account or homepage.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_username 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) {
+ $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'],
+ );
+ parent::options_form($form, $form_state);
+ }
+
+ function render_link($data, $values) {
+ if (!empty($this->options['link_to_user'])) {
+ $account = new stdClass();
+ $account->uid = $this->get_value($values, 'uid');
+ $account->name = $this->get_value($values);
+ $account->homepage = $this->get_value($values, 'homepage');
+
+ return theme('username', array(
+ 'account' => $account
+ ));
+ }
+ else {
+ return $data;
+ }
+ }
+
+ function render($values) {
+ $value = $this->get_value($values);
+ return $this->render_link($this->sanitize_value($value), $values);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_last_comment_timestamp.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_last_comment_timestamp.inc
new file mode 100644
index 0000000..2bfa970
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_last_comment_timestamp.inc
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Field handler to display the timestamp of a comment with the count of comments.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_last_comment_timestamp extends views_handler_field_date {
+ function construct() {
+ parent::construct();
+ $this->additional_fields['comment_count'] = 'comment_count';
+ }
+
+ function render($values) {
+ $comment_count = $this->get_value($values, 'comment_count');
+ if (empty($this->options['empty_zero']) || $comment_count) {
+ return parent::render($values);
+ }
+ else {
+ return NULL;
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_comment_name.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_comment_name.inc
new file mode 100644
index 0000000..63f948f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_comment_name.inc
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * Field handler to present the name of the last comment poster.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_ncs_last_comment_name extends views_handler_field {
+ function query() {
+ // last_comment_name only contains data if the user is anonymous. So we
+ // have to join in a specially related user table.
+ $this->ensure_my_table();
+ // join 'users' to this table via vid
+ $join = new views_join();
+ $join->construct('users', $this->table_alias, 'last_comment_uid', 'uid');
+ $join->extra = array(array('field' => 'uid', 'operator' => '!=', 'value' => '0'));
+
+ // ncs_user alias so this can work with the sort handler, below.
+// $this->user_table = $this->query->add_relationship(NULL, $join, 'users', $this->relationship);
+ $this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join);
+
+ $this->field_alias = $this->query->add_field(NULL, "COALESCE($this->user_table.name, $this->table_alias.$this->field)", $this->table_alias . '_' . $this->field);
+
+ $this->user_field = $this->query->add_field($this->user_table, 'name');
+ $this->uid = $this->query->add_field($this->table_alias, 'last_comment_uid');
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+
+ $options['link_to_user'] = array('default' => TRUE);
+
+ return $options;
+ }
+
+ function render($values) {
+ if (!empty($this->options['link_to_user'])) {
+ $account = new stdClass();
+ $account->name = $this->get_value($values);
+ $account->uid = $values->{$this->uid};
+ return theme('username', array(
+ 'account' => $account
+ ));
+ }
+ else {
+ return $this->sanitize_value($this->get_value($values));
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_updated.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_updated.inc
new file mode 100644
index 0000000..3950ffb
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_ncs_last_updated.inc
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Field handler to display the newer of last comment / node updated.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_ncs_last_updated extends views_handler_field_date {
+ function query() {
+ $this->ensure_my_table();
+ $this->node_table = $this->query->ensure_table('node', $this->relationship);
+ $this->field_alias = $this->query->add_field(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)", $this->table_alias . '_' . $this->field);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_comment.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_comment.inc
new file mode 100644
index 0000000..6892fed
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_comment.inc
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * Display node comment status.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_node_comment extends views_handler_field {
+ function render($values) {
+ $value = $this->get_value($values);
+ switch ($value) {
+ case COMMENT_NODE_HIDDEN:
+ default:
+ return t('Hidden');
+ case COMMENT_NODE_CLOSED:
+ return t('Closed');
+ case COMMENT_NODE_OPEN:
+ return t('Open');
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_new_comments.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_new_comments.inc
new file mode 100644
index 0000000..0ecdfc6
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_node_new_comments.inc
@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * Field handler to display the number of new comments.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_node_new_comments extends views_handler_field_numeric {
+ function init(&$view, &$options) {
+ parent::init($view, $options);
+
+ // translate an older setting:
+ if (!empty($options['no_empty'])) {
+ $this->options['hide_empty'] = TRUE;
+ unset($this->options['no_empty']);
+ }
+ }
+
+ function construct() {
+ parent::construct();
+ $this->additional_fields['nid'] = 'nid';
+ $this->additional_fields['type'] = 'type';
+ $this->additional_fields['comment_count'] = array('table' => 'node_comment_statistics', 'field' => 'comment_count');
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+
+ $options['link_to_comment'] = array('default' => TRUE);
+
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ $form['link_to_comment'] = array(
+ '#title' => t('Link this field to new comments'),
+ '#description' => t("Enable to override this field's links."),
+ '#type' => 'checkbox',
+ '#default_value' => $this->options['link_to_comment'],
+ );
+
+ parent::options_form($form, $form_state);
+ }
+
+ function query() {
+ $this->ensure_my_table();
+ $this->add_additional_fields();
+ $this->field_alias = $this->table . '_' . $this->field;
+ }
+
+ function pre_render(&$values) {
+ global $user;
+ if (!$user->uid || empty($values)) {
+ return;
+ }
+
+ $nids = array();
+ $ids = array();
+ foreach ($values as $id => $result) {
+ $nids[] = $result->{$this->aliases['nid']};
+ $values[$id]->{$this->field_alias} = 0;
+ // Create a reference so we can find this record in the values again.
+ if (empty($ids[$result->{$this->aliases['nid']}])) {
+ $ids[$result->{$this->aliases['nid']}] = array();
+ }
+ $ids[$result->{$this->aliases['nid']}][] = $id;
+ }
+
+ if ($nids) {
+ $result = db_query("SELECT n.nid, COUNT(c.cid) as num_comments FROM {node} n INNER JOIN {comment} c ON n.nid = c.nid
+ LEFT JOIN {history} h ON h.nid = n.nid AND h.uid = :h_uid WHERE n.nid IN (:nids)
+ AND c.changed > GREATEST(COALESCE(h.timestamp, :timestamp), :timestamp) AND c.status = :status GROUP BY n.nid ", array(
+ ':status' => COMMENT_PUBLISHED,
+ ':h_uid' => $user->uid,
+ ':nids' => $nids,
+ ':timestamp' => NODE_NEW_LIMIT,
+ ));
+
+ foreach ($result as $node) {
+ foreach ($ids[$node->nid] as $id) {
+ $values[$id]->{$this->field_alias} = $node->num_comments;
+ }
+ }
+ }
+ }
+
+ function render_link($data, $values) {
+ if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
+ $node = new stdClass();
+ $node->nid = $this->get_value($values, 'nid');
+ $node->type = $this->get_value($values, 'type');
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['path'] = 'node/' . $node->nid;
+ $this->options['alter']['query'] = comment_new_page_count($this->get_value($values, 'comment_count'), $this->get_value($values), $node);
+ $this->options['alter']['fragment'] = 'new';
+ }
+
+ return $data;
+ }
+
+ function render($values) {
+ $value = $this->get_value($values);
+ if (!empty($value)) {
+ return $this->render_link(parent::render($values), $values);
+ }
+ else {
+ $this->options['alter']['make_link'] = FALSE;
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_comment_user_uid.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_comment_user_uid.inc
new file mode 100644
index 0000000..4f9e711
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_comment_user_uid.inc
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * Filter handler to accept a user id to check for nodes that user posted or
+ * commented on.
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_comment_user_uid extends views_handler_filter_user_name {
+ function query() {
+ $this->ensure_my_table();
+
+ $subselect = db_select('comment', 'c');
+ $subselect->addField('c', 'cid');
+ $subselect->condition('c.uid', $this->value, $this->operator);
+ $subselect->where("c.nid = $this->table_alias.nid");
+
+ $condition = db_or()
+ ->condition("$this->table_alias.uid", $this->value, $this->operator)
+ ->exists($subselect);
+
+ $this->query->add_where($this->options['group'], $condition);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_ncs_last_updated.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_ncs_last_updated.inc
new file mode 100644
index 0000000..3818db9
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_ncs_last_updated.inc
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Filter handler for the newer of last comment / node updated
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_ncs_last_updated extends views_handler_filter_date {
+ function query() {
+ $this->ensure_my_table();
+ $this->node_table = $this->query->ensure_table('node', $this->relationship);
+
+ $field = "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)";
+
+ $info = $this->operators();
+ if (!empty($info[$this->operator]['method'])) {
+ $this->{$info[$this->operator]['method']}($field);
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_node_comment.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_node_comment.inc
new file mode 100644
index 0000000..659eaa6
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_filter_node_comment.inc
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * Filter based on comment node status
+ *
+ * @ingroup views_filter_handlers
+ */
+class views_handler_filter_node_comment extends views_handler_filter_in_operator {
+ function get_value_options() {
+ $this->value_options = array(
+ COMMENT_NODE_HIDDEN => t('Hidden'),
+ COMMENT_NODE_CLOSED => t('Closed'),
+ COMMENT_NODE_OPEN => t('Open'),
+ );
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_comment_thread.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_comment_thread.inc
new file mode 100644
index 0000000..e529b2a
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_comment_thread.inc
@@ -0,0 +1,20 @@
+<?php
+/**
+ * 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);
+ }
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_comment_name.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_comment_name.inc
new file mode 100644
index 0000000..8eca177
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_comment_name.inc
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Sort handler to sort by last comment name which might be in 2 different
+ * fields.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_ncs_last_comment_name extends views_handler_sort {
+ function query() {
+ $this->ensure_my_table();
+ $join = new views_join();
+ $join->construct('users', $this->table_alias, 'last_comment_uid', 'uid');
+
+ // @todo this might be safer if we had an ensure_relationship rather than guessing
+ // the table alias. Though if we did that we'd be guessing the relationship name
+ // so that doesn't matter that much.
+// $this->user_table = $this->query->add_relationship(NULL, $join, 'users', $this->relationship);
+ $this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join);
+ $this->user_field = $this->query->add_field($this->user_table, 'name');
+
+ // Add the field.
+ $this->query->add_orderby(NULL, "LOWER(COALESCE($this->user_table.name, $this->table_alias.$this->field))", $this->options['order'], $this->table_alias . '_' . $this->field);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_updated.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_updated.inc
new file mode 100644
index 0000000..04b01a1
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_updated.inc
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Sort handler for the newer of last comment / node updated.
+ *
+ * @ingroup views_sort_handlers
+ */
+class views_handler_sort_ncs_last_updated extends views_handler_sort_date {
+ function query() {
+ $this->ensure_my_table();
+ $this->node_table = $this->query->ensure_table('node', $this->relationship);
+ $this->field_alias = $this->query->add_orderby(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->table_alias . ".last_comment_timestamp)", $this->options['order'], $this->table_alias . '_' . $this->field);
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_rss.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_rss.inc
new file mode 100644
index 0000000..7576bb5
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_rss.inc
@@ -0,0 +1,151 @@
+<?php
+/**
+ * @file
+ * Contains the comment RSS row style plugin.
+ */
+
+/**
+ * Plugin which formats the comments as RSS items.
+ */
+class views_plugin_row_comment_rss extends views_plugin_row {
+ var $base_table = 'comment';
+ var $base_field = 'cid';
+
+ function option_definition() {
+ $options = parent::option_definition();
+
+ $options['item_length'] = array('default' => 'default');
+ $options['links'] = FALSE;
+
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+
+ $form['item_length'] = array(
+ '#type' => 'select',
+ '#title' => t('Display type'),
+ '#options' => $this->options_form_summary_options(),
+ '#default_value' => $this->options['item_length'],
+ );
+ $form['links'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Display links'),
+ '#default_value' => $this->options['links'],
+ );
+ }
+
+
+ function pre_render($result) {
+ $cids = array();
+ $nids = array();
+
+ foreach ($result as $row) {
+ $cids[] = $row->cid;
+ }
+
+ $this->comments = comment_load_multiple($cids);
+ foreach ($this->comments as &$comment) {
+ $comment->depth = count(explode('.', $comment->thread)) - 1;
+ $nids[] = $comment->nid;
+ }
+
+ $this->nodes = node_load_multiple($nids);
+ }
+
+ /**
+ * Return the main options, which are shown in the summary title
+ *
+ * @see views_plugin_row_node_rss::options_form_summary_options()
+ * @todo: Maybe provide a views_plugin_row_rss_entity and reuse this method
+ * in views_plugin_row_comment|node_rss.inc
+ */
+ function options_form_summary_options() {
+ $entity_info = entity_get_info('node');
+ $options = array();
+ if (!empty($entity_info['view modes'])) {
+ foreach ($entity_info['view modes'] as $mode => $settings) {
+ $options[$mode] = $settings['label'];
+ }
+ }
+ $options['title'] = t('Title only');
+ $options['default'] = t('Use site default RSS settings');
+ return $options;
+ }
+
+
+ function render($row) {
+ global $base_url;
+
+ $cid = $row->{$this->field_alias};
+ if (!is_numeric($cid)) {
+ return;
+ }
+
+ $item_length = $this->options['item_length'];
+ if ($item_length == 'default') {
+ $item_length = variable_get('feed_item_length', 'teaser');
+ }
+
+ // Load the specified comment and its associated node:
+ $comment = $this->comments[$cid];
+ if (empty($comment) || empty($this->nodes[$comment->nid])) {
+ return;
+ }
+
+ $item_text = '';
+
+ $uri = entity_uri('comment', $comment);
+ $comment->link = url($uri['path'], $uri['options'] + array('absolute' => TRUE));
+ $comment->rss_namespaces = array();
+ $comment->rss_elements = array(
+ array(
+ 'key' => 'pubDate',
+ 'value' => gmdate('r', $comment->created),
+ ),
+ array(
+ 'key' => 'dc:creator',
+ 'value' => $comment->name,
+ ),
+ array(
+ 'key' => 'guid',
+ 'value' => 'comment ' . $comment->cid . ' at ' . $base_url,
+ 'attributes' => array('isPermaLink' => 'false'),
+ ),
+ );
+
+ // The comment gets built and modules add to or modify
+ // $comment->rss_elements and $comment->rss_namespaces.
+ $build = comment_view($comment, $this->nodes[$comment->nid], 'rss');
+ unset($build['#theme']);
+
+ if (!empty($comment->rss_namespaces)) {
+ $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces);
+ }
+
+ // Hide the links if desired.
+ if (!$this->options['links']) {
+ hide($build['links']);
+ }
+
+ if ($item_length != 'title') {
+ // We render comment contents and force links to be last.
+ $build['links']['#weight'] = 1000;
+ $item_text .= drupal_render($build);
+ }
+
+ $item = new stdClass();
+ $item->description = $item_text;
+ $item->title = $comment->subject;
+ $item->link = $comment->link;
+ $item->elements = $comment->rss_elements;
+ $item->cid = $comment->cid;
+
+ return theme($this->theme_functions(), array(
+ 'view' => $this->view,
+ 'options' => $this->options,
+ 'row' => $item
+ ));
+ }
+}
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_view.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_view.inc
new file mode 100644
index 0000000..284fa5f
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_plugin_row_comment_view.inc
@@ -0,0 +1,96 @@
+<?php
+/**
+ * @file
+ * Contains the node RSS row style plugin.
+ */
+
+/**
+ * Plugin which performs a comment_view on the resulting object.
+ */
+class views_plugin_row_comment_view extends views_plugin_row {
+ var $base_field = 'cid';
+ var $base_table = 'comment';
+
+ /**
+ * Stores all comments which are preloaded.
+ */
+ var $comments = array();
+
+ /**
+ * Stores all nodes of all comments which are preloaded.
+ */
+ var $nodes = array();
+
+ function summary_title() {
+ return t('Settings');
+ }
+
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['links'] = array('default' => TRUE);
+ $options['view_mode'] = array('default' => 'full');
+ return $options;
+ }
+
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+
+ $options = $this->options_form_summary_options();
+ $form['view_mode'] = array(
+ '#type' => 'select',
+ '#options' => $options,
+ '#title' => t('View mode'),
+ '#default_value' => $this->options['view_mode'],
+ );
+
+ $form['links'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Display links'),
+ '#default_value' => $this->options['links'],
+ );
+ }
+
+
+ /**
+ * Return the main options, which are shown in the summary title.
+ */
+ function options_form_summary_options() {
+ $entity_info = entity_get_info('comment');
+ $options = array();
+ if (!empty($entity_info['view modes'])) {
+ foreach ($entity_info['view modes'] as $mode => $settings) {
+ $options[$mode] = $settings['label'];
+ }
+ }
+ if (empty($options)) {
+ $options = array(
+ 'full' => t('Full content')
+ );
+ }
+
+ return $options;
+ }
+
+ function pre_render($result) {
+ $cids = array();
+
+ foreach ($result as $row) {
+ $cids[] = $row->cid;
+ }
+
+ // Load all comments.
+ $cresult = comment_load_multiple($cids);
+ $nids = array();
+ foreach ($cresult as $comment) {
+ $comment->depth = count(explode('.', $comment->thread)) - 1;
+ $this->comments[$comment->cid] = $comment;
+ $nids[] = $comment->nid;
+ }
+
+ // Load all nodes of the comments.
+ $nodes = node_load_multiple(array_unique($nids));
+ foreach ($nodes as $node) {
+ $this->nodes[$node->nid] = $node;
+ }
+ }
+}