From 79c50f0fe4e9edff78b15544bcc913dbe8269f13 Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Thu, 25 Jun 2015 21:41:47 -0400 Subject: [PATCH] Updated subscription preferences page for consistency with dashboard pane; also link to first unread comment if there are new comments (DBOINCP-41) --- .../user_preferences.views_default.inc | 410 ++++++++++++++---- 1 file changed, 334 insertions(+), 76 deletions(-) diff --git a/drupal/sites/all/features/user_preferences/user_preferences.views_default.inc b/drupal/sites/all/features/user_preferences/user_preferences.views_default.inc index 8cc36fd837..c172d1f86a 100644 --- a/drupal/sites/all/features/user_preferences/user_preferences.views_default.inc +++ b/drupal/sites/all/features/user_preferences/user_preferences.views_default.inc @@ -69,17 +69,307 @@ function user_preferences_views_default_views() { 'hide_empty' => 0, 'empty_zero' => 0, 'hide_alter_empty' => 1, - 'link_to_node' => 1, - 'exclude' => 0, + 'link_to_node' => 0, + 'exclude' => 1, 'id' => 'title', 'table' => 'node', 'field' => 'title', 'relationship' => 'none', ), 'type' => array( + 'label' => 'Type', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'link_to_node' => 0, + 'machine_name' => 0, + 'exclude' => 1, 'id' => 'type', 'table' => 'node', 'field' => 'type', + 'relationship' => 'none', + ), + 'timestamp' => array( + 'label' => 'Has new content', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'link_to_node' => 0, + 'comments' => 1, + 'exclude' => 1, + 'id' => 'timestamp', + 'table' => 'history_user', + 'field' => 'timestamp', + 'relationship' => 'none', + ), + 'new_comments' => array( + 'label' => 'New comments', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'set_precision' => FALSE, + 'precision' => 0, + 'decimal' => '.', + 'separator' => ',', + 'format_plural' => 0, + 'format_plural_singular' => '1', + 'format_plural_plural' => '@count', + 'prefix' => '', + 'suffix' => '', + 'link_to_comment' => 1, + 'exclude' => 1, + 'id' => 'new_comments', + 'table' => 'node', + 'field' => 'new_comments', + 'relationship' => 'none', + ), + 'name' => array( + 'label' => 'Term', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'link_to_taxonomy' => 0, + 'exclude' => 1, + 'id' => 'name', + 'table' => 'term_data', + 'field' => 'name', + 'relationship' => 'none', + ), + 'name_1' => array( + 'label' => 'Vocabulary name', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'exclude' => 1, + 'id' => 'name_1', + 'table' => 'vocabulary', + 'field' => 'name', + 'relationship' => 'none', + ), + 'phpcode' => array( + 'label' => 'Page', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'value' => 'node_comment_statistics_last_updated > $data->history_user_timestamp) ? TRUE : FALSE; +$url = "node/{$data->nid}"; +if ($data->node_new_comments) { + $cid = boincuser_get_first_unread_comment_id($data->nid); + $url = "goto/comment/{$cid}"; +} +print \'\'; +print l($data->node_title, $url); +print \'\'; +?>', + 'exclude' => 0, + 'id' => 'phpcode', + 'table' => 'customfield', + 'field' => 'phpcode', + 'relationship' => 'none', + ), + 'phpcode_1' => array( + 'label' => '', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'value' => 'node_type == \'forum\') { + print $data->vocabulary_name . \' › \' . $data->term_data_name; +} +elseif ($data->node_type == \'news\') { + print bts(\'News\'); +} +?>', + 'exclude' => 0, + 'id' => 'phpcode_1', + 'table' => 'customfield', + 'field' => 'phpcode', + 'relationship' => 'none', + ), + 'last_updated' => array( + 'label' => 'Updated', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'date_format' => 'time ago', + 'custom_date_format' => '', + 'exclude' => 0, + 'id' => 'last_updated', + 'table' => 'node_comment_statistics', + 'field' => 'last_updated', + 'override' => array( + 'button' => 'Override', + ), + 'relationship' => 'none', ), 'ops' => array( 'label' => '', @@ -114,43 +404,6 @@ function user_preferences_views_default_views() { 'field' => 'ops', 'relationship' => 'flag_content_rel', ), - 'last_updated' => array( - 'label' => 'Updated/commented date', - 'alter' => array( - 'alter_text' => 0, - 'text' => '', - 'make_link' => 0, - 'path' => '', - 'absolute' => 0, - 'link_class' => '', - 'alt' => '', - 'rel' => '', - 'prefix' => '', - 'suffix' => '', - 'target' => '', - 'help' => '', - 'trim' => 0, - 'max_length' => '', - 'word_boundary' => 1, - 'ellipsis' => 1, - 'html' => 0, - 'strip_tags' => 0, - ), - 'empty' => '', - 'hide_empty' => 0, - 'empty_zero' => 0, - 'hide_alter_empty' => 1, - 'date_format' => 'small', - 'custom_date_format' => '', - 'exclude' => 1, - 'id' => 'last_updated', - 'table' => 'node_comment_statistics', - 'field' => 'last_updated', - 'override' => array( - 'button' => 'Override', - ), - 'relationship' => 'none', - ), )); $handler->override_option('access', array( 'type' => 'none', @@ -282,42 +535,6 @@ function user_preferences_views_default_views() { ), 'relationship' => 'none', ), - 'ops' => array( - 'label' => '', - 'alter' => array( - 'alter_text' => 0, - 'text' => '', - 'make_link' => 0, - 'path' => '', - 'absolute' => 0, - 'link_class' => '', - 'alt' => '', - 'rel' => '', - 'prefix' => '', - 'suffix' => '', - 'target' => '', - 'help' => '', - 'trim' => 0, - 'max_length' => '', - 'word_boundary' => 1, - 'ellipsis' => 1, - 'html' => 0, - 'strip_tags' => 0, - ), - 'empty' => '', - 'hide_empty' => 0, - 'empty_zero' => 0, - 'hide_alter_empty' => 1, - 'link_type' => '', - 'exclude' => 1, - 'id' => 'ops', - 'table' => 'flag_content', - 'field' => 'ops', - 'relationship' => 'flag_content_rel', - 'override' => array( - 'button' => 'Use default', - ), - ), 'timestamp' => array( 'label' => 'Has new content', 'alter' => array( @@ -499,8 +716,13 @@ function user_preferences_views_default_views() { 'hide_alter_empty' => 1, 'value' => 'node_comment_statistics_last_updated > $data->history_user_timestamp) ? TRUE : FALSE; +$url = "node/{$data->nid}"; +if ($data->node_new_comments) { + $cid = boincuser_get_first_unread_comment_id($data->nid); + $url = "goto/comment/{$cid}"; +} print \'\'; -print l($data->node_title, "node/{$data->nid}"); +print l($data->node_title, $url); print \'\'; ?>', 'exclude' => 0, @@ -592,6 +814,42 @@ elseif ($data->node_type == \'news\') { ), 'relationship' => 'none', ), + 'ops' => array( + 'label' => '', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'absolute' => 0, + 'link_class' => '', + 'alt' => '', + 'rel' => '', + 'prefix' => '', + 'suffix' => '', + 'target' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'html' => 0, + 'strip_tags' => 0, + ), + 'empty' => '', + 'hide_empty' => 0, + 'empty_zero' => 0, + 'hide_alter_empty' => 1, + 'link_type' => '', + 'exclude' => 1, + 'id' => 'ops', + 'table' => 'flag_content', + 'field' => 'ops', + 'relationship' => 'flag_content_rel', + 'override' => array( + 'button' => 'Use default', + ), + ), )); $handler->override_option('title', 'Subscriptions'); $handler->override_option('items_per_page', 5);