Browse Source

Fixed issues with the library module

spficklin 12 years ago
parent
commit
d2b7b59b9e

+ 0 - 0
tripal_contact/tripal_contact.api.inc → tripal_contact/api/tripal_contact.api.inc


+ 1 - 1
tripal_contact/tripal_contact.module

@@ -22,7 +22,7 @@
  * @ingroup tripal_modules
  */
 
-require('tripal_contact.api.inc');
+require('api/tripal_contact.api.inc');
 
 /*************************************************************************
  * Implements hook_views_api()

+ 5 - 0
tripal_core/api/tripal_core.api.inc

@@ -2939,6 +2939,11 @@ function tripal_db_set_default_search_path() {
  */
 function tripal_core_is_sql_prepared($statement_name) {
   global $prepared_statements;
+  
+  if (!is_array($prepared_statements)) {
+    watchdog('tripal_core', "tripal_core_is_sql_prepared: argument must be an array", array(), WATCHDOG_ERROR);
+      return FALSE; 
+  }
 
   // check to see if the statement is prepared already
   if (in_array($statement_name, $prepared_statements)) {

+ 1 - 1
tripal_core/tripal_core.install

@@ -34,7 +34,7 @@ function tripal_core_install() {
  *   - changes the specs of mv_table, mv_specs and indexed
  *   - creates the tripal_custom_tables table
  *
- * @ingroup tripal_feature
+ * @ingroup tripal_core
  */
 function tripal_core_update_6000() {
   // add additional columns to the tripal_mviews table

+ 0 - 205
tripal_feature/includes/tripal_feature.admin.inc

@@ -5,211 +5,6 @@
  * @todo Add file header description
  */
 
-/**
- * Purpose: Provide Guidance to new Tripal Admin
- *
- * @return
- *   HTML Formatted text
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_module_description_page() {
-
-  $text .= '<h3>Tripal Feature Administrative Tools Quick Links:</h3>';
-  $text .= "<ul>
-             <li><a href=\"" . url("admin/tripal/tripal_feature/configuration") . "\">Feature Configuration</a></li>
-             <li><a href=\"" . url("admin/tripal/tripal_feature/fasta_loader") . "\">Import a multi-FASTA file</a></li>
-             <li><a href=\"" . url("admin/tripal/tripal_feature/gff3_load") . "\">Import a GFF3 file</a></li>
-             <li><a href=\"" . url("admin/tripal/tripal_feature/sync") . "\">Sync Features</a></li>
-             <li><a href=\"" . url("admin/tripal/tripal_feature/delete") . "\">Delete Features</a></li>
-           </ul>";
-#             <li><a href=\"".url("admin/tripal/tripal_feature/aggregate"). "\">Feature Relationship Aggegators</a></li>
-
-  $text .= '<h3>Module Description:</h3>';
-  $text .= '<p>This module provides an interface for the Chado feature module which stores information
-            related to genomic features.  This module provides support for bulk loading of data in
-            FASTA or GFF format, visualization of "feature" pages, editing and updating.
-            </p>';
-
-  $text .= '<h3>Setup Instructions:</h3>';
-  $text .= '<p>After installation of the feature module.  The following tasks should be performed
-            <ol>
-              <li><p><b>Set Permissions</b>: The feature module supports the Drupal user permissions interface for
-               controlling access to feature content and functions. These permissions include viewing,
-               creating, editing or administering of
-               feature content. The default is that only the original site administrator has these
-               permissions.  You can <a href="' . url('admin/user/roles') . '">add roles</a> for classifying users,
-               <a href="' . url('admin/user/user') . '">assign users to roles</a> and
-               <a href="' . url('admin/user/permissions') . '">assign permissions</a> for the feature content to
-               those roles.  For a simple setup, allow anonymous users access to view organism content and
-               allow the site administrator all other permissions.</p></li>
-
-               <li><p><b>Themeing</b>:  Before content from Chado can be visualized the Tripal base theme must
-               be installed.  This should have been done prior to this point.  But is mentioned here in the event you
-               follow the instructions below and cannot see content.  In this case, if you do not see content
-               check that Tripal theming is properly installed</p></li>
-
-               <li><p><b>Loading of Ontologies</b>:  If you
-               used Tripal to create the Chado database, then you must load ontologies before proceeding.  Visit the
-               page to <a href="' . url('admin/tripal/tripal_cv/obo_loader') . '">load ontologies</a> and load at
-               least the following ontologies:
-               <ul>
-                  <li>Chado Feature Properties</li>
-                  <li>Relationship Ontology</li>
-                  <li>Sequence Ontology</li>
-                  <li>Gene Ontology (if loading GO terms for features)</li>
-               </ul></p></li>
-
-               <li><p><b>Create Organisms</b>:  Before adding feature data you must already have the
-               organisms loaded in the database.  See the
-               <a href="' . url('admin/tripal/tripal_organism') . '">Tripal Organism Admin page</a> for
-               instructions for adding and Syncing organisms.</p></li>
-
-               <li><p><b>Create Analysis</b>:  Tripal requires that feature data loaded using the Tripal loaders
-               be associated with an analyis.  This provides a grouping for the feature data and can be used
-               later to visualize data pipelines.  Before loading feature data through the FASTA or GFF loaders
-               you will need to <a href="' . url('node/add') . '">create an analysis</a> for the data.</p></li>
-
-               <li><p><b>Create Referring Database Entries</b>:  If you would like to associate your feature data with an
-               external reference database, check to ensure that the <a href="' . url('admin/tripal/tripal_db/edit_db') . '">
-               database record already exists</a>.  If not you should <a href="' . url('admin/tripal/tripal_db/add_db') . '">add a new database record</a> before importing
-               feature data.</p></li>
-
-               <li><p><b>Data Import</b>:  if you do not already have an existing Chado database with preloaded data
-               then you will want
-               to import data.  You can do so using the Chado perl scripts that come with the normal
-               <a href="http://gmod.org/wiki/Chado">distribution of Chado</a> or you can use the <a href="' . url('admin/tripal/tripal_feature/fasta_loader') . '">FASTA loader</a> and
-               <a href="' . url('admin/tripal/tripal_feature/gff3_load') . '">GFF loader</a> provided here.  If you
-               created the Chado database using Tripal then you\'ll most likely want to use the Tripal loaders.  If your data
-               is not condusive for loading with these loaders you may have to write your own loaders.
-               </p></li>
-
-               <li><p><b>Sync Features</b>:  After data is loaded you need to sync features.  This process is what
-               creates the pages for viewing online.  Not all features need be synced.  For instance, if you
-               have loaded whole genome sequence with fully defined gene models with several features to define
-               a gene and its products (e.g. gene, mRNA, CDS, 5\'UTR, 3\'UTR, etc) you probably only want to create
-               pages for genes or genes and mRNA.  You probably do not want a page for a 5\'UTR.
-               Using the <a href="' . url('admin/tripal/tripal_feature/configuration/sync') . '">Feature Sync page</a>
-               you can sync (or create pages) for the desired feature types. </p></li>
-
-               <li><p><b>Set Feature URL</b>:  It is often convenient to have a simple URL for each feature page.
-               For example, http://www.mygenomesite.org/[feature], where [feature] is a unique identifier for a feature page.
-               With this, people can easily include links to feature pages of interest. Use the
-               <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a>
-               to specify whether to use the feature name, unique name or internal ID as the [feature] portion of the
-               URL.  Select the one that will guarantee a unique identifier for feature pages.</p></li>
-
-               <li><p><b>Indexing</b>:  Once all data has been loaded (including analysis data--e.g. blast, interpro, etc.)
-               you can index all feature pages for searching if you want to ues the Drupal default search mechanism.
-               Use the <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a>
-               to either Index (for the first time) or "Reindex" (after adding new data)
-               the feature pages for searching.  Once the site is 100% indexed the pages will be searchable using Drupal\'s
-               full text searching.  You can find the percent indexed for the entire site by visiting the
-               <a href="' . url('admin/settings/search') . '">Search settings page</a>. Indexing
-               can take quite a while if you have a lot of data</p></li>
-
-               <li><p><b>Set Taxonomy</b>:  Drupal provides a mechanism for categorizing content to allow
-               for advanced searching.  Drupal calls this "Taxonomy", but is essentially categorizing the pages.
-               You can categorize feature pages by their type (e.g. gene, mRNA, contig, EST, etc.) and by the
-               organism to which they belong.  This allows for filtering of search results by organism and feature type.
-               Use the <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a> to
-               set the Taxonomy.</p></li>
-            </ol>
-            </p>';
-
-
-  $text .= '<h3>Features of this Module:</h3>';
-  $text .= '<p>Aside from data loading and feature page setup (as described in the Setup section above),
-            The Tripal feature module also provides the following functionality
-            <ul>
-              <li><p><b>Feature Browser:</b>  The feature browser is a tabular list of features with links to their
-               feature pages which appears on the organism
-               page.  It was created to provide a mechanism to allow site visitors to quickly
-               accesss feature pages when they do not know what to search for.  For sites with large numbers of features, this
-               method for finding a specific pages is inadequate, but may still be included to aid new site
-               visitors.    This browser can be toggled on or off using the
-               <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a></p></li>
-
-              <li><p><b>Feature Summary Report:</b>  The feature summary report is a pie chart that indicates the types and quantities
-              of feature types (Sequence Ontology terms) that are loaded in the database. It appears on the organism
-              page.  The summary can be toggled on or off using the
-              <a href="' . url('admin/tripal/tripal_feature/configuration') . '">Feature Configuration page</a></p></li>
-
-              <li><p><b>Integration with Drupal Views</b>: <a href="http://drupal.org/project/views">Drupal Views</a> is
-              a powerful tool that allows the site administrator to create lists or basic searching forms of Chado content.
-              It provides a graphical interface within Drupal to allow the site admin to directly query the Chado database
-              and create custom lists without PHP programming or customization of Tripal source code.  Views can also
-              be created to filter content that has not yet been synced with Druapl in order to protect access to non
-              published data (only works if Chado was installed using Tripal).  You can see a list of available pre-existing
-              Views <a href="' . url('admin/build/views/') . '">here</a>, as well as create your own. </p></li>
-
-              <li><p><b>Basic Feature Lookup View</b>: This module provides a basic <a href="' . url('features') . '">feature search
-              tool</a> for finding or listing features in Chado. It does not require indexing for Drupal searching but relies
-              on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a> must be installed. </p></li>
-
-              <li><p><b>Delete Features</b>: This module provides a <a href="' . url('admin/tripal/tripal_feature/delete') . '">Delete Feature page</a>
-              for bulk deltions of features. You may delete features using a list of feature names, or for a specific organism
-              or for a specific feature type.</p></li>
-
-            </ul>
-            </p>';
-
-  $text .= '<h3>Page Customizations</h3>';
-  $text .= '<p>There are several ways to customize the look-and-feel for the way Chado data is presented through Tripal.
-             Below is a description of several methods.  These methods may be used in conjunction with one another to
-             provide fine-grained control.
-             <ul>
-
-             <li><p><b>Integration with Drupal Panels</b>:  <a href="http://drupal.org/project/views">Drupal Panels</a>
-              allows for customization of a page layout if you don\'t want to do PHP/Javascript/CSS programming.  Tripal comes with pre-set layouts for feature pages.  However,
-              Panels become useful if you prefer a layout that is different from the pre-set layouts.  Chado content
-              is provided to Panels in the form of Drupal "blocks" which you can then place anywhere on a page using the
-              Panel\'s GUI.</p></li>
-
-             <li><p><b>Drupal\'s Content Construction Kit (CCK)</b>: the
-             <a href="http://drupal.org/project/cck">Content Construction Kit (CCK) </a> is a powerful way to add non-Chado content
-             to any page without need to edit template files or knowing PHP.  You must first download and install CCK.
-             With CCK, the site administartor can create a new field to appear on the page.  For example, currently,
-             the Chado publication module is not yet supported by Tripal.  Therefore, the site administrator can add a text
-             field to the feature pages.  This content is not stored in Chado, but will appear on the feature page.  A field
-             added by CCK will also appear in the form when editing a feature to allow users to manually enter the appropriate
-             text.  If the default pre-set layout and themeing for Tripal is used, it is better to create the CCK element,
-             indicate that it is not to be shown (using the CCK interface), then manually add the new content type
-             where desired by editing the templates (as described below).  If using Panels, the CCK field can be added to the
-             location desired using the Panels interface.</p></li>
-
-             <li><p><b>Drupal Node Templates</b>:  The Tripal packages comes with a "theme_tripal" directory that contains the
-             themeing for Chado content.    The feature module has a template file for feature "nodes" (Tripal feature pages).  This file
-             is named "node-chado_feature.tpl.php", and provides javascript, HTML and PHP code for display of the feature
-             pages.  You can edit this file to control which types of information (or which feature "blocks") are displayed for features. Be sure to
-             copy these template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
-             future Tripal updates may overwrite your customizations. See the <a href="http://tripal.sourceforge.net/">Tripal website </a>
-             for instructions on how to access variables and other Chado content within the template file.</p></li>
-
-             <li><p><b>Feature "Block" Templates</b>:  In the "theme_tripal" directory is a subdirectory named "tripal_feature".
-             Inside this directory is a set of templates that control distinct types of information for features.  For example,
-             there is a "base" template for displaying of data directly from the Chado feature table, and a "references"
-             template for showing external site references for a feature (data from the feature_dbxref table).  These templates are used both by Drupal blocks
-             for use in Drupal Panels (as described above) or for use in the default pre-set layout that the node template
-             provides (also desribed above).  You can customize this template as you desire.  Be sure to copy the
-             template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
-             future Tripal updates may overwrite your customizations.  See the <a href="http://tripal.sourceforge.net/">Tripal website </a>
-             for instructions on how to access variables and other Chado content within the template files.</p></li>
-             </li>
-
-             <li><p><b>Adding Links to the "Resources" Sidebar</b>: If you use the pre-set default Tripal layout for theming, you
-             will see a "Resources" sidebar on each page.  The links that appear on the sidebar are automatically generated
-             using Javascript for all of the feature "Blocks" that appear on the page. If you want to add additional links
-             (e.g. a dynamic link to GBrowse for the feature) and you want that link to appear in the
-             "Resources" sidebar, simply edit the Drupal Node Template (as described above) and add the link to the
-             section at the bottom of the template file where the resources section is found.</p></li>
-
-             </ul>
-             </p>';
-
-  return $text;
-}
-
 /**
  *
  *

+ 190 - 0
tripal_feature/theme/tripal_feature_admin.tpl.php

@@ -0,0 +1,190 @@
+ <h3>Tripal Feature Administrative Tools Quick Links:</h3>
+  <ul>
+   <li><a href="<?php print url("admin/tripal/tripal_feature/configuration") ?>">Feature Configuration</a></li>
+   <li><a href="<?php print url("admin/tripal/tripal_feature/fasta_loader") ?>">Import a multi-FASTA file</a></li>
+   <li><a href="<?php print url("admin/tripal/tripal_feature/gff3_load") ?>">Import a GFF3 file</a></li>
+   <li><a href="<?php print url("admin/tripal/tripal_feature/sync") ?>">Sync Features</a></li>
+   <li><a href="<?php print url("admin/tripal/tripal_feature/delete") ?>">Delete Features</a></li>
+ </ul>
+
+  <h3>Module Description:</h3>
+  <p>This module provides an interface for the Chado feature module which stores information
+    related to genomic features.  This module provides support for bulk loading of data in
+    FASTA or GFF format, visualization of "feature" pages, editing and updating.
+    </p>
+
+  <h3>Setup Instructions:</h3>
+  <p>After installation of the feature module.  The following tasks should be performed</p>
+  <ol>
+    <li><p><b>Set Permissions</b>: The feature module supports the Drupal user permissions interface for
+     controlling access to feature content and functions. These permissions include viewing,
+     creating, editing or administering of
+     feature content. The default is that only the original site administrator has these
+     permissions.  You can <a href="<?php print url('admin/user/roles') ?>">add roles</a> for classifying users,
+     <a href="<?php print url('admin/user/user') ?>">assign users to roles</a> and
+     <a href="<?php print url('admin/user/permissions') ?>">assign permissions</a> for the feature content to
+     those roles.  For a simple setup, allow anonymous users access to view organism content and
+     allow the site administrator all other permissions.</p></li>
+
+     <li><p><b>Themeing</b>:  Before content from Chado can be visualized the Tripal base theme must
+     be installed.  This should have been done prior to this point.  But is mentioned here in the event you
+     follow the instructions below and cannot see content.  In this case, if you do not see content
+     check that Tripal theming is properly installed</p></li>
+
+     <li><p><b>Loading of Ontologies</b>:  If you
+     used Tripal to create the Chado database, then you must load ontologies before proceeding.  Visit the
+     page to <a href="<?php print url('admin/tripal/tripal_cv/obo_loader') ?>">load ontologies</a> and load at
+     least the following ontologies:
+     <ul>
+        <li>Chado Feature Properties</li>
+        <li>Relationship Ontology</li>
+        <li>Sequence Ontology</li>
+        <li>Gene Ontology (if loading GO terms for features)</li>
+     </ul></p></li>
+
+     <li><p><b>Create Organisms</b>:  Before adding feature data you must already have the
+     organisms loaded in the database.  See the
+     <a href="<?php print url('admin/tripal/tripal_organism') ?>">Tripal Organism Admin page</a> for
+     instructions for adding and Syncing organisms.</p></li>
+
+     <li><p><b>Create Analysis</b>:  Tripal requires that feature data loaded using the Tripal loaders
+     be associated with an analyis.  This provides a grouping for the feature data and can be used
+     later to visualize data pipelines.  Before loading feature data through the FASTA or GFF loaders
+     you will need to <a href="<?php print url('node/add') ?>">create an analysis</a> for the data.</p></li>
+
+     <li><p><b>Create Referring Database Entries</b>:  If you would like to associate your feature data with an
+     external reference database, check to ensure that the <a href="<?php print url('admin/tripal/tripal_db/edit_db') ?>">
+     database record already exists</a>.  If not you should <a href="<?php print url('admin/tripal/tripal_db/add_db') ?>">add a new database record</a> before importing
+     feature data.</p></li>
+
+     <li><p><b>Data Import</b>:  if you do not already have an existing Chado database with preloaded data
+     then you will want
+     to import data.  You can do so using the Chado perl scripts that come with the normal
+     <a href="http://gmod.org/wiki/Chado">distribution of Chado</a> or you can use the <a href="<?php print url('admin/tripal/tripal_feature/fasta_loader') ?>">FASTA loader</a> and
+     <a href="<?php print url('admin/tripal/tripal_feature/gff3_load') ?>">GFF loader</a> provided here.  If you
+     created the Chado database using Tripal then you\'ll most likely want to use the Tripal loaders.  If your data
+     is not condusive for loading with these loaders you may have to write your own loaders.
+     </p></li>
+
+     <li><p><b>Sync Features</b>:  After data is loaded you need to sync features.  This process is what
+     creates the pages for viewing online.  Not all features need be synced.  For instance, if you
+     have loaded whole genome sequence with fully defined gene models with several features to define
+     a gene and its products (e.g. gene, mRNA, CDS, 5\'UTR, 3\'UTR, etc) you probably only want to create
+     pages for genes or genes and mRNA.  You probably do not want a page for a 5\'UTR.
+     Using the <a href="<?php print url('admin/tripal/tripal_feature/configuration/sync') ?>">Feature Sync page</a>
+     you can sync (or create pages) for the desired feature types. </p></li>
+
+     <li><p><b>Set Feature URL</b>:  It is often convenient to have a simple URL for each feature page.
+     For example, http://www.mygenomesite.org/[feature], where [feature] is a unique identifier for a feature page.
+     With this, people can easily include links to feature pages of interest. Use the
+     <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a>
+     to specify whether to use the feature name, unique name or internal ID as the [feature] portion of the
+     URL.  Select the one that will guarantee a unique identifier for feature pages.</p></li>
+
+     <li><p><b>Indexing</b>:  Once all data has been loaded (including analysis data--e.g. blast, interpro, etc.)
+     you can index all feature pages for searching if you want to ues the Drupal default search mechanism.
+     Use the <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a>
+     to either Index (for the first time) or "Reindex" (after adding new data)
+     the feature pages for searching.  Once the site is 100% indexed the pages will be searchable using Drupal\'s
+     full text searching.  You can find the percent indexed for the entire site by visiting the
+     <a href="<?php print url('admin/settings/search') ?>">Search settings page</a>. Indexing
+     can take quite a while if you have a lot of data</p></li>
+
+     <li><p><b>Set Taxonomy</b>:  Drupal provides a mechanism for categorizing content to allow
+     for advanced searching.  Drupal calls this "Taxonomy", but is essentially categorizing the pages.
+     You can categorize feature pages by their type (e.g. gene, mRNA, contig, EST, etc.) and by the
+     organism to which they belong.  This allows for filtering of search results by organism and feature type.
+     Use the <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a> to
+     set the Taxonomy.</p></li>
+  </ol>
+  </p>
+
+
+  <h3>Features of this Module:</h3>
+  <p>Aside from data loading and feature page setup (as described in the Setup section above),
+  The Tripal feature module also provides the following functionality
+  <ul>
+    <li><p><b>Feature Browser:</b>  The feature browser is a tabular list of features with links to their
+     feature pages which appears on the organism
+     page.  It was created to provide a mechanism to allow site visitors to quickly
+     accesss feature pages when they do not know what to search for.  For sites with large numbers of features, this
+     method for finding a specific pages is inadequate, but may still be included to aid new site
+     visitors.    This browser can be toggled on or off using the
+     <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a></p></li>
+
+    <li><p><b>Feature Summary Report:</b>  The feature summary report is a pie chart that indicates the types and quantities
+    of feature types (Sequence Ontology terms) that are loaded in the database. It appears on the organism
+    page.  The summary can be toggled on or off using the
+    <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Feature Configuration page</a></p></li>
+
+    <li><p><b>Integration with Drupal Views</b>: <a href="http://drupal.org/project/views">Drupal Views</a> is
+    a powerful tool that allows the site administrator to create lists or basic searching forms of Chado content.
+    It provides a graphical interface within Drupal to allow the site admin to directly query the Chado database
+    and create custom lists without PHP programming or customization of Tripal source code.  Views can also
+    be created to filter content that has not yet been synced with Druapl in order to protect access to non
+    published data (only works if Chado was installed using Tripal).  You can see a list of available pre-existing
+    Views <a href="<?php print url('admin/build/views/') ?>">here</a>, as well as create your own. </p></li>
+
+    <li><p><b>Basic Feature Lookup View</b>: This module provides a basic <a href="<?php print url('features') ?>">feature search
+    tool</a> for finding or listing features in Chado. It does not require indexing for Drupal searching but relies
+    on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a> must be installed. </p></li>
+
+    <li><p><b>Delete Features</b>: This module provides a <a href="<?php print url('admin/tripal/tripal_feature/delete') ?>">Delete Feature page</a>
+    for bulk deltions of features. You may delete features using a list of feature names, or for a specific organism
+    or for a specific feature type.</p></li>
+
+  </ul>
+            </p>
+
+  <h3>Page Customizations</h3>
+  <p>There are several ways to customize the look-and-feel for the way Chado data is presented through Tripal.
+ Below is a description of several methods.  These methods may be used in conjunction with one another to
+ provide fine-grained control.
+ <ul>
+
+ <li><p><b>Integration with Drupal Panels</b>:  <a href="http://drupal.org/project/views">Drupal Panels</a>
+  allows for customization of a page layout if you don\'t want to do PHP/Javascript/CSS programming.  Tripal comes with pre-set layouts for feature pages.  However,
+  Panels become useful if you prefer a layout that is different from the pre-set layouts.  Chado content
+  is provided to Panels in the form of Drupal "blocks" which you can then place anywhere on a page using the
+  Panel\'s GUI.</p></li>
+
+ <li><p><b>Drupal\'s Content Construction Kit (CCK)</b>: the
+ <a href="http://drupal.org/project/cck">Content Construction Kit (CCK) </a> is a powerful way to add non-Chado content
+ to any page without need to edit template files or knowing PHP.  You must first download and install CCK.
+ With CCK, the site administartor can create a new field to appear on the page.  For example, currently,
+ the Chado publication module is not yet supported by Tripal.  Therefore, the site administrator can add a text
+ field to the feature pages.  This content is not stored in Chado, but will appear on the feature page.  A field
+ added by CCK will also appear in the form when editing a feature to allow users to manually enter the appropriate
+ text.  If the default pre-set layout and themeing for Tripal is used, it is better to create the CCK element,
+ indicate that it is not to be shown (using the CCK interface), then manually add the new content type
+ where desired by editing the templates (as described below).  If using Panels, the CCK field can be added to the
+ location desired using the Panels interface.</p></li>
+
+ <li><p><b>Drupal Node Templates</b>:  The Tripal packages comes with a "theme_tripal" directory that contains the
+ themeing for Chado content.    The feature module has a template file for feature "nodes" (Tripal feature pages).  This file
+ is named "node-chado_feature.tpl.php", and provides javascript, HTML and PHP code for display of the feature
+ pages.  You can edit this file to control which types of information (or which feature "blocks") are displayed for features. Be sure to
+ copy these template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
+ future Tripal updates may overwrite your customizations. See the <a href="http://tripal.info/">Tripal website </a>
+ for instructions on how to access variables and other Chado content within the template file.</p></li>
+
+ <li><p><b>Feature "Block" Templates</b>:  In the "theme_tripal" directory is a subdirectory named "tripal_feature".
+ Inside this directory is a set of templates that control distinct types of information for features.  For example,
+ there is a "base" template for displaying of data directly from the Chado feature table, and a "references"
+ template for showing external site references for a feature (data from the feature_dbxref table).  These templates are used both by Drupal blocks
+ for use in Drupal Panels (as described above) or for use in the default pre-set layout that the node template
+ provides (also desribed above).  You can customize this template as you desire.  Be sure to copy the
+ template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
+ future Tripal updates may overwrite your customizations.  See the <a href="http://tripal.info/">Tripal website </a>
+ for instructions on how to access variables and other Chado content within the template files.</p></li>
+ </li>
+
+ <li><p><b>Adding Links to the "Resources" Sidebar</b>: If you use the pre-set default Tripal layout for theming, you
+ will see a "Resources" sidebar on each page.  The links that appear on the sidebar are automatically generated
+ using Javascript for all of the feature "Blocks" that appear on the page. If you want to add additional links
+ (e.g. a dynamic link to GBrowse for the feature) and you want that link to appear in the
+ "Resources" sidebar, simply edit the Drupal Node Template (as described above) and add the link to the
+ section at the bottom of the template file where the resources section is found.</p></li>
+
+ </ul>
+ </p>

+ 7 - 1
tripal_feature/tripal_feature.module

@@ -158,7 +158,8 @@ function tripal_feature_menu() {
   $items['admin/tripal/tripal_feature'] = array(
     'title' => 'Features',
     'description' => 'Basic Description of Tripal Organism Module Functionality',
-    'page callback' => 'tripal_feature_module_description_page',
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_feature_admin'),
     'access arguments' => array('administer tripal features'),
     'type' => MENU_NORMAL_ITEM,
   );
@@ -1914,6 +1915,11 @@ function tripal_feature_theme() {
       'arguments' => array('form' => NULL),
       'function' => 'theme_tripal_feature_edit_ALL_properties_form',
     ),
+    'tripal_feature_admin' => array(
+      'template' => 'tripal_feature_admin',  
+      'arguments' =>  array(NULL),  
+      'path' => drupal_get_path('module', 'tripal_feature') . '/theme' 
+    ),
   );
 }
 /**

+ 584 - 0
tripal_library/includes/tripal_library.admin.inc

@@ -0,0 +1,584 @@
+<?php 
+
+
+/**
+ * Administrative settings form
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_admin() {
+  $form = array();
+
+  // before proceeding check to see if we have any
+  // currently processing jobs. If so, we don't want
+  // to give the opportunity to sync libraries
+  $active_jobs = FALSE;
+  if (tripal_get_module_active_jobs('tripal_library')) {
+    $active_jobs = TRUE;
+  }
+
+  // add the field set for syncing libraries
+  if (!$active_jobs) {
+    get_tripal_library_admin_form_sync_set($form);
+    get_tripal_library_admin_form_reindex_set($form);
+    get_tripal_library_admin_form_taxonomy_set($form);
+    get_tripal_library_admin_form_cleanup_set($form);
+  }
+  else {
+    $form['notice'] = array(
+     '#type' => 'fieldset',
+     '#title' => t('Library Management Temporarily Unavailable')
+    );
+    $form['notice']['message'] = array(
+        '#value' => t('Currently, library management jobs are waiting or are running. . Managemment features have been hidden until these jobs complete.  Please check back later once these jobs have finished.  You can view the status of pending jobs in the Tripal jobs page.'),
+    );
+  }
+
+  return system_settings_form($form);
+}
+
+
+/**
+ *
+ *
+ * @ingroup tripal_library
+ */
+function get_tripal_library_admin_form_cleanup_set(&$form) {
+  $form['cleanup'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Clean Up')
+  );
+  $form['cleanup']['description'] = array(
+     '#type' => 'item',
+     '#value' => t("With Drupal and chado residing in different databases ".
+        "it is possible that nodes in Drupal and libraries in Chado become ".
+        "\"orphaned\".  This can occur if an library node in Drupal is ".
+        "deleted but the corresponding chado library is not and/or vice ".
+        "versa. Click the button below to resolve these discrepancies."),
+     '#weight' => 1,
+  );
+  $form['cleanup']['button'] = array(
+    '#type' => 'submit',
+    '#value' => t('Clean up orphaned libraries'),
+    '#weight' => 2,
+  );
+}
+
+/**
+ *
+ *
+ * @ingroup tripal_library
+ */
+function get_tripal_library_admin_form_taxonomy_set(&$form) {
+  $form['taxonify'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Assign Drupal Taxonomy to Library Features')
+  );
+
+  // get the list of libraries
+  $sql = "SELECT * FROM {Library} ORDER BY uniquename";
+  $lib_rset = chado_query($sql);
+
+  // iterate through all of the libraries
+  $lib_boxes = array();
+  while ($library = db_fetch_object($lib_rset)) {
+    $lib_boxes[$library->library_id] = "$library->name";
+  }
+
+  $form['taxonify']['description'] = array(
+     '#type' => 'item',
+     '#value' => t("Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
+                   "nodes. These terms allow for advanced filtering during searching. This option allows ".
+                   "for setting taxonomy only for features that belong to the selected libraries below.  All other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
+   '#weight' => 1,
+  );
+
+  $form['taxonify']['tx-libraries'] = array(
+   '#title'       => t('Libraries'),
+   '#type'        => t('checkboxes'),
+   '#description' => t("Check the libraries whose features you want to reset taxonomy.  Note: this list contains all libraries, even those that may not be synced."),
+   '#required'    => FALSE,
+   '#prefix'      => '<div id="lib_boxes">',
+   '#suffix'      => '</div>',
+   '#options'     => $lib_boxes,
+   '#weight'      => 2
+  );
+  $form['taxonify']['tx-button'] = array(
+    '#type' => 'submit',
+    '#value' => t('Set Feature Taxonomy'),
+    '#weight'      => 3
+  );
+}
+/**
+ *
+ * @ingroup tripal_library
+ */
+function get_tripal_library_admin_form_reindex_set(&$form) {
+   // define the fieldsets
+  $form['reindex'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Reindex Library Features')
+  );
+
+  // get the list of libraries
+  $sql = "SELECT * FROM {Library} ORDER BY uniquename";
+  $lib_rset = chado_query($sql);
+
+  // iterate through all of the libraries
+  $lib_boxes = array();
+  while ($library = db_fetch_object($lib_rset)) {
+    $lib_boxes[$library->library_id] = "$library->name";
+  }
+  $form['reindex']['description'] = array(
+     '#type' => 'item',
+     '#value' => t("This option allows for reindexing of only those features that belong to the selected libraries below. All other features will be unaffected.  To reindex all features in the site see the Feature Administration page."),
+   '#weight' => 1,
+  );
+
+  $form['reindex']['re-libraries'] = array(
+   '#title'       => t('Libraries'),
+   '#type'        => t('checkboxes'),
+   '#description' => t("Check the libraries whoee features you want to reindex. Note: this list contains all libraries, even those that may not be synced."),
+   '#required'    => FALSE,
+   '#prefix'      => '<div id="lib_boxes">',
+   '#suffix'      => '</div>',
+   '#options'     => $lib_boxes,
+   '#weight' => 2,
+  );
+  $form['reindex']['re-button'] = array(
+    '#type' => 'submit',
+    '#value' => t('Reindex Features'),
+    '#weight' => 3,
+  );
+}
+/**
+ *
+ * @ingroup tripal_library
+ */
+function get_tripal_library_admin_form_sync_set(&$form) {
+   // define the fieldsets
+  $form['sync'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Sync Libraries')
+  );
+
+
+  // get the list of libraries
+  $sql = "SELECT * FROM {Library} ORDER BY uniquename";
+  $lib_rset = chado_query($sql);
+
+  // if we've added any libraries to the list that can be synced
+  // then we want to build the form components to allow the user
+  // to select one or all of them.  Otherwise, just present
+  // a message stating that all libraries are currently synced.
+  $lib_boxes = array();
+  $added = 0;
+  while ($library = db_fetch_object($lib_rset)) {
+    // check to see if the library is already present as a node in drupal.
+    // if so, then skip it.
+    $sql = "SELECT * FROM {chado_library} WHERE library_id = %d";
+    if (!db_fetch_object(db_query($sql, $library->library_id))) {
+      $lib_boxes[$library->library_id] = "$library->name";
+      $added++;
+    }
+  }
+
+  // if we have libraries we need to add to the checkbox then
+  // build that form element
+  if ($added > 0) {
+    $lib_boxes['all'] = "All Libraries";
+
+    $form['reindex']['description'] = array(
+     '#type' => 'item',
+     '#value' => t("This option allows for the creation of Drupal content for libraries in chado. Only the selected libraries will be synced."),
+   '#weight' => 1,
+    );
+
+
+    $form['sync']['libraries'] = array(
+      '#title'       => t('Available Libraries'),
+      '#type'        => t('checkboxes'),
+      '#description' => t("Check the libraries you want to sync.  Drupal content will be created for each of the libraries listed above.  Select 'All Libraries' to sync all of them."),
+      '#required'    => FALSE,
+      '#prefix'      => '<div id="lib_boxes">',
+      '#suffix'      => '</div>',
+      '#options'     => $lib_boxes,
+    '#weight' => 2,
+    );
+    $form['sync']['button'] = array(
+       '#type' => 'submit',
+       '#value' => t('Sync Libraries'),
+     '#weight' => 3,
+    );
+  }
+   // we don't have any libraries to select from
+  else {
+    $form['sync']['value'] = array(
+       '#value' => t('All libraries in Chado are currently synced with Drupal.')
+    );
+  }
+}
+/**
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_admin_validate($form, &$form_state) {
+  global $user;  // we need access to the user info
+  $job_args = array();
+
+  // Submit the Sync Job if selected
+  if ($form_state['values']['op'] == t('Sync Libraries')) {
+
+    // check to see if the user wants to sync chado and drupal.  If
+    // so then we need to register a job to do so with tripal
+    $libraries = $form_state['values']['libraries'];
+    $do_all = FALSE;
+    $to_sync = array();
+
+  foreach ($libraries as $library_id) {
+    if (preg_match("/^all$/i", $library_id)) {
+      $do_all = TRUE;
+    }
+    if ($library_id and preg_match("/^\d+$/i", $library_id)) {
+      // get the library info
+      $sql = "SELECT * FROM {Library} WHERE library_id = %d";
+      $library = db_fetch_object(chado_query($sql, $library_id));
+      $to_sync[$library_id] = $library->name;
+    }
+  }
+
+  // submit the job to the tripal job manager
+  if ($do_all) {
+    tripal_add_job('Sync all libraries', 'tripal_library', 'tripal_library_sync_libraries', $job_args, $user->uid);
+  }
+  else{
+    foreach ($to_sync as $library_id => $name) {
+      $job_args[0] = $library_id;
+      tripal_add_job("Sync library: $name", 'tripal_library', 'tripal_library_sync_libraries', $job_args, $user->uid);
+      }
+    }
+  }
+
+  // -------------------------------------
+  // Submit the Reindex Job if selected
+  if ($form_state['values']['op'] == t('Reindex Features')) {
+    $libraries = $form_state['values']['re-libraries'];
+    foreach ($libraries as $library_id) {
+      if ($library_id and preg_match("/^\d+$/i", $library_id)) {
+        // get the library info
+        $sql = "SELECT * FROM {Library} WHERE library_id = %d";
+        $library = db_fetch_object(chado_query($sql, $library_id));
+        $job_args[0] = $library_id;
+        tripal_add_job("Reindex features for library: $library->name", 'tripal_library',
+         'tripal_library_reindex_features', $job_args, $user->uid);
+      }
+    }
+  }
+
+  // -------------------------------------
+  // Submit the Taxonomy Job if selected
+  if ($form_state['values']['op'] == t('Set Feature Taxonomy')) {
+    $libraries = $form_state['values']['tx-libraries'];
+    foreach ($libraries as $library_id) {
+      if ($library_id and preg_match("/^\d+$/i", $library_id)) {
+        // get the library info
+        $sql = "SELECT * FROM {Library} WHERE library_id = %d";
+        $library = db_fetch_object(chado_query($sql, $library_id));
+        $job_args[0] = $library_id;
+        tripal_add_job("Set taxonomy for features in library: $library->name", 'tripal_library',
+         'tripal_library_taxonify_features', $job_args, $user->uid);
+      }
+    }
+  }
+    // -------------------------------------
+    // Submit the Cleanup Job if selected
+    if ($form_state['values']['op'] == t('Clean up orphaned libraries')) {
+      tripal_add_job('Cleanup orphaned libraries', 'tripal_library',
+         'tripal_library_cleanup', $job_args, $user->uid);
+    }
+}
+
+
+/**
+ * Add the library as a taxonomy term for associating with library_features
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_add_taxonomy($node, $library_id) {
+
+    //include the file containing the required functions.  We only have to
+    // do this because Drupal 6 fails to do this globally for us and
+    // the drupal_execute function below won't work
+    module_load_include('inc', 'taxonomy', 'taxonomy.admin');
+
+   /*   // get the vocabulary id
+    $vocabularies = taxonomy_get_vocabularies();
+    $vid = NULL;
+    foreach($vocabularies as $vocab){
+    if($vocab->name == 'DNA Libraries'){
+    $vid = $vocab->vid;
+    }
+    }
+
+    if(!$vid){  */
+   // add the vocabulary
+  $vocab_form['values']['name'] = 'DNA Libraries';
+  $vocab_form['values']['description'] = 'Allows for associating/searching of library features by library name';
+  $vocab_form['values']['help'] = '';
+  $vocab_form['values']['module'] = 'taxonomy';
+  drupal_execute('taxonomy_form_vocabulary', $vocab_form);
+  return;
+   //   }
+
+   // make sure this term doesn't already exist.  If it doesn't then add it
+  if ($vid) {
+    $tree = taxonomy_get_tree($vid);
+    $found = 0;
+    foreach ($tree as $term) {
+      if ($term->name == $node->title) {
+        $found = 1;
+      }
+    }
+
+      // add the term to the vocabulary
+    if (!$found) {
+      $form_state = array();
+      $form_state['values']['name'] = $node->title;
+      $form_state['values']['description'] = $library_id;
+      drupal_execute('taxonomy_form_term', $form_state, $vid);
+    }
+  }
+}
+
+
+/**
+ *
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_sync_libraries($library_id = NULL, $job_id = NULL) {
+
+  global $user;
+  $page_content = '';
+
+  // get the list of libraries and create new nodes
+  if (!$library_id) {
+    $sql = "SELECT * FROM {Library} L";
+    $results = chado_query($sql);
+  }
+  else {
+    $sql = "SELECT * FROM {Library} L WHERE library_id = %d";
+    $results = chado_query($sql, $library_id);
+  }
+
+  // We'll use the following SQL statement for checking if the library
+  // already exists as a drupal node.
+  $sql = "SELECT * FROM {chado_library} ".
+        "WHERE library_id = %d";
+
+  while ($library = db_fetch_object($results)) {
+
+    // check if this library already exists in the drupal database. if it
+    // does then skip this library and go to the next one.
+    if (!db_fetch_object(db_query($sql, $library->library_id))) {
+
+    $new_node = new stdClass();
+    $new_node->type = 'chado_library';
+    $new_node->uid = $user->uid;
+    $new_node->title = "$library->name";
+    $new_node->library_id = $library->library_id;
+    $new_node->organism_id = $library->organism_id;
+    $new_node->uniquename = $library->uniquename;
+    $new_node->type_id = $library->type_id;
+
+    node_validate($new_node);
+    $errors = form_get_errors();
+    if (!$errors) {
+      $node = node_submit($new_node);
+      node_save($node);
+      if ($node->nid) {
+        print "Added " . $library->name . "\n";
+      }
+      else {
+        print "ERROR: Unable to create " . $library->name . "\n";
+      }
+    }
+    else {
+      print "ERROR: Unable to create " . $library->name . "\n" . print_r($errors, TRUE) . "\n";
+    }
+    }
+    else {
+      print "Skipped " . $library->name . "\n";
+    }
+  }
+  return $page_content;
+}
+
+
+/**
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_feature_set_taxonomy($library_id = NULL) {
+
+   //TO DO : return usable error if vocabs don't exist
+   // get the list of vocabularies and find our two vocabularies of interest
+  $vocabularies = taxonomy_get_vocabularies();
+  $vid = NULL;
+  foreach ($vocabularies as $vocab) {
+    if ($vocab->name == 'Library') {
+      $vid = $vocab->vid;
+    }
+  }
+  if (!$vid) {
+    return;
+  }
+
+  // We'll use the following SQL statement for getting the node info
+  if ($library_id) {
+    print "Finding features for library with ID: $library_id\n";
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           "FROM {library_feature} LF ".
+           "INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "WHERE L.library_id = $library_id ".
+           "ORDER BY LF.feature_id";
+    $features = chado_query($sql);
+  }
+  else {
+    print "Finding features for all libraries\n";
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           "FROM {library_feature} LF ".
+           "INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "ORDER BY LF.feature_id";
+    $features = chado_query($sql);
+  }
+
+  $node_sql = "SELECT * FROM {chado_feature} CF ".
+             "  INNER JOIN {node} N ON CF.nid = N.nid ".
+             "WHERE feature_id = %d";
+
+  // iterate through the features and add the taxonomy
+  while ($feature = db_fetch_object($features)) {
+    $node = db_fetch_object(db_query($node_sql, $feature->feature_id));
+    $tags["$vid"] = $feature->libname;
+    $terms['tags'] = $tags;
+    taxonomy_node_save($node, $terms);
+    print "Updated $feature->feature_id as $feature->libname\n";
+  }
+}
+/**
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_reindex_features($library_id = NULL, $job_id = NULL) {
+  $i = 0;
+
+  // if the caller provided a library_id then get all of the features
+  // associated with the library. Otherwise get all sequences assoicated
+  // with all libraries.
+  if ($library_id) {
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           " FROM {library_feature} LF ".
+           "  INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "WHERE L.library_id = $library_id ".
+           "ORDER BY LF.feature_id";
+    $results = chado_query($sql);
+  }
+  else {
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           " FROM {library_feature} LF ".
+           "  INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "ORDER BY LF.feature_id";
+    $results = chado_query($sql);
+  }
+
+   // load into ids array
+  $count = 0;
+  $ids = array();
+  while ($id = db_fetch_object($results)) {
+    $ids[$count] = $id->feature_id;
+    $count++;
+  }
+
+  $interval = intval($count * 0.01);
+  foreach ($ids as $feature_id) {
+    // update the job status every 1% features
+    if ($job_id and $i % interval == 0) {
+      tripal_job_set_progress($job_id, intval(($i/$count)*100));
+    }
+    tripal_feature_sync_feature($feature_id);
+    $i++;
+  }
+}
+/**
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
+  $i = 0;
+
+  // if the caller provided a library_id then get all of the features
+  // associated with the library. Otherwise get all sequences assoicated
+  // with all libraries.
+  if ($library_id) {
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           " FROM {library_feature} LF ".
+           "  INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "WHERE L.library_id = $library_id ".
+           "ORDER BY LF.feature_id";
+    $results = chado_query($sql);
+  }
+  else {
+    $sql = "SELECT LF.feature_id, L.library_id, L.name as libname ".
+           " FROM {library_feature} LF ".
+           "  INNER JOIN Library L ON LF.library_id = L.library_id ".
+           "ORDER BY LF.feature_id";
+    $results = chado_query($sql);
+  }
+
+  // load into ids array
+  $count = 0;
+  $ids = array();
+  while ($id = db_fetch_object($results)) {
+    $ids[$count] = $id->feature_id;
+    $count++;
+  }
+
+  // make sure our vocabularies are set before proceeding
+  tripal_feature_set_vocabulary();
+
+  // use this SQL for getting the nodes
+  $nsql =  "SELECT * FROM {chado_feature} CF ".
+          "  INNER JOIN {node} N ON N.nid = CF.nid ".
+          "WHERE feature_id = %d";
+
+   // iterate through the features and set the taxonomy
+  $interval = intval($count * 0.01);
+  foreach ($ids as $feature_id) {
+    // update the job status every 1% features
+    if ($job_id and $i % interval == 0) {
+      tripal_job_set_progress($job_id, intval(($i/$count)*100));
+    }
+      $node = db_fetch_object(db_query($nsql, $feature_id));
+      tripal_feature_set_taxonomy($node, $feature_id);
+      $i++;
+  }
+}
+
+
+/**
+ * Remove orphaned drupal nodes
+ *
+ * @param $dummy
+ *   Not Used -kept for backwards compatibility
+ * @param $job_id
+ *   The id of the tripal job executing this function
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_cleanup($dummy = NULL, $job_id = NULL) {
+
+  return tripal_core_clean_orphaned_nodes('library', $job_id);
+  
+}
+

+ 94 - 0
tripal_library/theme/tripal_library_admin.tpl.php

@@ -0,0 +1,94 @@
+<h3>Tripal Library Administrative Tools Quick Links:</h3>
+<ul>
+ <li><a href="<?php print url("admin/tripal/tripal_library/configuration") ?>">Library Configuration</a></li>
+</ul>
+<h3>Module Description:</h3>
+<p>The Tripal Library module is an interface for the Chado Library module which groups features (sequences) into genetic libraries.
+    This module provides support for visualization of "library" pages, editing and updating.</p>
+
+<h3>Setup Instructions:</h3>
+<ol>
+<li><p><b>Set Permissions</b>: The library module supports the Drupal user permissions interface for
+   controlling access to library content and functions. These permissions include viewing,
+   creating, editing or administering of
+   library content. The default is that only the original site administrator has these
+   permissions.  You can <a href="<?php print url('admin/user/roles') ?>">add roles</a> for classifying users,
+   <a href="<?php print url('admin/user/user') ?>">assign users to roles</a> and
+   <a href="<?php print url('admin/user/permissions') ?>">assign permissions</a> for the library content to
+   those roles.  For a simple setup, allow anonymous users access to view organism content and
+   allow the site administrator all other permissions.</p></li>
+<li><p><b>Sync any Existing Libraries</b>: Near the top of the ' . l('Library Configuration page', 'admin/tripal/tripal_library/configuration') ?> there is
+  a Sync Libraries section which provides list of libraries currently in chado which can be sync\'d.
+  Simply select the libraries you would like to create Drupal/Tripal pages for and click Sync Libraries.</p></li>
+</ol>
+
+
+<h3>Features of this Module:</h3>
+<ul>
+  <li><b>Add/Edit/Delete Libraries</b>: Libraries with no associated features can be created ' . l('here', 'node/add/chado-library') ?> but it is
+  recommended to create the library using the feature loader. For example, when you load FASTA files using the Tripal loader you are
+  given the option of specifying a library for all created features. Existing Libraries (regardless of the method used to create them) can be
+  edited or deleted by clicking the Edit tab at the top of the Library Page.</li>
+  <li><p><b>Integration with Drupal Views</b>: <a href="http://drupal.org/project/views">Drupal Views</a> is
+  a powerful tool that allows the site administrator to create lists or basic searching forms of Chado content.
+  It provides a graphical interface within Drupal to allow the site admin to directly query the Chado database
+  and create custom lists without PHP programming or customization of Tripal source code.  Views can also
+  be created to filter content that has not yet been synced with Druapl in order to protect access to non
+  published data (only works if Chado was installed using Tripal).  You can see a list of available pre-existing
+  Views <a href="<?php print url('admin/build/views/') ?>">here</a>, as well as create your own. </p></li>
+  <li><b>Basic Listing</b>: This module provides a basic <a href="<?php print url('libraries') ?>">library display
+  tool</a> for finding or listing libraries in Chado. It does not require indexing for Drupal searching but relies
+  on Drupal Views.  <a href="http://drupal.org/project/views">Drupal Views</a> must be installed.</li>
+</ul>
+
+<h3>Page Customizations</h3>
+<p>There are several ways to customize the look-and-feel for the way Chado data is presented through Tripal.
+Below is a description of several methods.  These methods may be used in conjunction with one another to
+provide fine-grained control.
+<ul>
+
+<li><p><b>Integration with Drupal Panels</b>:  <a href="http://drupal.org/project/views">Drupal Panels</a>
+allows for customization of a page layout if you don\'t want to do PHP/Javascript/CSS programming.  Tripal comes with pre-set layouts for library pages.  However,
+Panels become useful if you prefer a layout that is different from the pre-set layouts.  Chado content
+is provided to Panels in the form of Drupal "blocks" which you can then place anywhere on a page using the
+Panel\'s GUI.</p></li>
+
+<li><p><b>Drupal\'s Content Construction Kit (CCK)</b>: the
+<a href="http://drupal.org/project/cck">Content Construction Kit (CCK) </a> is a powerful way to add non-Chado content
+to any page without need to edit template files or knowing PHP.  You must first download and install CCK.
+With CCK, the site administartor can create a new field to appear on the page.  For example, currently,
+the Chado publication module is not yet supported by Tripal.  Therefore, the site administrator can add a text
+field to the library pages.  This content is not stored in Chado, but will appear on the library page.  A field
+added by CCK will also appear in the form when editing a library to allow users to manually enter the appropriate
+text.  If the default pre-set layout and themeing for Tripal is used, it is better to create the CCK element,
+indicate that it is not to be shown (using the CCK interface), then manually add the new content type
+where desired by editing the templates (as described below).  If using Panels, the CCK field can be added to the
+location desired using the Panels interface.</p></li>
+
+<li><p><b>Drupal Node Templates</b>:  The Tripal packages comes with a "theme_tripal" directory that contains the
+themeing for Chado content.    The library module has a template file for library "nodes" (Tripal library pages).  This file
+is named "node-chado_library.tpl.php", and provides javascript, HTML and PHP code for display of the library
+pages.  You can edit this file to control which types of information (or which library "blocks") are displayed for libraries. Be sure to
+copy these template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
+future Tripal updates may overwrite your customizations. See the <a href="http://tripal.info">Tripal website </a>
+for instructions on how to access variables and other Chado content within the template file.</p></li>
+
+<li><p><b>Library "Block" Templates</b>:  In the "theme_tripal" directory is a subdirectory named "tripal_library".
+Inside this directory is a set of templates that control distinct types of information for libraries.  For example,
+there is a "base" template for displaying of data directly from the Chado library table.  These templates are used both by Drupal blocks
+for use in Drupal Panels (as described above) or for use in the default pre-set layout that the node template
+provides (also desribed above).  You can customize this template as you desire.  Be sure to copy the
+template to your primary theme directory for editing. Do not edit them in the "theme_tripal" directory as
+future Tripal updates may overwrite your customizations.  See the <a href="http://tripal.info">Tripal website </a>
+for instructions on how to access variables and other Chado content within the template files.</p></li>
+</li>
+
+<li><p><b>Adding Links to the "Resources" Sidebar</b>: If you use the pre-set default Tripal layout for theming, you
+will see a "Resources" sidebar on each page.  The links that appear on the sidebar are automatically generated
+using Javascript for all of the library "Blocks" that appear on the page. If you want to add additional links
+(e.g. a link to a views table showing all features of the current library) and you want that link to appear in the
+"Resources" sidebar, simply edit the Drupal Node Template (as described above) and add the link to the
+section at the bottom of the template file where the resources section is found.</p></li>
+
+</ul>
+</p>

+ 43 - 16
tripal_library/tripal_library.install

@@ -17,18 +17,6 @@ function tripal_library_install() {
   // features, librarys, etc....
   drupal_install_schema('tripal_library');
 
-  // Insert cvterm 'library_description' into cvterm table of chado
-  // database. This CV term is used to keep track of the library
-  // description in the libraryprop table.
-  tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 'tripal', 0, 1, 'tripal');
-
-  // Add CVTerms for the library types
-  tripal_cv_add_cvterm(array('name' => 'cdna_library', 'def' => 'cDNA Library'), 'tripal', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'bac_library', 'def' => 'BAC Library'), 'tripal', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'fosmid_library', 'def' => 'FOSMID Library'), 'tripal', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'cosmid_library', 'def' => 'COSMID Library'), 'tripal', 0, 1, 'tripal');
-  tripal_cv_add_cvterm(array('name' => 'yac_library', 'def' => 'YAC Library'), 'tripal', 0, 1, 'tripal');
-
   // Add the materialized view needed to count the features for the library
   // Create the MView
   tripal_add_mview('library_feature_count', 'tripal_library',
@@ -48,7 +36,9 @@ function tripal_library_install() {
     'GROUP BY L.library_id, L.name, CVT.name',
     ''
   );
-
+  
+  // Add cvterms
+  tripal_library_add_cvterms();
 }
 
 /**
@@ -140,11 +130,48 @@ function tripal_library_requirements($phase) {
     // make sure chado is installed
     if (!tripal_core_is_chado_installed()) {
       $requirements ['tripal_library'] = array(
-            'title' => "tripal_library",
-            'value' => "ERROR: Chado most be installed before this module can be enabled",
-            'severity' => REQUIREMENT_ERROR,
+        'title' => "tripal_library",
+        'value' => "ERROR: Chado most be installed before this module can be enabled",
+        'severity' => REQUIREMENT_ERROR,
       );
     }
   }
   return $requirements;
+}
+
+/*
+ * 
+ */
+function tripal_library_add_cvterms() {
+  
+  // Insert cvterm 'library_description' into cvterm table of chado
+  // database. This CV term is used to keep track of the library
+  // description in the libraryprop table.
+  tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 
+    'tripal', 0, 1, 'tripal');
+  
+  // add cvterms for the map unit types
+  tripal_cv_add_cvterm(array('name' => 'cdna_library','def' => 'cDNA library'), 
+    'tripal_library_types', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'bac_library','def' => 'Bacterial Artifical Chromsome (BAC) library'), 
+    'tripal_library_types', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'fosmid_library','def' => 'Fosmid library'), 
+    'tripal_library_types', 0, 1, 'tripal');   
+  tripal_cv_add_cvterm(array('name' => 'cosmid_library','def' => 'Cosmid library'), 
+    'tripal_library_types', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'yac_library','def' => 'Yeast Artificial Chromosome (YAC) library'), 
+    'tripal_library_types', 0, 1, 'tripal');
+}
+
+/**
+ *  Update for Drupal 6.x, Tripal 1.0
+ *  This update
+ *   - adds the library types
+ *
+ * @ingroup tripal_library
+ */
+function tripal_library_update_6000() {
+  // add in the missing library typ cv terms
+  tripal_library_add_cvterms();
+  return $ret;
 }

File diff suppressed because it is too large
+ 122 - 850
tripal_library/tripal_library.module


Some files were not shown because too many files changed in this diff