Index: active_translation.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/active_translation.module,v retrieving revision 1.11 diff -u -p -r1.11 -N active_translation.module --- active_translation.module 17 Nov 2008 08:42:56 -0000 1.11 +++ active_translation.module 12 Jul 2009 13:45:55 -0000 @@ -318,12 +318,16 @@ function active_translation_rebuild_on_s * * Rewrite node queries so language selection options are enforced. */ -function active_translation_db_rewrite_sql($query, $primary_table, $primary_key) { +function active_translation_db_rewrite_sql($query, $primary_table, $primary_key, $args = array()) { global $language; switch ($primary_table) { case 'n': case 'node': + // Disable language conditions for views. + // If you want active_translation require the view 'relationship'. + if (array_key_exists('view', $args)) return; + // STOLE THISE FROM I18N, NEED TO MAKE SURE THEY'RE STILL VALID. // Ignore the admin pages. @@ -346,3 +350,13 @@ function active_translation_db_rewrite_s return $result; } } + +/** + * Implementation of hook_views_api(). + */ +function active_translation_views_api() { + return array( + 'api' => '2.0', + 'path' => drupal_get_path('module', 'active_translation') .'/views', + ); +} Index: views/active_translation.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/views/active_translation.views.inc diff -N views/active_translation.views.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ views/active_translation.views.inc 12 Jul 2009 13:41:54 -0000 @@ -0,0 +1,37 @@ + t('i18n'), + 'title' => t('Active translation'), + 'help' => t('Relate node table to active translations.'), + 'relationship' => array( + 'relationship table' => 'node', + 'relationship field' => 'nid', + 'base' => 'active_translation', + 'base field' => '***CURRENT_LANGUAGE***', + 'handler' => 'views_handler_relationship', + 'label' => t('Active translation'), + ), + ); +} Index: views/active_translation.views_default.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/views/active_translation.views_default.inc diff -N views/active_translation.views_default.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ views/active_translation.views_default.inc 12 Jul 2009 13:41:54 -0000 @@ -0,0 +1,138 @@ +name = 'at_frontpage'; + $view->description = 'Emulates the default Drupal front page with active translation.'; + $view->tag = 'default'; + $view->view_php = ''; + $view->base_table = 'node'; + $view->is_cacheable = FALSE; + $view->api_version = 2; + $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */ + $handler = $view->new_display('default', 'Default', 'default'); + $handler->override_option('relationships', array( + 'active_translation' => array( + 'label' => 'Active translation', + 'required' => 1, + 'id' => 'active_translation', + 'table' => 'node', + 'field' => 'active_translation', + 'relationship' => 'none', + ), + )); + $handler->override_option('sorts', array( + 'sticky' => array( + 'id' => 'sticky', + 'table' => 'node', + 'field' => 'sticky', + 'order' => 'DESC', + ), + 'created' => array( + 'id' => 'created', + 'table' => 'node', + 'field' => 'created', + 'order' => 'DESC', + 'relationship' => 'none', + 'granularity' => 'second', + ), + )); + $handler->override_option('filters', array( + 'promote' => array( + 'id' => 'promote', + 'table' => 'node', + 'field' => 'promote', + 'operator' => '=', + 'value' => '1', + 'group' => 0, + 'exposed' => FALSE, + 'expose' => array( + 'operator' => FALSE, + 'label' => '', + ), + ), + 'status' => array( + 'id' => 'status', + 'table' => 'node', + 'field' => 'status', + 'operator' => '=', + 'value' => '1', + 'group' => 0, + 'exposed' => FALSE, + 'expose' => array( + 'operator' => FALSE, + 'label' => '', + ), + ), + )); + $handler->override_option('access', array( + 'type' => 'none', + 'role' => array(), + 'perm' => '', + )); + $handler->override_option('cache', array( + 'type' => 'none', + )); + $handler->override_option('header_format', '1'); + $handler->override_option('footer_format', '1'); + $handler->override_option('empty_format', '1'); + $handler->override_option('use_pager', '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', 'frontpage'); + $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, + )); + $handler = $view->new_display('feed', 'Feed', 'feed'); + $handler->override_option('title', 'Front page feed'); + $handler->override_option('style_plugin', 'rss'); + $handler->override_option('style_options', array( + 'mission_description' => 1, + 'description' => '', + )); + $handler->override_option('row_plugin', 'node_rss'); + $handler->override_option('row_options', array( + 'item_length' => 'default', + )); + $handler->override_option('path', 'rss.xml'); + $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, + )); + $handler->override_option('displays', array( + 'default' => 'default', + 'page' => 'page', + )); + $handler->override_option('sitename_title', '1'); + + return array($view->name => $view); +}