Parcourir la source

Moved Views Integration to the tripal core and removed the views integration module

spficklin il y a 13 ans
Parent
commit
189d2d2171

+ 9 - 9
base/tripal_core/mviews.php

@@ -179,7 +179,7 @@ function tripal_mview_report ($mview_id) {
    // create a table with each row containig stats for
    // an individual job in the results set.
 
-   $return_url = url("admin/tripal/tripal_mviews/");
+   $return_url = url("admin/tripal/views/mviews/");
 
    $output .= "<p><a href=\"$return_url\">Return to table of materialized views.</a></p>";
    $output .= "<br />";
@@ -240,9 +240,9 @@ function tripal_mview_report ($mview_id) {
 
    // build the URLs using the url function so we can handle installations where
    // clean URLs are or are not used
-   $update_url = url("admin/tripal/tripal_mviews/action/update/$mview->mview_id");
-   $delete_url = url("admin/tripal/tripal_mviews/action/delete/$mview->mview_id");
-   $edit_url = url("admin/tripal/tripal_mviews/edit/$mview->mview_id");
+   $update_url = url("admin/tripal/views/mviews/action/update/$mview->mview_id");
+   $delete_url = url("admin/tripal/views/mviews/action/delete/$mview->mview_id");
+   $edit_url = url("admin/tripal/views/mviews/edit/$mview->mview_id");
 
    $output .= "<tr><th>Actions</th>".
               "<td> <a href='$update_url'>Update</a>, ".
@@ -279,9 +279,9 @@ function tripal_mviews_report () {
       }
 	  // build the URLs using the url function so we can handle installations where
 	  // clean URLs are or are not used
-	  $view_url = url("admin/tripal/tripal_mview/$mview->mview_id");
-	  $update_url = url("admin/tripal/tripal_mviews/action/update/$mview->mview_id");
-	  $delete_url = url("admin/tripal/tripal_mviews/action/delete/$mview->mview_id");
+	  $view_url   = url("admin/tripal/views/mviews/report/$mview->mview_id");
+	  $update_url = url("admin/tripal/views/mviews/action/update/$mview->mview_id");
+	  $delete_url = url("admin/tripal/views/mviews/action/delete/$mview->mview_id");
 	  // create the row for the table
       $output .= "  <tr>";
       $output .= "    <td><a href='$view_url'>View</a>&nbsp".
@@ -291,7 +291,7 @@ function tripal_mviews_report () {
                  "    <td><a href='$delete_url'>Delete</a></td>".
                  "  </tr>";
    }
-   $new_url = url("admin/tripal/tripal_mviews/new");
+   $new_url = url("admin/tripal/views/mviews/new");
    $output .= "</table>";
    $output .= "<br />";
    $output .= "<p><a href=\"$new_url\">Create a new materialized view.</a></p>";
@@ -411,7 +411,7 @@ function tripal_mviews_form(&$form_state = NULL,$mview_id = NULL){
      '#executes_submit_callback' => TRUE,
    );
 
-   $form['#redirect'] = 'admin/tripal/tripal_mviews';
+   $form['#redirect'] = 'admin/tripal/views/mviews';
    return $form;
 }
 /**

+ 2 - 0
base/tripal_core/tripal_core.info

@@ -5,3 +5,5 @@ core = 6.x
 project = tripal_core
 package = Tripal
 version = 6.x-0.3.1b
+
+dependencies = views

+ 135 - 0
base/tripal_core/tripal_core.install

@@ -100,6 +100,141 @@ function tripal_core_get_schemas (){
       'primary key' => array('mview_id'),
   );
 
+	$schema['tripal_views_integration'] = array(
+		'description' => 'contains the setupes, their materialized view id and base table name that was used.',
+		'fields' => array(
+			'setup_id' => array(
+				'description' => 'the id of the setup',
+				'type' => 'serial',
+				'unsigned' => TRUE,
+				'not null' => TRUE,
+			),
+			'mview_id' => array(
+				'description' => 'the materialized view used for this setup',
+				'type' => 'int',
+				'unsigned' => TRUE,
+			),
+			'chado_table_name' => array(
+				'description' => 'the base table name to be used when using this setup',
+				'type' => 'varchar',
+				'length' => 255,
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'name' => array(
+				'description' => 'Human readable name of this setup',
+				'type' => 'varchar',
+				'length' => 255,
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'description' => array(
+				'description' => 'description of this row',
+				'type' => 'varchar',
+				'length' => 255,
+				'not null' => TRUE,
+				'default' => '',
+			),
+		),
+		'unique_keys' => array(
+			'setup_id' => array('setup_id'),
+		),
+		'primary key' => array('setup_id'),
+	);
+
+	$schema['tripal_mviews_join'] = array(
+		'description' => 'which materialzed views and chado tables to join in a given setup',
+		'fields' => array(
+		  'mview_join_id' => array(
+				'description' => 'the id of the join',
+					'type' => 'serial',
+					'unsigned' => TRUE,
+					'not null' => TRUE,
+		  ),
+			'setup_id' => array(
+				'description' => 'tripal setup id from tripal_views_integration table',
+				'type' => 'int',
+				'unsigned' => TRUE,
+				'not null'=> TRUE,
+			),
+			'view_table' => array(
+					'description' => 'materialized view table name',
+					'type' => 'varchar',
+					'length' => '255',
+					'not null' => TRUE,
+					'default' => '',
+	    ),
+			'view_column' => array(
+				'description' => 'column of materialized view table (mview_table)',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'chado_table_join' => array(
+				'description' => 'on which chado table to join to materialized view in this serach',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'chado_column' => array(
+				'description' => 'chado table (above) column to join on materialized view in this serach',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+	    ),
+		),
+		'unique_keys' => array(
+			'setup_id' => array('mview_join_id'),
+		),
+		'primary key' => array('mview_join_id'),
+	);
+
+	$schema['tripal_views_handlers'] = array(
+		'description' => 'in formation for views: column and views handler name',
+		'fields' => array(
+			'handler_id' => array(
+				'description' => 'the id of the handler',
+					'type' => 'serial',
+					'unsigned' => TRUE,
+					'not null' => TRUE,
+	    ),
+			'setup_id' => array(
+				'description' => 'which setup this is used by from tripal_views_integration table',
+					'type' => 'int',
+					'unsigned' => TRUE,
+					'not null'=> TRUE,
+			),
+			'column_name' => array(
+				'description' => '',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'handler_filter' => array(
+				'description' => 'identifier of the handler filter to be used for this column',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+			),
+			'handler_field' => array(
+				'description' => 'identifier of the handler field to be used for this column',
+				'type' => 'varchar',
+				'length' => '255',
+				'not null' => TRUE,
+				'default' => '',
+	    ),
+		),
+		'unique_keys' => array(
+				'setup_id' => array('handler_id'),
+	  ),
+		'primary key' => array('handler_id'),
+	);
+	return $schema;
   return $schema;
 }
 ?>

+ 93 - 30
base/tripal_core/tripal_core.module

@@ -4,6 +4,7 @@ require_once "jobs.php";
 require_once "mviews.php";
 require_once "cvterms.php";
 require_once "chado_install.php";
+require_once "tripal_views_integration.inc";
 
 require_once "tripal_core.api.inc";
 
@@ -85,7 +86,6 @@ function tripal_core_menu() {
       'file' => 'system.admin.inc',
       'file path' => drupal_get_path('module', 'system'),
    );
-
    $items['admin/tripal/tripal_jobs'] = array(
      'title' => 'Jobs',
      'description' => 'Jobs managed by Tripal',
@@ -117,66 +117,124 @@ function tripal_core_menu() {
      'access arguments' => array('access administration pages'),
      'type' => MENU_CALLBACK,
    );
-   $items['admin/tripal/tripal_mview/%'] = array(
-     'title' => 'Materialized View',
-     'description' => 'Materialized views are used to improve speed of large or complex queries.',
-     'page callback' => 'tripal_mview_report',
-     'page arguments' => array(3),
+   $items['tripal_toggle_box_menu/%/%/%'] = array(
+     'title' => t('Libraries'),
+     'page callback' => 'tripal_toggle_box_menu',
+     'page arguments' => array(1,2,3),
      'access arguments' => array('access administration pages'),
+     'type' => MENU_CALLBACK | MENU_LINKS_TO_PARENT 
+   );
+   $items['admin/tripal/chado_1_11_install'] = array(
+     'title' => 'Install Chado v1.11',
+     'description' => 'Installs Chado version 1.11 inside the current Drupal database',
+     'page callback' => 'drupal_get_form',
+     'page arguments' => array('tripal_core_chado_v1_11_load_form'),
+     'access arguments' => array('access administration pages'),
+     'type' => MENU_NORMAL_ITEM,
+   );
+
+   $items['admin/tripal/views'] = array(
+     'title' => t('Views'),
+     'description' => 'Management of Materialized Views & Integration with Drupal Views',
+     'page callback' => 'tripal_core_views_description_page',
+     'access arguments' => array('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
-   $items['admin/tripal/tripal_mviews'] = array(
-     'title' => 'Materialized Views',
+   $items['admin/tripal/views/mviews'] = array(
+     'title' => 'MViews',
      'description' => 'Materialized views are used to improve speed of large or complex queries.',
      'page callback' => 'tripal_mviews_report',
      'access arguments' => array('access administration pages'),
      'type' => MENU_NORMAL_ITEM,
    );
-   $items['admin/tripal/tripal_mviews/new'] = array(
-     'title' => 'Create View',
+   $items['admin/tripal/views/mviews/report/%'] = array(
+     'title' => 'Materialized View',
+     'description' => 'Materialized views are used to improve speed of large or complex queries.',
+     'page callback' => 'tripal_mview_report',
+     'page arguments' => array(5),
+     'access arguments' => array('access administration pages'),
+     'type' => MENU_NORMAL_ITEM,
+   );
+   $items['admin/tripal/views/mviews/new'] = array(
+     'title' => 'Create MView',
      'description' => 'Materialized views are used to improve speed of large or complex queries.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('tripal_mviews_form'),
      'access arguments' => array('access administration pages'),
      'type' => MENU_NORMAL_ITEM,
    );
-   $items['admin/tripal/tripal_mviews/edit/%'] = array(
-     'title' => 'Edit View',
+   $items['admin/tripal/views/mviews/edit/%'] = array(
+     'title' => 'Edit MView',
      'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_mviews_form',4),
+     'page arguments' => array('tripal_mviews_form',5),
      'access arguments' => array('access administration pages'),
      'type' => MENU_NORMAL_ITEM,
    );
-   $items['admin/tripal/tripal_mviews/action/%/%'] = array(
-     'title' => 'Create View',
+   $items['admin/tripal/views/mviews/action/%/%'] = array(
+     'title' => 'Create MView',
      'description' => 'Materialized views are used to improve speed of large or complex queries.',
      'page callback' => 'tripal_mviews_action',
-     'page arguments' => array(4,5),
+     'page arguments' => array(5,6),
      'access arguments' => array('access administration pages'),
      'type' => MENU_CALLBACK,
    );
+	$items['admin/tripal/views/integration'] = array(
+    'title' => t('Drupal Views Integration'),
+    'description' => t('Allows you to select existing materialized views and provide details for integration with Drupal Views.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_core_views_integration_admin_form'),
+    'access arguments' => array('manage tripal_views_integration'),
+    'type' => MENU_NORMAL_ITEM,
+	);
+	$items['admin/tripal/views/integration/mviews'] = array(
+    'title' => t('Integrated MViews'),
+    'description' => t('Allows you to select existing materialized views and provide details for integration with Drupal Views.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_core_views_integration_admin_form'),
+    'access arguments' => array('manage tripal_views_integration'),
+    'type' => MENU_NORMAL_ITEM,
+	);
 
-   $items['tripal_toggle_box_menu/%/%/%'] = array(
-     'title' => t('Libraries'),
-     'page callback' => 'tripal_toggle_box_menu',
-     'page arguments' => array(1,2,3),
-     'access arguments' => array('access administration pages'),
-     'type' => MENU_CALLBACK | MENU_LINKS_TO_PARENT 
-   );
-   $items['admin/tripal/chado_1_11_install'] = array(
-     'title' => 'Install Chado v1.11',
-     'description' => 'Installs Chado version 1.11 inside the current Drupal database',
+	//page to actually create setup->mview->chado table relationships
+	$items['admin/tripal/views/integration/mviews/new'] = array(
+     'title' => 'Add an MView',
      'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_core_chado_v1_11_load_form'),
-     'access arguments' => array('access administration pages'),
+     'page arguments' => array('tripal_core_views_integration_new_setup_form'),
+     'access arguments' => array('manage tripal_views_integration'), //TODO: figure out the proper permissions arguments
      'type' => MENU_NORMAL_ITEM,
-   );
+	);
 
+	$items['admin/tripal/views/integration/chado'] = array(
+    'title' => t('Integrated Chado Table'),
+    'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_core_views_integration_admin_form'),
+    'access arguments' => array('manage tripal_views_integration'),
+    'type' => MENU_NORMAL_ITEM,
+	);
+	$items['admin/tripal/views/integration/chado/new'] = array(
+     'title' => 'Add a Chado table',
+     'page callback' => 'drupal_get_form',
+     'page arguments' => array('tripal_core_views_integration_new_setup_form'),
+     'access arguments' => array('manage tripal_views_integration'), //TODO: figure out the proper permissions arguments
+     'type' => MENU_NORMAL_ITEM,
+	);
   return $items;
 }
 
 
-
+/**
+ *  Set the permission types that the chado module uses.  Essentially we
+ *  want permissionis that protect creation, editing and deleting of chado
+ *  data objects
+ *
+ * @ingroup tripal_core
+ */
+function tripal_core_perm(){
+   return array(
+      'manage tripal_views_integration',
+   );
+}
 /**
  *
  *
@@ -233,6 +291,10 @@ function tripal_core_theme () {
          'arguments' => array('job_id'=> null),
          'template' => 'tripal_core_job_view',
       ),
+	  'tripal_views_integration_new_setup_form' => array(
+         'arguments' => array('form' => NULL),
+         'template'  => 'tripal_views_integration_fields_form',
+	   ),
    );
 }
 /**
@@ -258,3 +320,4 @@ function tripal_core_load_gff3($gff_file, $organism_id,$analysis_id,$add_only =0
    tripal_feature_load_gff3($gff_file, $organism_id,$analysis_id,$add_only, 
       $update, $refresh, $remove, $job);
 }
+

+ 141 - 1
base/tripal_core/tripal_core.views.inc

@@ -280,4 +280,144 @@ function tripal_core_add_node_ids_to_view (&$view) {
 	} //end of case for stock NID
 		
 	return $view;
-}
+}
+/**
+ *
+ * @ingroup tripal_core
+ */
+
+function tripal_core_views_data(){   
+
+    $tvi_query = db_query('SELECT * FROM tripal_views_integration');
+
+    //tvi = tripal_views_integration
+    while($tvi_row = db_fetch_object($tvi_query)){
+
+      //ids we'll use for queries
+      $setup_id = $tvi_row->setup_id;
+      $mview_id = $tvi_row->mview_id;
+
+      //let's get the name of the table
+      $mview_table = db_fetch_object(db_query("SELECT name, mv_specs FROM {tripal_mviews} WHERE mview_id = '$mview_id';"));
+
+      //use name from above and description from $tvi_row
+      $data[$mview_table->name]['table']['group'] = t('Mview ' . $tvi_row->name);
+      $data[$mview_table->name]['table']['base'] = array(
+        'group' => t($tvi_row->name),
+        'title' => t($tvi_row->name),
+        'help'  => t($tvi_row->description),
+      );
+
+      //let's add fields
+      //tmj = tripal_mviews_join
+      $tmj_query = db_query("SELECT * FROM tripal_mviews_join WHERE setup_id = '$setup_id'");
+      while($tmj_row = db_fetch_object($tmj_query)){
+
+        $column_name = $tmj_row->view_column;
+        $handlers = db_fetch_object(db_query("SELECT handler_filter, handler_field FROM {tripal_views_handlers} WHERE setup_id = '$setup_id' AND column_name = '$column_name';"));
+        //handlers would be used $handlers->handler_filter, $handlers->handler_field etc, thuogh may need to include new ones in this query or do select *
+
+        //let's use handlers we retrieved from above
+        $data[$mview_table->name][$tmj_row->view_column] = array(
+           'title' => t($tmj_row->view_column),
+           'help' => t("**"),
+           'field' => array(
+              'handler' => 'views_handler_field',
+              'click sortable' => TRUE,
+           ),
+           'sort' => array(
+              'handler' => 'views_handler_sort',
+           ),
+           'filter' => array(
+              'handler' => 'views_handler_filter_string',
+           ),
+           'argument' => array(
+              'handler' => 'views_handler_argument_string',
+           ),
+        );
+               
+        $chado_join_table = $tmj_row->chado_table_join;
+        $chado_join_column = $tmj_row->chado_column;
+        $mview_join_column = $tmj_row->view_column;
+        
+        // add recipricol join entries
+        $data["$mview_table->name"]['table']['join']["$chado_join_table"] = array(
+          'left_field' => $chado_join_column,
+          'field' => $mview_join_column,
+        );
+
+        // check to see if this table is one that correlates with Drupal nodes
+        // if so, there will be a chado_<table_name> table in the Drupal database
+        // if there is, then we need to add the linking join information
+        $sql = "SELECT tablename FROM pg_tables WHERE tablename = 'chado_$chado_join_table'";
+        if(db_fetch_object(db_query($sql))){
+
+           // join the mview to the linker table
+           $data["$mview_table->name"]['table']['join']["chado_$chado_join_table"] = array(
+             'left_field' => $chado_join_column,
+             'field' => $mview_join_column,
+           );
+        }
+      }
+    }
+
+    return $data;
+}
+/**
+ *
+ * @ingroup tripal_core
+ */
+function tripal_core_views_data_alter(&$data) {
+    $tvi_query = db_query('SELECT * FROM tripal_views_integration');
+
+    //tvi = tripal_views_integration
+    while($tvi_row = db_fetch_object($tvi_query)){
+
+      //ids we'll use for queries
+      $mview_id = $tvi_row->mview_id;
+      $setup_id = $tvi_row->setup_id;
+
+      //let's get the name of the table
+      $mview_table = db_fetch_object(db_query("SELECT name, mv_specs FROM {tripal_mviews} WHERE mview_id = '$mview_id';"));
+
+      // iterate through the columns and alter the existing data array for
+      // joins to other tables
+      $tmj_query = db_query("SELECT * FROM tripal_mviews_join WHERE setup_id = '$setup_id'");
+      while($tmj_row = db_fetch_object($tmj_query)){
+        
+        $chado_join_table = $tmj_row->chado_table_join;
+        $chado_join_column = $tmj_row->chado_column;
+        $mview_join_column = $tmj_row->view_column;      
+ 
+        // add the recipricol join entries for each column
+        $data["$chado_join_table"]['table']['join']["$mview_table->name"] = array(
+          'left_field' => $mview_join_column,
+          'field' => $chado_join_column,
+        );
+
+        // check to see if this table is one that correlates with Drupal nodes
+        // if so, there will be a chado_<table_name> table in the Drupal database
+        // if there is, then we need to add the linking join information.  We did
+        // this step in the hook_views_data function above, but now we need 
+        // to add the reciprical joins
+        $sql = "SELECT tablename FROM pg_tables WHERE tablename = 'chado_$chado_join_table'";
+        if(db_fetch_object(db_query($sql))){
+
+           // join the linker table to the mview
+           $data["chado_$chado_join_table"]['table']['join']["$mview_table->name"] = array(
+             'left_field' => $mview_join_column,
+             'field' => $chado_join_column,
+           );
+
+           // Join the node table to the view by way of the chado linker table
+           $data['node']['table']['join']["$mview_table->name"] = array(
+           	'left_table' => "chado_$chado_join_table",
+           	'left_field' => 'nid',
+           	'field' => 'nid',
+           );
+        }
+      }
+    }
+
+    return $data;
+}

+ 0 - 20
base/tripal_views_integration/README.patches.txt

@@ -1,20 +0,0 @@
-This README lists all patches that were used in developement of tripal_views_integration.
-
-------------------------------------------------------
-These are the patches needed to ahah_helper module:
-Submit issue reported and solved here:
-http://drupal.org/node/1231140
-The original patch location:
-http://drupal.org/files/issues/1231140.ahah_helper.form-submit-handler.patch
-The patch file alexgl used:
-patches/1231140.ahah_helper.form-submit-handler.patch
-Usage:
-1. Find the global or local path to this module and substitue in the command below for*path_to_tripal_views_integration*
-2. Navigate to the folder of contrib module ahah_helper and run:
-ahah_helper$ patch -p1 < *path_to_tripal_views_integration*/patches/1231140.ahah_helper.form-submit-handler.patch
-
-(alternatively you can just copy the patch file to the ahah_helper folder and run the command without *path_to_tripal_views_integration*)
-NOTE: we have to use patch -p1 command, since this is a git patch, and the ahah_helper folder most likely will not be
-	git inintialized. -p0 will not work. If folder is not git initialized then 'git apply -v *patchname*' will do nothing.
------------------------------------------------------
-

+ 0 - 388
base/tripal_views_integration/includes/tripal_views_integration.admin.inc

@@ -1,388 +0,0 @@
-<?php
-/**
- * Purpose: Provide Guidance to new Tripal Admin
- *
- * @return
- *   HTML Formatted text
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_module_description_page() {
-
-  $text .= '<h3>Tripal Views Integration Administrative Tools Quick Links:</h3>';
-  $text .= "<ul>
-             <li><a href=\"".url("admin/tripal/tripal_views_integration/list") . "\">List of integrated views</a></li>
-             <li><a href=\"".url("admin/tripal/tripal_views_integration/new"). "\">Setup integration of a materialized view</a></li>
-           </ul>";
-  #             <li><a href=\"".url("admin/tripal/tripal_feature/aggregate"). "\">Feature Relationship Aggegators</a></li>
-
-  $text .= '<h3>Module Description:</h3>';
-  $text .= '<p>This module provides an interface for integrating <a href="http://drupal.org/project/views">Drupal Views</a>
-            with Tripal materialized views.  This will allow site administrators to create custom queries for the materialized views
-            and in turn provide custom content pages, custom blocks and custom search forms. The forms allow a site administrator
-            to select a materialized view and associate other Chado tables on which the view can join.  Usage of this module requires
-            a good understanding of foreign-key relationships in Chado.
-            </p>';
-
-  $text .= '<h3>Setup Instructions:</h3>';
-  $text .= '<p>After installation of the feature module.  The following tasks should be performed
-            <ol>
-              <li><b>Install Drupal Views</b>: The <a href="http://drupal.org/project/views">Drupal Views</a> module
-                must first be installed before this module can be used.  If you are reading this page then you must have
-                Drupal Views installed</li>
-              <li><b>Set Permissions</b>: To allow access to site administrators for this module, simply
-               <a href="'.url('admin/user/permissions').'">assign permissions</a> to the appropriate user roles for the
-               permission type "manage tripal_views_integration". </li>
-            </ol>
-            </p>';
-  $text .= '<h3>Usage Instructions:</h3>';
-  $text .= "<p>To use this module follow these steps:
-            <ol>
-               <li><b>Identify or create a materialized view:</b> Using the <a href=\"".url("admin/tripal/tripal_mviews") . "\">
-                 Tripal materialized View</a> interface, identify the view you would like to integrate or create a new one.</li>
-               <li><b>Setup the Views Integration</b>: Navigate to the <a href=\"".url("admin/tripal/tripal_views_integration/new") . "\">
-                 Tripal views integration setup page</a> to integrate the selected materialized view.  Provide a  user friendly name
-                 and description to help you remember the purpose for integrating the view.  Next, select the view you want to integrate
-                 from the provided select box.  If your materialized view has fields that can join with other Chado tables, you may
-                 provide those relationships in the provided form.  Finally, if your fields require a special handler for display, you
-                 may select it from the drop down provided</li>
-               <li><b>Create custom pages/block/search form</b>:  After saving setup information from step 2 above, you will be redirected to the
-                 Drupal Views interface</a> where you can create a custom page, block or search form.</li>
-               <li><b>Review your integrated views</b>:  A page providing a
-                 <a href=\"".url("admin/tripal/tripal_views_integration/list") . "\">list of all integrated views</a> is provided. You may
-                 view this page to see all integrated views, but also to remove any unwanted integrations.</li>
-            </ol>
-         
-            </p>";
-  $text .= '<h3>Features of this Module:</h3>';
-  $text .= '<p>This module provides the following functionality
-            <ul>
-              <li>A dynamic form for integration of an existing materialized view with Drupal Views.  This form allows the site
-                  administrator to select an existing view and indicate Chado tables on which the fields may join.</li>
-            </ul>
-            
-            </p>';
-  return $text;
-}
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_admin_form(){
-
-  $form = array();
-
-  $form['#theme'] = 'tripal';
-
-  $query_results = db_query('SELECT * FROM public.tripal_views_integration;');
-
-  $header = array('Setup ID', 'Name', 'Materialized View ID', 'Base Table Name', 'Description');
-  $rows = array();
-
-  $results = array();
-  while($result = db_fetch_object($query_results)){
-    $rows[] = array($result->setup_id, $result->name, $result->mview_id, $result->base_table_name, $result->description,);
-    $results[] = $result;
-  }
-
-  $options = array();
-  foreach ($results as $key => $value) {
-    if(!empty($value))
-    $options[] = $value->setup_id;// . ' | ' . $value->name . ' | ' . $value->mview_id . ' | ' . $value->base_table_name;
-  }
-
-  $form['existing_rows'] = array(
-    '#type' => 'select',
-    '#options' => $options,
-    '#description' => '<strong>Select a View Setup to delete from the database.</strong>',
-    '#prefix' => theme('table', $header, $rows),
-  );
-
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Remove'),
-  );
-
-  $form['cancel'] = array(
-    '#type' => 'markup',
-    '#value' => l(t('Cancel '), 'admin/tripal/'),
-  );
-
-  $form['new'] = array(
-    '#type' => 'markup',
-    '#value' => l(t(' New'), 'admin/tripal/tripal_views_integration/new'),
-  );
-
-  return $form;
-}
-
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_admin_form_submit($form, &$form_state){
-  $value = $form['existing_rows']['#options'][$form_state['values']['existing_rows']];
-  db_query("DELETE FROM public.tripal_views_integration WHERE setup_id = $value;");
-  db_query("DELETE FROM public.tripal_views_handlers WHERE setup_id = $value;");
-  db_query("DELETE FROM public.tripal_mviews_join WHERE setup_id = $value;");
-}
-/**
- *
- * @ingroup tripal_views_integration
- */
-
-function tripal_views_integration_new_setup_form(&$form_state){
-
-  $form = array();
-
-  $data = array();
-
-  $form['#cache'] = TRUE;
-
-  //ahah_helper requires this to register the form with it's module
-  ahah_helper_register($form, $form_state);
-
-  // field for the name of the
-  $form['row_name'] = array(
-    '#title' => t('Name'),
-    '#type' => 'textfield',
-    '#size' => 60,
-    '#maxlength' => 128,
-    '#description' => 'Name of the Views Setup',
-    '#required' => TRUE,
-  );
-
-  $form['row_description'] = array(
-    '#title' => t('Description'),
-    '#type' => 'textfield',
-    '#size' => 60,
-    '#maxlength' => 255,
-    '#description' => 'Briefly describe in which view this will be used',
-    '#required' => TRUE,
-  );
-
-  $mview_query = db_query("SELECT mview_id,name FROM {tripal_mviews} ORDER BY name;");
-  $mview_options = array();
-  $mview_options['0'] = 'Select';
-  while ($mview_option = db_fetch_array($mview_query)){
-    $mview_options[$mview_option['mview_id']] = $mview_option['name'];
-  }
-
-  $form['mview_id'] = array(
-    '#title' => t('Materialized View'),
-    '#type' => 'select',
-    '#options' => $mview_options,
-    '#description' => 'Which materialized view to use.',
-    '#required' => TRUE,
-    '#default_value' => $mview_default_value,
-    '#ahah' => array(
-       'path' => ahah_helper_path(array('view_setup_table')),
-       'wrapper' => 'table-rows-div',
-       'effect' => 'fade',
-       'event' => 'change',
-       'method' => 'replace',
-  ),
-  );
-
-  // ignore this for now... we'll come back to it later -- spf
-  //   $form['row_base_table_name'] = array(
-  //      '#title' => t('Base Table Name'),
-  //      '#type' => 'select',
-  //      // '#options' => array('stub'),
-  //      '#options' => tripal_core_get_chado_tables(),
-  //      '#description' => 'Select which chado table to use for this view.',
-  //      '#required' => TRUE,
-  //   );
-
-  $form['view_setup_table'] = array(
-     '#type' => 'item',
-       '#prefix' => '<div id="table-rows-div">',
-       '#suffix' => '</div>',
-  );
-
-
-  if ($form_state['storage']['mview_id']){
-
-    $mview_id = $form_state['storage']['mview_id'];
-
-    $form['view_setup_table'] = array(
-     '#type' => 'fieldset',
-     '#title' => 'Join Selection',
-     '#prefix' => '<div id="fieldset-table-rows-wrapper">',
-     '#suffix' => '</div>',
-    );
-
-    // get the columns in this materialized view.  They are separated by commas
-    // where the first word is the column name and the rest is the type
-    $sql = "SELECT mv_specs FROM {tripal_mviews} WHERE mview_id = $mview_id";
-    $mview = db_fetch_object(db_query($sql));
-    $columns = explode(",",$mview->mv_specs);
-
-    $i=1;
-    $chado_tables = tripal_core_get_chado_tables();
-    $chado_tables = array_merge(array('',), $chado_tables);
-
-    $handlers_filters = array('', 'hello' , 'world');
-    $handlers_fields = array('', 'foo', 'bar');
-    $form['view_setup_table']["instructions"] = array(
-         '#type' => 'markup',
-         '#value' => "Select an optional table to which the fields of the materialized view can join.  If a field does not need to join you may leave the selection blank.",
-    );
-    $form['view_setup_table']["fields_headers"] = array(
-         '#type' => 'markup',
-         '#value' => "<div class=\"field-headers\">".
-              "<div class=\"column-id\">Field Name and Type</div>".
-              "<div class=\"fields-column-join\">Join Table</div>".
-              "<div class=\"fields-column-join-column\">Join Column</div>".
-              "<div class=\"fields-filter-handler\">Filter Handler</div>".
-              "<div class=\"fields-field-handler\">Field Handler</div></div>",
-    );
-
-    $data['field_types'] = array();
-
-    foreach ($columns as $column){
-      $column = trim($column);  // trim trailing and leading spaces
-      preg_match("/^(.*?)\ (.*?)$/",$column,$matches);
-      $column_name = $matches[1];
-      $column_type = $matches[2];
-
-      $form['view_setup_table']["fields_start_$mview_id-$i"] = array(
-           '#type' => 'markup',
-           '#value' => "<div class=\"fields-new-row\">",
-      );
-
-      $form['view_setup_table']["fields_name_$mview_id-$i"] = array(
-        '#type' => 'markup',
-        '#attributes' => array('class' => 'fields-column-name'),
-        '#value' => "<div class=\"column-id\"><span class=\"column-name\">$column_name</span>".
-                   "<br><span class=\"column-type\">$column_type</span></div>",
-      );
-
-      $data['field_types'][$column_name] = $column_type;
-
-      $table = $form_state['storage']["fields_join_$mview_id-$i"];
-      $form['view_setup_table']["fields_join_$mview_id-$i"] = array(
-        '#type' => 'select',
-        '#prefix' => "<div class=\"fields-column-join\">",
-        '#suffix' => "</div>",
-        '#options' => $chado_tables,
-        '#required' => FALSE,
-        '#default_value' => $table,
-        '#ahah' => array(
-           'path' => ahah_helper_path(array("view_setup_table","fields_join_column_$mview_id-$i")),
-           'wrapper' => "fields-column-join-column-$mview_id-$i",
-           'effect' => 'fade',
-           'event' => 'change',
-           'method' => 'replace',
-      ),
-      );
-      if($table){
-        $table_desc = module_invoke_all('chado_'.$table.'_schema');
-        $columns = array_keys($table_desc['fields']);
-      } else {
-        $columns = array();
-      }
-      $form['view_setup_table']["fields_join_column_$mview_id-$i"] = array(
-        '#type' => 'select',
-        '#prefix' => "<div id=\"fields-column-join-column-$mview_id-$i\" class=\"fields-column-join-column\">",
-        '#suffix' => "</div>",
-        '#options' => $columns,
-        '#required' => FALSE,
-      );
-      
-      $form['view_setup_table']["fields_filter_handler_$mview_id-$i"] = array(
-        '#type' => 'select',
-        '#prefix' => "<div class=\"fields-filter-handler\">",
-        '#suffix' => "</div>",
-        '#options' => $handlers_filters,
-        '#required' => FALSE,
-      );
-      
-      $form['view_setup_table']["fields_field_handler_$mview_id-$i"] = array(
-         '#type' => 'select',
-         '#prefix' => "<div class=\"fields-field-handler\">",
-         '#suffix' => "</div>",
-         '#options' => $handlers_fields,
-         '#required' => FALSE,
-      );
-      
-      $form['view_setup_table']["fields_end_$i"] = array(
-        '#type' => 'markup',
-        '#value' => "</div>",
-      );
-      $i++;
-   }
-   $form['view_setup_table']['save'] = array(
-      '#type'  => 'submit',
-      '#value' => t('Save'),
-   );
-
-    $data['row_count'] = $i - 1;
-  }
-
-  //use this to put values into $form_state['values']
-  $form['data'] = array();
-
-  //need to find out if storing $form['data'][$key]['#value'] = $value <- is an issue
-  //since it will give me errors if i try to stare an array instead of $value
-  //and yet $value can be an array ie "field_types"
-  foreach ($data as $key => $value) {
-    $form['data'][$key] = array(
-    	'#type' => 'hidden',
-    	'#value' => $value,
-    );
-  }
-
-  return $form;
-}
-
-
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_new_setup_form_validate($form, &$form_state){
-  $name_array = explode(" ", $form_state['values']['row_name']);
-  if(count($name_array) > 1){
-    form_set_error($form_state['values']['row_name'], 'Name must be ONE word only.');
-  }
-  //TODO: write validation function for this new form
-}
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_new_setup_form_submit($form, &$form_state){
-  $name = $form_state['values']['row_name'];
-  $mview_id = $form_state['values']['mview_id'];
-  $tripal_views_integration_record = array(
-    'mview_id' => $mview_id,
-    'name' => $name,
-  	'description' => $form_state['values']['row_description'],
-  );
-
-  drupal_write_record('tripal_views_integration', $tripal_views_integration_record);
-
-  $i = 1;
-  foreach ($form_state['values']['field_types'] as $key => $value){
-    $mview_join_record = array(
-        'setup_id' => $tripal_views_integration_record['setup_id'],
-        'view_table' => $form['mview_id']['#options'][$form_state['values']['mview_id']],
-        'view_column' => $key,
-        'chado_table_join' => $form_state['values']["fields_join_$mview_id-$i"],
-        'chado_column' => $form['view_setup_table']["fields_join_column_$mview_id-$i"]['#options'][$form_state['values']["fields_join_column_$mview_id-$i"]],
-    );
-    drupal_write_record('tripal_mviews_join', $mview_join_record);
-    
-    $handlers_record = array(
-      'setup_id' => $tripal_views_integration_record['setup_id'],
-      'column_name' => $key,//TODO: should we change this to an mview_join_id from tripal_view_join?
-      'handler_filter' => $form['view_setup_table']["fields_filter_handler_$mview_id-$i"]['#options'][$form_state['values']["fields_filter_handler_$mview_id-$i"]],
-    	'handler_field' => $form['view_setup_table']["fields_field_handler_$mview_id-$i"]['#options'][$form_state['values']["fields_field_handler_$mview_id-$i"]],
-    );
-    drupal_write_record('tripal_views_handlers', $handlers_record);
-    $i++;
-  }
-
-}
-

+ 0 - 18
base/tripal_views_integration/patches/1231140.ahah_helper.form-submit-handler.patch

@@ -1,18 +0,0 @@
-diff --git a/ahah_helper.module b/ahah_helper.module
-index dfd222a..32d5c5d 100644
---- a/ahah_helper.module
-+++ b/ahah_helper.module
-@@ -132,6 +132,13 @@ function ahah_helper_generic_submit($form, &$form_state) {
-  */
- function ahah_helper_real_submit($form, &$form_state) {
-   unset($form_state['storage']);
-+
-+  // Call FormAPI's standard submit handler for the form.
-+  $form_id = $form['form_id']['#value'];
-+  $function = $form_id . '_submit';
-+  if (function_exists($function)) {
-+    $function($form, &$form_state);
-+  }
- }
- 
- /**

+ 0 - 9
base/tripal_views_integration/tripal_views_integration.info

@@ -1,9 +0,0 @@
-name = Tripal Views Integration
-description = Tripal module that integrates materialized views with Drupal views to enable custom pages, queries and search forms.
-core = 6.x
-package = Tripal
-
-dependencies[] = tripal_core
-dependencies[] = ahah_helper
-dependencies[] = views
-

+ 0 - 155
base/tripal_views_integration/tripal_views_integration.install

@@ -1,155 +0,0 @@
-<?php
-function tripal_views_integration_schema(){
-	$schema = array();
-	$schema['tripal_views_integration'] = array(
-		'description' => 'contains the setupes, their materialized view id and base table name that was used.',
-		'fields' => array(
-			'setup_id' => array(
-				'description' => 'the id of the setup',
-				'type' => 'serial',
-				'unsigned' => TRUE,
-				'not null' => TRUE,
-			),
-			'mview_id' => array(
-				'description' => 'the materialized view used for this setup',
-				'type' => 'int',
-				'unsigned' => TRUE,
-			),
-			'chado_table_name' => array(
-				'description' => 'the base table name to be used when using this setup',
-				'type' => 'varchar',
-				'length' => 255,
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'name' => array(
-				'description' => 'Human readable name of this setup',
-				'type' => 'varchar',
-				'length' => 255,
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'description' => array(
-				'description' => 'description of this row',
-				'type' => 'varchar',
-				'length' => 255,
-				'not null' => TRUE,
-				'default' => '',
-			),
-		),
-		'unique_keys' => array(
-			'setup_id' => array('setup_id'),
-		),
-		'primary key' => array('setup_id'),
-	);
-	$schema['tripal_mviews_join'] = array(
-		'description' => 'which materialzed views and chado tables to join in a given setup',
-		'fields' => array(
-		  'mview_join_id' => array(
-				'description' => 'the id of the join',
-					'type' => 'serial',
-					'unsigned' => TRUE,
-					'not null' => TRUE,
-		  ),
-			'setup_id' => array(
-				'description' => 'tripal setup id from tripal_views_integration table',
-				'type' => 'int',
-				'unsigned' => TRUE,
-				'not null'=> TRUE,
-			),
-			'view_table' => array(
-					'description' => 'materialized view table name',
-					'type' => 'varchar',
-					'length' => '255',
-					'not null' => TRUE,
-					'default' => '',
-	    ),
-			'view_column' => array(
-				'description' => 'column of materialized view table (mview_table)',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'chado_table_join' => array(
-				'description' => 'on which chado table to join to materialized view in this serach',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'chado_column' => array(
-				'description' => 'chado table (above) column to join on materialized view in this serach',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-	    ),
-		),
-		'unique_keys' => array(
-			'setup_id' => array('mview_join_id'),
-		),
-		'primary key' => array('mview_join_id'),
-	);
-	$schema['tripal_views_handlers'] = array(
-		'description' => 'in formation for views: column and views handler name',
-		'fields' => array(
-			'handler_id' => array(
-				'description' => 'the id of the handler',
-					'type' => 'serial',
-					'unsigned' => TRUE,
-					'not null' => TRUE,
-	    ),
-			'setup_id' => array(
-				'description' => 'which setup this is used by from tripal_views_integration table',
-					'type' => 'int',
-					'unsigned' => TRUE,
-					'not null'=> TRUE,
-			),
-			'column_name' => array(
-				'description' => '',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'handler_filter' => array(
-				'description' => 'identifier of the handler filter to be used for this column',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-			),
-			'handler_field' => array(
-				'description' => 'identifier of the handler field to be used for this column',
-				'type' => 'varchar',
-				'length' => '255',
-				'not null' => TRUE,
-				'default' => '',
-	    ),
-		),
-		'unique_keys' => array(
-				'setup_id' => array('handler_id'),
-	  ),
-		'primary key' => array('handler_id'),
-	);
-	return $schema;
-}
-
-function tripal_views_integration_install(){
-	drupal_install_schema('tripal_views_integration');
-}
-
-function tripal_views_integration_uninstall(){
-	drupal_uninstall_schema('tripal_views_integration');
-}
-
-
-/*
- * NOTE: when updating schema for this module's tables
- * follow api of schema module, otherwise on uninstall
- * the tables will not be removed correctly
- *
- */
-
-

+ 0 - 81
base/tripal_views_integration/tripal_views_integration.module

@@ -1,81 +0,0 @@
-<?php
-
-require_once 'includes/tripal_views_integration.admin.inc';
-
-/**
- * Implements hook_views_api()
- *
- * Purpose: Essentially this hook tells drupal that there is views support for
- *  for this module which then includes tripal_db.views.inc where all the
- *  views integration code is
- *
- * @ingroup tripal_views_integration
- */ 
-function tripal_views_integration_views_api() {
-   return array(
-      'api' => 2.0,
-   );
-}
-
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_menu(){
-	$items = array();
-
-   $items['admin/tripal/tripal_views_integration'] = array(
-     'title' => t('Views Integration'),
-     'description' => 'Basic Description of Tripal Views Integration Module',
-     'page callback' => 'tripal_views_integration_module_description_page',
-     'access arguments' => array('administer site configuration'),
-     'type' => MENU_NORMAL_ITEM,
-   );
-
-	$items['admin/tripal/tripal_views_integration/list'] = array(
-    'title' => t('List of Integrated Views'),
-    'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_views_integration_admin_form'),
-    'access arguments' => array('manage tripal_views_integration'),
-    'type' => MENU_NORMAL_ITEM,
-	);
-
-	//page to actually create setup->mview->chado table relationships
-	$items['admin/tripal/tripal_views_integration/new'] = array(
-     'title' => 'Integrate a Materialized View',
-     'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_views_integration_new_setup_form'),
-     'access arguments' => array('manage tripal_views_integration'), //TODO: figure out the proper permissions arguments
-     'type' => MENU_NORMAL_ITEM,
-	);
-
-	return $items;
-}
-/**
- *  Set the permission types that the chado module uses.  Essentially we
- *  want permissionis that protect creation, editing and deleting of chado
- *  data objects
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_perm(){
-   return array(
-      'manage tripal_views_integration',
-   );
-}
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_theme(){
-	$theme = array();
-
-	$theme['tripal_views_integration_new_setup_form'] = array(
-      'arguments' => array('form' => NULL),
-      'template'  => 'tripal_views_integration_fields_form',
-	);
-
-	return $theme;
-}
-

+ 0 - 140
base/tripal_views_integration/tripal_views_integration.views.inc

@@ -1,140 +0,0 @@
-  <?php
-/**
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_views_data(){   
-
-    $tvi_query = db_query('SELECT * FROM tripal_views_integration');
-
-    //tvi = tripal_views_integration
-    while($tvi_row = db_fetch_object($tvi_query)){
-
-      //ids we'll use for queries
-      $setup_id = $tvi_row->setup_id;
-      $mview_id = $tvi_row->mview_id;
-
-      //let's get the name of the table
-      $mview_table = db_fetch_object(db_query("SELECT name, mv_specs FROM {tripal_mviews} WHERE mview_id = '$mview_id';"));
-
-      //use name from above and description from $tvi_row
-      $data[$mview_table->name]['table']['group'] = t('Mview ' . $tvi_row->name);
-      $data[$mview_table->name]['table']['base'] = array(
-        'group' => t($tvi_row->name),
-        'title' => t($tvi_row->name),
-        'help'  => t($tvi_row->description),
-      );
-
-      //let's add fields
-      //tmj = tripal_mviews_join
-      $tmj_query = db_query("SELECT * FROM tripal_mviews_join WHERE setup_id = '$setup_id'");
-      while($tmj_row = db_fetch_object($tmj_query)){
-
-        $column_name = $tmj_row->view_column;
-        $handlers = db_fetch_object(db_query("SELECT handler_filter, handler_field FROM {tripal_views_handlers} WHERE setup_id = '$setup_id' AND column_name = '$column_name';"));
-        //handlers would be used $handlers->handler_filter, $handlers->handler_field etc, thuogh may need to include new ones in this query or do select *
-
-        //let's use handlers we retrieved from above
-        $data[$mview_table->name][$tmj_row->view_column] = array(
-           'title' => t($tmj_row->view_column),
-           'help' => t("**"),
-           'field' => array(
-              'handler' => 'views_handler_field',
-              'click sortable' => TRUE,
-           ),
-           'sort' => array(
-              'handler' => 'views_handler_sort',
-           ),
-           'filter' => array(
-              'handler' => 'views_handler_filter_string',
-           ),
-           'argument' => array(
-              'handler' => 'views_handler_argument_string',
-           ),
-        );
-               
-        $chado_join_table = $tmj_row->chado_table_join;
-        $chado_join_column = $tmj_row->chado_column;
-        $mview_join_column = $tmj_row->view_column;
-        
-        // add recipricol join entries
-        $data["$mview_table->name"]['table']['join']["$chado_join_table"] = array(
-          'left_field' => $chado_join_column,
-          'field' => $mview_join_column,
-        );
-
-        // check to see if this table is one that correlates with Drupal nodes
-        // if so, there will be a chado_<table_name> table in the Drupal database
-        // if there is, then we need to add the linking join information
-        $sql = "SELECT tablename FROM pg_tables WHERE tablename = 'chado_$chado_join_table'";
-        if(db_fetch_object(db_query($sql))){
-
-           // join the mview to the linker table
-           $data["$mview_table->name"]['table']['join']["chado_$chado_join_table"] = array(
-             'left_field' => $chado_join_column,
-             'field' => $mview_join_column,
-           );
-        }
-      }
-    }
-
-    return $data;
-}
-/**      $setup_id = $tvi_row->setup_id;
- *
- * @ingroup tripal_views_integration
- */
-function tripal_views_integration_views_data_alter(&$data) {
-    $tvi_query = db_query('SELECT * FROM tripal_views_integration');
-
-    //tvi = tripal_views_integration
-    while($tvi_row = db_fetch_object($tvi_query)){
-
-      //ids we'll use for queries
-      $mview_id = $tvi_row->mview_id;
-      $setup_id = $tvi_row->setup_id;
-
-      //let's get the name of the table
-      $mview_table = db_fetch_object(db_query("SELECT name, mv_specs FROM {tripal_mviews} WHERE mview_id = '$mview_id';"));
-
-      // iterate through the columns and alter the existing data array for
-      // joins to other tables
-      $tmj_query = db_query("SELECT * FROM tripal_mviews_join WHERE setup_id = '$setup_id'");
-      while($tmj_row = db_fetch_object($tmj_query)){
-        
-        $chado_join_table = $tmj_row->chado_table_join;
-        $chado_join_column = $tmj_row->chado_column;
-        $mview_join_column = $tmj_row->view_column;      
- 
-        // add the recipricol join entries for each column
-        $data["$chado_join_table"]['table']['join']["$mview_table->name"] = array(
-          'left_field' => $mview_join_column,
-          'field' => $chado_join_column,
-        );
-
-        // check to see if this table is one that correlates with Drupal nodes
-        // if so, there will be a chado_<table_name> table in the Drupal database
-        // if there is, then we need to add the linking join information.  We did
-        // this step in the hook_views_data function above, but now we need 
-        // to add the reciprical joins
-        $sql = "SELECT tablename FROM pg_tables WHERE tablename = 'chado_$chado_join_table'";
-        if(db_fetch_object(db_query($sql))){
-
-           // join the linker table to the mview
-           $data["chado_$chado_join_table"]['table']['join']["$mview_table->name"] = array(
-             'left_field' => $mview_join_column,
-             'field' => $chado_join_column,
-           );
-
-           // Join the node table to the view by way of the chado linker table
-           $data['node']['table']['join']["$mview_table->name"] = array(
-           	'left_table' => "chado_$chado_join_table",
-           	'left_field' => 'nid',
-           	'field' => 'nid',
-           );
-        }
-      }
-    }
-
-    return $data;
-}

