Browse Source

Rearranged all templates to be in a single 'templates' directory inside of each module. Added more documentation and functions to the example module.

Stephen Ficklin 11 năm trước cách đây
mục cha
commit
f2989fd4e2
100 tập tin đã thay đổi với 1475 bổ sung413 xóa
  1. 1 0
      tripal_analysis/theme/templates/tripal_analysis_base.tpl.php
  2. 0 0
      tripal_analysis/theme/templates/tripal_analysis_help.tpl.php
  3. 1 0
      tripal_analysis/theme/templates/tripal_analysis_properties.tpl.php
  4. 0 0
      tripal_analysis/theme/templates/tripal_analysis_teaser.tpl.php
  5. 6 6
      tripal_analysis/tripal_analysis.module
  6. 1 0
      tripal_contact/theme/templates/tripal_contact_base.tpl.php
  7. 0 0
      tripal_contact/theme/templates/tripal_contact_help.tpl.php
  8. 1 0
      tripal_contact/theme/templates/tripal_contact_properties.tpl.php
  9. 1 0
      tripal_contact/theme/templates/tripal_contact_publications.tpl.php
  10. 2 0
      tripal_contact/theme/templates/tripal_contact_relationships.tpl.php
  11. 0 0
      tripal_contact/theme/templates/tripal_contact_teaser.tpl.php
  12. 7 7
      tripal_contact/tripal_contact.module
  13. 1 1
      tripal_core/includes/custom_tables.inc
  14. 2 2
      tripal_core/includes/jobs.inc
  15. 2 2
      tripal_core/includes/mviews.inc
  16. 0 0
      tripal_core/theme/templates/node--chado-generic.tpl.php
  17. 0 0
      tripal_core/theme/templates/tripal_core_customize.tpl.php
  18. 0 0
      tripal_core/theme/templates/tripal_core_customtables_help.tpl.php
  19. 0 0
      tripal_core/theme/templates/tripal_core_jobs_help.tpl.php
  20. 0 0
      tripal_core/theme/templates/tripal_core_mviews_help.tpl.php
  21. 3 3
      tripal_core/tripal_core.module
  22. 0 0
      tripal_cv/theme/templates/tripal_cv_help.tpl.php
  23. 1 1
      tripal_cv/tripal_cv.module
  24. 0 0
      tripal_db/theme/templates/tripal_db_help.tpl.php
  25. 1 1
      tripal_db/tripal_db.module
  26. 118 0
      tripal_example/README.txt
  27. 337 268
      tripal_example/includes/tripal_example.chado_node.inc
  28. 0 0
      tripal_example/theme/templates/tripal_example_base.tpl.php
  29. 8 0
      tripal_example/theme/templates/tripal_example_help.tpl.php
  30. 85 0
      tripal_example/theme/templates/tripal_example_properties.tpl.php
  31. 70 0
      tripal_example/theme/templates/tripal_example_references.tpl.php
  32. 150 0
      tripal_example/theme/templates/tripal_example_relationships.tpl.php
  33. 111 0
      tripal_example/theme/tripal_example.theme.inc
  34. 50 0
      tripal_example/tripal_example.info
  35. 250 0
      tripal_example/tripal_example.install
  36. 163 59
      tripal_example/tripal_example.module
  37. 1 0
      tripal_example/tripal_example.views.inc
  38. 1 0
      tripal_example/tripal_example.views_default.inc
  39. 1 0
      tripal_feature/theme/templates/tripal_feature_alignments.tpl.php
  40. 1 0
      tripal_feature/theme/templates/tripal_feature_analyses.tpl.php
  41. 1 0
      tripal_feature/theme/templates/tripal_feature_base.tpl.php
  42. 0 0
      tripal_feature/theme/templates/tripal_feature_help.tpl.php
  43. 1 0
      tripal_feature/theme/templates/tripal_feature_properties.tpl.php
  44. 1 0
      tripal_feature/theme/templates/tripal_feature_publications.tpl.php
  45. 1 0
      tripal_feature/theme/templates/tripal_feature_references.tpl.php
  46. 2 0
      tripal_feature/theme/templates/tripal_feature_relationships.tpl.php
  47. 0 0
      tripal_feature/theme/templates/tripal_feature_sequence.tpl.php
  48. 1 0
      tripal_feature/theme/templates/tripal_feature_synonyms.tpl.php
  49. 0 0
      tripal_feature/theme/templates/tripal_feature_teaser.tpl.php
  50. 1 0
      tripal_feature/theme/templates/tripal_feature_terms.tpl.php
  51. 1 0
      tripal_feature/theme/templates/tripal_organism_feature_browser.tpl.php
  52. 1 0
      tripal_feature/theme/templates/tripal_organism_feature_counts.tpl.php
  53. 17 19
      tripal_feature/tripal_feature.module
  54. 1 0
      tripal_featuremap/theme/templates/tripal_feature_featurepos.tpl.php
  55. 1 0
      tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php
  56. 1 0
      tripal_featuremap/theme/templates/tripal_featuremap_featurepos.tpl.php
  57. 0 0
      tripal_featuremap/theme/templates/tripal_featuremap_help.tpl.php
  58. 1 0
      tripal_featuremap/theme/templates/tripal_featuremap_properties.tpl.php
  59. 1 0
      tripal_featuremap/theme/templates/tripal_featuremap_publication.tpl.php
  60. 1 0
      tripal_featuremap/theme/templates/tripal_featuremap_references.tpl.php
  61. 0 0
      tripal_featuremap/theme/templates/tripal_featuremap_teaser.tpl.php
  62. 9 9
      tripal_featuremap/tripal_featuremap.module
  63. 1 0
      tripal_genetic/theme/templates/tripal_feature_genotypes.tpl.php
  64. 0 0
      tripal_genetic/theme/templates/tripal_genetic_help.tpl.php
  65. 1 0
      tripal_genetic/theme/templates/tripal_stock_genotypes.tpl.php
  66. 3 3
      tripal_genetic/tripal_genetic.module
  67. 1 0
      tripal_library/theme/templates/tripal_feature_libraries.tpl.php
  68. 1 0
      tripal_library/theme/templates/tripal_library_base.tpl.php
  69. 0 0
      tripal_library/theme/templates/tripal_library_help.tpl.php
  70. 1 0
      tripal_library/theme/templates/tripal_library_properties.tpl.php
  71. 1 0
      tripal_library/theme/templates/tripal_library_publications.tpl.php
  72. 1 0
      tripal_library/theme/templates/tripal_library_references.tpl.php
  73. 1 0
      tripal_library/theme/templates/tripal_library_synonyms.tpl.php
  74. 0 0
      tripal_library/theme/templates/tripal_library_teaser.tpl.php
  75. 1 0
      tripal_library/theme/templates/tripal_library_terms.tpl.php
  76. 1 0
      tripal_library/theme/templates/tripal_organism_libraries.tpl.php
  77. 11 11
      tripal_library/tripal_library.module
  78. 1 0
      tripal_natural_diversity/theme/templates/tripal_feature_nd_genotypes.tpl.php
  79. 0 0
      tripal_natural_diversity/theme/templates/tripal_natural_diversity_help.tpl.php
  80. 1 0
      tripal_natural_diversity/theme/templates/tripal_stock_nd_genotypes.tpl.php
  81. 1 0
      tripal_natural_diversity/theme/templates/tripal_stock_nd_phenotypes.tpl.php
  82. 4 4
      tripal_natural_diversity/tripal_natural_diversity.module
  83. 0 0
      tripal_organism/theme/templates/tripal_organism_base.tpl.php
  84. 0 0
      tripal_organism/theme/templates/tripal_organism_help.tpl.php
  85. 1 0
      tripal_organism/theme/templates/tripal_organism_properties.tpl.php
  86. 1 0
      tripal_organism/theme/templates/tripal_organism_references.tpl.php
  87. 0 0
      tripal_organism/theme/templates/tripal_organism_teaser.tpl.php
  88. 6 6
      tripal_organism/tripal_organism.module
  89. 1 0
      tripal_phenotype/theme/templates/tripal_feature_phenotypes.tpl.php
  90. 0 0
      tripal_phenotype/theme/templates/tripal_phenotype_help.tpl.php
  91. 2 2
      tripal_phenotype/tripal_phenotype.module
  92. 1 0
      tripal_project/theme/templates/tripal_project_base.tpl.php
  93. 1 0
      tripal_project/theme/templates/tripal_project_contact.tpl.php
  94. 0 0
      tripal_project/theme/templates/tripal_project_help.tpl.php
  95. 1 0
      tripal_project/theme/templates/tripal_project_properties.tpl.php
  96. 1 0
      tripal_project/theme/templates/tripal_project_publications.tpl.php
  97. 1 0
      tripal_project/theme/templates/tripal_project_relationships.tpl.php
  98. 0 0
      tripal_project/theme/templates/tripal_project_teaser.tpl.php
  99. 8 8
      tripal_project/tripal_project.module
  100. 2 1
      tripal_pub/includes/tripal_pub.pub_importers.inc

+ 1 - 0
tripal_analysis/theme/tripal_analysis/tripal_analysis_base.tpl.php → tripal_analysis/theme/templates/tripal_analysis_base.tpl.php

@@ -95,6 +95,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_analysis-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 0 - 0
tripal_analysis/theme/tripal_analysis_help.tpl.php → tripal_analysis/theme/templates/tripal_analysis_help.tpl.php


+ 1 - 0
tripal_analysis/theme/tripal_analysis/tripal_analysis_properties.tpl.php → tripal_analysis/theme/templates/tripal_analysis_properties.tpl.php

@@ -33,6 +33,7 @@ if (count($properties) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_analysis-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_analysis/theme/tripal_analysis/tripal_analysis_teaser.tpl.php → tripal_analysis/theme/templates/tripal_analysis_teaser.tpl.php


+ 6 - 6
tripal_analysis/tripal_analysis.module

@@ -161,34 +161,34 @@ function tripal_analysis_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_analysis_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_analysis_base',
-      'path' => "$path/theme/tripal_analysis",
+      'path' => "$path/theme/templates",
     ),
     'tripal_analysis_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_analysis_properties',
-      'path' => "$path/theme/tripal_analysis",
+      'path' => "$path/theme/templates",
     ),
     'tripal_analysis_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_analysis_teaser',
-      'path' => "$path/theme/tripal_analysis",
+      'path' => "$path/theme/templates",
     ),
     'tripal_analysis_help' => array(
       'template' => 'tripal_analysis_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
 
     // tripal_feature theme
     'tripal_feature_analyses' => array(
       'template' => 'tripal_feature_analyses',
       'variables' =>  array('node' => NULL),
-      'path' => "$path/theme/tripal_analysis",
+      'path' => "$path/theme/templates",
     ),
 
   );

+ 1 - 0
tripal_contact/theme/tripal_contact/tripal_contact_base.tpl.php → tripal_contact/theme/templates/tripal_contact_base.tpl.php

@@ -58,6 +58,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_contact-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 0 - 0
tripal_contact/theme/tripal_contact_help.tpl.php → tripal_contact/theme/templates/tripal_contact_help.tpl.php


+ 1 - 0
tripal_contact/theme/tripal_contact/tripal_contact_properties.tpl.php → tripal_contact/theme/templates/tripal_contact_properties.tpl.php

@@ -49,6 +49,7 @@ if (count($properties) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_contact-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_contact/theme/tripal_contact/tripal_contact_publications.tpl.php → tripal_contact/theme/templates/tripal_contact_publications.tpl.php

@@ -69,6 +69,7 @@ if (count($pubauthor_contacts) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_contact-table-publications',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 2 - 0
tripal_contact/theme/tripal_contact/tripal_contact_relationships.tpl.php → tripal_contact/theme/templates/tripal_contact_relationships.tpl.php

@@ -60,6 +60,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
          'rows' => $rows,
          'attributes' => array(
            'id' => 'tripal_contact-table-relationship-object',
+           'class' => 'tripal-data-table'
          ),
          'sticky' => FALSE,
          'caption' => '',
@@ -109,6 +110,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
          'rows' => $rows,
          'attributes' => array(
            'id' => 'tripal_contact-table-relationship-subject',
+           'class' => 'tripal-data-table'
          ),
          'sticky' => FALSE,
          'caption' => '',

+ 0 - 0
tripal_contact/theme/tripal_contact/tripal_contact_teaser.tpl.php → tripal_contact/theme/templates/tripal_contact_teaser.tpl.php


+ 7 - 7
tripal_contact/tripal_contact.module

@@ -135,37 +135,37 @@ function tripal_contact_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_contact_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_contact_base',
-      'path' => "$path/theme/tripal_contact",
+      'path' => "$path/theme/templates",
     ),
     'tripal_contact_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_contact_properties',
-      'path' => "$path/theme/tripal_contact",
+      'path' => "$path/theme/templates",
     ),
     'tripal_contact_relationships' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_contact_relationships',
-      'path' => "$path/theme/tripal_contact",
+      'path' => "$path/theme/templates",
     ),
     'tripal_contact_publications' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_contact_publications',
