ソースを参照

Fixed priority problem on views integration

spficklin 12 年 前
コミット
4c94b1aceb

+ 3 - 6
tripal_contact/tripal_contact.views.inc

@@ -28,11 +28,8 @@ function tripal_contact_views_data()  {
   if (module_exists('tripal_views')) {
 
     // Base Table: contact
-    $tablename = 'contact';
-    
-    // get the setup with the lightest priority. That's the table 
-    // that currently integrated with views.
-    $priority = tripal_views_get_table_lightest_priority($tablename);
+    $tablename = 'contact';    
+    $priority = 9;
       
     // check to see if the table is integrated. If it is then integrate it's
     // corresponding 'chado_[table]' table.
@@ -49,7 +46,7 @@ function tripal_contact_views_data()  {
       'contact_relationship',
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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);

+ 2 - 4
tripal_cv/tripal_cv.views.inc

@@ -40,9 +40,7 @@ function tripal_cv_views_data() {
       'cvterm'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -72,7 +70,7 @@ function tripal_cv_views_data() {
       'cvtermsynonym'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_db/tripal_db.views.inc

@@ -37,9 +37,7 @@ function tripal_db_views_data()  {
       'dbxref'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -60,7 +58,7 @@ function tripal_db_views_data()  {
       'dbxrefprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_feature/tripal_feature.views.inc

@@ -38,9 +38,7 @@ function tripal_feature_views_data()  {
     );
         
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-    	// that currently integrated with views.
-    	$priority = tripal_views_get_table_lightest_priority($tablename);
+    	$priority = 9;
     	
     	// check to see if the table is integrated. If it is then integrate it's
     	// corresponding 'chado_[table]' table.
@@ -84,7 +82,7 @@ function tripal_feature_views_data()  {
       'featurerange'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_genetic/tripal_genetic.views.inc

@@ -30,9 +30,7 @@ function tripal_genetic_views_data()  {
       'phenstatement'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -52,7 +50,7 @@ function tripal_genetic_views_data()  {
       'phenotype_comparison'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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);

+ 2 - 4
tripal_library/tripal_library.views.inc

@@ -35,9 +35,7 @@ function tripal_library_views_data()  {
       'library'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -66,7 +64,7 @@ function tripal_library_views_data()  {
       'libraryprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -30,9 +30,7 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagent'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -73,7 +71,7 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagentprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_organism/tripal_organism.views.inc

@@ -36,9 +36,7 @@ function tripal_organism_views_data()  {
       'organism'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -70,7 +68,7 @@ function tripal_organism_views_data()  {
       'organism_dbxref'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);    	
+    	$priority = 9;    	
       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 - 4
tripal_phenotype/tripal_phenotype.views.inc

@@ -28,9 +28,7 @@ function tripal_phenotype_views_data()  {
       'phenotype'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-	    // that currently integrated with views.
-	    $priority = tripal_views_get_table_lightest_priority($tablename);
+	    $priority = 9;
 	      
 	    // check to see if the table is integrated. If it is then integrate it's
 	    // corresponding 'chado_[table]' table.
@@ -56,7 +54,7 @@ function tripal_phenotype_views_data()  {
       'phenotype_cvterm'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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 - 4
tripal_project/tripal_project.views.inc

@@ -28,9 +28,7 @@ function tripal_project_views_data()  {
       'project'
     );
     foreach ($tables as $tablename) {
-    	// get the setup with the lightest priority. That's the table 
-      // that currently integrated with views.
-      $priority = tripal_views_get_table_lightest_priority($tablename);
+      $priority = 9;
       
       // check to see if the table is integrated. If it is then integrate it's
       // corresponding 'chado_[table]' table.
@@ -53,7 +51,7 @@ function tripal_project_views_data()  {
     $tables = array(
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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);

+ 3 - 5
tripal_stock/tripal_stock.views.inc

@@ -33,9 +33,7 @@ function tripal_stock_views_data()  {
 
   if (module_exists('tripal_views')) {
     $tablename = 'stock';
-    // get the setup with the lightest priority. That's the table 
-    // that currently integrated with views.
-    $priority = tripal_views_get_table_lightest_priority($tablename);
+    $priority = 9;
       
     // check to see if the table is integrated. If it is then integrate it's
     // corresponding 'chado_[table]' table.
@@ -55,7 +53,7 @@ function tripal_stock_views_data()  {
     }
 
     $tablename = 'stockcollection';
-    $priority = tripal_views_get_table_lightest_priority($tablename);     
+    $priority = 9;     
       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);
@@ -74,7 +72,7 @@ function tripal_stock_views_data()  {
       'stockprop_pub'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+    	$priority = 9;     
       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);

+ 10 - 5
tripal_views/api/tripal_views.api.inc

@@ -16,7 +16,8 @@
  *   view or a chado table
  *
  * @return
- *   On success, the setup_id to use for integration of this table; otherwise FALSE
+ *   returns the lowest priority.  If the table has not been integrated, a priority of 10
+ *   is returned.
  */
 function tripal_views_get_table_lightest_priority($table_name) {
 
@@ -26,7 +27,8 @@ function tripal_views_get_table_lightest_priority($table_name) {
     return $setup->priority;
   }
   else {
-    return FALSE;
+  	// default priority is 10
+    return 10;
   }
 }
 
@@ -411,14 +413,17 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
 }
 
 /**
- * Integrate all chado tables in the schema api
+ * Integrate all chado tables in the schema api.  This integration only occurs
+ * once and sets all Chado tables to a priority of 10
  */
 function tripal_views_integrate_all_chado_tables() {
 
   $tables = tripal_core_get_chado_tables(TRUE);
   foreach ($tables as $tablename) {
-    if (!tripal_views_is_integrated($tablename, 10)) {
-      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, 10);
+  
+    $priority = 10;
+    if (!tripal_views_is_integrated($tablename, $priority)) {
+      $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
       if ($table_integration_array) {
         tripal_views_integration_add_entry($table_integration_array);
       }