+ 0 - 50
base/tripal_views_integration/tripal_views_integration_fields_form.tpl.php

@@ -1,50 +0,0 @@
-<style type="text/css">
-
-#tripal-views-integration-new-setup-form  .fields-new-row, .field-headers {
-   dislay: block;
-   margin: 0px;
-   border-bottom-style: solid;
-   border-bottom-width: 1px;
-}
-#tripal-views-integration-new-setup-form .form-item {
-   margin: 0px 0px 5px 0px;
-}
-#tripal-views-integration-new-setup-form .column-id, .fields-column-join,.fields-column-join-column, .fields-filter-handler, .fields-field-handler {
-   display: inline-block;
-   margin: 0px;
-   vertical-align: top;
-}
-#tripal-views-integration-new-setup-form  .field-headers {
-   font-weight: bold;
-}
-#tripal-views-integration-new-setup-form  .field-headers div {
-   display: inline-block;
-   margin: 0px;
-   vertical-align: top;
-}
-#tripal-views-integration-new-setup-form .column-name {
-
-}
-#tripal-views-integration-new-setup-form .column-type {
-   font-style: italic;
-}
-#tripal-views-integration-new-setup-form .column-id {
-   width: 25%;
-}
-#tripal-views-integration-new-setup-form .fields-column-join {
-   width: 25%;
-}
-#tripal-views-integration-new-setup-form .fields-column-join-column {
-   width: 25%;
-}
-#tripal-views-integration-new-setup-form .fields-filter-handler {
-   width: 10%;
-}
-#tripal-views-integration-new-setup-form .fields-field-handler {
-   width: 10%;
-}
-
-</style>
-
-<?php print drupal_render($form); ?>
-