| 
					
				 | 
			
			
				@@ -421,7 +421,8 @@ function tripal_views_views_data(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Add Tripal views Integration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Basically, use tripal_views record to generate the views $data array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $tvi_query = db_query('SELECT * FROM {tripal_views}'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     while($tvi_row = db_fetch_object($tvi_query)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -441,7 +442,10 @@ function tripal_views_views_data(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $base_table = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $base_fields = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $type_prefix = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // indicated whether the current table is a base table or not 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      $is_base_table = $tvi_row->base_table; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // populate the base table name and fields.  If an $mview_id is given 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // then get the materialized view info, otherwise get the Chado table info 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if($mview_id){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -474,7 +478,7 @@ function tripal_views_views_data(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $type_prefix = 'Chado Table'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         $type_prefix = 'Chado'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          $base_table = $tvi_row->table_name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // The chado table could be a regular Chado table or a custom table 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // in the chado database.  Therefore we'll check both 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -499,12 +503,22 @@ function tripal_views_views_data(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // Setup the base table info in the data array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      $data[$base_table]['table']['group'] = t("$type_prefix: $tvi_row->name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      $data[$base_table]['table']['base'] = array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'group' => "$type_prefix: $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'title' => "$type_prefix: $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'help'  => $tvi_row->comment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      $data[$base_table]['table']['group'] = t("$type_prefix $tvi_row->name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if ($is_base_table) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $data[$base_table]['table']['base'] = array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'group' => "$type_prefix $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'title' => "$type_prefix $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'help'  => $tvi_row->comment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $data[$base_table]['table'] = array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'group' => "$type_prefix $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'title' => "$type_prefix $tvi_row->name", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          'help'  => $tvi_row->comment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // first add the fields 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       foreach ($base_fields as $column_name => $base_field){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $data[$base_table][$column_name] = array( 
			 |