I'm using a table where two fields, one of which is "Node: has new content," share the same column. On recent updates of Views, the field disappears (Node Title in my case) when content is new or updated. It re-appears once the content isn't new anymore. In other words, only "updated" or "new" appears whenever a change is made.

CommentFileSizeAuthor
#6 views.patch1.42 KBmfb

Comments

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Can you export a simple view that replicates this behavior?

brisath’s picture

$view = new view;
$view->name = 'my_work_private';
$view->description = 'Shows all unpublished .';
$view->tag = 'add';
$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', 'Defaults', 'default');
$handler->override_option('fields', array(
'type' => array(
'id' => 'type',
'table' => 'node',
'field' => 'type',
'label' => 'Type',
),
'title' => array(
'id' => 'title',
'table' => 'node',
'field' => 'title',
'label' => 'Title',
'link_to_node' => TRUE,
),
'edit_node' => array(
'label' => 'Edit',
'text' => '',
'exclude' => 0,
'id' => 'edit_node',
'table' => 'node',
'field' => 'edit_node',
'relationship' => 'none',
),
'status' => array(
'label' => 'Published',
'type' => 'yes-no',
'not' => 0,
'exclude' => 0,
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'name' => array(
'label' => 'Latest Author',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'uid_1',
),
'last_updated' => array(
'label' => 'Last Activity',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'relationship' => 'none',
),
'comment_count' => array(
'id' => 'comment_count',
'table' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => 'Replies',
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
),
'timestamp' => array(
'id' => 'timestamp',
'table' => 'history_user',
'field' => 'timestamp',
'label' => '',
'comments' => 1,
'relationship' => 'none',
'link_to_node' => 0,
'comment' => 1,
),
'new_comments' => array(
'id' => 'new_comments',
'table' => 'node',
'field' => 'new_comments',
'label' => '',
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => ' new',
'link_to_comment' => 1,
'no_empty' => 1,
'relationship' => 'none',
),
'last_comment_name' => array(
'label' => 'Last Comment',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_user' => TRUE,
'exclude' => 0,
'id' => 'last_comment_name',
'table' => 'node_comment_statistics',
'field' => 'last_comment_name',
'relationship' => 'none',
),
'group_nid' => array(
'id' => 'group_nid',
'table' => 'og_ancestry',
'field' => 'group_nid',
),
));
$handler->override_option('sorts', array(
'last_updated' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'uid' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(
'count' => TRUE,
'override' => FALSE,
'items_per_page' => 25,
),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => 'Authored work by %1',
'default_argument_type' => 'current_user',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 1,
'not' => 0,
'me_alias' => 1,
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'none',
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'poll' => 0,
'weblinks' => 0,
'forum' => 0,
'aerobic' => 0,
'class' => 0,
'collaboration' => 0,
'content' => 0,
'fitness_test' => 0,
'group_announcement' => 0,
'guideline' => 0,
'instructor_evaluation2009_03' => 0,
'media' => 0,
'menu_page' => 0,
'muscle' => 0,
'nomination' => 0,
'nutrition_log' => 0,
'objective_survey_fitness' => 0,
'page' => 0,
'paper' => 0,
'project' => 0,
'story' => 0,
),
'validate_argument_php' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_is_member' => 0,
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'user_argument_type' => '',
'restrict_user_roles' => 0,
'user_roles' => array(),
),
));
$handler->override_option('filters', array(
'status_extra' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'private' => 'private',
),
'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('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'My Work');
$handler->override_option('use_pager', TRUE);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'columns' => array(
'type' => 'type',
'title' => 'title',
'edit_node' => 'edit_node',
'status' => 'status',
'name' => 'name',
'last_updated' => 'last_updated',
'comment_count' => 'comment_count',
'timestamp' => 'title',
'new_comments' => 'comment_count',
'last_comment_name' => 'last_comment_name',
'group_nid' => 'group_nid',
),
'info' => array(
'type' => array(
'sortable' => 1,
'separator' => '',
),
'title' => array(
'sortable' => 1,
'separator' => '',
),
'edit_node' => array(
'separator' => '',
),
'status' => array(
'sortable' => 0,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'last_updated' => array(
'sortable' => 1,
'separator' => '',
),
'comment_count' => array(
'sortable' => 1,
'separator' => '
',
),
'timestamp' => array(
'separator' => '',
),
'new_comments' => array(
'separator' => '',
),
'last_comment_name' => array(
'sortable' => 0,
'separator' => '',
),
'group_nid' => array(
'separator' => '',
),
),
'default' => 'last_updated',
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'user/%/private');
$handler->override_option('menu', array(
'type' => 'none',
'title' => 'Authored',
'description' => '',
'weight' => '-1',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'normal',
'title' => 'My Authored Work',
'description' => '',
'weight' => '40',
));

