Pārlūkot izejas kodu

Default views now link to node and only show published/sync'd results if chado is local

Lacey Sanderson 12 gadi atpakaļ
vecāks
revīzija
170f8328d6

+ 65 - 0
tripal_analysis/tripal_analysis.views.inc

@@ -435,6 +435,8 @@ function tripal_analysis_views_default_views() {
     ),
     'default' => 'name',
   ));
+  // this is needed so that fields/filters can be added to the default display later
+  $default_handler = $handler;
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'chado/analyses');
   $handler->override_option('menu', array(
@@ -451,6 +453,69 @@ function tripal_analysis_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name']['alter']['make_link'] = 1;
+    $fields['name']['alter']['path'] = 'node/[nid]';
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+  }
   $views[$view->name] = $view;
 
   return $views;

+ 64 - 0
tripal_feature/tripal_feature.views.inc

@@ -573,6 +573,7 @@ function tripal_feature_views_default_views() {
     ),
     'default' => '-1',
   ));
+  $default_handler = $handler;
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'chado/features');
   $handler->override_option('menu', array(
@@ -589,6 +590,69 @@ function tripal_feature_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name']['alter']['make_link'] = 1;
+    $fields['name']['alter']['path'] = 'node/[nid]';
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+  }
   $views[$view->name] = $view;
 
   return $views;

+ 64 - 0
tripal_library/tripal_library.views.inc

@@ -390,6 +390,7 @@ function tripal_library_views_default_views() {
     ),
     'default' => 'uniquename',
   ));
+  $default_handler = $handler;
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'chado/libraries');
   $handler->override_option('menu', array(
@@ -406,6 +407,69 @@ function tripal_library_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name_1']['alter']['make_link'] = 1;
+    $fields['name_1']['alter']['path'] = 'node/[nid]';
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+  }
   $views[$view->name] = $view;
 
   return $views;

+ 64 - 0
tripal_organism/tripal_organism.views.inc

@@ -313,6 +313,7 @@ function tripal_organism_views_default_views() {
     ),
     'default' => '-1',
   ));
+  $default_handler = $handler;
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'chado/organisms');
   $handler->override_option('menu', array(
@@ -329,6 +330,69 @@ function tripal_organism_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['common_name']['alter']['make_link'] = 1;
+    $fields['common_name']['alter']['path'] = 'node/[nid]';
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+  }
   $views[$view->name] = $view;
 
   return $views;

+ 64 - 0
tripal_stock/tripal_stock.views.inc

@@ -551,6 +551,7 @@ function tripal_stock_views_default_views() {
     ),
     'default' => '-1',
   ));
+  $default_handler = $handler;
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->override_option('path', 'chado/stocks');
   $handler->override_option('menu', array(
@@ -567,6 +568,69 @@ function tripal_stock_views_default_views() {
     'weight' => 0,
     'name' => 'navigation',
   ));
+  // Add code specific to a local chado installation
+  // NOTE: Edit $handler above to $default_handler for the default display
+  if (tripal_core_chado_schema_exists()) {
+    // Add nid field
+    $fields = $view->get_items('field', 'default');
+    $new_fields = array(
+      'nid' => array(
+        'label' => 'Nid',
+        '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,
+        'exclude' => 1,
+        'id' => 'nid',
+        'table' => 'node',
+        'field' => 'nid',
+        'relationship' => 'none',
+      )
+    );
+    $fields = $new_fields + $fields;
+    // Change analysis.name to have a link to the node
+    $fields['name_2']['alter']['make_link'] = 1;
+    $fields['name_2']['alter']['path'] = 'node/[nid]';
+    $default_handler->override_option('fields', $fields);
+    // Only show records with published nodes
+    $filters = $view->get_items('filter', 'default');
+    $filters['status'] = array(
+      'operator' => '=',
+      'value' => '1',
+      'group' => '0',
+      'exposed' => FALSE,
+      'expose' => array(
+        'operator' => FALSE,
+        'label' => '',
+      ),
+      'id' => 'status',
+      'table' => 'node',
+      'field' => 'status',
+      'relationship' => 'none',
+    );
+    $default_handler->override_option('filters', $filters);
+  }
   $views[$view->name] = $view;
 
   return $views;