Browse Source

Fixed priority problem on views integration

spficklin 12 years ago
parent
commit
f5b4d884be

+ 2 - 2
tripal_analysis/tripal_analysis.views.inc

@@ -42,7 +42,7 @@ function tripal_analysis_views_data()  {
     // check to see if the table is integrated. If it is then integrate it's
     // corresponding 'chado_[table]' table.
     if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
       // Make table-specific modifications
       $table_integration_array['fields']['program']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
@@ -68,7 +68,7 @@ function tripal_analysis_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 12 - 4
tripal_contact/tripal_contact.views.inc

@@ -29,8 +29,15 @@ function tripal_contact_views_data()  {
 
     // Base Table: contact
     $tablename = 'contact';
-    if (!tripal_views_is_integrated($tablename, 9)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    
+    // get the setup with the lightest priority. That's the table 
+    // that currently integrated with views.
+    $priority = tripal_views_get_lightest_priority_setup($tablename);
+      
+    // check to see if the table is integrated. If it is then integrate it's
+    // corresponding 'chado_[table]' table.
+    if (!tripal_views_is_integrated($tablename, $priority)) {
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
       $status = tripal_views_integration_add_entry($table_integration_array);
         if (!$status) {
           drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');
@@ -42,8 +49,9 @@ function tripal_contact_views_data()  {
       'contact_relationship',
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         $status = tripal_views_integration_add_entry($table_integration_array);
         if (!$status) {
           drupal_set_message(t('Tripal Contact is unable to integrate %table', array('%table' => $tablename)), 'error');

+ 11 - 4
tripal_cv/tripal_cv.views.inc

@@ -40,9 +40,15 @@ function tripal_cv_views_data() {
       'cvterm'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
+    	// get the setup with the lightest priority. That's the table 
+      // that currently integrated with views.
+      $priority = tripal_views_get_lightest_priority_setup($tablename);
+      
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
+      if (!tripal_views_is_integrated($tablename, $priority)) {
         // get default integration array
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // add specialty handlers
         if ($tablename == 'cvterm') {
@@ -66,8 +72,9 @@ function tripal_cv_views_data() {
       'cvtermsynonym'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 11 - 4
tripal_db/tripal_db.views.inc

@@ -37,8 +37,14 @@ function tripal_db_views_data()  {
       'dbxref'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    	// get the setup with the lightest priority. That's the table 
+      // that currently integrated with views.
+      $priority = tripal_views_get_lightest_priority_setup($tablename);
+      
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // add specialty handlers
         if ($tablename == 'db') {
@@ -54,8 +60,9 @@ function tripal_db_views_data()  {
       'dbxrefprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 2 - 2
tripal_feature/tripal_feature.views.inc

@@ -45,7 +45,7 @@ function tripal_feature_views_data()  {
     	// check to see if the table is integrated. If it is then integrate it's
     	// corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add in node relationships if chado is in the same db as drupal
         if (tripal_core_chado_schema_exists()) {
@@ -86,7 +86,7 @@ function tripal_feature_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 11 - 4
tripal_genetic/tripal_genetic.views.inc

@@ -30,8 +30,14 @@ function tripal_genetic_views_data()  {
       'phenstatement'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    	// get the setup with the lightest priority. That's the table 
+      // that currently integrated with views.
+      $priority = tripal_views_get_lightest_priority_setup($tablename);
+      
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
         $status = tripal_views_integration_add_entry($table_integration_array);
         if (!$status) {
           drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');
@@ -46,8 +52,9 @@ function tripal_genetic_views_data()  {
       'phenotype_comparison'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         $status = tripal_views_integration_add_entry($table_integration_array);
         if (!$status) {
           drupal_set_message(t('Tripal Genetic is unable to integrate %table', array('%table' => $tablename)), 'error');

+ 2 - 2
tripal_library/tripal_library.views.inc

@@ -42,7 +42,7 @@ function tripal_library_views_data()  {
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add in node relationships if chado is in the same db as drupal
         if (tripal_core_chado_schema_exists()) {
@@ -68,7 +68,7 @@ function tripal_library_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 11 - 4
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -30,8 +30,14 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagent'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    	// get the setup with the lightest priority. That's the table 
+      // that currently integrated with views.
+      $priority = tripal_views_get_lightest_priority_setup($tablename);
+      
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add specialty handlers
         switch ($tablename) {
@@ -67,8 +73,9 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagentprop'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 2 - 2
tripal_organism/tripal_organism.views.inc

@@ -43,7 +43,7 @@ function tripal_organism_views_data()  {
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add specialty handlers
         $table_integration_array['fields']['common_name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string';
@@ -72,7 +72,7 @@ function tripal_organism_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);    	
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 11 - 4
tripal_phenotype/tripal_phenotype.views.inc

@@ -28,8 +28,14 @@ function tripal_phenotype_views_data()  {
       'phenotype'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    	// get the setup with the lightest priority. That's the table 
+	    // that currently integrated with views.
+	    $priority = tripal_views_get_lightest_priority_setup($tablename);
+	      
+	    // check to see if the table is integrated. If it is then integrate it's
+	    // corresponding 'chado_[table]' table.
+	    if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add specialty handlers
         switch ($tablename) {
@@ -50,8 +56,9 @@ function tripal_phenotype_views_data()  {
       'phenotype_cvterm'
     );
     foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 9)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+    	$priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 2 - 2
tripal_project/tripal_project.views.inc

@@ -35,7 +35,7 @@ function tripal_project_views_data()  {
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add in node relationships if chado is in the same db as drupal
         if (tripal_core_chado_schema_exists()) {
@@ -55,7 +55,7 @@ function tripal_project_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }

+ 5 - 4
tripal_stock/tripal_stock.views.inc

@@ -40,7 +40,7 @@ function tripal_stock_views_data()  {
     // check to see if the table is integrated. If it is then integrate it's
     // corresponding 'chado_[table]' table.
     if (!tripal_views_is_integrated($tablename, $priority)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
       // Add in node relationships if chado is in the same db as drupal
       if (tripal_core_chado_schema_exists()) {
@@ -55,8 +55,9 @@ function tripal_stock_views_data()  {
     }
 
     $tablename = 'stockcollection';
-    if (!tripal_views_is_integrated($tablename, 9)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
+    $priority = tripal_views_get_lightest_priority_setup($tablename);     
+      if (!tripal_views_is_integrated($tablename, $priority)) {
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
       tripal_views_integration_add_entry($table_integration_array);
     }
 
@@ -75,7 +76,7 @@ function tripal_stock_views_data()  {
     foreach ($tables as $tablename) {
     	$priority = tripal_views_get_lightest_priority_setup($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }