Posted by giorgio79 on August 1, 2009 at 3:08pm
Jump to:
| Project: | Views Bulk Operations (VBO) |
| Version: | 6.x-1.11 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hello,
I have built really cool management and admin views with VBO, and I am sharing them here, so hopefully you will find it useful as well. Hopefully more VBOs will be built for taxonomy, as currently only Delete is supported, but it is a good start. I am hoping Karim will see the power in including such views from the start :)
Currently, this is the only way I know of to successfully filter for orphaned terms for example for non programmers.
You will need http://drupal.org/project/term_node_count as well
You will be able to access this view with the admin user at mysite.com/manage-term
$view = new view;
$view->name = 'manage_term';
$view->description = 'manage_term';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'term_data';
$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(
'name' => array(
'label' => 'Term',
'link_to_taxonomy' => 1,
'exclude' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'relationship' => 'none',
),
'node_count' => array(
'label' => 'Term Node Count',
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'link_to_term' => 0,
'exclude' => 0,
'id' => 'node_count',
'table' => 'term_node_count',
'field' => 'node_count',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'node_count' => array(
'order' => 'ASC',
'id' => 'node_count',
'table' => 'term_node_count',
'field' => 'node_count',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'tid' => array(
'operator' => 'or',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'tid_op',
'identifier' => 'tid',
'label' => 'Taxonomy: Term ID',
'optional' => 1,
'single' => 1,
'remember' => 0,
),
'type' => 'textfield',
'vid' => '1',
'id' => 'tid',
'table' => 'term_data',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'node_count' => array(
'operator' => '=',
'value' => array(
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'node_count_op',
'identifier' => 'node_count',
'label' => 'Taxonomy: Term Node Count',
'optional' => 1,
'remember' => 0,
),
'id' => 'node_count',
'table' => 'term_node_count',
'field' => 'node_count',
'relationship' => 'none',
),
'vid' => array(
'operator' => 'in',
'value' => array(
'1' => '1',
'2' => '2',
'3' => '3',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'vid_op',
'identifier' => 'vid',
'label' => 'Taxonomy: Vocabulary',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'vid',
'table' => 'term_data',
'field' => 'vid',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'administer nodes',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'bulk');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'name' => 'name',
'node_count' => 'node_count',
),
'info' => array(
'name' => array(
'sortable' => 1,
'separator' => '',
),
'node_count' => array(
'separator' => '',
),
),
'default' => '-1',
'execution_type' => '2',
'display_type' => '0',
'hide_select_all' => 0,
'skip_confirmation' => 0,
'display_result' => 1,
'merge_single_action' => 1,
'selected_operations' => array(
'views_bulk_operations_delete_term_action' => 'views_bulk_operations_delete_term_action',
'backup_migrate_backup_action' => 0,
'system_message_action' => 0,
'views_bulk_operations_script_action' => 0,
'views_bulk_operations_argument_selector_action' => 0,
'twitter_actions_set_status_action' => 0,
'system_goto_action' => 0,
'system_send_email_action' => 0,
),
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'manage-term');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Comments
#1
Thank you, I will try it next time I need to clean !
#2
Setting this as fixed for now :) Any improvements are welcome, please share.
Would love to see some standard management VBO enhanced views included with VBO :)
#3
Sorry I didn't get to include them yet. I will do that on the next release hopefully. Thanks!
#4
Automatically closed -- issue fixed for 2 weeks with no activity.
#6
Hi,
I tried the view here with latest VBO. I got:
# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT * FROM term_data td WHERE td.tid IN () in //sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc on line 298.# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT * FROM term_data td WHERE td.tid IN () in /sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc on line 298.
Greetings, Martijn
#7
Setting this to active again because of the bug, ok?
Greetings, Martijn
#8
Please try 6.x-1.12.
#9
Reverting to previous status. 6.x-1.12 should have fixed these errors. Create a new issue if it didn't.