brisath’s picture

Status: Postponed (maintainer needs more info) » Active

Hopefully the above export has what you're looking for.

mfb’s picture

Priority: Normal » Critical

This isn't limited to "Node: has new content". The issue I am seeing is if multiple fields in a shared column have a non-empty value, only the last field that has a non-empty value is displayed. If the preceeding fields have an empty value, e.g. 0, they'll display just fine. This seems pretty broken to me so could qualify as a "critical" bug.

najibx’s picture

It looks like, "Show a marker if the node has new or updated content "can't" share same column. I simply takes over the title.

mfb’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

There is some weird logic in template_preprocess_views_view_table(). Here's a patch that fixed the issue for me.

Equ’s picture

I can confirm this behavior. I'll try to apply the patch above and see how it works

agileware’s picture

Title: Field disappearing when "Node: has new content" shows on shared column in table » When multiple fields share a column in table view only the last field displays

I can confirm this behavior, but as mentioned in #4 it happens with any fields that are sharing a column.

The patch in #6 fixed the problem for me and it hasn't had any negative affect on any of my table views.

Equ’s picture

6.x-3.0-dev also fixes this problem.

izmeez’s picture

subscribing. I noticed this was not a problem in the 6.x-2.x-dev version up to and including Jun 30, 2009 but has been a problem since then.

Thanks,

Izzy

extect’s picture

Status: Needs review » Reviewed & tested by the community

#6 works fine!

markus_petrux’s picture

ditto. #6 works here as well.

dww’s picture

Status: Reviewed & tested by the community » Fixed

This behavior appears to have been introduced by:
http://drupal.org/cvs?commit=232500

revision 1.78
date: 2009-07-01 16:36:14 -0700;  author: merlinofchaos;  state: Exp;  lines: +2 -2;  commitid: 15074a4bf2e84567;
Tables would not accept 0 as having data so columns with zeroes would lose data when merging with other columns.

However:

A) That commit doesn't appear to have helped. Even without this patch applied, if I add a "Global: Custom text" field to a table view with "0" as the value, it doesn't show up, even using revision 1.78 of theme.inc.

B) That commit clearly broke this other behavior. If I checkout rev 1.77, multiple fields sharing the same table column works fine.

The patch here solves the problem and looks reasonable to my eyes. Code style is certainly fine, no security holes or anything. Doesn't make things worse, certainly fixes the bug here, and lots of people have confirmed it solves their problems.

So, I committed this to HEAD. I also tested and confirmed that DRUPAL-6--3 does *not* have this bug, so I didn't "backport" it there.

dww’s picture

Further investigation by myself and Earl in IRC lead to the following:

Most 0-valued fields *are* working properly now with this patch. Apparently, it was just bad luck that I was trying to test with the "Global: Custom text", since that appears to be a special-case that's broken. Adding something like "Node: Comment count", and those 0s are showing up just fine now. Phew. ;)

I'll open a separate issue about this, since it seems unrelated to this bug.

dww’s picture

FYI: #546586: 0 not considered valid alternate or empty text -- extremely minor edge case. But, might reveal something deeper that actually *is* worth fixing, who knows. ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.