-      'path' => "$path/theme/tripal_contact",
+      'path' => "$path/theme/templates",
     ),
     'tripal_contact_help' => array(
       'template' => 'tripal_contact_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
     'tripal_contact_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_contact_teaser',
-      'path' => "$path/theme/tripal_contact",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 1 - 1
tripal_core/includes/custom_tables.inc

@@ -140,7 +140,7 @@ function tripal_custom_tables_list() {
   $table = array(
     'header' => $header,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => FALSE,
     'caption' => '',
     'colgroups' => array(),

+ 2 - 2
tripal_core/includes/jobs.inc

@@ -207,7 +207,7 @@ function tripal_jobs_report() {
   $table = array(
     'header' => $header,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => FALSE,
     'caption' => '',
     'colgroups' => array(),
@@ -308,7 +308,7 @@ function tripal_jobs_view($job_id) {
   $table = array(
     'header' => $header,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => FALSE,
     'caption' => '',
     'colgroups' => array(),

+ 2 - 2
tripal_core/includes/mviews.inc

@@ -114,7 +114,7 @@ function tripal_mview_report($mview_id) {
   $table = array(
     'header' => $header,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => FALSE,
     'caption' => '',
     'colgroups' => array(),
@@ -178,7 +178,7 @@ function tripal_mviews_report() {
   $table = array(
     'header' => $header,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => FALSE,
     'caption' => '',
     'colgroups' => array(),

+ 0 - 0
tripal_core/theme/node--chado-generic.tpl.php → tripal_core/theme/templates/node--chado-generic.tpl.php


+ 0 - 0
tripal_core/theme/tripal_core_customize.tpl.php → tripal_core/theme/templates/tripal_core_customize.tpl.php


+ 0 - 0
tripal_core/theme/tripal_core_customtables_help.tpl.php → tripal_core/theme/templates/tripal_core_customtables_help.tpl.php


+ 0 - 0
tripal_core/theme/tripal_core_jobs_help.tpl.php → tripal_core/theme/templates/tripal_core_jobs_help.tpl.php


+ 0 - 0
tripal_core/theme/tripal_core_mviews_help.tpl.php → tripal_core/theme/templates/tripal_core_mviews_help.tpl.php


+ 3 - 3
tripal_core/tripal_core.module

@@ -420,7 +420,7 @@ function tripal_core_theme($existing, $type, $theme, $path) {
     'tripal_core_customize' => array(
       'arguments' => array('job_id' => NULL),
       'template' => 'tripal_core_customize',
-      'path' => "$path/theme"
+      'path' => "$path/theme/templates"
     ),
     'theme_file_upload_combo' => array(
       'render element' => 'element',
@@ -431,12 +431,12 @@ function tripal_core_theme($existing, $type, $theme, $path) {
     'tripal_core_jobs_help' => array(
       'template' => 'tripal_core_jobs_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme"
+      'path' => "$path/theme/templates"
     ),
     'tripal_core_customtables_help' => array(
       'template' => 'tripal_core_customtables_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme"
+      'path' => "$path/theme/templates"
     ),
 
     // Chado Node API Themes

+ 0 - 0
tripal_cv/theme/tripal_cv_help.tpl.php → tripal_cv/theme/templates/tripal_cv_help.tpl.php


+ 1 - 1
tripal_cv/tripal_cv.module

@@ -336,7 +336,7 @@ function tripal_cv_theme($existing, $type, $theme, $path) {
     'tripal_cv_help' => array(
       'template' => 'tripal_cv_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme/"
+      'path' => "$path/theme/templates"
     )
   );
 

+ 0 - 0
tripal_db/theme/tripal_db_help.tpl.php → tripal_db/theme/templates/tripal_db_help.tpl.php


+ 1 - 1
tripal_db/tripal_db.module

@@ -142,7 +142,7 @@ function tripal_db_theme($existing, $type, $theme, $path) {
     'tripal_db_help' => array(
       'template' => 'tripal_db_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme/"
+      'path' => "$path/theme/templates"
     )
   );
   return $items;

+ 118 - 0
tripal_example/README.txt

@@ -0,0 +1,118 @@
+This module is provided as a template for creating a custom Tripal Extension 
+Module for Drupal 7 and Tripal 2.x.
+
+Drupal does provide quite a bit of documentation on its website at 
+http://www.drupal.org but the easiest way to learn to program a Drupal module
+is to purchase the following book:
+
+  Tomlinson, VanDyk.  Pro Drupal Development. 2010. ISBN-13: 978-1430228387
+
+But this quick link can help get you started:
+
+  https://drupal.org/developing/modules/7
+
+Briefly, to create a Drupal module you must
+ 
+1) Create a directory to house all of your module's files
+2) Create a .info inside of the directory which provides information about your
+   module to Drupal
+3) Create a .module file which contains the functions used by your module
+4) Create a .install file which contains the functions used for installation,
+   enabling, disabling and uninstallation of your module.
+
+Examine the example functions and documentation in each of the files in this
+example module to learn how Tripal uses the Drupal API.
+
+-------------------------
+DIRECTORY AND FILE NAMING
+-------------------------
+When creating your Tripal Extension module, the following directory structure
+and file naming is suggested:
+
+For the required files:
+[module dir]/[module name].info
+[module dir]/[module name].module
+[module dir]/[module name].install
+
+If you want to include Drush commands for your module
+[module dir]/[module name].drush.inc
+
+If you want to integrate with Drupal Views 3.x:
+[module dir]/[module name].views.inc
+[module dir]/[module name].views_default.inc
+
+
+Include Files
+-------------
+To limit the size of files, some functionality can be placed inside of 
+"include" files. Include files are placed inside of an 'includes' directory.
+[module dir]/includes
+
+If your module creates a node type that uses data housed in Chado, you should 
+place all of the Drupal hooks for nodes inside of an include named:
+[module dir]/includes/[module name].chado_node.inc
+
+If your module has an administrative interface, all of the functions related to
+administration should go in an include file named:
+[module dir]/includes/[module name].admin.inc
+
+All other include files should be named in the following way:
+[module dir]/includes/[module name].[function].inc
+
+where [function] is a brief description of the functionality provided by the
+include file.  Please only use underscores inside of the [function] (no dashes
+or periods).
+
+
+Theme Files
+-------------
+Tripal primarily uses template files for displaying content from Chado. This 
+allows anyone to easily change the way data is displayed without needing to
+delve into the module's source code.  A template typically provides data for
+a single data type (e.g. feature) or association (e.g. properties associated to
+features, or publications associated with featurmaps, etc.).  These template
+files and any JavaScript, CSS or images needed to suppport them are all
+housed inside of a 'theme' directory with the following structure:
+[module dir]/theme
+[module dir]/theme/css      (for CSS files)
+[module dir]/theme/js       (for JS files)
+[module dir]/theme/images   (for images)
+
+All Drupal hooks and functions related to theming of content should go in the
+file named:
+[module dir]/theme/[module name].theme.inc
+
+The functions in that file will typically be functions which directly
+generate content for a page or "preprocess" hooks that prepare variables that
+are passed to templates.
+
+Template files are typically placed inside of directories named after the 
+Tripal node type to which the template adds content.  For example, the 
+tripal_pub module is responsible for interactions with the publication tables
+of Chado.  It provides it's own 'chado_pub' node type.  But it also adds 
+publication information on feature pages if there is an associated publication.
+Therefore, the tripal_pub/theme/chado_feature directory exists and 
+contains the templates responsible for adding content to the 'chado_feature' 
+node type !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Template files are named in the following way
+[module dir]/theme/[template dir]/[module name]_[function].tpl.php.
+
+Notice that templates have an underscore separating the [module name] from the
+[function].  Typically a period is used (as with include files) but for
+backwards compatibility the undescores are kept.
+
+API Files
+---------
+If your module will provide a set of functions that can be used as an 
+Application Programming Intervace (API), then those functions should be placed 
+in files housed in the 'api' directory:
+[module dir]/api
+
+When creating API functions try to organize them into groups of related function
+and separate them into files by function with the following nameing:
+[module dir]/api/[module name].[function].api.inc
+
+
+
+

+ 337 - 268
tripal_example/includes/tripal_example.chado_node.inc

@@ -7,40 +7,48 @@
  */
 
 /**
- *  Implementation of hook_node_info().  This hook provides information to drupal
- *  about any node types that are being created by this module. If your module
- *  does not create any node types then this function is not required.
+ *  Implementation of hook_node_info().  
+ *  
+ *  This hook provides information to drupal about any node types that are being 
+ *  created by this module. If your module does not create any node types then 
+ *  this function is not required.
  *
  * @ingroup tripal_example
  */
 function tripal_example_node_info() {
   $nodes = array();
 
-  //$nodes['chado_example'] = array(
-  //  'name'        => t('Example'),
-  //  'base'        => 'chado_example',
-  //  'description' => t('A example from the chado database'),
-  //  'has_title'   => TRUE,
-  //  'locked'      => TRUE
-  // This section of the node type array specifies how Tripal will sync the node
-  // types with data in Chado. When Drupal creates a node it has no way of
-  // coordinating which node belongs to which record in Chado. Therefore,
-  // Tripal maintains tables in the Drupal schema that maps Drupal nodes
-  // to recrords in Chado.  Syncing is the process of creating Drupal nodes
-  // and linking them to the appropriate record.
-  //  'chado_node_api' => array(
-  //    'base_table' => 'example',       // the base table name (e.g. feature, example, contact)
-  //    'hook_prefix' => 'chado_example',// the node type hook prefix
-  //    'record_type_title' => array(
-  //      'singular' => t('Library'),    // how to refer to the record
-  //      'plural' => t('Libraries')     // how to refer to the record in plurals
-  //    ),
-  //    'sync_filters' => array(
-  //      'type_id' => TRUE,             // if the record has a type_id set to TRUE
-  //      'organism_id' => TRUE          // if the record has an organism_id set to TRUE
-  //    ),
-  //  )
-  //);
+  // EXPLANATION: this array describes all of the node types that are created
+  // by this module. For many Tripal modules (e.g. tripal_example, tripal_stock,
+  // tripal_library, tripal_pub, etc.) new node types are created. It is
+  // customary to name all new node types that interact with data in Chado
+  // with a 'chado_' prefix.  
+  
+  $nodes['chado_example'] = array(
+    'name'        => t('Example'),
+    'base'        => 'chado_example',
+    'description' => t('A record from the fake chado example table'),
+    'has_title'   => TRUE,
+    'locked'      => TRUE,
+    // EXPLANATION: This section of the node type array specifies how Tripal will sync the node
+    // types with data in Chado. When Drupal creates a node it has no way of
+    // coordinating which node belongs to which record in Chado. Therefore,
+    // Tripal maintains tables in the Drupal schema that maps Drupal nodes
+    // to recrords in Chado.  Syncing is the process of creating Drupal nodes
+    // and linking them to the appropriate record.
+    'chado_node_api' => array(
+      'base_table' => 'example',       // the base table name (e.g. example, example, contact)
+      'hook_prefix' => 'chado_example',// the node type hook prefix
+      'record_type_title' => array(
+        'singular' => t('Example'),    // how to refer to the record
+        'plural' => t('Examples')      // how to refer to the record in plurals
+      ),
+      'sync_filters' => array(
+        'type_id' => TRUE,             // if the record has a type_id set to TRUE
+        'organism_id' => TRUE          // if the record has an organism_id set to TRUE
+      ),
+    )
+  );
 
   return $nodes;
 }
@@ -65,7 +73,9 @@ function chado_example_node_access($node, $op, $account) {
   if (is_object($node)) {
     $node_type = $node->type;
   }
-  
+  // EXPLANATION:  in the tripal_example_permissions() function we 
+  // created the permission types that are used here to check for 
+  // access permissions to the 'chado_exmaple' node type.
   if($node_type == 'chado_example') {
     if ($op == 'create') {
       if (!user_access('create chado_example content', $account)) {
@@ -93,15 +103,27 @@ function chado_example_node_access($node, $op, $account) {
 }
 
 /**
- * Implementation of hook_form() when a node type of chado_example is defined.
- * If a node type is not defined then this function is not needed. The table
- * name in chado for this example module is named 'example' so there is a
- * corresponding example_id in that table (similar to feature.feature_id,
- * contact.contact_id, etc).
+ * Implementation of hook_form() 
+ * 
+ * Creates the form for editing or inserting a record 
  *
  * @ingroup tripal_example
  */
 function chado_example_form($node, &$form_state) {
+  
+  // EXPLANATION: This function should construct a form array that is used
+  // by Drupal to contruct a form for inserting or editing our new node type.
+  // See this page for information about the Form API:
+  // https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7
+  //
+  // The code below is laid out in the following order
+  // 1) Set default values
+  // 2) Add form elements used by this node type
+  // 3) Use the Tripal API to add form elemetns for properties, 
+  //    dbxref's and relationships
+  //
+  // For the example code below we assume that the fake 'example' table
+  // only has a uniquename, organism_id, type_id and example_id.
 
   $form = array();
 
@@ -116,37 +138,72 @@ function chado_example_form($node, &$form_state) {
   // set form field defaults
 
 
-  // if we are editing an existing node then the example is already part of the node
+  // SET FORM DEFAULTS
+  //---------------------------------------------
+  
+  // if we are editing an existing node then the 'example' record from Chado
+  // is already part of the node, so we set the defaults from that object
   if (property_exists($node, 'example')) {
-    // $example = $node->example;
-    // $example = chado_expand_var($example, 'field', 'example.residues');
-    // $example_id   = $example->example_id;
-    // $uniquename   = $example->uniquename;
+    $example = $node->example;
+    $example = chado_expand_var($example, 'field', 'example.residues');
+    $example_id   = $example->example_id;
+    $uniquename   = $example->uniquename;
 
     // keep track of the example id
-    //$form['example_id'] = array(
-    //  '#type' => 'value',
-    //  '#value' => $example_id,
-    //);
+    $form['example_id'] = array(
+      '#type' => 'value',
+      '#value' => $example_id,
+    );
   }
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
-    // $uniquename   = $form_state['values']['uniquename'];
+     $uniquename   = $form_state['values']['uniquename'];
+     $example_type = $form_state['values']['example_type'];
 
   }
   // if we are re building the form from after submission (from ajax call) then
   // the values are in the $form_state['input'] array
   if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
-    // $uniquename   = $form_state['input']['uniquename'];
-
+     $uniquename   = $form_state['input']['uniquename'];
+     $example_type = $form_state['input']['example_type'];
   }
+    
   
-  // NOTE: if the table has a 'type_id' column, be sure to use the 
-  // tripal_get_default_cv('example', 'type_id') to get the site's 
-  // default vocabulary.
+  // FORM ELEMENTS 
+  //---------------------------------------------
+  $form['uniquename']= array(
+    '#type' => 'textfield',
+    '#title' => t('Unique Name'),
+    '#required' => TRUE,
+    '#default_value' => $uniquename,
+    '#description' => t('Enter a unique name for this example.  This name must be unique.'),
+    '#maxlength' => 255
+  );
   
-
+  // for the type_id we want to use the default vocabulary so that this
+  // field can have autocomplete functionality
+  $type_cv = tripal_get_default_cv('example', 'type_id');
+  $cv_id = $type_cv->cv_id;
+  $form['example_type'] = array(
+    '#title'       => t('Feature Type'),
+    '#type'        => 'textfield',
+    '#description' => t("Choose the example type."),
+    '#required'    => TRUE,
+    '#default_value' => $example_type,
+    '#autocomplete_path' => "admin/tripal/chado/tripal_cv/cvterm/auto_name/$cv_id",
+  );
+  
+  // add a select box of organisms
+  $organisms = tripal_get_organism_select_options();
+  $form['organism_id'] = array(
+    '#title'       => t('Organism'),
+    '#type'        => t('select'),
+    '#description' => t("Choose the organism with which this example is associated"),
+    '#required'    => TRUE,
+    '#default_value' => $organism_id,
+    '#options'     => $organisms,
+  );
 
   // PROPERTIES FORM
   //---------------------------------------------
@@ -198,6 +255,10 @@ function chado_example_form($node, &$form_state) {
 /**
  * Implementation of hook_validate
  *
+ * This function validates a form prior to insert or update. If an error 
+ * is detected, it sets the error using form_set_error() which takes the
+ * user back to the form to make corrections.
+ * 
  * This validation is being used for three activities:
  *   CASE A: Update a node that exists in both drupal and chado
  *   CASE B: Synchronizing a node from chado to drupal
@@ -222,20 +283,20 @@ function chado_example_validate($node, $form, &$form_state) {
   }
 
   // be sure to always trim text fields
-  // $node->uniquename   = trim($node->uniquename);
+  $node->uniquename   = trim($node->uniquename);
   
   // Validating for an update. If the 'nid' property is present in the node then
   // this is an update and validation can be different for updates
   if (property_exists($node, 'nid')) {
 
     // if there is a problem with a field then you can set an error on the form
-    // form_set_error('uniquename', t("example update cannot proceed. The example name '$node->uniquename' is not unique for this organism. Please provide a unique name for this example."));
+    form_set_error('uniquename', t("example update cannot proceed. The example name '$node->uniquename' is not unique for this organism. Please provide a unique name for this example."));
   }
   // Validating for an insert
   else {
 
     // if there is a problem with a field then you can set an error on the form
-    // form_set_error('uniquename', t("example insert cannot proceed. The example name '$node->uniquename' already exists for this organism. Please provide a unique name for this example."));
+    form_set_error('uniquename', t("example insert cannot proceed. The example name '$node->uniquename' already exists for this organism. Please provide a unique name for this example."));
   }
 }
 
@@ -256,81 +317,75 @@ function chado_example_validate($node, $form, &$form_state) {
  */
 function chado_example_insert($node) {
   // be sure to always trim text fields
-  //$node->uniquename   = trim($node->uniquename);
+  $node->uniquename   = trim($node->uniquename);
 
   // if there is an example_id in the $node object then this must be a sync so
   // we can skip adding the example as it is already there, although
   // we do need to proceed with the rest of the insert
   if (!property_exists($node, 'example_id')) {
 
-    // ADD TO CHADO
-
-    // * Example Table *
     // perform the insert using the tripal_core_chado_insert function();
-    //$values = array(
-    //  'uniquename' => $node->uniquename,
-    //  'residues' => $residues,
-    //);
-    //$example = chado_select_record('example', array('*'), $values);
-    //if (!$example) {
-    //  drupal_set_message(t('Unable to add example.'), 'warning');
-    //  tripal_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
-    //    array('%values' => print_r($values, TRUE)));
-    //  return;
-    //}
+    $values = array(
+      'uniquename' => $node->uniquename,
+      'residues' => $residues,
+    );
+    $example = chado_select_record('example', array('*'), $values);
+    if (!$example) {
+      drupal_set_message(t('Unable to add example.'), 'warning');
+      tripal_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
+        array('%values' => print_r($values, TRUE)));
+      return;
+    }
 
     // get the example_id for linking Drupal node with Chado data
-    // $example_id = $example->example_id;
+    $example_id = $example->example_id;
 
     // Only add to other chado tables if the base record was inserted properly
     if ($example_id > 0) {
 
-      // * Properties Form *
       // If you implemented the properties form in chado_example_form then you need to
       // handle inserting these properties into your chado prop table.
-      // $details = array(
-      //   'property_table' => 'exampleprop',   // the name of the prop table
-      //   'base_table' => 'example',           // the name of your chado base table
-      //   'foreignkey_name' => 'example_id',   // the name of the key in your base table
-      //   'foreignkey_value' => $example_id    // the value of the example_id key
-      // );
-      // chado_update_node_form_properties($node, $details);
-
-      // * Additional DBxrefs Form *
+      $details = array(
+        'property_table' => 'exampleprop',   // the name of the prop table
+        'base_table' => 'example',           // the name of your chado base table
+        'foreignkey_name' => 'example_id',   // the name of the key in your base table
+        'foreignkey_value' => $example_id    // the value of the example_id key
+      );
+      chado_update_node_form_properties($node, $details);
+
       // If you implemented the dbxrefs form in chado_example_form then you need to
       // handle inserting these database references into your chado _dbxref table.
-      // $details = array(
-      //   'linking_table' => 'example_dbxref',   // the name of your _dbxref table
-      //   'foreignkey_name' => 'example_id',     // the name of the key in your base table
-      //   'foreignkey_value' => $example_id      // the value of the example_id key
-      // );
-      // chado_update_node_form_dbxrefs($node, $details);
-
-      // * Relationships Form *
+      $details = array(
+        'linking_table' => 'example_dbxref',   // the name of your _dbxref table
+        'foreignkey_name' => 'example_id',     // the name of the key in your base table
+        'foreignkey_value' => $example_id      // the value of the example_id key
+      );
+      chado_update_node_form_dbxrefs($node, $details);
+
       // If you implemented the relationships form in chado_example_form then you need to
       // handle inserting these relationships into your chado _relationship table.
-      // $details = array(
-      //   'relationship_table' => 'example_relationship',  // name of the _relationship table
-      //   'foreignkey_value' => $example_id                // value of the example_id key
-      // );
-      // chado_update_node_form_relationships($node, $details);
+      $details = array(
+        'relationship_table' => 'example_relationship',  // name of the _relationship table
+        'foreignkey_value' => $example_id                // value of the example_id key
+      );
+      chado_update_node_form_relationships($node, $details);
     }
   }
   else {
     // the node has an example_id so get it for linking Drupal node with Chado data
-    // $example_id = $node->example_id;
+    $example_id = $node->example_id;
   }
 
   // Make sure the entry for this example doesn't already exist in the
   // chado_example table if it doesn't exist then we want to add it.
   // $check_org_id = chado_get_id_from_nid('example', $node->nid);
-  //if (!$check_org_id) {
-  //  $record = new stdClass();
-  //  $record->nid = $node->nid;
-  //  $record->vid = $node->vid;
-  //  $record->example_id = $example_id;
-  //  drupal_write_record('chado_example', $record);
-  //}
+  if (!$check_org_id) {
+    $record = new stdClass();
+    $record->nid = $node->nid;
+    $record->vid = $node->vid;
+    $record->example_id = $example_id;
+    drupal_write_record('chado_example', $record);
+  }
 }
 
 /**
@@ -345,53 +400,50 @@ function chado_example_insert($node) {
  */
 function chado_example_update($node) {
   // be sure to always trim text fields
-  // $node->uniquename   = trim($node->uniquename);
+  $node->uniquename   = trim($node->uniquename);
 
   // use the chado_update_record() function to update the record
-  //$match = array(
-  //'example_id' => $example_id,
-  //);
-  //$values = array(
-  //  'uniquename' => $node->uniquename,
-  //);
-  //$options = array('return_record' => TRUE);
-  //$status = chado_update_record('example', $match, $values, $options);
-
-  //if (!$status) {
-  //  drupal_set_message(t('Unable to update example.'), 'warning');
-  //  tripal_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
-  //    array('%values' => print_r($values, TRUE)));
-  //}
-
-  // * Properties Form *
+  $match = array(
+    'example_id' => $example_id,
+  );
+  $values = array(
+    'uniquename' => $node->uniquename,
+  );
+  $options = array('return_record' => TRUE);
+  $status = chado_update_record('example', $match, $values, $options);
+
+  if (!$status) {
+    drupal_set_message(t('Unable to update example.'), 'warning');
+    tripal_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
+      array('%values' => print_r($values, TRUE)));
+  }
+
   // If you implemented the properties form in chado_example_form then you need to
   // handle updating these properties into your chado prop table.
-  // $details = array(
-  //   'property_table' => 'exampleprop',   // the name of the prop table
-  //   'base_table' => 'example',           // the name of your chado base table
-  //   'foreignkey_name' => 'example_id',   // the name of the key in your base table
-  //   'foreignkey_value' => $example_id    // the value of the example_id key
-  // );
-  // chado_update_node_form_properties($node, $details);
-
-  // * Additional DBxrefs Form *
+  $details = array(
+    'property_table' => 'exampleprop',   // the name of the prop table
+    'base_table' => 'example',           // the name of your chado base table
+    'foreignkey_name' => 'example_id',   // the name of the key in your base table
+    'foreignkey_value' => $example_id    // the value of the example_id key
+  );
+  chado_update_node_form_properties($node, $details);
+
   // If you implemented the dbxrefs form in chado_example_form then you need to
   // handle updating these database references into your chado _dbxref table.
-  // $details = array(
-  //   'linking_table' => 'example_dbxref',   // the name of your _dbxref table
-  //   'foreignkey_name' => 'example_id',     // the name of the key in your base table
-  //   'foreignkey_value' => $example_id      // the value of the example_id key
-  // );
-  // chado_update_node_form_dbxrefs($node, $details);
-
-  // * Relationships Form *
+  $details = array(
+    'linking_table' => 'example_dbxref',   // the name of your _dbxref table
+    'foreignkey_name' => 'example_id',     // the name of the key in your base table
+    'foreignkey_value' => $example_id      // the value of the example_id key
+  );
+  chado_update_node_form_dbxrefs($node, $details);
+
   // If you implemented the relationships form in chado_example_form then you need to
   // handle updating these relationships into your chado _relationship table.
-  // $details = array(
-  //   'relationship_table' => 'example_relationship',  // name of the _relationship table
-  //   'foreignkey_value' => $example_id                // value of the example_id key
-  // );
-  // chado_update_node_form_relationships($node, $details);
+  $details = array(
+    'relationship_table' => 'example_relationship',  // name of the _relationship table
+    'foreignkey_value' => $example_id                // value of the example_id key
+  );
+  chado_update_node_form_relationships($node, $details);
 
 }
 /**
@@ -407,7 +459,7 @@ function chado_example_update($node) {
 function chado_example_delete($node) {
 
   // get the example id from the node
-  //$example_id  = chado_get_id_from_nid('example', $node->nid);
+  $example_id  = chado_get_id_from_nid('example', $node->nid);
 
   // if we don't have a example id for this node then this isn't a node of
   // type chado_example or the entry in the chado_example table was lost.
@@ -417,13 +469,13 @@ function chado_example_delete($node) {
 
   // remove the entry in the chado_exapmle table linking the deleted
   // Drupal node with the data in chado
-  // $sql_del = "DELETE FROM {chado_example} WHERE nid = :nid AND vid = :vid";
-  // db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  $sql_del = "DELETE FROM {chado_example} WHERE nid = :nid AND vid = :vid";
+  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
 
   // Remove data from example tables of chado database.  This will
   // cause a cascade delete and remove all data in referencing tables
   // for this example
-  // chado_query("DELETE FROM {example} WHERE example_id = :example_id", array(':example_id' => $example_id));
+  chado_query("DELETE FROM {example} WHERE example_id = :example_id", array(':example_id' => $example_id));
 
   // inform the user that the data was deleted
   drupal_set_message(t("The example and all associated data were removed from Chado"));
@@ -433,8 +485,8 @@ function chado_example_delete($node) {
 /**
  * Implementation of hook_load().  This function is necessary to load
  * into the $node object the fields of the table form Chado. For example
- * for the feature table, the chado_feature_load() function adds in
- * a feature object which contains all of the fields and sub objects
+ * for the example table, the chado_example_load() function adds in
+ * a example object which contains all of the fields and sub objects
  * for data in tables with foreign key relationships.
  *
  * This function is not required if the hook_node_info() does not define
@@ -443,22 +495,26 @@ function chado_example_delete($node) {
  * @ingroup tripal_example
  */
 function chado_example_load($nodes) {
+  
+  // EXPLANATION: when displaying or node or accessing the node in a template
+  // we need the data from Chado.  This fucntion finds the record in Chado that 
+  // this node belongs to and adds the record.
 
   // there may be multiple nodes that get passed in so we have to iterate through
   // them all
   foreach ($nodes as $nid => $node) {
     // find the example and add in the details
-    //$example_id = chado_get_id_from_nid('example', $nid);
+    $example_id = chado_get_id_from_nid('example', $nid);
 
     // if the nid does not have a matching record then skip this node.
     // this can happen with orphaned nodes.
-    //if (!$example_id) {
-    //  continue;
-    //}
+    if (!$example_id) {
+      continue;
+    }
     
     // build the example variable by using the chado_generate_var() function
-    //$values = array('example_id' => $example_id);
-    //$example = chado_generate_var('example', $values);
+    $values = array('example_id' => $example_id);
+    $example = chado_generate_var('example', $values);
 
     // for fields in the table that are of type 'text' you may want to include those
     // by default, the tripal_core_generate_chado_var does not include text fields as
@@ -468,180 +524,193 @@ function chado_example_load($nodes) {
     // include it here using the chado_expand_var() function.  In most
     // cases it is probably best to let the end-user decide if text fields should
     // be included by using this function in the templates.
-    //$example = chado_expand_var($example, 'field', 'example.residues');
+    $example = chado_expand_var($example, 'field', 'example.residues');
 
     // add the new example object to this node.
-    //$nodes[$nid]->example = $example;
+    $nodes[$nid]->example = $example;
   }
 }
 
 /**
- * Implementation of hook_node_presave().  This node is useful for
- * making changes to the node prior to it being saved to the database.
- * One useful case for this is to set the title of a node. In some cases
- * such as for the organism module, the title will be set depending on
- * what genus and species is provided. This hook can allow the title to
- * be set using user supplied data before the node is saved.  In practice
- * any change can be made to any fields in the node object.
- *
- * This function is not required. You probably won't need it if you
- * don't define a custom node type in the hook_node_info() function. But
- * it is node type agnostic, so you can use this function to change the
- * contents of any node regardless of it's type.
+ * Implementation of hook_node_presave().
+ * 
+ * Performs actions on a node object prior to it being saved
  *
  * @ingroup tripal_example
  */
 function tripal_example_node_presave($node) {
 
-  /*
+  // EXPLANATION: This node is useful for
+  // making changes to the node prior to it being saved to the database.
+  // One useful case for this is to set the title of a node. In some cases
+  // such as for the organism module, the title will be set depending on
+  // what genus and species is provided. This hook can allow the title to
+  // be set using user supplied data before the node is saved.  In practice
+  // any change can be made to any fields in the node object.
+  //
+  // This function is not required. You probably won't need it if you
+  //  don't define a custom node type in the hook_node_info() function. But
+  // it is node type agnostic, so you can use this function to change the
+  // contents of any node regardless of it's type.
+  
   // set the node title
   switch ($node->type) {
     case 'chado_example':
-      // for a form submission the 'examplename' field will be set,
+      // for a form submission the 'uniquename' field will be set,
       // for a sync, we must pull from the example object
-      if (property_exists($node, 'examplename')) {
+      if (property_exists($node, 'uniquename')) {
         // set the title
-        $node->title = $node->examplename;
+        $node->title = $node->uniquename;
       }
       else if (property_exists($node, 'example')) {
-        $node->title = $node->example->name;
+        $node->title = $node->example->uniquename;
       }
       break;
   }
-  */
 }
 
 /**
- * Implementation of hook node_insert().  This function is used
- * after any a node is inserted into the database.  It is different
- * from the hook_insert() function above in that it is called after
- * any node is saved, regardlesss of it's type. This function is useful
- * for making changes to the database after a node is inserted when you
- * can't edit the hook_insert() function of a node not defined by this
- * module, or to access values of a node when have not yet been saved.
- * An example comes from the tripal_feature module where the URL alias
- * of a node cannot be set in the hook_insert() function. Therefore
- * the tripal_feature module uses this function to set the url path
- * of a newly inserted feature node.
- *
- * This function is not required. You probably won't need it if you
- * don't define a custom node type in the hook_node_info() function. But
- * it is node type agnostic, so you can use this function to do any
- * activity after insert of a node.
+ * Implementation of hook node_insert(). 
+ * 
+ * Performs actions after any node has been inserted. 
  *
  * @ingroup tripal_example
  */
 function tripal_example_node_insert($node) {
-
-  // set the URL path after inserting.  We do it here because we do not know the
-  // example_id in the presave and cannot do it in the hook_insert()
-  //switch ($node->type) {
-  //  case 'chado_example':
-  //    if (!$node->example_id) {
-  //      $sql = "SELECT * FROM {chado_example} WHERE nid = :nid";
-  //      $chado_example = db_query($sql, array(':nid' => $node->nid))->fetchObject();
-  //      $node->example_id = $chado_example->example_id;
-  //    }
   
-  //    // on an insert we need to add the feature_id to the node object
-  //    // so that the tripal_example_get_example_url function can set the URL properly
-  //    $node->example_id = chado_get_id_from_nid('example', $node->nid);
-
-  //    // remove any previous alias
-  //    db_query("DELETE FROM {url_alias} WHERE source = :source", array(':source' => "node/$node->nid"));
-
-  //    // set the URL for this example page
-  //    $url_alias = tripal_example_get_example_url($node);
-  //    $path_alias = array("source" => "node/$node->nid", "alias" => $url_alias);
-  //    path_save($path_alias);
-  //    break;
-  //}
+  // EXPLANATION: This function is used
+  // after any a node is inserted into the database.  It is different
+  // from the hook_insert() function above in that it is called after
+  // any node is saved, regardlesss of it's type. This function is useful
+  // for making changes to the database after a node is inserted.
+  // An example comes from the tripal_feature module where the URL alias
+  // of a node cannot be set in the hook_insert() function. Therefore
+  // the tripal_feature module uses this function to set the url path
+  // of a newly inserted example node.
+  //
+  // This function is not required. You probably won't need it if you
+  // don't define a custom node type in the hook_node_info() function. But
+  // it is node type agnostic, so you can use this function to do any
+  // activity after insert of any node.
+
+  // the Example code below will set the URL path after inserting.  We do it 
+  // here because we do not know the example_id in the presave and cannot do 
+  // it in the hook_insert()
+  switch ($node->type) {
+    case 'chado_example':
+      
+      // if we do not have an record ID for this node then get it
+      if (!$node->example_id) {
+        $node->example_id = chado_get_id_for_node('example', $node);
+      }
+
+      // set the URL for this example page
+      // see the code in the tripal_feature/includes/tripal_feature.chado_node.inc file
+      // in the function tripal_feature_node_insert for an example of how that
+      // module sets the URL.  It uses a configuration file to allow the user
+      // to dynmically build a URL schema and then uses that schema to generate 
+      // a URL string.
+      break;
+  }
 }
+
 /**
- * Implementation of hook node_update().  This function is used
- * after any a node is updated in the database.  It is different
- * from the hook_update() function above in that it is called after
- * any node is updated, regardlesss of it's type. This function is useful
- * for making changes to the database after a node is updated when you
- * can't perform changes in the hook_upate() function of a node not defined by this
- * module, or to access values of a node when have not yet been updated.
- * An example comes from the tripal_feature module where the URL alias
- * of a node cannot be set in the hook_update() function. Therefore
- * the tripal_feature module uses this function to reset the url path
- * of an updated feature node.
- *
- * This function is not required. You probably won't need it if you
- * don't define a custom node type in the hook_node_info() function. But
- * it is node type agnostic, so you can use this function to do any
- * activity after insert of a node.
+ * Implementation of hook node_update().
+ * 
+ * Performs actions after any node has been updated. 
  *
  */
 function tripal_example_node_update($node) {
 
+  // EXPLANATION: This function is used
+  // after any a node is updated in the database.  It is different
+  // from the hook_update() function above in that it is called after
+  // any node is updated, regardlesss of it's type. 
+  // An example comes from the tripal_feature module where the URL alias
+  // of a node cannot be set in the hook_update() function. Therefore
+  // the tripal_feature module uses this function to reset the url path
+  // of an updated feature node.
+  //
+  // This function is not required. You probably won't need it if you
+  // don't define a custom node type in the hook_node_info() function. But
+  // it is node type agnostic, so you can use this function to do any
+  // activity after insert of a node.
+  
   // add items to other nodes, build index and search results
   switch ($node->type) {
     case 'chado_example':
-      // remove any previous alias
-      //db_query("DELETE FROM {url_alias} WHERE source = :source", array(':source' => "node/$node->nid"));
-
       // set the URL for this example page
-      //$url_alias = tripal_example_get_example_url($node);
-      //$path_alias = array("source" => "node/$node->nid", "alias" => $url_alias);
-      //path_save($path_alias);
+      // see the code in the tripal_feature/includes/tripal_feature.chado_node.inc file
+      // in the function tripal_feature_node_insert for an example of how that
+      // module sets the URL.  It uses a configuration file to allow the user
+      // to dynmically build a URL schema and then uses that schema to generate 
+      // a URL string.
       break;
   }
 }
 /**
- * Implementation of hook_node_view().  This function allows you to
- * add custom content to any node page.  It is node type agnostic.
- * Here we typically use it to add content to our custom node type or
- * to other Tripal node types. Typically for Tripal, a content "block"
- * (e.g. feature properties, feature dbxref, feature pub) has a corresponding
- * template file.  Those template files are first defined to Drupal using
- * the hook_theme() function defined in the tripal_example.module file.  Here
- * we can add items to a node's content by calling those templates as needed.
+ * Implementation of hook_node_view().  
  *
  * @ingroup tripal_example
  */
 function tripal_example_node_view($node, $view_mode, $langcode) {
+  
+  // EXPLANATION: This function defines the content "blocks" that appear 
+  // when thhe node is displayed. It is node type agnostic so we can add
+  // content to any node type.  So, we use this function to add the content
+  // from all of our theme templates onto our new node type. We will also
+  // use this function to add content to other node types.
+          
   switch ($node->type) {
     case 'chado_example':
       // there are different ways a node can be viewed. Primarily Tripal
       // supports full page view and teaser view.
       if ($view_mode == 'full') {
-        // there is always a base template.  This is the template that
-        // is first shown when the example node type is first displayed
-        //$node->content['tripal_example_base'] = array(
-        //  '#markup' => theme('tripal_example_base', array('node' => $node)),
-        //  '#tripal_toc_id'    => 'base',
-        //  '#tripal_toc_title' => 'Overview',
-        //  '#weight' => -100,
-        //);
-        // we can add other templates as well.
-        //$node->content['tripal_example_properties'] = array(
-        //  '#markup' => theme('tripal_example_properties', array('node' => $node)),
-        //  '#tripal_toc_id'    => 'properties',
-        //  '#tripal_toc_title' => 'Properties',
-        //);
-        //$node->content['tripal_example_publications'] = array(
-        //  '#markup' => theme('tripal_example_publications', array('node' => $node)),
-        //  '#tripal_toc_id'    => 'publications',
-        //  '#tripal_toc_title' => 'Publications',
-        //);
-        //$node->content['tripal_example_references'] = array(
-        //  '#markup' => theme('tripal_example_references', array('node' => $node)),
-        //  '#tripal_toc_id'    => 'references',
-        //  '#tripal_toc_title' => 'Cross References',
-        //);
+        
+        // There is always a base template.  This is the template that
+        // is first shown when the example node type is first displayed. 
+        // if you are using the default Tripal node template, then you should
+        // also set two additional items in each array:  tripal_toc_id and
+        // tripal_toc_title.  The tripal_tock_id should be a single unqiue
+        // world that is used to reference the template. This ID is used for
+        // constructing URLs for the content.  The tripal_toc_title contains
+        // the title that should appear in the table of contents for this 
+        // content.  You should only set the '#weight' element for the 
+        // base template (or Overview) to ensure that it appears at the top of
+        // the list. Otherwise items are sorted alphabetically.
+        $node->content['tripal_example_base'] = array(
+          '#markup' => theme('tripal_example_base', array('node' => $node)),
+          '#tripal_toc_id'    => 'base',
+          '#tripal_toc_title' => 'Overview',
+          '#weight' => -100,
+        );
+        // we can add other templates as well for properties, publications,
+        // dbxrefs, etc...
+        $node->content['tripal_example_properties'] = array(
+          '#markup' => theme('tripal_example_properties', array('node' => $node)),
+          '#tripal_toc_id'    => 'properties',
+          '#tripal_toc_title' => 'Properties',
+        );
+        $node->content['tripal_example_references'] = array(
+          '#markup' => theme('tripal_feature_references', array('node' => $node)),
+          '#tripal_toc_id'    => 'references',
+          '#tripal_toc_title' => 'Cross References',
+        );
+        $node->content['tripal_example_relationships'] = array(
+          '#markup' => theme('tripal_feature_relationships', array('node' => $node)),
+          '#tripal_toc_id'    => 'relationships',
+          '#tripal_toc_title' => 'Relationships',
+        );
       }
       // set the content for the teaser view
       if ($view_mode == 'teaser') {
-        //$node->content['tripal_example_teaser'] = array(
-        //  '#value' => theme('tripal_example_teaser', array('node' => $node)),
-        //);
+        // The teaser is also a required template
+        $node->content['tripal_example_teaser'] = array(
+          '#value' => theme('tripal_example_teaser', array('node' => $node)),
+        );
       }
       break;
-    // you can add custom content to any tripal node type by adding
+    // you can add custom content to any node type by adding
     // content to the node in the same way as above.
     case 'chado_organism':
       break;

+ 0 - 0
tripal_example/theme/tripal_example_help.tpl.php → tripal_example/theme/templates/tripal_example_base.tpl.php


+ 8 - 0
tripal_example/theme/templates/tripal_example_help.tpl.php

@@ -0,0 +1,8 @@
+<h3>Module Description:</h3>
+<p>Place details about this module here.</p>
+
+<h3>Setup Instructions:</h3>
+<p>Instructions for setup of this module go here.</p>
+
+<h3>Features of this Module:</h3>
+<p>A description of this module's features go here.</p>

+ 85 - 0
tripal_example/theme/templates/tripal_example_properties.tpl.php

@@ -0,0 +1,85 @@
+<?php
+$pub = $node->pub;
+
+// expand the pub to include the properties.
+$options = array(
+  'return_array' => 1,
+  'order_by' => array('rank' => 'ASC'),
+);
+$pub = tripal_core_expand_chado_vars($pub,'table', 'pubprop', $options);
+$pubprops = $pub->pubprop;
+$properties = array();
+if (is_array($pubprops)) {
+  foreach ($pubprops as $property) {
+    // skip the following properties as those are already on other templates
+    if ($property->type_id->name == 'Abstract' or
+        $property->type_id->name == 'Citation' or
+        $property->type_id->name == 'Publication Dbxref' or
+        $property->type_id->name == 'Authors' or
+        $property->type_id->name == 'Structured Abstract Part')  {
+      continue;
+    }
+    $property = tripal_core_expand_chado_vars($property,'field','pubprop.value');
+    $properties[] = $property;
+  }
+}
+// we'll keep track of the keywords so we can lump them into a single row
+$keywords = array(); 
+
+if (count($properties)) { ?>
+  <div class="tripal_pub-data-block-desc tripal-data-block-desc">Additional details for this publication include:</div> <?php 
+
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Property Name', 'Value');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  $keywords = array();
+  foreach ($properties as $property) {
+    // each keyword is stored as a seperate properties. We want to show them
+    // only in a single field not as a bunc of individual properties, so when we see one, 
+    // save it in an array for later and down't add it yet to the table yet.
+    if ($property->type_id->name == 'Keywords') {
+      $keywords[] = $property->value;
+      continue;
+    }
+    $rows[] = array(
+      $property->type_id->name,
+      $property->value
+    );
+  }
+  // now add in a single row for all keywords
+  if (count($keywords) > 0) {
+    $rows[] = array(
+      'Keywords',
+      implode(', ', $keywords),
+    );
+  } 
+
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-properties',
+      'class' => 'tripal-data-table'
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+}

+ 70 - 0
tripal_example/theme/templates/tripal_example_references.tpl.php

@@ -0,0 +1,70 @@
+<?php
+$pub = $variables['node']->pub;
+
+
+// expand the pub object to include the records from the pub_dbxref table
+$options = array('return_array' => 1);
+$pub = tripal_core_expand_chado_vars($pub, 'table', 'pub_dbxref', $options);
+$pub_dbxrefs = $pub->pub_dbxref;
+
+$references = array();
+if (count($pub_dbxrefs) > 0 ) {
+  foreach ($pub_dbxrefs as $pub_dbxref) {    
+    $references[] = $pub_dbxref->dbxref_id;
+  }
+}
+
+if(count($references) > 0){ ?>
+  <div class="tripal_pub-data-block-desc tripal-data-block-desc">This publication is also available in the following databases:</div><?php 
+  
+  // the $headers array is an array of fields to use as the colum headers.
+  // additional documentation can be found here
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $headers = array('Database', 'Accession');
+  
+  // the $rows array contains an array of rows where each row is an array
+  // of values for each column of the table in that row.  Additional documentation
+  // can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $rows = array();
+  
+  foreach ($references as $dbxref){
+    $database = $dbxref->db_id->name . ': ' . $dbxref->db_id->description;
+    if ($dbxref->db_id->url) {
+      $database = l($dbxref->db_id->name, $dbxref->db_id->url, array('attributes' => array('target' => '_blank'))) . ': ' . $dbxref->db_id->description; 
+    }
+    $accession = $dbxref->db_id->name . ':' . $dbxref->accession;
+    if ($dbxref->db_id->urlprefix) {
+      $accession = l($accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
+    }
+    if (property_exists($dbxref, 'is_primary')) {
+      $accession .= " <i>(primary cross-reference)</i>";
+    }
+    
+    $rows[] = array(
+      $database,
+      $accession
+    );
+  }
+  // the $table array contains the headers and rows array as well as other
+  // options for controlling the display of the table.  Additional
+  // documentation can be found here:
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+  $table = array(
+    'header' => $headers,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'tripal_pub-table-references',
+      'class' => 'tripal-data-table'
+    ),
+    'sticky' => FALSE,
+    'caption' => '',
+    'colgroups' => array(),
+    'empty' => '',
+  );
+  
+  // once we have our table array structure defined, we call Drupal's theme_table()
+  // function to generate the table.
+  print theme_table($table);
+}
+

+ 150 - 0
tripal_example/theme/templates/tripal_example_relationships.tpl.php

@@ -0,0 +1,150 @@
+<?php
+/* Typically in a Tripal template, the data needed is retrieved using a call to
+ * tripal_core_expand_chado_vars function.  For example, to retrieve all 
+ * of the pub relationships for this node, the following function call would be made:
+ * 
+ *   $pub = tripal_core_expand_chado_vars($pub,'table','pub_relationship');
+ * 
+ * However, this function call can be extremely slow when there are numerous relationships.
+ * This is because the tripal_core_expand_chado_vars function is recursive and expands 
+ * all data following the foreign key relationships tree.  Therefore, to speed retrieval
+ * of data, a special variable is provided to this template:
+ * 
+ *   $pub->all_relationships;
+ *   
+ * This variable is an array with two sub arrays with the keys 'object' and 'subject'.  The array with
+ * key 'object' contains relationships where the pub is the object, and the array with
+ * the key 'subject' contains relationships where the pub is the subject
+ */
+$pub = $variables['node']->pub;
+
+$all_relationships = $pub->all_relationships;
+$object_rels = $all_relationships['object'];
+$subject_rels = $all_relationships['subject'];
+
+if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
+  <div class="tripal_pub-data-block-desc tripal-data-block-desc"></div> <?php
+  
+  // first add in the subject relationships.  
+  foreach ($subject_rels as $rel_type => $rels){
+    foreach ($rels as $obj_type => $objects){ ?>
+      <p>This <?php print $pub->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> pub(s): <?php
+       
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Publication');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($objects as $object){
+        // link the pub to it's node
+        $title = $object->record->object_id->title;
+        if (property_exists($object->record, 'nid')) {
+          $title = l($title, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        
+        // get the citation
+        $values = array(
+          'pub_id' => $object->record->object_id->pub_id,
+          'type_id' => array(
+            'name' => 'Citation',
+          ),
+        );
+        $citation = tripal_core_generate_chado_var('pubprop', $values);
+        $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
+        
+        $rows[] = array(
+          $title . '<br>' . htmlspecialchars($citation->value),
+        ); 
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_pub-table-relationship-object',
+           'class' => 'tripal-data-table'
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+  
+  // second add in the object relationships.  
+  foreach ($object_rels as $rel_type => $rels){
+    foreach ($rels as $subject_type => $subjects){?>
+      <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> pub(s) are <?php print $rel_type ?> this <?php print $pub->type_id->name;?>: <?php 
+      // the $headers array is an array of fields to use as the colum headers.
+      // additional documentation can be found here
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $headers = array('Publication');
+      
+      // the $rows array contains an array of rows where each row is an array
+      // of values for each column of the table in that row.  Additional documentation
+      // can be found here:
+      // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+      $rows = array();
+      
+      foreach ($subjects as $subject){
+        // link the pub to it's node
+        $title = $subject->record->subject_id->title;
+        if (property_exists($subject->record, 'nid')) {
+          $title = l($title, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
+        }
+        
+        // get the citation
+        $values = array(
+          'pub_id' => $subject->record->subject_id->pub_id,
+          'type_id' => array(
+            'name' => 'Citation',
+          ),
+        );
+        $citation = tripal_core_generate_chado_var('pubprop', $values);
+        $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
+        
+        $rows[] = array(
+          $title . '<br>' . htmlspecialchars($citation->value),
+        );
+       } 
+       // the $table array contains the headers and rows array as well as other
+       // options for controlling the display of the table.  Additional
+       // documentation can be found here:
+       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
+       $table = array(
+         'header' => $headers,
+         'rows' => $rows,
+         'attributes' => array(
+           'id' => 'tripal_pub-table-relationship-subject',
+           'class' => 'tripal-data-table'
+         ),
+         'sticky' => FALSE,
+         'caption' => '',
+         'colgroups' => array(),
+         'empty' => '',
+       );
+       
+       // once we have our table array structure defined, we call Drupal's theme_table()
+       // function to generate the table.
+       print theme_table($table); ?>
+       </p>
+       <br><?php
+     }
+  }
+}

+ 111 - 0
tripal_example/theme/tripal_example.theme.inc

@@ -1 +1,112 @@
 <?php
+
+/**
+ * @file
+ * 
+ * This file should contain all Drupal hooks for theming content.  For templates 
+ * that need specific the hook_preprocess functions should be included here
+ *
+ */
+
+/**
+ * implementation of hook_preprocess_HOOK()
+ * 
+ * Used to alter or add to theme variables.  The variables are passed into
+ * templates when prossing.  This function organizes the relationships
+ * into more simple structures for parsing in the template file.
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_preprocess_tripal_example_relationships(&$variables) {
+  // EXPLANATION:  If you have implmented a new chado node type and the record
+  // that belongs to the node has a corresponding xxxx_relationship table
+  // this this function can be used to provide relationships to the template
+  // in a format that is easier to parse.  This is one example where specific SQL
+  // statements can improve performance over Tripal API calls.  SQL is not 
+  // recommended inside of template files, but rather the Tripal API calls only.
+  // Therefore, this function queries the relationships and then organizes them
+  // into arrays that are easier and faster to parse.  You should be able to
+  // copy the content of this function 
+  // and adjust as necessary to change table names if your record has relationships.
+
+  $example = $variables['node']->example;
+  
+   // expand the example object to include the example relationships.
+  $options = array(
+    'return_array' => 1,
+    // we don't want to fully recurse we only need information about the
+    // relationship type and the object and subject examples (including example type)
+    'include_fk' => array(
+      'type_id' => 1,
+      'object_id' => array(
+        'type_id' => 1,
+      ),
+      'subject_id'  => array(
+        'type_id' => 1,
+      ),
+    ),
+  );
+  $example = chado_expand_var($example, 'table', 'example_relationship', $options);
+
+  // get the subject relationships
+  $srelationships = $example->example_relationship->subject_id;
+  $orelationships = $example->example_relationship->object_id;
+
+  // combine both object and subject relationshisp into a single array
+  $relationships = array();
+  $relationships['object'] = array();
+  $relationships['subject'] = array();
+
+  // iterate through the object relationships
+  if ($orelationships) {
+    foreach ($orelationships as $relationship) {
+      $rel = new stdClass();
+      $rel->record = $relationship;
+       
+      // get the relationship and child types
+      $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
+      $child_type = $relationship->subject_id->type_id->name;
+       
+      // get the node id of the subject
+      $sql = "SELECT nid FROM {chado_example} WHERE example_id = :example_id";
+      $n = db_query($sql, array(':example_id' => $relationship->subject_id->example_id))->fetchObject();
+      if ($n) {
+        $rel->record->nid = $n->nid;
+      }
+
+      if (!array_key_exists($rel_type, $relationships['object'])) {
+        $relationships['object'][$rel_type] = array();
+      }
+      if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
+        $relationships['object'][$rel_type][$child_type] = array();
+      }
+      $relationships['object'][$rel_type][$child_type][] = $rel;
+    }
+  }
+
+  // now add in the subject relationships
+  if ($srelationships) {
+    foreach ($srelationships as $relationship) {
+      $rel = new stdClass();
+      $rel->record = $relationship;
+      $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
+      $parent_type = $relationship->object_id->type_id->name;
+       
+      // get the node id of the subject
+      $sql = "SELECT nid FROM {chado_example} WHERE example_id = :example_id";
+      $n = db_query($sql, array(':example_id' => $relationship->object_id->example_id))->fetchObject();
+      if ($n) {
+        $rel->record->nid = $n->nid;
+      }
+       
+      if (!array_key_exists($rel_type, $relationships['subject'])) {
+        $relationships['subject'][$rel_type] = array();
+      }
+      if (!array_key_exists($parent_type, $relationships['subject'][$rel_type])) {
+        $relationships['subject'][$rel_type][$parent_type] = array();
+      }
+      $relationships['subject'][$rel_type][$parent_type][] = $rel;
+    }
+  }
+  $example->all_relationships = $relationships;
+}

+ 50 - 0
tripal_example/tripal_example.info

@@ -0,0 +1,50 @@
+;
+; Provide details about your module in this file. Instruction for setup of this
+; file can be found here:  https:;drupal.org/node/542202
+;
+name = Tripal Example
+description = An example module that can be used as a template for anyone wanting to create a custom extension module for Tripal.
+
+;
+; The version of Drupal with which this module is compatible.
+;
+core = 7.x
+
+;
+; The computer-readable name for this module
+;
+project = tripal_example
+
+;
+; In order for this module to appear in the 'Tripal Extensions' section when
+; viewing the module administrative page, the package must be set to 
+; 'Tripal Extensions'
+; 
+package = Tripal Extensions
+
+;
+; Follow these instructions when specifying the version:
+; https:;drupal.org/node/1015226
+; 
+version = 7.x-2.0
+
+;
+; Stylesheets containing CSS that should always be available for the
+; module should be specified here.  
+;
+stylesheets[all][] = theme/css/tripal_feature.css
+
+;
+; Javascript files that should always be available for the
+; module should be specified here.  
+;
+scripts[]          = theme/js/tripal_feature.js
+
+; 
+; Add additional dependencies for other modules using the module project name.
+; These modules must be enabled before this module can be enabled
+;
+dependencies[] = tripal_core
+dependencies[] = tripal_views
+dependencies[] = tripal_db
+dependencies[] = tripal_cv

+ 250 - 0
tripal_example/tripal_example.install

@@ -1 +1,251 @@
 <?php
+/**
+ * @file
+ * Installation of the example module
+ */
+
+/**
+ * Implements hook_disable().
+ *
+ * Perform actions when the module is disabled by the site administrator
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_disable() {
+  
+  // EXPLANATION: If you are using Drupal Views you want to ensure
+  // that any default views that your module provides are disabled
+  // when the module is disabled.  Default views are specified in the 
+  // [module name].views.default.inc file.  The following code will disable
+  // these views.  If your module does not create any default views you
+  // can remove the following code.
+
+  // Disable all default views provided by this module
+  require_once("tripal_example.views_default.inc");
+  $views = tripal_example_views_default_views();
+  foreach (array_keys($views) as $view_name) {
+    tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
+  }
+
+}
+
+/**
+ * Implements hook_requirements().
+ * 
+ * Performs check to see if all required dependencies are met. Drupal will
+ * automatically check for module dependencies but here you can check for 
+ * other requirements. 
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_requirements($phase) {
+   
+  
+  $requirements = array();
+  if ($phase == 'install') {
+    // EXPLANATION: It is essential that Chado be installed for almost all
+    // Tripal modules. Therefore, the following code checks to ensure Chado
+    // is installed and available.  If your module does not require that
+    // Chado be installed, you can remove the following check.
+    
+    // make sure chado is installed
+    if (!$GLOBALS["chado_is_installed"]) {
+      $requirements ['tripal_example'] = array(
+          'title' => "tripal_example",
+          'value' => "ERROR: Chado must be installed before this module can be enabled",
+          'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}
+
+/**
+ * Implements hook_install().
+ * 
+ * Performs actions when the modules is first installed. 
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_install() {
+  
+  // EXPLANATION: If your module will making data publicly available for
+  // download or use by the site you can create the directory using the
+  // tripal_create_files_dir() function.  This will create a directory
+  // in the public access directory which will typcially be in
+  // sites/default/files/tripal/[module name]/
+  
+  // create the module's data directory
+  tripal_create_files_dir('tripal_example');
+
+  // EXPLANATION: Here is a good place to add any materialized views, 
+  // controlled vocabularies CV, databases or CV terms needed by your module.
+  // To keep this module code short, create functions to do each of those
+  // tasks
+  
+  // add any materialized view
+  tripal_example_add_mviews();
+
+  // add any external databases used by the example module.
+  tripal_example_add_dbs();
+  
+  // add any controlled vocabularies used by the example module. You may need
+  // to add a vocabulary if you to set it as default (see next lines of code).
+  // For example, the Sequence Ontology (SO) is used by the feature module as the
+  // default vocabulary for the feature type_id field.  But, that vocabulary
+  // does not yet exist in Chado until after the SO is loaded using the 
+  // Tripal OBO loader.  But, we can add it here as a placeholder so that we can
+  // then set it as a default vocabulary (see below).
+  tripal_example_add_cvs();
+  
+  // EXPLANATION: Many tables in Chado have a 'type_id' column which allows for
+  // association of controlled vocabulries to describe the record.   Chado
+  // places no restrictions on which vocabularies can be used, but Tripal can
+  // be instructed to provide a default vocabulary for any given field. For 
+  // example, the feature.type_id column will typically use the Sequence Ontology
+  // In that case, we can use the tripal_set_default_cv() function to specify
+  // the Sequence Ontology (sequence) as the default vocabulary.  
+  tripal_set_default_cv('example', 'type_id', 'sequence');
+  tripal_set_default_cv('exampleprop', 'type_id', 'example_property');
+  tripal_set_default_cv('example_relationship', 'type_id', 'example_relationship');
+}
+
+/**
+ * Implements hook_uninstall().
+ * 
+ * Performs actions when the modules is uninstalled.
+ * 
+ * @ingroup tripal_example
+ */
+function tripal_example_uninstall() {
+
+}
+
+/**
+ * Implementation of hook_schema().
+ * 
+ * Provides a list of tables to be created inside of the Drupal schema
+ * (the 'public' schema by default). It uses the Drupal Schema API
+ * array structure to define the table, its indexes and constraints.
+ * 
+ * Schema API documentation is here:
+ * https://api.drupal.org/api/drupal/includes%21database%21schema.inc/group/schemaapi/7
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_schema() {
+
+  // EXPLANATION: If your module creates a node type for data in the Chado
+  // database then you probably need to link Drupal nodes with a respective
+  // ID in the Chado table.  The following is an example array for a table
+  // that will link the 'chado_example' node type (created by this example
+  // module) with a record in the fake Chado example table.  This table
+  // will link the 'nid' of the node with the 'example_id' of the eample
+  // record.
+  $schema['chado_example'] = array(
+    'fields' => array(
+      'vid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+       ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+       ),
+      'example_id' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'sync_date' => array(
+        'type' => 'int',
+        'not null' => FALSE,
+        'description' => 'UNIX integer sync date/time'
+      ),
+    ),
+    'indexes' => array(
+      'chado_example_idx1' => array('example_id')
+    ),
+    'unique keys' => array(
+      'chado_example_uq1' => array('nid', 'vid'),
+      'chado_example_uq2' => array('vid')
+    ),
+    'primary key' => array('nid'),
+  );
+
+  return $schema;
+};
+
+/**
+ * Creates a materialized view that stores the type & number of examples per organism
+ *
+ * @ingroup tripal_example
+ */
+function tripal_example_add_mviews() {
+  
+  // EXPLANATION: use the tripal_add_mview() function to add a materialized
+  // view needed by your module.  If you have more than one materialized view
+  // it is best to create a single function for each one and call each
+  // function here. Otherwise this function can become quite long.
+  
+}
+/**
+ * Add cvs related to publications
+ *
+ * @ingroup tripal_pub
+ */
+function tripal_example_add_cvs() {
+
+  // EXPLANATION: use the tripal_cv_add_cv() function to add any 
+  // controlled vocabularies needed by your module.  If the vocabulary already
+  // exists then the function will gracefully return.  
+}
+
+/**
+ * This is the required update for tripal_example.
+ */
+function tripal_example_update_7200() {
+  // EXPLANATION: as you create new releases of your module you may find that 
+  // tables your module created, or data may need to be adjusted. This function 
+  // allows you to do that. This function is executed using the 
+  // http://[your site]/update.php  URL or using the drush command 'updatedb'.
+  // This function should be named according to the instructions provided here: 
+  // https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
+  //
+  // It is best not to use Tripal API calls inside of this function because an 
+  // upgarde from Drupal 6 to Drupal 7 requires that all modules be disabled
+  // which means the Tripal API is not available.  This is an unfortunate
+  // requirement, but will prevent errors during a major upgrade.
+
+  // it is good to wrap any database changes inside of a try catch block:
+  try {
+   // perform database changes
+  }
+  catch (\PDOException $e) {
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not apply updates: '. $error);
+  }
+}
+
+/**
+ * Implementation of hook_update_dependencies().  It specifies a list of
+ * other modules whose updates must be run prior to this one.
+ */
+function tripal_example_update_dependencies() {
+  $dependencies = array();
+
+  // EXPLANATION: here we can specify which modules must be updated prior
+  // to applying the updates in this module.  This is useful because it
+  // prevents updates from being executed out of order.  The following 
+  // example code shows that the 'tripal_example' module update number 7200
+  // must be executed after the 'tripal_cv' module's 7200 update. 
+  $dependencies['tripal_example'][7200] = array(
+    'tripal_cv' => 7200
+  );
+
+  return $dependencies;
+}

+ 163 - 59
tripal_example/tripal_example.module

@@ -8,26 +8,31 @@
  *
  */
 
-/* 
-// include any files that might be required
+// EXPLANATION: include any files needed for this module.  That includes any 
+// API file, the theme file, or include files.
 require('api/tripal_example.api.inc');
 require('theme/tripal_example.theme.inc');
 require('includes/tripal_example.admin.inc');
 require('includes/tripal_example.chado_node.inc');
-*/
-
-
 
 
 /**
- * Set the permission types that the chado module uses.  Essentially we
- * want permissionis that protect creation, editing and deleting of chado
- * data objects
- *
+ * Implementation of hook_permissions()
+ * 
+ * Set the permission types that this module uses.
+ * 
  * @ingroup tripal_example
  */
 function tripal_example_permisssions() {
-  /*
+  
+  // EXPLANATION:  here we want to setup any of the permission types
+  // that this module needs.  Our exmample module creates a new
+  // chado node type called 'chado_example'.  Therefore, we need 
+  // permissions to view, edit, delete, create our new node type.  Additionally,
+  // we want to add a permission that allows for administration of this 
+  // module.  These permissions will appear in the 'People' -> 'Permissions'
+  // configuration page and allow the site admin to specify which user roles
+  // are allowed to perform specific actions.
   return array(
     'access chado_example content' => array(
       'title' => t('View Examples'),
@@ -50,22 +55,37 @@ function tripal_example_permisssions() {
       'description' => t('Allow users to administer all examples.'),
     ),
   );
-  */
 }
 
 /**
- * Menu items are automatically added for the new node types created
- * by this module to the 'Create Content' Navigation menu item.  This function
- * adds more menu items needed for this module.
+ * Implements hook_menu()
+ * 
+ * Specifies menu items and URLs used by this module.
  *
  * @ingroup tripal_example
  */
 function tripal_example_menu() {
   $items = array();
   
-  /*
-  // The administative settings menu
-  $items['admin/tripal/chado/tripal_example'] = array(
+  // EXPLANATION:  the $items array should be popluated to contain a list of 
+  // menu items or URL callbacks that our module needs.  
+  // all Tripal Extension modules shoudl provide at least these menu items:
+  //  * A menu item for an administrative home page
+  //  * A menu item for 'Help' documentation
+  //  * A menu item for a module configuration page
+  //
+  // Additionally, if your module defines a custom node type that is linked
+  // to a record in Chado:
+  //  * A menu item for syncing drupal nodes with Chado records.   
+  //    
+  
+  // EXPLANATION:  all extension modules should have an administrative menu item
+  // with the path set to 'admin/tripal/extesion/[module name]'.  This will
+  // place the menu item in the 'Tripal' -> 'Extesion Modules' page.  Because this
+  // is an administrative menu item we must be sure to set the 'access arguments'
+  // to be 'administer tripal example' which is a permission type we created
+  // in the tripal_example_permissions() function above.
+  $items['admin/tripal/extension/tripal_example'] = array(
     'title' => 'Examples',
     'description' => 'Any example.',
     'page callback' => 'tripal_example_admin_examples_listing',
@@ -73,6 +93,14 @@ function tripal_example_menu() {
     'type' => MENU_NORMAL_ITEM,
   );
 
+  // EXPLANATION: all extension modules should provide help documentation to 
+  // describe the functionality of the module and any installation or setup
+  // tasks that may be required.  The menu 'type' is MENU_LOCAL_TASK so that
+  // the link appears in a tab on the extension module's administrative page.
+  // here the 'page callback' specifies that we are using Drupal's theme 
+  // function and the 'page_arguments' indicate the name of the template file
+  // Thus, all help documentation should be provided in the 
+  // [module name]/theme/tripal_example_help.tpl.php file. 
   $items['admin/tripal/chado/tripal_example/help'] = array(
     'title' => 'Help',
     'description' => 'Basic Description of Tripal Library Module Functionality',
@@ -83,6 +111,15 @@ function tripal_example_menu() {
     'weight' => 10
   );
 
+  // EXPLANATION: all extension modules should provide a configuration page. 
+  // Even if your module does not need configuration the menu item and page
+  // should be created. This helps users recognize that the module is installed
+  // and working.  The configuration page can simply state that no 
+  // configuration settings are available.  Typically a form is provided for the 
+  // module's configuration settings. Therefore the 'page callback' uses the
+  // drupal_get_form() function and the 'page argument' indicates the form
+  // to call is named 'tripal_eample_admin'.  The function that describes
+  // to form is in the includes/tripal_example.admin.inc file.
   $items['admin/tripal/chado/tripal_example/configuration'] = array(
     'title' => 'Settings',
     'description' => 'Configure the Tripal Library module',
@@ -92,6 +129,12 @@ function tripal_example_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 5
   );
+  
+  // EXPLANATION: If your module defines a new chado node type and that node
+  // type directly links to a record in Chado, then you can use the Tripal API
+  // to quickly provide syncing functionality.  See the API documentation here
+  // for more information on how that is setup:
+  // http://api.tripal.info/api/tripal/tripal_core%21api%21tripal_core.chado_nodes.api.inc/function/chado_node_sync_form/2.x
   $items['admin/tripal/chado/tripal_example/sync'] = array(
     'title' => ' Sync',
     'description' => 'Create pages on this site for examples stored in Chado',
@@ -101,24 +144,16 @@ function tripal_example_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 2
   );
-
-  $items['admin/tripal/chado/tripal_example/views/examples/enable'] = array(
-    'title' => 'Enable Library Administrative View',
-    'page callback' => 'tripal_views_admin_enable_view',
-    'page arguments' => array('tripal_example_admin_examples', 'admin/tripal/chado/tripal_example'),
-    'access arguments' => array('administer tripal example'),
-    'type' => MENU_CALLBACK,
-  );
-  */
-
+  
   return $items;
 }
 
 /**
  * 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
+ * 
+ * This hook tells drupal that there is views support for
+ * for this module which then automatically includes the tripal_db.views.inc 
+ * where all the views integration code is found.
  *
  * @ingroup tripal_example
  */
@@ -139,83 +174,136 @@ function tripal_example_views_api() {
 function tripal_example_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
 
-  /*
+  // EXPLANATION: this function defines all of the functions and templates
+  // that this module needs to provide content.  These details are provided
+  // in the form of an array the indicates which functions or templates
+  // provide content.  Please see the Drupal theming guide for an in-depth
+  // description for how theming works in Drupal:
+  // https://drupal.org/documentation/theme
+  
   $items = array(
+    
+    // EXPLANATION:  If this module defines a new node type that displays
+    // Chado data then we should use Tripal's default node template.  This
+    // template ensures that all content provided by Tripal and Tripal 
+    // extension modules has the same look and feel.  It is designed to be
+    // generic such that it won't intefer with the look-and-feel of the default
+    // theme.  This generic template will organize the node into a table
+    // of contents found on the left-side of the page and place the content
+    // in the center of the page.  User's will cycle through content on the 
+    // page by clicking the links in the table of contents. If you do not want
+    // to use the default Tripal template you can change this array to your
+    // liking.
     'node__chado_example' => array(
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
 
-    // tripal_example templates
+    // EXPLANATION: the following defines all of the template files used for
+    // this module. Templates are named with underscores separating words, and
+    // correspond directly to a file with the extension '.tpl.php'. For example
+    // the 'tripal_example_base' template will have a corresponding
+    // tripal_example_base.tpl.php file where the display code is housed.
+    // The only required templates are the 'base',  'help' and 'teaseer' templates.
+    // The base template provides the basic information about the record in 
+    // in Chado.  The 'help' template provides the adminstrative help documenation,
+    // and the teaser provides a brief summary of the record that can be used
+    // as short description of the record in aggregated lists.
+    
+    // the base template
     'tripal_example_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_base',
-      'path' => "$path/theme/tripal_example",
+      'path' => "$path/theme/templates",
+    ),
+    // the help template
+    'tripal_example_help' => array(
+      'template' => 'tripal_example_help',
+      'variables' =>  array(NULL),
+      'path' => "$path/theme",
     ),
+    // the teaser template.
+    'tripal_example_teaser' => array(
+      'variables' => array('node' => NULL),
+      'template' => 'tripal_example_teaser',
+      'path' => "$path/theme/templates",
+    ),
+    
+    
+    // EXPLANATION: Typically, a different template is created for each subset of data.
+    // for example, most Chado tables have a 'XXXXprop', 'XXXX_cvterm',
+    // 'XXXX_dbxref', 'XXXX_synonyms', 'XXXX_relationships' tables. Therefore,
+    // a template is created to display data from each of these tables.
+    
     'tripal_example_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_properties',
-      'path' => "$path/theme/tripal_example",
+      'path' => "$path/theme/templates",
     ),
     'tripal_example_publications' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_publications',
-      'path' => "$path/theme/tripal_example",
+      'path' => "$path/theme/templates",
     ),
     'tripal_example_references' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_references',
-      'path' => "$path/theme/tripal_example",
+      'path' => "$path/theme/templates",
     ),
     'tripal_example_synonyms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_synonyms',
-      'path' => "$path/theme/tripal_example",
+      'path' => "$path/theme/templates",
     ),
     'tripal_example_terms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_example_terms',
-      'path' => "$path/theme/tripal_example",
-    ),
-    'tripal_example_help' => array(
-      'template' => 'tripal_example_help',
-      'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
 
-    // teaser
-    'tripal_example_teaser' => array(
-      'variables' => array('node' => NULL),
-      'template' => 'tripal_example_teaser',
-      'path' => "$path/theme/tripal_example",
-    ),
+    // EXPLANATION: sometimes a module may want to add content to another
+    // modules' node types. For example, the feature module does this by
+    // adding a 'feature summary' data to an organism.  To add data to another
+    // module's node, the templates belong to this module and are 
+    // specified in the same way as above.  However, the naming of the 
+    // template is changed to include the name of the module that supplies
+    // the node type followed by our record name: 
 
     // tripal_organism templates
     'tripal_organism_examples' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_examples',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
 
     // tripal_feature templates
     'tripal_feature_examples' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_examples',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
 
   );
-  */
   return $items;
 }
 
 /**
  * Implements hook_help()
- * Purpose: Adds a help page to the module list
+ * 
+ * Adds a help page to the module list
  */
 function tripal_example_help ($path, $arg) {
+  
+  // EXPLANATION: in the tripal_example_menu() function above we created 
+  // a menu item for the help documentation.  The menu item specified 
+  // a function that should be called when the menu item is clicked.  This 
+  // is that function.  But, rather than place HTML code in this function
+  // we want to have our help documentation in a template file.  We 
+  // specified in the tripal_example_theme() function that we have a template
+  // file so now we want to use get the contents of that template file and
+  // return it.
   if ($path == 'admin/help#tripal_example') {
     return theme('tripal_example_help', array());
   }
@@ -223,28 +311,44 @@ function tripal_example_help ($path, $arg) {
 
 
 /**
+ * Implements hook_cron()
  *
  * @ingroup tripal_example
  */
 function tripal_example_cron() {
 
+  // EXPLANATION: here we can add any code that needs to be executed when
+  // the Drupal cron is run.
 }
 
 
 /**
  * Implementation of hook_form_alter()
+ * 
+ * Allows a module to alter any form prior to it being rendered. For more
+ * details about Drupal's Form API see this page:
+ * 
+ * https://api.drupal.org/api/drupal/includes!form.inc/group/form_api/7
  *
- * @param $form
- * @param $form_state
- * @param $form_id
  */
 function tripal_example_form_alter(&$form, &$form_state, $form_id) {
-
+  
   if ($form_id == "chado_example_node_form") {
+    
+    // EXPLANATION:  The hook_form_alter() Drupal hook is used to alter
+    // a form before it is displayed.  This allows any module to provide new
+    // form elements or change the form that another module creates.  We do
+    // not need to alter a form created by another module, but we do want to
+    // alter the form for our new node type.  For example, all node types
+    // will automatically have a 'Preview' button.  For inserting or updating
+    // data for Chado we don't really need a Preview button and it complicates
+    // the form.  So, we use the following code to disable the Preview button.
+    // if you want to keep the preview button then remove this code.
     // turn of preview button for insert/updates
     $form['actions']['preview']['#access'] = FALSE;
     
-    //remove the body field
+    // EXPLANATION: Drupal always adds a 'body' field to all node types.
+    // Our node type doens't use the 'body' field so we remove it from the form.
     unset($form['body']);
   }
 }

+ 1 - 0
tripal_example/tripal_example.views.inc

@@ -0,0 +1 @@
+<?php

+ 1 - 0
tripal_example/tripal_example.views_default.inc

@@ -0,0 +1 @@
+<?php

+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_alignments.tpl.php → tripal_feature/theme/templates/tripal_feature_alignments.tpl.php

@@ -116,6 +116,7 @@ if(count($alignments) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-alignments',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_analyses.tpl.php → tripal_feature/theme/templates/tripal_feature_analyses.tpl.php

@@ -39,6 +39,7 @@ if (count($analyses) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-analyses',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_base.tpl.php → tripal_feature/theme/templates/tripal_feature_base.tpl.php

@@ -97,6 +97,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_feature-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 0 - 0
tripal_feature/theme/tripal_feature_help.tpl.php → tripal_feature/theme/templates/tripal_feature_help.tpl.php


+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_properties.tpl.php → tripal_feature/theme/templates/tripal_feature_properties.tpl.php

@@ -38,6 +38,7 @@ if(count($properties) > 0){
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_publications.tpl.php → tripal_feature/theme/templates/tripal_feature_publications.tpl.php

@@ -69,6 +69,7 @@ if (count($feature_pubs) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-publications',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_references.tpl.php → tripal_feature/theme/templates/tripal_feature_references.tpl.php

@@ -72,6 +72,7 @@ if(count($references) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-references',
+      'class' => 'tripal-data-table' 
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 2 - 0
tripal_feature/theme/tripal_feature/tripal_feature_relationships.tpl.php → tripal_feature/theme/templates/tripal_feature_relationships.tpl.php

@@ -69,6 +69,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
          'rows' => $rows,
          'attributes' => array(
            'id' => 'tripal_feature-table-relationship-object',
+           'class' => 'tripal-data-table'
          ),
          'sticky' => FALSE,
          'caption' => '',
@@ -127,6 +128,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
          'rows' => $rows,
          'attributes' => array(
            'id' => 'tripal_feature-table-relationship-subject',
+           'class' => 'tripal-data-table'
          ),
          'sticky' => FALSE,
          'caption' => '',

+ 0 - 0
tripal_feature/theme/tripal_feature/tripal_feature_sequence.tpl.php → tripal_feature/theme/templates/tripal_feature_sequence.tpl.php


+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_synonyms.tpl.php → tripal_feature/theme/templates/tripal_feature_synonyms.tpl.php

@@ -37,6 +37,7 @@ if(count($synonyms) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-synonyms',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_feature/theme/tripal_feature/tripal_feature_teaser.tpl.php → tripal_feature/theme/templates/tripal_feature_teaser.tpl.php


+ 1 - 0
tripal_feature/theme/tripal_feature/tripal_feature_terms.tpl.php → tripal_feature/theme/templates/tripal_feature_terms.tpl.php

@@ -64,6 +64,7 @@ if (count($s_terms) > 0) { ?>
       'rows' => $rows,
       'attributes' => array(
         'id' => "tripal_feature-table-terms-$i",
+        'class' => 'tripal-data-table'
       ),
       'sticky' => FALSE,
       'caption' => 'Vocabulary:  <b>' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b> ' . $configure_link,

+ 1 - 0
tripal_feature/theme/tripal_organism/tripal_organism_feature_browser.tpl.php → tripal_feature/theme/templates/tripal_organism_feature_browser.tpl.php

@@ -89,6 +89,7 @@ if (count($features) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_organism-table-features',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_feature/theme/tripal_organism/tripal_organism_feature_counts.tpl.php → tripal_feature/theme/templates/tripal_organism_feature_counts.tpl.php

@@ -54,6 +54,7 @@ if (count($types) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_organism-table-features',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 17 - 19
tripal_feature/tripal_feature.module

@@ -245,79 +245,79 @@ function tripal_feature_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_feature_alignments' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_alignments',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_analyses' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_analyses',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_base',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_sequence' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_sequence',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_proteins' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_proteins',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_publications' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_publications',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_synonyms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_synonyms',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_references' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_references',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_properties',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_terms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_terms',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_relationships' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_relationships',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_feature_help' => array(
       'template' => 'tripal_feature_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme/"
+      'path' => "$path/theme/templates"
     ),
 
     // template for the organism page
     'tripal_organism_feature_browser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_feature_browser',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
     'tripal_organism_feature_counts' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_feature_counts',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
 
     // themed forms
@@ -329,7 +329,7 @@ function tripal_feature_theme($existing, $type, $theme, $path) {
     'tripal_feature_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_teaser',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
   );
 
@@ -1156,9 +1156,7 @@ function tripal_feature_match_features_page($id) {
     return "<p>No features matched the given name '$id'</p>";
   }
 
-  $table_attrs = array(
-    'class' => 'tripal-table tripal-table-horz'
-  );
+  $table_attrs = array('class' => 'tripal-data-table');
   $output = "<p>The following features match the name '$id'.</p>";
   $output .= theme_table($header, $rows, $table_attrs, $caption);
   return $output;

+ 1 - 0
tripal_featuremap/theme/tripal_feature/tripal_feature_featurepos.tpl.php → tripal_featuremap/theme/templates/tripal_feature_featurepos.tpl.php

@@ -117,6 +117,7 @@ if(count($map_positions) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-featurepos',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_base.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_base.tpl.php

@@ -62,6 +62,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_featuremap-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 1 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_featurepos.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_featurepos.tpl.php

@@ -125,6 +125,7 @@ if(count($feature_positions) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_featuremap-table-featurepos',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_featuremap/theme/tripal_featuremap_help.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_help.tpl.php


+ 1 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_properties.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_properties.tpl.php

@@ -34,6 +34,7 @@ if(count($properties) > 0){
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_featuremap-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_publication.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_publication.tpl.php

@@ -69,6 +69,7 @@ if (count($featuremap_pubs) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_featuremap-table-publications',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_references.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_references.tpl.php

@@ -52,6 +52,7 @@ if(count($references) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_featuremap-table-references',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_featuremap/theme/tripal_featuremap/tripal_featuremap_teaser.tpl.php → tripal_featuremap/theme/templates/tripal_featuremap_teaser.tpl.php


+ 9 - 9
tripal_featuremap/tripal_featuremap.module

@@ -196,49 +196,49 @@ function tripal_featuremap_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_featuremap_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_featuremap_base',
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_featuremap_properties',
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_featurepos' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_featuremap_featurepos',
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_publication' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_featuremap_publication',
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_references' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_featuremap_references',
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_help' => array(
       'template' => 'tripal_featuremap_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
     'tripal_featuremap_teaser' => array(
       'template' => 'tripal_featuremap_teaser',
       'variables' =>  array(NULL),
-      'path' => "$path/theme/tripal_featuremap",
+      'path' => "$path/theme/templates",
     ),
 
     // templates for the chado_feature nodes:
     'tripal_feature_featurepos' => array(
       'arguments' => array('node' => NULL),
       'template' => 'tripal_feature_featurepos',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 1 - 0
tripal_genetic/theme/tripal_feature/tripal_feature_genotypes.tpl.php → tripal_genetic/theme/templates/tripal_feature_genotypes.tpl.php

@@ -128,6 +128,7 @@ if (count($feature_genotypes) > 0) {?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_genetic-table-genotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_genetic/theme/tripal_genetic_help.tpl.php → tripal_genetic/theme/templates/tripal_genetic_help.tpl.php


+ 1 - 0
tripal_genetic/theme/tripal_stock/tripal_stock_genotypes.tpl.php → tripal_genetic/theme/templates/tripal_stock_genotypes.tpl.php

@@ -124,6 +124,7 @@ if (count($stock_genotypes) > 0) {?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_genetic-table-genotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 3 - 3
tripal_genetic/tripal_genetic.module

@@ -118,17 +118,17 @@ function tripal_genetic_theme($existing, $type, $theme, $path) {
     'tripal_feature_genotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_genotypes',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_stock_genotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_stock_genotypes',
-      'path' => "$path/theme/tripal_stock",
+      'path' => "$path/theme/templates",
     ),
     'tripal_genetic_help' => array(
       'template' => 'tripal_genetic_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme/",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 1 - 0
tripal_library/theme/tripal_feature/tripal_feature_libraries.tpl.php → tripal_library/theme/templates/tripal_feature_libraries.tpl.php

@@ -53,6 +53,7 @@ if (count($library_features) > 0) {?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-libraries',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_base.tpl.php → tripal_library/theme/templates/tripal_library_base.tpl.php

@@ -85,6 +85,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_library-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 0 - 0
tripal_library/theme/tripal_library_help.tpl.php → tripal_library/theme/templates/tripal_library_help.tpl.php


+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_properties.tpl.php → tripal_library/theme/templates/tripal_library_properties.tpl.php

@@ -45,6 +45,7 @@ if(count($properties) > 0){
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_library-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_publications.tpl.php → tripal_library/theme/templates/tripal_library_publications.tpl.php

@@ -69,6 +69,7 @@ if (count($library_pubs) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_library-table-publications',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_references.tpl.php → tripal_library/theme/templates/tripal_library_references.tpl.php

@@ -53,6 +53,7 @@ if(count($references) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_library-table-references',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_synonyms.tpl.php → tripal_library/theme/templates/tripal_library_synonyms.tpl.php

@@ -37,6 +37,7 @@ if(count($synonyms) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_library-table-synonyms',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_library/theme/tripal_library/tripal_library_teaser.tpl.php → tripal_library/theme/templates/tripal_library_teaser.tpl.php


+ 1 - 0
tripal_library/theme/tripal_library/tripal_library_terms.tpl.php → tripal_library/theme/templates/tripal_library_terms.tpl.php

@@ -55,6 +55,7 @@ if (count($s_terms) > 0) { ?>
       'rows' => $rows,
       'attributes' => array(
         'id' => "tripal_library-table-terms-$i",
+        'class' => 'tripal-data-table'
       ),
       'sticky' => FALSE,
       'caption' => '<b>Vocabulary: ' . ucwords(preg_replace('/_/', ' ', $cv)) . '</b>',

+ 1 - 0
tripal_library/theme/tripal_organism/tripal_organism_libraries.tpl.php → tripal_library/theme/templates/tripal_organism_libraries.tpl.php

@@ -53,6 +53,7 @@ if (count($libraries) > 0) {?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_organism-table-libraries',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 11 - 11
tripal_library/tripal_library.module

@@ -161,65 +161,65 @@ function tripal_library_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
 
     // tripal_library templates
     'tripal_library_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_base',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_properties',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_publications' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_publications',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_references' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_references',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_synonyms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_synonyms',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_terms' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_terms',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
     'tripal_library_help' => array(
       'template' => 'tripal_library_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
 
     // teaser
     'tripal_library_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_library_teaser',
-      'path' => "$path/theme/tripal_library",
+      'path' => "$path/theme/templates",
     ),
 
     // tripal_organism templates
     'tripal_organism_libraries' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_libraries',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
 
     // tripal_feature templates
     'tripal_feature_libraries' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_libraries',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
 
   );

+ 1 - 0
tripal_natural_diversity/theme/tripal_feature/tripal_feature_nd_genotypes.tpl.php → tripal_natural_diversity/theme/templates/tripal_feature_nd_genotypes.tpl.php

@@ -182,6 +182,7 @@ if (count($feature_genotypes) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_natural_diversity-table-genotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_natural_diversity/theme/tripal_natural_diversity_help.tpl.php → tripal_natural_diversity/theme/templates/tripal_natural_diversity_help.tpl.php


+ 1 - 0
tripal_natural_diversity/theme/tripal_stock/tripal_stock_nd_genotypes.tpl.php → tripal_natural_diversity/theme/templates/tripal_stock_nd_genotypes.tpl.php

@@ -211,6 +211,7 @@ if (count($genotypes) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_natural_diversity-table-genotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_natural_diversity/theme/tripal_stock/tripal_stock_nd_phenotypes.tpl.php → tripal_natural_diversity/theme/templates/tripal_stock_nd_phenotypes.tpl.php

@@ -168,6 +168,7 @@ if (count($phenotypes) > 0) {?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_natural_diversity-table-phenotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 4 - 4
tripal_natural_diversity/tripal_natural_diversity.module

@@ -104,23 +104,23 @@ function tripal_natural_diversity_theme($existing, $type, $theme, $path) {
     'tripal_feature_nd_genotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_nd_genotypes',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     // tripal_stock templates
     'tripal_stock_nd_genotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_stock_nd_genotypes',
-      'path' => "$path/theme/tripal_stock",
+      'path' => "$path/theme/templates",
     ),
     'tripal_stock_nd_phenotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_stock_nd_phenotypes',
-      'path' => "$path/theme/tripal_stock",
+      'path' => "$path/theme/templates",
     ),
     'tripal_natural_diversity_help' => array(
       'template' => 'tripal_natural_diversity_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 0 - 0
tripal_organism/theme/tripal_organism/tripal_organism_base.tpl.php → tripal_organism/theme/templates/tripal_organism_base.tpl.php


+ 0 - 0
tripal_organism/theme/tripal_organism_help.tpl.php → tripal_organism/theme/templates/tripal_organism_help.tpl.php


+ 1 - 0
tripal_organism/theme/tripal_organism/tripal_organism_properties.tpl.php → tripal_organism/theme/templates/tripal_organism_properties.tpl.php

@@ -35,6 +35,7 @@ if(count($properties) > 0){
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_organism-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_organism/theme/tripal_organism/tripal_organism_references.tpl.php → tripal_organism/theme/templates/tripal_organism_references.tpl.php

@@ -66,6 +66,7 @@ if(count($references) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_organism-table-references',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_organism/theme/tripal_organism/tripal_organism_teaser.tpl.php → tripal_organism/theme/templates/tripal_organism_teaser.tpl.php


+ 6 - 6
tripal_organism/tripal_organism.module

@@ -163,32 +163,32 @@ function tripal_organism_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_organism_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_base',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
     'tripal_organism_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_properties',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
     'tripal_organism_references' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_references',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
     'tripal_organism_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_organism_teaser',
-      'path' => "$path/theme/tripal_organism",
+      'path' => "$path/theme/templates",
     ),
     'tripal_organism_help' => array(
       'template' => 'tripal_organism_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 1 - 0
tripal_phenotype/theme/tripal_feature/tripal_feature_phenotypes.tpl.php → tripal_phenotype/theme/templates/tripal_feature_phenotypes.tpl.php

@@ -65,6 +65,7 @@ if(count($feature_phenotypes) > 0){ ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_feature-table-phenotypes',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_phenotype/theme/tripal_phenotype_help.tpl.php → tripal_phenotype/theme/templates/tripal_phenotype_help.tpl.php


+ 2 - 2
tripal_phenotype/tripal_phenotype.module

@@ -102,12 +102,12 @@ function tripal_phenotype_theme($existing, $type, $theme, $path) {
     'tripal_feature_phenotypes' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_feature_phenotypes',
-      'path' => "$path/theme/tripal_feature",
+      'path' => "$path/theme/templates",
     ),
     'tripal_phenotype_help' => array(
       'template' => 'tripal_phenotype_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 1 - 0
tripal_project/theme/tripal_project/tripal_project_base.tpl.php → tripal_project/theme/templates/tripal_project_base.tpl.php

@@ -70,6 +70,7 @@ $table = array(
   'rows' => $rows,
   'attributes' => array(
     'id' => 'tripal_project-table-base',
+    'class' => 'tripal-data-table'
   ),
   'sticky' => FALSE,
   'caption' => '',

+ 1 - 0
tripal_project/theme/tripal_project/tripal_project_contact.tpl.php → tripal_project/theme/templates/tripal_project_contact.tpl.php

@@ -64,6 +64,7 @@ if (count($project_contacts) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_pub-table-contacts',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_project/theme/tripal_project_help.tpl.php → tripal_project/theme/templates/tripal_project_help.tpl.php


+ 1 - 0
tripal_project/theme/tripal_project/tripal_project_properties.tpl.php → tripal_project/theme/templates/tripal_project_properties.tpl.php

@@ -50,6 +50,7 @@ if (count($properties) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_project-table-properties',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_project/theme/tripal_project/tripal_project_publications.tpl.php → tripal_project/theme/templates/tripal_project_publications.tpl.php

@@ -69,6 +69,7 @@ if (count($project_pubs) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_project-table-publications',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 1 - 0
tripal_project/theme/tripal_project/tripal_project_relationships.tpl.php → tripal_project/theme/templates/tripal_project_relationships.tpl.php

@@ -72,6 +72,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
     'rows' => $rows,
     'attributes' => array(
       'id' => 'tripal_project-table-relationship-subject',
+      'class' => 'tripal-data-table'
     ),
     'sticky' => FALSE,
     'caption' => '',

+ 0 - 0
tripal_project/theme/tripal_project/tripal_project_teaser.tpl.php → tripal_project/theme/templates/tripal_project_teaser.tpl.php


+ 8 - 8
tripal_project/tripal_project.module

@@ -166,42 +166,42 @@ function tripal_project_theme($existing, $type, $theme, $path) {
       'template' => 'node--chado-generic',
       'render element' => 'node',
       'base hook' => 'node',
-      'path' => "$core_path/theme",
+      'path' => "$core_path/theme/templates",
     ),
     'tripal_project_base' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_base',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_contact' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_contact',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_properties' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_properties',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_publications' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_publications',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_relationships' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_relationships',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_teaser' => array(
       'variables' => array('node' => NULL),
       'template' => 'tripal_project_teaser',
-      'path' => "$path/theme/tripal_project",
+      'path' => "$path/theme/templates",
     ),
     'tripal_project_help' => array(
       'variables' => 'tripal_project_help',
       'variables' =>  array(NULL),
-      'path' => "$path/theme",
+      'path' => "$path/theme/templates",
     ),
   );
   return $items;

+ 2 - 1
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -171,6 +171,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
         'rows' => $rows,
         'attributes' => array(
           'id' => 'tripal_pub-importer-test',
+          'class' => 'tripal-data-table'
         ),
         'sticky' => FALSE,
         'caption' => '',
@@ -775,7 +776,7 @@ function theme_tripal_pub_importer_setup_form_elements($variables) {
   $table = array(
     'header' => $headers,
     'rows' => $rows,
-    'attributes' => array(),
+    'attributes' => array('class' => 'tripal-data-table'),
     'sticky' => TRUE,
     'caption' => '',
     'colgroups' => array(),

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác