Browse Source

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

Lacey Sanderson 11 years ago
parent
commit
f76548951b
22 changed files with 59 additions and 33 deletions
  1. 23 3
      tripal_core/api/tripal_core.chado_query.api.inc
  2. 1 1
      tripal_feature/includes/tripal_feature.blocks.inc
  3. 0 5
      tripal_feature/includes/tripal_feature.chado_node.inc
  4. 0 5
      tripal_feature/tripal_feature.module
  5. 9 0
      tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  6. 2 2
      tripal_featuremap/theme/tripal_feature/tripal_feature_featurepos.tpl.php
  7. 1 1
      tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_featurepos.tpl.php
  8. 8 1
      tripal_featuremap/tripal_featuremap.module
  9. 1 1
      tripal_genetic/theme/tripal_feature/tripal_feature_genotypes.tpl.php
  10. 1 1
      tripal_genetic/theme/tripal_stock/tripal_stock_genotypes.tpl.php
  11. 1 1
      tripal_library/includes/tripal_library.chado_node.inc
  12. 1 1
      tripal_natural_diversity/theme/tripal_feature/tripal_feature_nd_genotypes.tpl.php
  13. 1 1
      tripal_natural_diversity/theme/tripal_stock/tripal_stock_nd_genotypes.tpl.php
  14. 1 1
      tripal_pub/includes/tripal_pub.pub_search.inc
  15. 1 1
      tripal_pub/theme/tripal_pub/tripal_pub_featuremaps.tpl.php
  16. 1 1
      tripal_pub/theme/tripal_pub/tripal_pub_features.tpl.php
  17. 1 1
      tripal_pub/theme/tripal_pub/tripal_pub_libraries.tpl.php
  18. 1 1
      tripal_pub/theme/tripal_pub/tripal_pub_projects.tpl.php
  19. 1 1
      tripal_pub/theme/tripal_pub/tripal_pub_stocks.tpl.php
  20. 1 1
      tripal_stock/includes/tripal_stock.chado_node.inc
  21. 1 1
      tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php
  22. 2 2
      tripal_stock/tripal_stock.module

+ 23 - 3
tripal_core/api/tripal_core.chado_query.api.inc

@@ -1355,7 +1355,7 @@ function chado_query($sql, $args = array()) {
  * @param $limit
  *   The number of query results to display per page.
  * @param $element
- *   An optional integer to distinguish between multiple pagers on one page.
+ *   An numeric identifier used to distinguish between multiple pagers on one page.
  * @param $count_query
  *   An SQL query used to count matching records.
  *
@@ -1366,10 +1366,10 @@ function chado_query($sql, $args = array()) {
  * @ingroup tripal_chado_query_api
  */
 function chado_pager_query($query, $args, $limit, $element, $count_query = '') {
-
   // get the page and offset for the pager
   $page = isset($_GET['page']) ? $_GET['page'] : '0';
   $offset = $limit * $page;
+  $q = $_GET['q'];
 
   // Construct a count query if none was given.
   if (!isset($count_query)) {
@@ -1387,7 +1387,7 @@ function chado_pager_query($query, $args, $limit, $element, $count_query = '') {
   $total_records = $results->fetchField();
 
   // set a session variable for storing the total number of records
-  $_SESSION['chado_pager'][$element]['total_records'] = $total_records;
+  $GLOBALS['chado_pager'][$q][$element]['total_records'] = $total_records;
 
   pager_default_initialize($total_records, $limit, $element);
 
@@ -1395,6 +1395,26 @@ function chado_pager_query($query, $args, $limit, $element, $count_query = '') {
   $results = chado_query($query, $args);
   return $results;
 }
+/**
+ * A function to retrieve the total number of records for a pager that
+ * was generated using the chado_pager_query() function
+ * 
+ * @param $element
+ *   The $element argument that was passed to the chado_pager_query function
+ *   
+ * @ingroup tripal_chado_query_api
+ */
+function chado_pager_get_count($element) {
+  $q = $_GET['q'];
+  
+  if (array_key_exists($q, $_SESSION['chado_pager']) and 
+      array_key_exists($element, $_SESSION['chado_pager'][$q])) {
+    return $GLOBALS['chado_pager'][$q][$element]['total_records'];
+  }
+  else {
+    return 0;
+  }
+}
 
 /**
  * Gets the value of a foreign key relationship

+ 1 - 1
tripal_feature/includes/tripal_feature.blocks.inc

@@ -61,7 +61,7 @@ function tripal_feature_block_view($delta = '') {
     $block = array();
     switch ($delta) {
       case 'references':
-        $block['subject'] = t('References');
+        $block['subject'] = t('Cross References');
         $block['content'] = theme('tripal_feature_references', $node);
         break;
       case 'base':

+ 0 - 5
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -864,11 +864,6 @@ function tripal_feature_node_view($node, $view_mode, $langcode) {
           '#tripal_toc_title' => 'Overview',
           '#weight' => -100,
         );
-        $node->content['tripal_feature_featurepos'] = array(
-          '#markup' => theme('tripal_feature_featurepos', array('node' => $node)),
-          '#tripal_toc_id'    => 'featurepos',
-          '#tripal_toc_title' => 'Maps',
-        );
         $node->content['tripal_feature_properties'] = array(
           '#markup' => theme('tripal_feature_properties', array('node' => $node)),
           '#tripal_toc_id'    => 'properties',

+ 0 - 5
tripal_feature/tripal_feature.module

@@ -246,11 +246,6 @@ function tripal_feature_theme($existing, $type, $theme, $path) {
       'template' => 'tripal_feature_base',
       'path' => "$path/theme/tripal_feature",
     ),
-    'tripal_feature_featurepos' => array(
-      'arguments' => array('node' => NULL),
-      'template' => 'tripal_feature_featurepos',
-      'path' => "$path/theme/tripal_feature",
-    ),
     'tripal_feature_sequence' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_sequence',

+ 9 - 0
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -524,5 +524,14 @@ function tripal_featuremap_node_view($node, $view_mode, $langcode) {
         );
       }
       break;
+    case 'chado_feature':
+      if ($view_mode == 'full') {
+        $node->content['tripal_feature_featurepos'] = array(
+          '#markup' => theme('tripal_feature_featurepos', array('node' => $node)),
+          '#tripal_toc_id'    => 'featurepos',
+          '#tripal_toc_title' => 'Maps',
+        );
+      }
+      break;
   }
 }

+ 2 - 2
tripal_feature/theme/tripal_feature/tripal_feature_featurepos.tpl.php → tripal_featuremap/theme/tripal_feature/tripal_feature_featurepos.tpl.php

@@ -32,10 +32,10 @@ $feature = tripal_core_expand_chado_vars($feature, 'table', 'featurepos', $optio
 // because the featurepos table has  FK relationships with map_feature_id and feature_id with the feature table 
 // the function call above will try to expand both and will create an array of matches for each FK.
 // we only want to show the map that this feature belongs to
-$map_positions = $feature->featurepos->feature_id;
+$map_positions = $feature->featurepos->map_feature_id;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$featurepos_pager_id]['total_records'];
+$total_records = chado_pager_get_count($featurepos_pager_id);
 
 
 if(count($map_positions) > 0){ ?>

+ 1 - 1
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_featurepos.tpl.php

@@ -34,7 +34,7 @@ $feature_positions = $featuremap->featurepos;
 
 
 // the total number of records for the paged query is stored in a session variable
-$total_features = $_SESSION['chado_pager'][$featurepos_pager_id]['total_records'];
+$total_features = chado_pager_get_count($featurepos_pager_id);
 
 
 if(count($feature_positions) > 0){ ?>

+ 8 - 1
tripal_featuremap/tripal_featuremap.module

@@ -218,6 +218,13 @@ function tripal_featuremap_theme($existing, $type, $theme, $path) {
       'variables' =>  array(NULL),
       'path' => "$path/theme/tripal_featuremap",
     ),
+    
+    // templates for the chado_feature node type
+    'tripal_feature_featurepos' => array(
+      'arguments' => array('node' => NULL),
+      'template' => 'tripal_feature_featurepos',
+      'path' => "$path/theme/tripal_feature",
+    ),
   );
   return $items;
 }
@@ -277,7 +284,7 @@ function tripal_featuremap_block_view($delta = '') {
         $block['content'] = theme('tripal_featuremap_publication', $node);
         break;
       case 'maprefs':
-        $block['subject'] = t('References');
+        $block['subject'] = t('Cross References');
         $block['content'] = theme('tripal_featuremap_references', $node);
         break;
       default :

+ 1 - 1
tripal_genetic/theme/tripal_feature/tripal_feature_genotypes.tpl.php

@@ -40,7 +40,7 @@ $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_genotype',
 $feature_genotypes = $feature->feature_genotype->feature_id;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$feature_pager_id]['total_records'];
+$total_records = chado_pager_get_count($feature_pager_id);
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($feature_genotypes) > 0) {?>

+ 1 - 1
tripal_genetic/theme/tripal_stock/tripal_stock_genotypes.tpl.php

@@ -30,7 +30,7 @@ $stock = tripal_core_expand_chado_vars($stock, 'table', 'stock_genotype', $optio
 $stock_genotypes = $stock->stock_genotype;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$stock_pager_id]['total_records'];
+$total_records = chado_pager_get_count($stock_pager_id);
 
 // now iterate through the stock genotypes and print a paged table.
 if (count($stock_genotypes) > 0) {?>

+ 1 - 1
tripal_library/includes/tripal_library.chado_node.inc

@@ -494,7 +494,7 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
         $node->content['tripal_library_references'] = array(
           '#markup' => theme('tripal_library_references', array('node' => $node)),
           '#tripal_toc_id'    => 'references',
-          '#tripal_toc_title' => 'References',
+          '#tripal_toc_title' => 'Cross References',
         );
         $node->content['tripal_library_synonyms'] = array(
           '#markup' => theme('tripal_library_synonyms', array('node' => $node)),

+ 1 - 1
tripal_natural_diversity/theme/tripal_feature/tripal_feature_nd_genotypes.tpl.php

@@ -63,7 +63,7 @@ $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_genotype',
 $feature_genotypes = $feature->feature_genotype->feature_id;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$feature_pager_id]['total_records'];
+$total_records = chado_pager_get_count($feature_pager_id);
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($feature_genotypes) > 0) { ?>

+ 1 - 1
tripal_natural_diversity/theme/tripal_stock/tripal_stock_nd_genotypes.tpl.php

@@ -98,7 +98,7 @@ if (count($nd_experiment_stocks) > 0) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$stock_pager_id]['total_records'];
+$total_records = chado_pager_get_count($stock_pager_id);
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($genotypes) > 0) { ?>

+ 1 - 1
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -41,7 +41,7 @@ function tripal_pub_search_page() {
     // get the list of publications from the remote database using the search criteria.
     $pubs = tripal_pub_get_search_results($search_array, $limit);
     $page = isset($_GET['page']) ? $_GET['page'] : '0';
-    $total_records = $_SESSION['chado_pager'][0]['total_records'];
+    $total_records = chado_pager_get_count(0);
     $total_pages = (int) ($total_records / $limit) + 1;
 
     // iterate through the results and construct the table displaying the publications

+ 1 - 1
tripal_pub/theme/tripal_pub/tripal_pub_featuremaps.tpl.php

@@ -29,7 +29,7 @@ if (count($featuremap_pubs) > 0 ) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = chado_pager_get_count($element);
 
 if(count($featuremaps) > 0){ ?>
   <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication contains information about <?php print number_format($total_records) ?> maps:</div> <?php 

+ 1 - 1
tripal_pub/theme/tripal_pub/tripal_pub_features.tpl.php

@@ -29,7 +29,7 @@ if (count($feature_pubs) > 0 ) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = chado_pager_get_count($element);
 
 if(count($features) > 0){ ?>
   <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication contains information about <?php print number_format($total_records) ?> features:</div> <?php 

+ 1 - 1
tripal_pub/theme/tripal_pub/tripal_pub_libraries.tpl.php

@@ -29,7 +29,7 @@ if (count($library_pubs) > 0 ) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = chado_pager_get_count($element);
 
 if(count($libraries) > 0){ ?>
   <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication contains information about <?php print number_format($total_records) ?> libraries:</div> <?php 

+ 1 - 1
tripal_pub/theme/tripal_pub/tripal_pub_projects.tpl.php

@@ -29,7 +29,7 @@ if (count($project_pubs) > 0 ) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = chado_pager_get_count($element);
 
 if(count($projects) > 0){ ?>
   <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication contains information about <?php print number_format($total_records) ?> projects:</div> <?php 

+ 1 - 1
tripal_pub/theme/tripal_pub/tripal_pub_stocks.tpl.php

@@ -29,7 +29,7 @@ if (count($stock_pubs) > 0 ) {
 }
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = chado_pager_get_count($element);
 
 if(count($stocks) > 0){ ?>
   <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication contains information about <?php print number_format($total_records) ?> stocks:</div> <?php 

+ 1 - 1
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -881,7 +881,7 @@ function tripal_stock_node_view($node, $view_mode, $langcode) {
         $node->content['tripal_stock_references'] = array(
           '#markup' => theme('tripal_stock_references', array('node' => $node)),
           '#tripal_toc_id'    => 'references',
-          '#tripal_toc_title' => 'References',
+          '#tripal_toc_title' => 'Cross References',
         );
         $node->content['tripal_stock_relationships'] = array(
           '#markup' => theme('tripal_stock_relationships', array('node' => $node)),

+ 1 - 1
tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php

@@ -24,7 +24,7 @@ $stocks = $organism->stock;
 
 // create the pager.  
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$pager_id]['total_records'];
+$total_records = chado_pager_get_count($pager_id);
 
  
 if (count($stocks) > 0) { ?>

+ 2 - 2
tripal_stock/tripal_stock.module

@@ -345,7 +345,7 @@ function tripal_stock_block_info() {
   $blocks['properties']['info'] = t('Tripal Stock Properties');
   $blocks['properties']['cache'] = 'BLOCK_NO_CACHE';
 
-  $blocks['references']['info'] = t('Tripal Stock References');
+  $blocks['references']['info'] = t('Tripal Stock Cross References');
   $blocks['references']['cache'] = 'BLOCK_NO_CACHE';
 
   $blocks['relationships_as_object']['info'] = t('Tripal Stock Relationships');
@@ -396,7 +396,7 @@ function tripal_stock_block_view($delta = '') {
         break;
 
       case 'references':
-        $block['subject'] = t('References');
+        $block['subject'] = t('Cross References');
         $block['content'] = theme('tripal_stock_references', $node);
         break;