Browse Source

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Lacey Sanderson 10 years ago
parent
commit
2a4fae4a5f

+ 3 - 3
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -123,9 +123,9 @@ function chado_analysis_form($node, &$form_state) {
     $sourceuri      = $form_state['input']['sourceuri'];
     $timeexecuted   = $form_state['input']['timeexecuted'];
     $description    = $form_state['input']['description'];
-    $d_removed      = $form_state['input']['removed'];
-    $num_new        = $form_state['input']['num_new'] ? $form_state['input']['num_new'] : 0;
-    $analysis_type  = $form_state['input']['analysis_type'];
+    $d_removed      = isset($form_state['input']['removed']) ? $form_state['input']['removed'] : array();
+    $num_new        = isset($form_state['input']['num_new']) ? $form_state['input']['num_new'] : 0;
+    $analysis_type  = isset($form_state['input']['analysis_type']) ? $form_state['input']['analysis_type'] : '';
   }
 
   $form['title']= array(

+ 0 - 44
tripal_analysis/tripal_analysis.module

@@ -195,50 +195,6 @@ function tripal_analysis_theme($existing, $type, $theme, $path) {
 
   return $items;
 }
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_analysis
- */
-function tripal_analysis_block_info() {
-  $blocks['base']['info'] = t('Tripal Analysis Details');
-  $blocks['base']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['featureblast']['info'] = t('Tripal Feature Analyses');
-  $blocks['featureblast']['cache'] = DRUPAL_NO_CACHE;
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_analysis
- */
-function tripal_analysis_block_view($delta = '') {
-
-  if (user_access('access chado_analysis content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'base':
-        $block['subject'] = t('Analysis Details');
-        $block['content'] = theme('tripal_analysis_base', $node);
-        break;
-      case 'tripal_feature_analyses':
-        $block['subject'] = t('Feature Analyses');
-        $block['content'] = theme('tripal_feature_analyses', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
-
-
 /**
  * Implements hook_views_api().
  * Essentially this hook tells drupal that there is views support for

+ 14 - 0
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -696,4 +696,18 @@ function tripal_contact_node_update($node) {
  */
 function chado_contact_chado_node_default_title_format() {
   return '[contact.name]';
+}
+
+/**
+ * Implements [content_type]_chado_node_sync_select_query().
+ *
+ * Adds a where clause to the query to exclude the NULL contact.
+ */
+function chado_contact_chado_node_sync_select_query($query) {
+  $query['where_clauses']['title'][] = 'contact.name <> :contact_name_null1';
+  $query['where_clauses']['title'][] = 'contact.name <> :contact_name_null2';
+  $query['where_args']['title'][':contact_name_null1'] = 'null';
+  $query['where_args']['title'][':contact_name_null2'] = 'NULL';
+
+  return $query;
 }

+ 0 - 73
tripal_contact/tripal_contact.module

@@ -170,79 +170,6 @@ function tripal_contact_theme($existing, $type, $theme, $path) {
   );
   return $items;
 }
-
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_contact
- */
-function tripal_contact_block_info() {
-
-  $blocks['contbase']['info'] = t('Tripal Contact Details');
-  $blocks['contbase']['cache'] = 'DRUPAL_NO_CACHE';
-
-  $blocks['contprops']['info'] = t('Tripal Contact Properties');
-  $blocks['contprops']['cache'] = 'DRUPAL_NO_CACHE';
-
-  $blocks['contrels']['info'] = t('Tripal Contact Relationships');
-  $blocks['contrels']['cache'] = 'DRUPAL_NO_CACHE';
-
-  $blocks['contpubs']['info'] = t('Tripal Contact Publications');
-  $blocks['contpubs']['cache'] = 'DRUPAL_NO_CACHE';
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- * @ingroup tripal_contact
- */
-function tripal_contact_block_view($delta = '') {
-
-  if (user_access('access chado_contact content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'contbase':
-        $block['subject'] = t('Overview');
-        $block['content'] = array(
-          '#theme' => 'tripal_contact_base',
-          '#nodes' => $node,
-          '#title' => '',
-        );
-        break;
-      case 'contprops':
-        $block['subject'] = t('Properties');
-        $block['content'] = array(
-          '#theme' => 'tripal_contact_properties',
-          '#nodes' => $node,
-          '#title' => '',
-        );
-        break;
-      case 'contrels':
-        $block['subject'] = t('Relationships');
-        $block['content'] = array(
-          '#theme' => 'tripal_contact_relationships',
-          '#nodes' => $node,
-          '#title' => '',
-        );
-        break;
-      case 'contpubs':
-        $block['subject'] = t('Publications');
-        $block['content'] = array(
-          '#theme' => 'tripal_contact_publications',
-          '#nodes' => $node,
-          '#title' => '',
-        );
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
 /**
  * Implement hook_permission().
  *

+ 61 - 39
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -510,41 +510,47 @@ function chado_node_sync_records($base_table, $max_sync = FALSE, $organism_id =
   // Allow module to add to query
   $hook_query_alter = $linking_table . '_chado_node_sync_select_query';
   if (function_exists($hook_query_alter)) {
-    call_user_func($hook_query_alter, $select, $joins, $where_clauses, $where_args);
+    $update = call_user_func($hook_query_alter, array(
+      'select' => $select, 
+      'joins' => $joins, 
+      'where_clauses' => $where_clauses, 
+      'where_args' => $where_args,
+    ));
+    // Now add in any new changes
+    if ($update and is_array($update)) {
+      $select = $update['select'];
+      $joins = $update['joins'];
+      $where_clauses = $update['where_clauses'];
+      $where_args = $update['where_args'];
+    }
   }
-
   // Build Query, we do a left join on the chado_xxxx table in the Drupal schema
   // so that if no criteria are specified we only get those items that have not
   // yet been synced.
   $query = "
-    SELECT " . implode(', ',$select) . ' ' .
+    SELECT " . implode(', ', $select) . ' ' .
     'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' '.
     "  LEFT JOIN public.$linking_table CT ON CT.$base_table_id = $base_table.$base_table_id " .
-    "WHERE CT.$base_table_id IS NULL AND";
+    "WHERE CT.$base_table_id IS NULL ";
 
   // extend the where clause if needed
   $where = '';
   $sql_args = array();
-  if (count($where_clauses['type']) > 0) {
-    $where .= '(' . implode(' OR ', $where_clauses['type']) . ') AND';
-    $sql_args = array_merge($sql_args, $where_args['type']);
-  }
-  if (count($where_clauses['organism']) > 0) {
-    $where .= '(' . implode(' OR ', $where_clauses['organism']) . ') AND';
-    $sql_args = array_merge($sql_args, $where_args['organism']);
-  }
-  if (count($where_clauses['id']) > 0) {
-    $where .= '(' . implode(' OR ', $where_clauses['id']) . ') AND';
-    $sql_args = array_merge($sql_args, $where_args['id']);
+  foreach ($where_clauses as $category => $items) {
+    $where .= ' AND (';
+    foreach ($items as $item) {
+      $where .= $item . ' OR ';
+    }
+    $where = substr($where, 0, -4); // remove the trailing 'OR'
+    $where .= ') ';
+    $sql_args = array_merge($sql_args, $where_args[$category]);
   }
+  
   if ($where) {
     $query .= $where;
   }
-  $query = substr($query, 0, -4); // remove the trailing 'AND'
   $query .- " ORDER BY " . $base_table_id;
 
-print $query."\n";
-
   // If Maximum number to Sync is supplied
   if ($max_sync) {
     $query .= " LIMIT $max_sync";
@@ -836,7 +842,7 @@ function hook_chado_node_sync_form_submit ($form, $form_state) {
 
 
 /**
- * Alter the query for the chado database which gets the chado records to be sync'd (optional)
+ * Alter the query that retrieves records to be sync'd (optional)
  *
  * This might be necessary if you need fields from other chado tables to create your node
  * or if your chado node type only supports a subset of a given table (ie: a germplasm node
@@ -846,27 +852,43 @@ function hook_chado_node_sync_form_submit ($form, $form_state) {
  * Note: For your own module, replace hook in the function name with the machine-name of
  * your chado node type (ie: chado_feature).
  *
- * @param $select:
- *   An array of select clauses
- * @param $joins:
- *   An array of joins (ie: a single join could be 'LEFT JOIN {chadotable} alias ON base.id=alias.id')
- * @param $where_clauses:
- *   An array of where clauses which will all be AND'ed together. Use :placeholders for values.
- * @param $where_args:
- *   An associative array of arguments to be subbed in to the where clause where the
- *   key = :placeholder and the value is the actual argument to be subbed in.
+ * @param $query 
+ *   An array containing the following: 
+ *    'select': An array of select clauses
+ *    'joins:  An array of joins (ie: a single join could be 
+ *      'LEFT JOIN {chadotable} alias ON base.id=alias.id')
+ *    'where_clauses: An array of where clauses which will all be AND'ed 
+ *      together. Use :placeholders for values.
+ *    'where_args: An associative array of arguments to be subbed in to the 
+ *      where clause where the
  *
  * @ingroup tripal_chado_node_api
  */
-function hook_chado_node_sync_select_query (&$select, &$joins, &$where_clauses, &$where_args) {
-
-  // You can add fields to be selected
-  $select[] = 'example.myfavfield';
-
-  // Or joins to important tables
-  $joins[] = 'LEFT JOIN {exampleprop} PROP ON PROP.example_id=EXAMPLE.example_id';
-
-  // Or filter the query using where clauses
-  $where_clauses[] = 'example.myfavfield = :favvalue';
-  $where_args[':favvalue'] = 'awesome-ness';
+function hook_chado_node_sync_select_query($query) {
+
+  // You can add fields to be selected. Be sure to prefix each field with the 
+  // tale name.
+  $query['select'][] = 'example.myfavfield';
+
+  // Provide any join you may need to the joins array. Be sure to wrap the 
+  // table name in curly brackets.
+  $query['joins'][] = 'LEFT JOIN {exampleprop} PROP ON PROP.example_id=EXAMPLE.example_id';
+
+  // The category should be a unique id for a group of items that will be 
+  // concatenated together via an SQL 'OR'.  By default the $where_clases
+  // variable will come with categories of 'id', 'organism' and 'type'.  
+  // you can add your own unique category or alter the contents of the existing
+  // categories.  Be sure to make sure the category doesn't already exist
+  // in the $query['where_clauses']
+  $category = 'my_category'; 
+  
+  // Provide any aditionall where clauses and their necessary arguments.
+  // Be sure to prefix the field with the table name.   Be sure that the 
+  // placeholder is unique across all categories (perhaps add a unique 
+  // prefix/suffix).
+  $query['where_clauses'][$category][] = 'example.myfavfield = :favvalue';
+  $query['where_args'][$category][':favvalue'] = 'awesome-ness';
+  
+  // Must return the updated query
+  return $query;
 }

+ 0 - 256
tripal_cv/includes/tripal_cv.charts.inc

@@ -1,256 +0,0 @@
-<?php
-/**
- * @file
- * Tripal API for generating a Google Chart of count data
- */
-
-/**
- * Generates JSON used for generating a Google chart of count data associated
- * with a controlled vocabulary.  An example would be features assigned to
- * Gene Ontology terms.
- *
- * To generate a chart, the progammer must first create a materialized view that
- * will generate count data for a given controlled vocabulary.  For example, the Tripal
- * Analysis GO creates a materialized view for counting Gene Ontology assignments
- * to features.  This view is created on install of the module and is named
- * 'go_count_analysis'.
- *
- * Next, an HTML 'div' box must be added to the desired page
- * with a class name of 'tripal_cv_chart', and an id of the following format:
- *
- *  tripal_[module_name]_cv_chart_[unique id]
- *
- * where [module_name] is the name of the tripal module (e.g. tripal_analyisis_go)
- * and [unique id] is some unique identifier that the contolling module
- * recognizes. This string is the $chart_id variable passed as the first argument
- * to the function.  For example, the Tripal GO Analysis module generates
- * chart ids of the form:
- *
- *  tripal_analysis_go_cv_chart_10_2_bp
- *
- * In this case the module that will manage this chart is identified as 'tripal_analysis_go' and within
- * the [unique id] portion contains the
- * organism_id (e.g. 10), analysis_id (e.g. 2) and chart type (bp = biological process).
- *
- * Second, the programmer must then define a hook in the controlling module for setting
- * some options used to build the chart.  The hook has the form:  hook_cv_chart($chart_id).
- * This hook should accept the full $chart_id as the single parameter.  For the Tripal
- * Analysis GO module the hook is named:  tripal_analysis_go_cv_chart.
- *
- * The array returned by this hook must have the following fields:
- *  - count_mview
- *      the name of the materialized view that contains the count data
- *      this materialized view must have at least two columns, one with the cvterm_id
- *      for each term and a second column containing the counts
- *  - cvterm_id_column
- *      the column name in the materialized view that contains
- *      the cvterm_ids
- *  - count_column
- *      the column name in the materialized view that contains the
- *      counts
- *  - filter
- *      an SQL compatible WHERE clause string (whithout the word 'WHERE')
- *      that can be used for filtering the records in the materialized view.
- *  - title
- *      the title for the chart
- *  - type
- *      the type of chart to create (see Google Charts documenation). Leave
- *      blank for a pie chart.
- *  - size
- *      the dimensions of the chart in pixels (see Google Charts documenations
- *      for exact size limitations).
- *
- * Example from the tripal_analysis_go module:
- * @code
- *  function tripal_analysis_go_cv_chart($chart_id) {
- *
- *    // The CV module will create the JSON array necessary for buillding a
- *    // pie chart using jgChart and Google Charts.  We have to pass to it
- *    // a table that contains count information, tell it which column
- *    // contains the cvterm_id and provide a filter for getting the
- *    // results we want from the table.
- *    $organism_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$chart_id);
- *    $analysis_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$chart_id);
- *    $type        = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$chart_id);
- *
- *    $sql = "SELECT * FROM {analysis} WHERE analysis_id = :analysis_id";
- *    $analysis = chado_query($sql, array(':analysis_id' => $analysis_id))->fetchObject();
- *
- *    if (strcmp($type,'mf')==0) {
- *       $class = 'molecular_function';
- *       $title = "Number of Molecular Function Terms From $analysis->name Analysis";
- *    }
- *    if (strcmp($type,'cc')==0) {
- *       $class = 'cellular_component';
- *       $title = "Number of Cellular Component Terms From $analysis->name Analysis";
- *    }
- *    if (strcmp($type,'bp')==0) {
- *       $class = 'biological_process';
- *       $title = "Number of Biological Process Terms From $analysis->name Analysis";
- *    }
- *    $options = array(
- *       count_mview      => 'go_count_analysis',
- *       cvterm_id_column => 'cvterm_id',
- *       count_column     => 'feature_count',
- *       filter           => "
- *          CNT.organism_id = $organism_id AND
- *          CNT.analysis_id = $analysis_id AND
- *          CNT.cvterm_id IN (
- *            SELECT CVTR.subject_id
- *            FROM {cvterm_relationship} CVTR
- *              INNER JOIN {CVTerm} CVT on CVTR.object_id = CVT.cvterm_id
- *              INNER JOIN {CV} on CVT.cv_id = CV.cv_id
- *            WHERE CVT.name = '$class' AND
- *                   CV.name = '$class'
- *          )
- *       ",
- *       type             => 'p',
- *       size             => '550x175',
- *       title            => $title,
- *    );
- *    return $options;
- *  }
- *
- * @endcode
- *
- * @param $chart_id
- *   The unique identifier for the chart
- *
- * @return
- *   JSON array needed for the js caller
- *
- * With these three components (materialized view, a 'div' box with proper CSS class and ID, and a hook_cv_chart)
- * a chart will be created on the page.  There is no need to call this function directly.
- *
- * @ingroup tripal_cv_api
- */
-function tripal_cv_chart($chart_id) {
-  // parse out the tripal module name from the chart_id to find out
-  // which Tripal "hook" to call:
-  $tripal_mod = preg_replace("/^(tripal_.+?)_cv_chart_(.+)$/", "$1", $chart_id);
-  $callback = $tripal_mod . "_cv_chart";
-
-  // now call the function in the module responsible for the chart to fill out
-  // an options array needed by the tripal_cv_count_chart call below.
-  $opt = call_user_func_array($callback, array($chart_id));
-
-  // build the JSON array to return to the javascript caller
-  $json_arr = tripal_cv_count_chart(
-    $opt['count_mview'],
-    $opt['cvterm_id_column'],
-    $opt['count_column'],
-    $opt['filter'],
-    $opt['title'],
-    $opt['type'],
-    $opt['size']
-  );
-  $json_arr[] = $chart_id;  // add the chart_id back into the json array
-
-  return drupal_json($json_arr);
-
-}
-
- /**
-  * This function generates an array with fields compatible with Google charts used
-  * for generating pie charts of counts associated with terms in
-  * a controlled vocabulary.  An example would be counts of features assigned
-  * to terms in the Sequence Ontology.
-  *
-  * @param $cnt_table
-  *   The name of the table (most likely a materialized view) that
-  *   contains count data for each term.  The table must have at least
-  *   two columns, one with the cvterm_id for each term, and a second
-  *   column with the count (i.e. features assigned the term).
-  * @param $fk_column
-  *   This is the name of the column in the $cnt_table that holds the
-  *   cvterm_id for each term.
-  * @param $cnt_column
-  *   The name of the column in the $cnt_table containing the counts
-  * @param $filter
-  *   An SQL compatible 'where' clause (without the word 'WHERE') used
-  *   to filter the records in the $cnt_table
-  * @param $title
-  *   The title of the chart to be rendered.
-  * @param $type
-  *   The type of chart to be rendered. The value used here is the same as
-  *   the type names for Google charts. Default is p3 (pie chart).
-  * @param $size
-  *   The size in pixels of the chart to be rendered. Default is 300x75. The
-  *   size of the chart is constrained by Google charts.  See the Google
-  *   chart documentation for exact limitations.
-  *
-  * @return
-  *   An array that has the settings needed for Google Charts to creat the chart.
-  *
-  * @ingroup tripal_cv_api
-  */
-function tripal_cv_count_chart($cnt_table, $fk_column,
-  $cnt_column, $filter = NULL, $title = '', $type = 'p3', $size='300x75') {
-
-  if (!$type) {
-    $type = 'p3';
-  }
-
-  if (!$size) {
-    $size = '300x75';
-  }
-
-  if (!$filter) {
-    $filter = '(1=1)';
-  }
-
-  $is_pie = 0;
-  if (strcmp($type, 'p') == 0 or strcmp($type, 'p3') == 0) {
-    $is_pie = 1;
-  }
-  $sql = "
-    SELECT CVT.name, CVT.cvterm_id, CNT.$cnt_column as num_items
-    FROM {$cnt_table} CNT
-     INNER JOIN {cvterm} CVT on CNT.$fk_column = CVT.cvterm_id
-    WHERE $filter
-  ";
-
-  $features = array();
-  $results = chado_query($sql);
-  $data = array();
-  $axis = array();
-  $legend = array();
-  $total = 0;
-  $max = 0;
-  $i = 1;
-  while ($term = db_fetch_object($results)) {
-
-    if ($is_pie) {
-      $axis[] = "$term->name (" . number_format($term->num_items) . ")";
-      $data[] = array($term->num_items, 0, 0);
-    }
-    else {
-      $axis[] = "$term->name (" . number_format($term->num_items) . ")";
-      $data[] = array($term->num_items);
-      //$legend[] = "$term->name (" . number_format($term->num_items) . ")";
-    }
-    if ($term->num_items > $max) {
-      $max = $term->num_items;
-    }
-    $total += $term->num_items;
-    $i++;
-  }
-  // convert numerical values into percentages
-  foreach ($data as &$set) {
-    $set[0] = ($set[0] / $total) * 100;
-  }
-  $opt[] = array(
-    data => $data,
-    axis_labels => $axis,
-    legend => $legend,
-    size => $size,
-    type => $type,
-
-    bar_width     => 10,
-    bar_spacing   => 0,
-    title         => $title
-  );
-  //   $opt[] = $sql;
-
-  return $opt;
-}

+ 0 - 468
tripal_cv/includes/tripal_cv.trees.inc

@@ -1,468 +0,0 @@
-<?php
-/**
- * @file
- * Functions for rendering term tree's
- */
-
-/**
- * Renders the cv_list form
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_show_browser() {
-
-  $content = drupal_get_form('tripal_cv_list_form');
-  $content .= "
-    <div id=\"cv_browser\"></div>
-  ";
-
-  return $content;
-}
-
-
-/**
- * Generates JSON used for generating an exapandable tree of terms from
- * a controlled vocabulary that has associated counts.
- *
- * The progammer must first create a materialized view that
- * will generate count data for a given controlled vocabulary.  For example, the Tripal
- * Analysis GO creates a materialized view for counting Gene Ontology assignments
- * to features.  This view is created on install of the module and is named
- * 'go_count_analysis'.
- *
- * Second, the progammer must add an HTML 'div' box to the desired page
- * with a class name of 'tripal_cv_tree', and an id of the following format:
- *
- *  tripal_[module_name]_cv_tree_[unique id]
- *
- * where [module_name] is the name of the tripal module (e.g. tripal_analyisis_go)
- * and [unique id] is some unique identifier that the contolling module
- * recognizes. This string is the $tree_id variable passed as the first argument
- * to the function.  For example, the Tripal GO Analysis module generates
- * tree ids of the form:
- *
- *  tripal_analysis_go_cv_tree_10-2_bp
- *
- * In this case the module that will manage this tree is identified as 'tripal_analysis_go' and within
- * the [unique id] portion contains the
- * organism_id (e.g. 10), analysis_id (e.g. 2) and tree type (bp = biological process).
- *
- * Second, the programmer must then define a hook in the controlling module for setting
- * some options used to build the chart.  The hook has the form:  hook_cv_tree($tree_id).
- * This hook should accept the full $tree_id as the single parameter.  For the Tripal
- * Analysis GO module the hook is named:  tripal_analysis_go_cv_tree.
- *
- * The array returned by this hook must have the following fields:
- *  - cv_id
- *      the cv_id for the controlled vocabulary
- *  - count_mview
- *      the name of the materialized view that contains the count data
- *      this materialized view must have at least two columns, one with the cvterm_id
- *      for each term and a second column containing the counts. The tree will only
- *      be expanded to include child terms that have counts.
- *  - cvterm_id_column
- *      the column name in the materialized view that contains
- *      the cvterm_ids
- *  - count_column
- *      the column name in the materialized view that contains the
- *      counts
- *  - filter
- *      an SQL compatible WHERE clause string (whithout the word 'WHERE')
- *      that can be used for filtering the records in the materialized view.
- *  - label
- *      the title for the tree
- *
- * Example from the tripal_analysis_go module:
- * @code
- *  function tripal_analysis_go_cv_tree($tree_id) {
- *
- *   $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
- *   $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
- *   $type        = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$tree_id);
- *
- *   if(strcmp($type,'mf')==0) {
- *      $class = 'molecular_function';
- *   }
- *   if(strcmp($type,'cc')==0) {
- *      $class = 'cellular_component';
- *   }
- *   if(strcmp($type,'bp')==0) {
- *      $class = 'biological_process';
- *   }
- *
- *   $options = array(
- *      cv_id            => tripal_cv_get_cv_id($class),
- *      count_mview      => 'go_count_analysis',
- *      cvterm_id_column => 'cvterm_id',
- *      count_column     => 'feature_count',
- *      filter           => "CNT.organism_id = $organism_id AND CNT.analysis_id = $analysis_id",
- *      label            => 'Features',
- *   );
- *   return $options;
- * }
- *
- * @endcode
- *
- * @param $tree_id
- *   The unique identifier for the tree
- *
- * @return
- *   JSON array needed for the jsTree package for generating expandable trees.
- *
- * With these three components (materialized view, a 'div' box with proper CSS class and ID, and a hook_cv_tree)
- * a tree will be created on the page.  There is no need to call this function directly.
- *
- * @ingroup tripal_cv_api
- */
-function tripal_cv_tree($tree_id) {
-  // parse out the tripal module name from the chart_id to find out
-  // which Tripal "hook" to call:
-  $tripal_mod = preg_replace("/^(tripal_.+?)_cv_tree_(.+)$/", "$1", $tree_id);
-  if ($tripal_mod) {
-    $callback = $tripal_mod . "_cv_tree";
-
-    // now call the function in the module responsible for the tree.  This
-    // should call the tripal_cv_init_cv with the proper parameters set for
-    // getting the cv_id of the vocabulary to use
-    $opt = call_user_func_array($callback, array($tree_id));
-
-    // we only need to return the cv_id for this function call.
-    $json_array[] = $opt['cv_id'];
-  }
-
-  $json_array[] = $tree_id;
-  return drupal_json($json_array);
-}
-
-/**
- * Update the JSON tree describing a tree
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_update_tree() {
-  $content = array();
-  $ontology = 'sequence';
-
-  // get the id of the term to look up
-  $cv = check_plain($_REQUEST['cv']);
-  $term = check_plain($_REQUEST['term']);
-  $tree_id = check_plain($_REQUEST['tree_id']);
-
-  // get the options needed for this tree from the tripal module that
-  // wants to create the tree
-  $tripal_mod = preg_replace("/^(tripal_.+?)_cv_tree_(.+)$/", "$1", $tree_id);
-  if ($tripal_mod) {
-    $callback = $tripal_mod . "_cv_tree";
-    $opt = call_user_func_array($callback, array($tree_id));
-  }
-
-  // get the CV root terms
-  if (strcmp($term, 'root')==0) {
-    if (!$cv) {
-      $cv = $opt['cv_id'];
-    }
-    $content = tripal_cv_init_tree($cv, $opt['count_mview'],
-      $opt['cvterm_id_column'], $opt['count_column'], $opt['filter'], $opt['label']);
-
-  // get the children terms
-  }
-  else {
-    $content = tripal_cv_get_term_children($term, $opt['count_mview'],
-      $opt['cvterm_id_column'], $opt['count_column'], $opt['filter'], $opt['label']);
-  }
-
-  drupal_json($content);
-}
-
-/**
- * Generates JSON needed for jsTree Root-level Branches
- *
- * This function returns the JSON array for the jsTree
- *    jQuery code that builds a tree for browsing the ontology.  This function
- *    should be called to generate the root level branches of the tree.
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_init_tree($cv_id, $cnt_table = NULL, $fk_column = NULL,
-  $cnt_column = NULL, $filter = NULL, $label = NULL) {
-
-  // get the list of root terms for the provided CV
-  $sql = "
-    SELECT *
-    FROM {cv_root_mview} CRM
-    WHERE cv_id = :cv_id
-  ";
-  $results = chado_query($sql, array(':cv_id' => $cv_id));
-
-  // prepare the SQL statement that will allow us to pull out count
-  // information for each term in the tree.
-  if ($cnt_table) {
-    if (!$filter) {
-      $filter = '(1=1)';
-    }
-    $cnt_sql = "
-       SELECT CVT.name, CVT.cvterm_id, CNT.$cnt_column as num_items
-       FROM {$cnt_table} CNT
-        INNER JOIN {cvterm} CVT on CNT.$fk_column = CVT.cvterm_id
-       WHERE $filter AND CVT.cvterm_id = :cvterm_id
-       ORDER BY $cnt_column desc
-    ";
-  }
-
-  foreach ($results as $term) {
-    $name = $term->name;
-    $count = 0;
-    if ($cnt_table) {
-      $cnt_results = chado_query($cnt_sql, array(':cvterm_id' => $term->cvterm_id));
-      foreach ($cnt_results as $cnt) {
-        $count += $cnt->cnt;
-      }
-      if ($count > 0) {
-        $name .= " ($count $label(s))";
-      }
-    }
-    $content[] = array(
-      'attributes' => array(
-        'id' => $term->cvterm_id,
-      ),
-      'state' => 'closed',
-      'data' => $name,
-      'children' => array(),
-    );
-  }
-
-  return $content;
-
-}
-
-/**
- *  Generates JSON needed for jsTree -expanding a term to view children
- *
- *  This function returns the JSON array for the jsTree
- *    jQuery code when expanding a term to view it's children.
- *
- * @ingroup tripal_cv_api
- */
-function tripal_cv_get_term_children($cvterm_id, $cnt_table = NULL,
-  $fk_column = NULL, $cnt_column = NULL, $filter = NULL, $label = NULL) {
-
-  // get the children for the term provided
-  $sql = "
-    SELECT CVTR.cvterm_relationship_id,CVTR.subject_id,
-       CVT1.name as subject_name, CVT3.name as type_name, CVTR.type_id,
-       CVT2.name as object_name,CVTR.object_id
-    FROM {cvterm_relationship} CVTR
-       INNER JOIN {CVTerm} CVT1 on CVTR.subject_id = CVT1.cvterm_id
-       INNER JOIN {CVTerm} CVT2 on CVTR.object_id = CVT2.cvterm_id
-       INNER JOIN {CVTerm} CVT3 on CVTR.type_id = CVT3.cvterm_id
-       INNER JOIN {CV} on CV.cv_id = CVT1.cv_id
-    WHERE CVTR.object_id = :cvterm_id
-    ORDER BY CVT1.name
-  ";
-  $results = chado_query($sql, array(':cvterm_id' => $cvterm_id));
-
-  // prepare the SQL statement that will allow us to pull out count
-  // information for each term in the tree.
-  if ($cnt_table) {
-    if (!$filter) {
-      $filter = '(1=1)';
-    }
-    $cnt_sql = "
-       SELECT CVT.name, CVT.cvterm_id, CNT.$cnt_column as num_items
-       FROM {$cnt_table} CNT
-        INNER JOIN {cvterm} CVT on CNT.$fk_column = CVT.cvterm_id
-       WHERE $filter AND CVT.cvterm_id = :cvterm_id
-       ORDER BY $cnt_column desc
-    ";
-  }
-
-  // populate the JSON content array
-  foreach ($results as $term) {
-    // count the number of items per term if requested
-    $name = $term->subject_name;
-    $count = 0;
-    if ($cnt_table) {
-      $cnt_results = chado_query($cnt_sql, array(':cvterm_id' => $term->subject_id));
-      foreach ($cnt_results as $cnt) {
-        $count += $cnt->num_items;
-      }
-      if ($count > 0) {
-        $name .= " (" . number_format($count) . " $label)";
-
-        // check if we have any children if so then set the value
-        $children = chado_query($sql, array(':cvterm_id' => $term->subject_id))->fetchObject();
-        $state = 'leaf';
-        if ($children) {
-          $state = 'closed';
-        }
-        $content[] = array(
-          'attributes' => array(
-            'id' => $term->subject_id,
-          ),
-          'state' => $state,
-          'data' => $name,
-          'children' => array(),
-        );
-      }
-    }
-    else {
-      // check if we have any children if so then set the value
-      $children = chado_query($sql, array(':cvterm_id' => $term->subject_id))->fetchObject();
-      $state = 'leaf';
-      if ($children) {
-        $state = 'closed';
-      }
-      $content[] = array(
-        'attributes' => array(
-           'id' => $term->subject_id,
-        ),
-        'state' => $state,
-        'data' => $name,
-        'children' => array(),
-      );
-    }
-  }
-  $content[] = $cnt_sql;
-
-  return $content;
-}
-
-/**
- * Initilizes term tree browser
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_init_browser($cv_id) {
-
-  $content = "
-    <div id=\"tripal_cv_cvterm_info_box\">
-      <a href=\"#\" onclick=\"$('#tripal_cv_cvterm_info_box').hide()\" style=\"float: right\">Close [X]</a>
-      <h3>Term Information</h3>
-      <div id=\"tripal_cv_cvterm_info\"></div>
-    </div>
-    <div id=\"tripal_ajaxLoading\" style=\"display:none\">
-      <div id=\"loadingText\">Loading...</div>
-      <img src=\"$url\">
-    </div>
-    <h3>Tree Browser</h3>
-    <div id=\"browser\"</div>
-    </div>
-  ";
-
-  drupal_json(array('update' => "$content"));
-
-}
-
-/**
- * Describe a cvterm (Rendered)
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_cvterm_info($cvterm_id) {
-
-  // get the id of the term to look up
-  $cv = check_plain($_REQUEST['cv']);
-  $tree_id = check_plain($_REQUEST['tree_id']);
-
-  // first get any additional information to add to the cvterm
-  if (strcmp($tree_id, 'undefined') != 0) {
-    $tripal_mod = preg_replace("/^(tripal_.+?)_cv_tree_(.+)$/", "$1", $tree_id);
-    if ($tripal_mod) {
-      $callback = $tripal_mod . "_cvterm_add";
-      $opt = call_user_func_array($callback, array($cvterm_id, $tree_id));
-    }
-  }
-
-  $sql = "
-    SELECT CVT.name as cvtermname, CVT.definition, CV.name as cvname,
-       DBX.accession,DB.urlprefix,DB.db_id,DB.name as dbname
-    FROM {CVTerm} CVT
-      INNER JOIN {CV} on CVT.cv_id = CV.cv_id
-      INNER JOIN {dbxref} DBX on CVT.dbxref_id = DBX.dbxref_id
-      INNER JOIN {DB} on DBX.db_id = DB.db_id
-    WHERE CVT.cvterm_id = :cvterm_id
-  ";
-  $cvterm = chado_query($sql, array(':cvterm_id' => $cvterm_id))->fetchObject();
-
-  $sql = "
-    SELECT CVTS.synonym, CVT.name as cvname
-    FROM {cvtermsynonym} CVTS
-      INNER JOIN {cvterm} CVT on CVTS.type_id = CVT.cvterm_id
-    WHERE CVTS.cvterm_id = :cvterm_id
-
-  ";
-  $results = chado_query($sql, array(':cvterm_id' => $cvterm_id));
-  foreach ($results as $synonym) {
-    $synonym_rows .= "<b>$synonym->cvname:</b>  $synonym->synonym<br />";
-  }
-
-  $accession = $cvterm->accession;
-  if ($cvterm->urlprefix) {
-    $accession = "<a href=\"$cvterm->urlprefix$cvterm->accession\">$cvterm->accession</a>";
-  }
-
-  $content = "
-    <div id=\"cvterm\">
-    <table>
-      <tr><th>Term</th><td>$cvterm->cvtermname</td></tr>
-      <tr><th>Accession</th><td>$accession</td></tr>
-      <tr><th>Ontology</th><td>$cvterm->cvname</td></tr>
-      <tr><th>Definition</th><td>$cvterm->definition</td></tr>
-      <tr><th>Synonyms</th><td>$synonym_rows</td></tr>
-      <tr><th>Internal ID</th><td>$cvterm_id</td></tr>
-  ";
-
-  // now add in any additional options from a hook
-  if ($opt) {
-    foreach ($opt as $key => $value) {
-      $content .= "<tr><th>$key</th><td>$value</td>";
-    }
-  }
-
-  // close out the information table
-  $content .= "
-    </table>
-    </div>
-  ";
-  drupal_json(array('update' => $content));
-}
-
-/**
- * Form listing CVs
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_list_form($form, &$form_state) {
-
-  // get a list of db from chado for user to choose
-  $sql = "
-    SELECT DISTINCT CV.name,CV.cv_id
-    FROM {cvterm_relationship} CVTR
-       INNER JOIN {cvterm} CVT on CVTR.object_id = CVT.cvterm_id
-       INNER JOIN {CV} on CV.cv_id = CVT.cv_id
-  ";
-  $results = chado_query($sql);
-
-  $blastdbs = array();
-  $cvs[''] = '';
-  foreach ($results as $cv) {
-    $cvs[$cv->cv_id] = $cv->name;
-  }
-
-  $form['db_options'] = array(
-    '#type' => 'value',
-    '#value' => $cvs
-  );
-
-  $form['cv_list'] = array(
-    '#title' => t('CVs with relationships'),
-    '#type' => 'select',
-    '#description' => t('Choose the controlled vocabulary to browse'),
-    '#options' => $form['db_options']['#value'],
-    '#attributes' => array(
-      'onChange' => "return tripal_cv_init_browser(this)",
-    )
-  );
-
-  return $form;
-}

+ 0 - 2
tripal_cv/tripal_cv.module

@@ -19,8 +19,6 @@ require_once 'api/tripal_cv.schema.api.inc';
 require_once 'api/tripal_cv.DEPRECATED.inc';
 
 require_once 'includes/tripal_cv.admin.inc';
-require_once 'includes/tripal_cv.charts.inc';
-require_once 'includes/tripal_cv.trees.inc';
 require_once 'includes/tripal_cv.obo_loader.inc';
 require_once 'includes/tripal_cv.cv_form.inc';
 require_once 'includes/tripal_cv.cvterm_form.inc';

+ 0 - 76
tripal_example/includes/tripal_example.blocks.inc

@@ -1,76 +0,0 @@
-<?php
-
-/**
- * @ingroup tripal_example
- */
-function tripal_example_block_info() {
-
-  $blocks['libreferences']['info'] = t('Tripal Example Cross References');
-  $blocks['libreferences']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libbase']['info'] = t('Tripal Example Details');
-  $blocks['libbase']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libterms']['info'] = t('Tripal Example Terms');
-  $blocks['libterms']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libsynonyms']['info'] = t('Tripal Example Synonyms');
-  $blocks['libsynonyms']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libproperties']['info'] = t('Tripal Example Properties');
-  $blocks['libproperties']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['featurelibs']['info'] = t('Tripal Feature Examples');
-  $blocks['featurelibs']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['orglibs']['info'] = t('Tripal Organism Examples');
-  $blocks['orglibs']['cache'] = DRUPAL_NO_CACHE;
-
-  return $blocks;
-}
-
-
-/**
- * @ingroup tripal_example
- */
-function tripal_example_block_view($delta = '') {
-
-  if (user_access('access chado_example content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'libreferences':
-        $block['subject'] = t('Cross References');
-        $block['content'] = theme('tripal_example_references', $node);
-        break;
-      case 'libbase':
-        $block['subject'] = t('Example Details');
-        $block['content'] = theme('tripal_example_base', $node);
-        break;
-      case 'libsynonyms':
-        $block['subject'] = t('Synonyms');
-        $block['content'] = theme('tripal_example_synonyms', $node);
-        break;
-      case 'libproperties':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_example_properties', $node);
-        break;
-      case 'libterms':
-        $block['subject'] = t('Example Terms');
-        $block['content'] = theme('tripal_example_terms', $node);
-        break;
-      case 'featurelibs':
-        $block['subject'] = t('Examples');
-        $block['content'] = theme('tripal_feature_examples', $node);
-        break;
-      case 'orglibs':
-        $block['subject'] = t('Examples');
-        $block['content'] = theme('tripal_organism_examples', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}

+ 0 - 119
tripal_feature/includes/tripal_feature.blocks.inc

@@ -1,119 +0,0 @@
-<?php
-/**
- * @file
- *  Describes the feature blocks to drupal
- */
-
-/**
- * Implements hook_block().
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_block_info() {
-
-  $blocks['references']['info'] = t('Tripal Feature References');
-  $blocks['references']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['base']['info'] = t('Tripal Feature Details');
-  $blocks['base']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['sequence']['info'] = t('Tripal Feature Sequence');
-  $blocks['sequence']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['featureloc_sequences']['info'] = t('Tripal Feature Annotated Sequence');
-  $blocks['featureloc_sequences']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['synonyms']['info'] = t('Tripal Feature Synonyms');
-  $blocks['synonyms']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['properties']['info'] = t('Tripal Feature Properties');
-  $blocks['properties']['cache'] = 'BLOCK_NO_CACHE';;
-
-  $blocks['terms']['info'] = t('Tripal Annotated Terms');
-  $blocks['terms']['cache'] = 'BLOCK_NO_CACHE';;
-
-  $blocks['alignments']['info'] = t('Tripal Feature Alignments');
-  $blocks['alignments']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['relationships']['info'] = t('Tripal Feature Relationships');
-  $blocks['relationships']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['org_feature_counts']['info'] = t('Tripal Organism Feature Counts');
-  $blocks['org_feature_counts']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['org_feature_browser']['info'] = t('Tripal Organism Feature Browser');
-  $blocks['org_feature_browser']['cache'] = 'BLOCK_NO_CACHE';
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_block_view($delta = '') {
-
-  if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'references':
-        $block['subject'] = t('Cross References');
-        $block['content'] = theme('tripal_feature_references', $node);
-        break;
-      case 'base':
-        $block['subject'] = t('Feature Details');
-        $block['content'] = theme('tripal_feature_base', $node);
-        break;
-      case 'synonyms':
-        $block['subject'] = t('Synonyms');
-        $block['content'] = theme('tripal_feature_synonyms', $node);
-        break;
-      case 'properties':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_feature_properties', $node);
-        break;
-      case 'terms':
-        $block['subject'] = t('Annotated Terms');
-        $block['content'] = theme('tripal_feature_terms', $node);
-        break;
-      case 'sequence':
-        $block['subject'] = t('Sequence');
-        $block['content'] = theme('tripal_feature_sequence', $node);
-        break;
-      case 'featureloc_sequences':
-        $block['subject'] = t('Formatted Sequences');
-        $block['content'] = theme('tripal_feature_featureloc_sequences', $node);
-        break;
-      case 'alignments':
-        $block['subject'] = t('Alignments');
-        $block['content'] = theme('tripal_feature_alignments', $node);
-        break;
-      case 'relationships':
-        $block['subject'] = t('Relationships');
-        $block['content'] = theme('tripal_feature_relationships', $node);
-        break;
-      case 'org_feature_counts':
-        $block['subject'] = t('Feature Type Summary');
-        $block['content'] = theme('tripal_organism_feature_counts', array('node' => $node));
-        break;
-      case 'org_feature_browser':
-        $block['subject'] = t('Feature Browser');
-        $block['content'] = theme('tripal_organism_feature_browser', array('node' => $node));
-        break;
-      case 'library_feature_browser':
-        $block['subject'] = t('Library Feature Browser');
-        $block['content'] = theme('tripal_library_feature_browser', $node);
-        break;
-      case 'analysis_feature_browser':
-        $block['subject'] = t('Analysis Feature Browser');
-        $block['content'] = theme('tripal_analysis_feature_browser', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}

+ 0 - 1
tripal_feature/tripal_feature.module

@@ -24,7 +24,6 @@ require_once 'includes/tripal_feature.gff_loader.inc';
 require_once 'includes/tripal_feature.seq_extract.inc';
 require_once 'includes/tripal_feature.delete.inc';
 require_once 'includes/tripal_feature.chado_node.inc';
-require_once 'includes/tripal_feature.blocks.inc';
 
 /**
  * Implements hook_views_api().

+ 0 - 64
tripal_featuremap/tripal_featuremap.module

@@ -244,70 +244,6 @@ function tripal_featuremap_theme($existing, $type, $theme, $path) {
   return $items;
 }
 
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_block_info() {
-
-  $blocks['mapbase']['info'] = t('Tripal Map Details');
-  $blocks['mapbase']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['mapprops']['info'] = t('Tripal Map Properties');
-  $blocks['mapprops']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['mappos']['info'] = t('Tripal Map Features');
-  $blocks['mappos']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['mappubs']['info'] = t('Tripal Map Publications');
-  $blocks['mappubs']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['maprefs']['info'] = t('Tripal Map References');
-  $blocks['maprefs']['cache'] = 'BLOCK_NO_CACHE';
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_block_view($delta = '') {
-
-  if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'mapbase':
-        $block['subject'] = t('Library Details');
-        $block['content'] = theme('tripal_featuremap_base', $node);
-        break;
-      case 'mapprops':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_featuremap_properties', $node);
-        break;
-      case 'mappos':
-        $block['subject'] = t('Features');
-        $block['content'] = theme('tripal_featuremap_featurepos', $node);
-        break;
-      case 'mappubs':
-        $block['subject'] = t('Publications');
-        $block['content'] = theme('tripal_featuremap_publication', $node);
-        break;
-      case 'maprefs':
-        $block['subject'] = t('References');
-        $block['content'] = theme('tripal_featuremap_references', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
 /**
  * Implementation of hook_form_alter()
  *

+ 0 - 78
tripal_library/tripal_library.module

@@ -243,84 +243,6 @@ function tripal_library_help ($path, $arg) {
   }
 }
 
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_library
- */
-function tripal_library_block_info() {
-
-  $blocks['libreferences']['info'] = t('Tripal Library Cross References');
-  $blocks['libreferences']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libbase']['info'] = t('Tripal Library Details');
-  $blocks['libbase']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libterms']['info'] = t('Tripal Library Terms');
-  $blocks['libterms']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libsynonyms']['info'] = t('Tripal Library Synonyms');
-  $blocks['libsynonyms']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['libproperties']['info'] = t('Tripal Library Properties');
-  $blocks['libproperties']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['featurelibs']['info'] = t('Tripal Feature Libraries');
-  $blocks['featurelibs']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['orglibs']['info'] = t('Tripal Organism Libraries');
-  $blocks['orglibs']['cache'] = DRUPAL_NO_CACHE;
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_library
- */
-function tripal_library_block_view($delta = '') {
-
-  if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'libreferences':
-        $block['subject'] = t('Cross References');
-        $block['content'] = theme('tripal_library_references', $node);
-        break;
-      case 'libbase':
-        $block['subject'] = t('Library Details');
-        $block['content'] = theme('tripal_library_base', $node);
-        break;
-      case 'libsynonyms':
-        $block['subject'] = t('Synonyms');
-        $block['content'] = theme('tripal_library_synonyms', $node);
-        break;
-      case 'libproperties':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_library_properties', $node);
-        break;
-      case 'libterms':
-        $block['subject'] = t('Library Terms');
-        $block['content'] = theme('tripal_library_terms', $node);
-        break;
-      case 'featurelibs':
-        $block['subject'] = t('Libraries');
-        $block['content'] = theme('tripal_feature_libraries', $node);
-        break;
-      case 'orglibs':
-        $block['subject'] = t('Libraries');
-        $block['content'] = theme('tripal_organism_libraries', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
 /**
  * Implementation of hook_form_alter().
  *

+ 0 - 50
tripal_natural_diversity/tripal_natural_diversity.module

@@ -126,56 +126,6 @@ function tripal_natural_diversity_theme($existing, $type, $theme, $path) {
   return $items;
 }
 
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_library
- */
-function tripal_natural_diversity_block_info() {
-
-  $blocks['ndfgenotype']['info'] = t('Tripal Natural Diversity Feature Genotypes');
-  $blocks['ndfgenotype']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['ndsgenotype']['info'] = t('Tripal Natural Diversity Library Genotypes');
-  $blocks['ndsgenotype']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['ndsphenotype']['info'] = t('Tripal Natural Diversity Stock Phenotypes');
-  $blocks['ndsphenotype']['cache'] = 'BLOCK_NO_CACHE';
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_library
- */
-function tripal_natural_diversity_block_view($delta = '') {
-
-  if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'ndfgenotype':
-        $block['subject'] = t('Genotypes');
-        $block['content'] = theme('tripal_feature_nd_genotypes', $node);
-        break;
-      case 'ndsgenotype':
-        $block['subject'] = t('Stock Genotypes');
-        $block['content'] = theme('tripal_stock_nd_genotypes', $node);
-        break;
-      case 'ndsphenotype':
-        $block['subject'] = t('Phenotypes');
-        $block['content'] = theme('tripal_stock_nd_phenotypes', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
 /**
  * Implements hook_node_view(). Acts on all content types.
  *

+ 0 - 37
tripal_organism/tripal_organism.module

@@ -18,43 +18,6 @@ require_once 'includes/tripal_organism.chado_node.inc';
  * @}
  */
 
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_organism
- */
-function tripal_organism_block_info() {
-
-  $blocks['base']['info'] = t('Tripal Organism Details');
-  $blocks['base']['cache'] = DRUPAL_NO_CACHE;
-
-  return $blocks;
-
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_organism
- */
-function tripal_organism_block_view($delta = '') {
-
-  if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'base':
-        $block['subject'] = t('Organism Details');
-        $block['content'] = theme('tripal_organism_base', $node);
-        break;
-      default:
-    }
-    return $block;
-  }
-}
-
 /**
  *  Implements hook_menu().
  *

+ 0 - 64
tripal_project/tripal_project.module

@@ -207,70 +207,6 @@ function tripal_project_theme($existing, $type, $theme, $path) {
   return $items;
 }
 
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_project
- */
-function tripal_project_block_info() {
-
-  $blocks['projectbase']['info'] = t('Tripal Project Details');
-  $blocks['projectbase']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['projectprops']['info'] = t('Tripal Project Properties');
-  $blocks['projectprops']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['projectpubs']['info'] = t('Tripal Project Publications');
-  $blocks['projectpubs']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['projectcont']['info'] = t('Tripal Project Contact');
-  $blocks['projectcont']['cache'] = DRUPAL_NO_CACHE;
-
-  $blocks['projectrels']['info'] = t('Tripal Project Relationships');
-  $blocks['projectrels']['cache'] = DRUPAL_NO_CACHE;
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_project
- */
-function tripal_project_block_view($delta = '') {
-
-  if (user_access('access chado_project content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'projectbase':
-        $block['subject'] = t('Project Details');
-        $block['content'] = theme('tripal_project_base', $node);
-        break;
-      case 'projectprops':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_project_properties', $node);
-        break;
-      case 'projectpubs':
-        $block['subject'] = t('Publications');
-        $block['content'] = theme('tripal_project_publications', $node);
-        break;
-      case 'projectcont':
-        $block['subject'] = t('Contact');
-        $block['content'] = theme('tripal_project_contact', $node);
-        break;
-      case 'projectrels':
-        $block['subject'] = t('Relationships');
-        $block['content'] = theme('tripal_project_relationships', $node);
-        break;
-      default :
-    }
-    return $block;
-  }
-}
-
 /**
  * Implementation of hook_form_alter().
  *

+ 12 - 0
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -1203,3 +1203,15 @@ function tripal_pub_node_presave($node) {
 function chado_pub_chado_node_default_title_format() {
   return '[pub.title]';
 }
+
+/**
+ * Implements [content_type]_chado_node_sync_select_query().
+ * 
+ * Adds a where clause to the query to exclude the NULL pub.
+ */
+function chado_pub_chado_node_sync_select_query($query) {
+  $query['where_clauses']['title'][] = 'pub.title <> :pub_title_null';
+  $query['where_args']['title'][':pub_title_null'] = 'NULL';
+  
+  return $query;
+}

+ 0 - 108
tripal_stock/tripal_stock.module

@@ -340,114 +340,6 @@ function tripal_stock_help ($path, $arg) {
     return theme('tripal_stock_help', array());
   }
 }
-
-/**
- * Implements hook_block_info().
- *
- * @ingroup tripal_stock
- */
-function tripal_stock_block_info() {
-  $blocks['base']['info'] = t('Tripal Stock Details');
-  $blocks['base']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['properties']['info'] = t('Tripal Stock Properties');
-  $blocks['properties']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['references']['info'] = t('Tripal Stock References');
-  $blocks['references']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['relationships_as_object']['info'] = t('Tripal Stock Relationships');
-  $blocks['relationships_as_object']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['synonyms']['info'] = t('Tripal Stock Synonyms');
-  $blocks['synonyms']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['collections']['info'] = t('Tripal Stock Collections');
-  $blocks['collections']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['phenotypes']['info'] = t('Tripal Stock Phenotypes');
-  $blocks['phenotypes']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['genotypes']['info'] = t('Tripal Stock Genotypes');
-  $blocks['genotypes']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['locations']['info'] = t('Tripal Stock Locations');
-  $blocks['locations']['cache'] = 'BLOCK_NO_CACHE';
-
-  $blocks['orgstocks']['info'] = t('Tripal Organism Stocks');
-  $blocks['orgstocks']['cache'] = 'BLOCK_NO_CACHE';
-
-  return $blocks;
-}
-
-/**
- * Implements hook_block_view().
- *
- * @ingroup tripal_stock
- */
-function tripal_stock_block_view($delta = '') {
-
-  if (user_access('access chado_stock content') and arg(0) == 'node' and is_numeric(arg(1))) {
-    $nid = arg(1);
-    $node = node_load($nid);
-
-    $block = array();
-    switch ($delta) {
-      case 'base':
-        $block['subject'] = t('Stock Details');
-        $block['content'] = theme('tripal_stock_base', $node);
-        break;
-
-      case 'properties':
-        $block['subject'] = t('Properties');
-        $block['content'] = theme('tripal_stock_properties', $node);
-        break;
-
-      case 'references':
-        $block['subject'] = t('References');
-        $block['content'] = theme('tripal_stock_references', $node);
-        break;
-
-      case 'relationships':
-        $block['subject'] = t('Relationships');
-        $block['content'] = theme('tripal_stock_relationships', $node);
-        break;
-
-      case 'synonyms':
-        $block['subject'] = t('Synonyms');
-        $block['content'] = theme('tripal_stock_synonyms', $node);
-        break;
-
-      case 'collections':
-        $block['subject'] = t('Stock Collections');
-        $block['content'] = theme('tripal_stock_collections', $node);
-        break;
-
-      case 'phenotypes':
-        $block['subject'] = t('Stock Phenotypes');
-        $block['content'] = theme('tripal_stock_phenotypes', $node);
-        break;
-
-      case 'genotypes':
-        $block['subject'] = t('Stock Genotypes');
-        $block['content'] = theme('tripal_stock_genotypes', $node);
-        break;
-
-      case 'locations':
-        $block['subject'] = t('Stock Locations');
-        $block['content'] = theme('tripal_stock_locations', $node);
-        break;
-
-      case 'orgstocks':
-        $block['subject'] = t('Organism Stocks');
-        $block['content'] = theme('tripal_organism_stocks', $node);
-        break;
-
-    }
-    return $block;
-  }
-}
-
 /*
  * Uses the value provided in the $id argument to find all stocks that match
  * that ID by name, stockname or synonym.  If it matches uniquenly to a single

+ 1 - 1
tripal_views/theme/tripal_views_search_biological_content.tpl.php

@@ -10,7 +10,7 @@ $disabled_views = variable_get('views_defaults', array());
 this site:</p>
 <DL>
 <?php foreach ($biological_views as $view) { ?>
-  <?php if (!isset($disabled_views[ $view['machine_name'] ]) OR ($disabled_views[ $view['machine_name'] ] == TRUE)) { ?>
+  <?php if (!isset($disabled_views[ $view['machine_name'] ]) OR ($disabled_views[ $view['machine_name'] ] == FALSE)) { ?>
     <DT><?php print l($view['human_name'], $view['link']); ?></DT>
     <DD><?php print $view['description']; ?></DD>
 <?php }} ?>