I constructed a view and added a nodequeue as a views relationship, I am presented with the options of:
- Require this relationship
- Limit to one or more queues (Recommended)

The following code is generated depending on the value of the limit option.

// Code generated when I limit to a specific queue
SELECT node.nid AS nid,
   nodequeue_nodes_node.position AS nodequeue_nodes_node_position
 FROM cf_node node 
 INNER JOIN cf_nodequeue_nodes nodequeue_nodes_node ON node.nid = nodequeue_nodes_node.nid AND nodequeue_nodes_node.qid = 2
 WHERE node.status <> 0 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1
   ORDER BY nodequeue_nodes_node_position ASC

// Code generated when not limited to a specific queue
SELECT node.nid AS nid,
   nodequeue_nodes_node.position AS nodequeue_nodes_node_position
 FROM cf_node node 
 INNER JOIN cf_nodequeue_nodes nodequeue_nodes_node ON node.nid = nodequeue_nodes_node.nid
 WHERE node.status <> 0 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1
   ORDER BY nodequeue_nodes_node_position ASC

I am finding that I would like to pass the QID directly into views via the URL and have views work correctly. I do not want to hard code the selection of the nodequeue qid via the Limit option. Is there a way to do this?

I was thinking of leaving the Limit option blank, and then adding a filter on QID but this didnt seem to work. I'm not sure what the url structure would be, but I used:

http://testsite.com/nodequeue/3 (with a relationship and a filter on QID)

Any advice would be appreciated.

Thanks!

Comments

arcane’s picture

To simplify what I said above, I would just like to have one single view that has the QID passed in without creating a separate view for each nodequeue. I wasn't able to get the module to create it automatically so I would like to do it manually. Can someone please advise? Thanks.

ezra-g’s picture

Status: Active » Fixed

> I would just like to have one single view that has the QID passed in without creating a separate view for each nodequeue

Sounds like you're looking for the "Automatically create one view per queue" setting at admin/content/nodequeue/settings .

arcane’s picture

Status: Fixed » Active

Hi Ezra, Im actually looking for the exact opposite. I have up to 40 nodequeues I wish to create, translating into 40 templates, and this number could exponentially explode. I don't understand why I can't just pass in the QID and just have it work. Why have the Limit option in the first place. If I don't use the limit option, I end up getting all of the nodes in all nodequeues. Am I missing something?

amateescu’s picture

Status: Active » Fixed

You are missing the point of a checkbox. Unchecking the "Automatically create one view per queue" option would provide the opposite, right? :)

arcane’s picture

Status: Fixed » Active

Ok, maybe someone can help me understand. When I uncheck the checkbox, I get nodes for ALL nodequeues even though I pass in a specific nodequeue ID. This is not the desired behavior when I pass in a specific qid to the view. This is validated by the SQL shown above. Please advise on this since If this is not the intended behavior, then perhaps this is a bug?

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry about the misunderstanding there!

Can you paste an export of the view that's not working as you expect?

arcane’s picture

Thanks Ezra,

Here is the views export of the view automatically generated by the module. I edited the view to uncheck the limit option:


$view = new view;
$view->name = 'nodequeue_1';
$view->description = 'Display a list of all nodes in queue \'q1\'';
$view->tag = 'nodequeue';
$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('relationships', array(
  'nodequeue_rel' => array(
    'label' => 'queue',
    'required' => 1,
    'limit' => 0,
    'qids' => array(
      '1' => 1,
      '2' => 0,
    ),
    'id' => 'nodequeue_rel',
    'table' => 'node',
    'field' => 'nodequeue_rel',
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'label' => '',
    'relationship' => 'none',
    'link_to_node' => 1,
  ),
));
$handler->override_option('sorts', array(
  'position' => array(
    'id' => 'position',
    'table' => 'nodequeue_nodes',
    'field' => 'position',
    'order' => 'ASC',
    'relationship' => 'nodequeue_rel',
  ),
));
$handler->override_option('filters', array(
  'status_extra' => array(
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
    'operator' => '=',
    'value' => '',
    'group' => 0,
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Queue \'q1\'');
$handler->override_option('use_pager', '1');
$handler->override_option('use_more', 1);
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'teaser' => 1,
  'links' => 1,
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'nodequeue/1');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler = $view->new_display('block', 'Block', 'block');
$handler->override_option('items_per_page', 5);
$handler->override_option('use_pager', '0');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'type' => 'ul',
));
$handler->override_option('row_plugin', 'fields');
$handler->override_option('row_options', array(
  'inline' => array(),
  'separator' => '',
));
$handler->override_option('block_description', 'Queue \'q1\'');
$handler->override_option('block_caching', -1);
arcane’s picture

Let me know if you need anything else.

arcane’s picture

Status: Postponed (maintainer needs more info) » Active

I have supplied the information, setting back to active.