Эх сурвалжийг харах

Added documentation to tripal_core, tripal_analysis, tripal_contact, tripal_stock for the new Doxygen API Site

laceysanderson 14 жил өмнө
parent
commit
0f66f0150d
49 өөрчлөгдсөн 1296 нэмэгдсэн , 402 устгасан
  1. 61 2
      tripal_analysis/tripal_analysis.module
  2. 5 0
      tripal_analysis/tripal_analysis.views.inc
  3. 2 0
      tripal_analysis/views/analysis.views.inc
  4. 2 0
      tripal_analysis/views/chado_analysis.views.inc
  5. 5 0
      tripal_analysis/views/handlers/views_handler_field_computed_analysis_nid.inc
  6. 2 0
      tripal_analysis/views/misc_tables.views.inc
  7. 9 0
      tripal_contact/tripal_contact.module
  8. 4 0
      tripal_contact/tripal_contact.views.inc
  9. 17 6
      tripal_core/chado_install.php
  10. 12 4
      tripal_core/cvterms.php
  11. 18 6
      tripal_core/jobs.php
  12. 26 10
      tripal_core/mviews.php
  13. 31 16
      tripal_core/tripal_core.api.inc
  14. 84 41
      tripal_core/tripal_core.module
  15. 276 92
      tripal_core/tripal_core.schema.api.inc
  16. 47 5
      tripal_core/tripal_core.views.inc
  17. 5 3
      tripal_core/tripal_launch_jobs.php
  18. 5 1
      tripal_core/tripal_launch_jobs_multi.php
  19. 11 7
      tripal_core/views/handlers/views_handler_field_chado_count.inc
  20. 1 0
      tripal_core/views/handlers/views_handler_field_chado_tf_boolean.inc
  21. 5 0
      tripal_core/views/handlers/views_handler_field_cvterm_name.inc
  22. 5 0
      tripal_core/views/handlers/views_handler_field_dbxref_accession_link.inc
  23. 3 5
      tripal_core/views/handlers/views_handler_field_node_optional.inc
  24. 2 1
      tripal_core/views/handlers/views_handler_field_readable_date.inc
  25. 5 0
      tripal_core/views/handlers/views_handler_field_type_name.inc
  26. 4 1
      tripal_core/views/handlers/views_handler_filter_chado_boolean.inc
  27. 5 1
      tripal_core/views/handlers/views_handler_filter_chado_select_cvterm_name.inc
  28. 5 2
      tripal_core/views/handlers/views_handler_filter_chado_select_string.inc
  29. 27 8
      tripal_stock/tripal_stock-administration.inc
  30. 126 17
      tripal_stock/tripal_stock-db_references.inc
  31. 47 18
      tripal_stock/tripal_stock-properties.inc
  32. 50 15
      tripal_stock/tripal_stock-relationships.inc
  33. 34 3
      tripal_stock/tripal_stock-secondary_tables.inc
  34. 87 47
      tripal_stock/tripal_stock.api.inc
  35. 179 54
      tripal_stock/tripal_stock.module
  36. 7 4
      tripal_stock/tripal_stock.views.inc
  37. 5 3
      tripal_stock/views/chado_stock.views.inc
  38. 6 0
      tripal_stock/views/handlers/views_handler_argument_stockprop_id.inc
  39. 9 0
      tripal_stock/views/handlers/views_handler_field_computed_stock_nid.inc
  40. 7 2
      tripal_stock/views/handlers/views_handler_field_stock_dbxref_all.inc
  41. 8 2
      tripal_stock/views/handlers/views_handler_field_stock_dbxref_by_type.inc
  42. 4 2
      tripal_stock/views/handlers/views_handler_field_stockprop_all.inc
  43. 5 2
      tripal_stock/views/handlers/views_handler_field_stockprop_by_type.inc
  44. 4 2
      tripal_stock/views/handlers/views_handler_field_stockrel_all.inc
  45. 5 2
      tripal_stock/views/handlers/views_handler_field_stockrel_by_type.inc
  46. 6 2
      tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc
  47. 4 1
      tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
  48. 2 0
      tripal_stock/views/misc_tables.views.inc
  49. 17 15
      tripal_stock/views/stock.views.inc

+ 61 - 2
tripal_analysis/tripal_analysis.module

@@ -1,5 +1,18 @@
 <?php
 // $Id:
+
+/**
+ * @file
+ * Contains all the main hook implementations for the tripal_analysis module
+ */
+
+/**
+ * @defgroup tripal_analysis Analysis Module
+ * @{
+ * Provides functions for managing chado analysis' including creating details pages for each one
+ * @}
+ */
+
 /*******************************************************************************
  * Note: When we pull information for an analysis from chado database. We use
  * 'analysisname' instead of just 'name' to avoid name collision with drupal's
@@ -12,14 +25,18 @@ require('tripal_analysis.api.inc');
 
 /*************************************************************************
 *
-*/
+ *
+ * @ingroup tripal_analysis
+ */
 function tripal_analysis_register_child($modulename){
    $sql = "INSERT INTO {tripal_analysis} (modulename) VALUES ('%s')";
    db_query($sql, $modulename);
 }
 /*************************************************************************
 *
-*/
+ *
+ * @ingroup tripal_analysis
+ */
 function tripal_analysis_unregister_child($modulename){
    if (db_table_exists('tripal_analysis')) {
       $sql = "DELETE FROM {tripal_analysis} WHERE modulename = '%s'";
@@ -27,6 +44,8 @@ function tripal_analysis_unregister_child($modulename){
    }
 }
 /******************************************************************************
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_init(){
    drupal_add_js(drupal_get_path('theme', 'tripal').'/js/tripal_analysis.js');
@@ -35,6 +54,8 @@ function tripal_analysis_init(){
  * tripal_analysis_menu()
  * HOOK: Implementation of hook_menu()
  * Entry points and paths of the module
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_menu() {
 	// Display available analyses
@@ -77,6 +98,8 @@ function tripal_analysis_menu() {
 /*******************************************************************************
  * Display the summary view of analyses when click on the 'Analyses'
  * primary-link
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_show_analyses (){
 	// Show libraries stored in Drupal's {chado_analysis} table
@@ -94,6 +117,8 @@ function tripal_analysis_show_analyses (){
 /*******************************************************************************
  *  Provide information to drupal about the node types that we're creating
  *  in this module
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_node_info() {
 	$nodes = array();
@@ -113,6 +138,8 @@ function tripal_analysis_node_info() {
  *  When a new chado_analysis node is created we also need to add information
  *  to our chado_analysis table.  This function is called on insert of a new
  *  node of type 'chado_analysis' and inserts the necessary information.
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_insert($node){
 	global $user;
@@ -176,6 +203,8 @@ function chado_analysis_insert($node){
 	}
 }
 /*******************************************************************************
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_delete($node){
 	// Before removing, get analysis_id so we can remove it from chado database
@@ -208,6 +237,8 @@ function chado_analysis_delete($node){
 
 /*******************************************************************************
  * Update analyses
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_update($node){
 	global $user;
@@ -265,6 +296,8 @@ function chado_analysis_update($node){
 /*******************************************************************************
  *  When editing or creating a new node of type 'chado_analysis' we need
  *  a form.  This function creates the form that will be used for this.
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_form ($node){
 
@@ -376,6 +409,8 @@ function chado_analysis_form ($node){
 /*******************************************************************************
  *  When a node is requested by the user this function is called to allow us
  *  to add auxiliary data to the node object.
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_load($node){
 	// get the analysis_id for this node:
@@ -414,6 +449,8 @@ function chado_analysis_load($node){
 /*******************************************************************************
  *  This function customizes the view of the chado_analysis node.  It allows
  *  us to generate the markup.
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_view ($node, $teaser = FALSE, $page = FALSE) {
 	// use drupal's default node view:
@@ -435,6 +472,8 @@ function chado_analysis_view ($node, $teaser = FALSE, $page = FALSE) {
 
 /*******************************************************************************
  * Synchronize analyses from chado to drupal
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_sync_analyses ($analysis_id = NULL, $job_id = NULL){
 	global $user;
@@ -563,6 +602,8 @@ function tripal_analysis_sync_analyses ($analysis_id = NULL, $job_id = NULL){
  * @param arg array that holds the current path as would be returned from arg()
  * function
  * @return help text for the path
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_help($path, $arg) {
 	$output = '';
@@ -578,6 +619,8 @@ function tripal_analysis_help($path, $arg) {
 /*******************************************************************************
  *  The following function proves access control for users trying to
  *  perform actions on data managed by this module
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_access($op, $node, $account){
 	if ($op == 'create') {
@@ -606,6 +649,8 @@ function chado_analysis_access($op, $node, $account){
  *  Set the permission types that the chado module uses.  Essentially we
  *  want permissionis that protect creation, editing and deleting of chado
  #  data objects
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_perm(){
 	return array(
@@ -620,6 +665,8 @@ function tripal_analysis_perm(){
  *  We need to let drupal know about our theme functions and their arguments.
  *  We create theme functions to allow users of the module to customize the
  *  look and feel of the output generated in this module
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analysis_theme () {
 	return array(
@@ -635,6 +682,8 @@ function tripal_analysis_theme () {
  * algorithm, sourcename, sourceversion, sourceuri, timeexecuted) from
  * chado database. The return type is an object array that stores $analysis
  * objects sorted by program
+ *
+ * @ingroup tripal_analysis
  */
 function get_chado_analyses() {
 
@@ -671,6 +720,8 @@ function get_chado_analyses() {
 }
 /************************************************************************
  *
+ *
+ * @ingroup tripal_analysis
  */
 function theme_tripal_analysis_analysis_page($analyses) {
    
@@ -724,6 +775,8 @@ function theme_tripal_analysis_analysis_page($analyses) {
 
 /************************************************************************
  *
+ *
+ * @ingroup tripal_analysis
  */
 function tripal_analyses_cleanup($dummy = NULL, $job_id = NULL) {
 
@@ -782,6 +835,8 @@ function tripal_analyses_cleanup($dummy = NULL, $job_id = NULL) {
 }
 /*******************************************************************************
  *
+ *
+ * @ingroup tripal_analysis
  */
 /*
 function tripal_analysis_reindex_features ($analysis_id = NULL, $job_id = NULL){
@@ -827,6 +882,8 @@ function tripal_analysis_reindex_features ($analysis_id = NULL, $job_id = NULL){
 } */
 /*******************************************************************************
  *
+ *
+ * @ingroup tripal_analysis
  */
 /*
 function tripal_analysis_taxonify_features ($analysis_id = NULL, $job_id = NULL){
@@ -886,6 +943,8 @@ function tripal_analysis_taxonify_features ($analysis_id = NULL, $job_id = NULL)
  * Purpose: Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_analysis.views.inc where all the
  *  views integration code is
+ *
+ * @ingroup tripal_analysis
  */ 
 function tripal_analysis_views_api() {
    return array(

+ 5 - 0
tripal_analysis/tripal_analysis.views.inc

@@ -13,11 +13,14 @@
 /*************************************************************************
  * Implements hook_views_data()
  * Purpose: Describe chado/tripal tables & fields to views
+ *
  * @return: a data array which follows the structure outlined in the
  *   views2 documentation for this hook. Essentially, it's an array of table
  *   definitions keyed by chado/tripal table name. Each table definition 
  *   includes basic details about the table, fields in that table and
  *   relationships between that table and others (joins)
+ *
+ * @ingroup tripal_analysis
  */
 require('views/analysis.views.inc');
 require('views/chado_analysis.views.inc');
@@ -38,6 +41,8 @@ function tripal_analysis_views_data()  {
  *   where a handler describes either "the type of field", 
  *   "how a field should be filtered", "how a field should be sorted"
  * @return: An array of handler definitions
+ *
+ * @ingroup tripal_analysis
  */
 function chado_analysis_views_views_handlers() {
   return array(

+ 2 - 0
tripal_analysis/views/analysis.views.inc

@@ -25,6 +25,8 @@
  *       constraint analysis_c1 unique (program,programversion,sourcename)
  *   );
  * @endcode
+ *
+ * @ingroup tripal_analysis
  */
 function retrieve_analysis_views_data() {
 	global $db_url;

+ 2 - 0
tripal_analysis/views/chado_analysis.views.inc

@@ -7,6 +7,8 @@
  *
  * The main need for description of this table to views is to join chado data with drupal nodes
  *
+ *
+ * @ingroup tripal_analysis
  */
 function retrieve_chado_analysis_views_data () {
 	global $db_url;

+ 5 - 0
tripal_analysis/views/handlers/views_handler_field_computed_analysis_nid.inc

@@ -1,5 +1,10 @@
 <?php
 
+/**
+ *
+ *
+ * @ingroup tripal_analysis
+ */
 class views_handler_field_computed_analysis_nid extends views_handler_field_numeric {
 	function construct() {
 		parent::construct();

+ 2 - 0
tripal_analysis/views/misc_tables.views.inc

@@ -15,6 +15,8 @@
         ),
       ); 
  *   @endcode
+ *
+ * @ingroup tripal_analysis
  */
 function retrieve_analysis_misc_tables_views_data() {
   $data = array();

+ 9 - 0
tripal_contact/tripal_contact.module

@@ -9,6 +9,13 @@
  * @see http://gmod.org/wiki/Chado_General_Module
  */
 
+/**
+ * @defgroup tripal_contact Contact Module
+ * @{
+ * Provides functions for managing chado contacts
+ * @}
+ */
+
 require('tripal_contact.api.inc');
 
 /*************************************************************************
@@ -16,6 +23,8 @@ require('tripal_contact.api.inc');
  * Purpose: Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_contact.views.inc where all the
  *  views integration code is
+ *
+ * @ingroup tripal_contact
  */ 
 function tripal_contact_views_api() {
    return array(

+ 4 - 0
tripal_contact/tripal_contact.views.inc

@@ -19,6 +19,8 @@
  *   definitions keyed by chado/tripal table name. Each table definition 
  *   includes basic details about the table, fields in that table and
  *   relationships between that table and others (joins)
+ *
+ * @ingroup tripal_contact
  */
 function tripal_contact_views_data()  {
   $data = array();
@@ -33,6 +35,8 @@ function tripal_contact_views_data()  {
  *   "how a field should be filtered", "how a field should be sorted"
  *
  * @return: An array of handler definitions
+ *
+ * @ingroup tripal_contact
  */
 function tripal_contact_views_handlers() {
  return array(

+ 17 - 6
tripal_core/chado_install.php

@@ -1,7 +1,9 @@
 <?php
 
-/*************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_core_chado_v1_11_load_form (){
    $form['description'] = array(
@@ -17,8 +19,9 @@ using chado in a database external to the Drupal database with a 'chado' entry i
    );
    return $form;
 }
-/*************************************************************************
+/**
 *
+* @ingroup tripal_core
 */
 function tripal_core_chado_v1_11_load_form_submit ($form, &$form_state){
    global $user;
@@ -29,8 +32,10 @@ function tripal_core_chado_v1_11_load_form_submit ($form, &$form_state){
 
    return '';
 }
-/*************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_core_install_chado ($dummy = NULL, $job = NULL){
    $schema_file = drupal_get_path('module', 'tripal_core').'/default_schema.sql';
@@ -39,8 +44,10 @@ function tripal_core_install_chado ($dummy = NULL, $job = NULL){
    tripal_core_install_sql($schema_file);
    tripal_core_install_sql($init_file);      
 }
-/*************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_core_reset_chado_schema (){
    global $active_db;
@@ -53,8 +60,10 @@ function tripal_core_reset_chado_schema (){
    pg_query($active_db,"create schema chado");
    pg_query($active_db,"create language plpgsql");
 }
-/*************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_core_install_sql ($sql_file){
    global $active_db;
@@ -216,8 +225,10 @@ function tripal_core_install_sql ($sql_file){
    print "Installation Complete!\n";
    tripal_core_chado_install_done(); 
 }
-/*************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_core_chado_install_done (){
    // return the search path to normal

+ 12 - 4
tripal_core/cvterms.php

@@ -3,8 +3,10 @@
 // Copyright 2009 Clemson University
 //
 
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_add_cvterms ($name,$definition,$cv_name = 'tripal',$db_name='tripal'){
    
@@ -49,8 +51,10 @@ function tripal_add_cvterms ($name,$definition,$cv_name = 'tripal',$db_name='tri
      // TODO -- ERROR HANDLING
    }
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_add_db($db_name,$description,$urlprefix,$url){
    $previous_db = tripal_db_set_active('chado');  // use chado database
@@ -75,8 +79,10 @@ function tripal_add_db($db_name,$description,$urlprefix,$url){
    return $db->db_id;
 }
 
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_delete_db($db_name){
    $previous_db = tripal_db_set_active('chado');  // use chado database
@@ -86,8 +92,10 @@ function tripal_delete_db($db_name){
    
 }
 
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_add_cv($cv_name,$definition){
    $previous_db = tripal_db_set_active('chado');  // use chado database

+ 18 - 6
tripal_core/jobs.php

@@ -3,8 +3,10 @@
 // Copyright 2009 Clemson University
 //
 
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_add_job ($job_name,$modulename,$callback,$arguments,$uid,
    $priority = 10){
@@ -29,8 +31,10 @@ function tripal_add_job ($job_name,$modulename,$callback,$arguments,$uid,
 
    return 1;
 }
-/************************************************************************
+/**
 *   
+*
+* @ingroup tripal_core
 */
 function tripal_job_set_progress($job_id,$percentage){
 
@@ -44,8 +48,10 @@ function tripal_job_set_progress($job_id,$percentage){
    }
    return 0;
 }
-/************************************************************************
+/**
 *   Returns a list of jobs associated with the given module
+*
+* @ingroup tripal_core
 */
 function tripal_get_module_active_jobs ($modulename){
    $sql =  "SELECT * FROM {tripal_jobs} TJ ".
@@ -53,8 +59,10 @@ function tripal_get_module_active_jobs ($modulename){
   return db_fetch_object(db_query($sql,$modulename));
 
 }
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_jobs_report () {
    //$jobs = db_query("SELECT * FROM {tripal_jobs} ORDER BY job_id DESC");
@@ -105,8 +113,10 @@ function tripal_jobs_report () {
 	$output .= theme_pager();
    return $output;
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_jobs_launch (){
    
@@ -151,8 +161,10 @@ function tripal_jobs_launch (){
 		// send an email to the user advising that the job has finished
    }
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_jobs_check_running () {
    // iterate through each job that has not ended

+ 26 - 10
tripal_core/mviews.php

@@ -3,7 +3,7 @@
 // Copyright 2009 Clemson University
 //
 
-/************************************************************************
+/**
  * Add a materialized view to the chado database to help speed data access.
  * @param name The name of the materialized view.
  * @param modulename The name of the module submitting the materialized view (e.g. 'tripal_library')
@@ -14,7 +14,9 @@
  * @param special_index  
  * function
  * @return nothing
- */
+ *
+* @ingroup tripal_core
+*/
 function tripal_add_mview ($name,$modulename,$mv_table,$mv_specs,$indexed,$query,$special_index){
 
    $record = new stdClass();
@@ -59,8 +61,10 @@ function tripal_add_mview ($name,$modulename,$mv_table,$mv_specs,$indexed,$query
       }
    }
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_mviews_get_mview_id ($view_name){
 
@@ -74,8 +78,10 @@ function tripal_mviews_get_mview_id ($view_name){
    }
    return 0;
 }
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_mviews_action ($op,$mview_id){
    global $user;
@@ -110,8 +116,10 @@ function tripal_mviews_action ($op,$mview_id){
    }
    return '';
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_update_mview ($mview_id){
    $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = %d ";
@@ -133,8 +141,10 @@ function tripal_update_mview ($mview_id){
 	  }
    }
 }
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_mview_report ($mview_id) {
    // get this mview details
@@ -218,8 +228,10 @@ function tripal_mview_report ($mview_id) {
 
    return $output;
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_mviews_report () {
    $mviews = db_query("SELECT * FROM {tripal_mviews} ORDER BY name");
@@ -260,8 +272,10 @@ function tripal_mviews_report () {
    $output .= "<p><a href=\"$new_url\">Create a new materialized view.</a></p>";
    return $output;
 }
-/************************************************************************
+/**
 *
+*
+* @ingroup tripal_core
 */
 function tripal_mviews_form(&$form_state = NULL,$mview_id = NULL){
 
@@ -355,7 +369,7 @@ function tripal_mviews_form(&$form_state = NULL,$mview_id = NULL){
       '#default_value' => $default_mvquery,
       '#weight'        => 6
    );
-/*
+/**
    $form['special_index']= array(
       '#type'          => 'textarea',
       '#title'         => t('View Name'),
@@ -375,8 +389,10 @@ function tripal_mviews_form(&$form_state = NULL,$mview_id = NULL){
    $form['#redirect'] = 'admin/tripal/tripal_mviews';
    return $form;
 }
-/************************************************************************
+/**
+*
 *
+* @ingroup tripal_core
 */
 function tripal_mviews_form_submit($form, &$form_state){
    

+ 31 - 16
tripal_core/tripal_core.api.inc

@@ -1,12 +1,25 @@
 <?php
 /**
-* @file
-* The Tripal Core API
-*
-* This file provides the API needed for all other Tripal and Tripal dependent
-* modules.
-*/
-
+ * @file
+ * The Tripal Core API
+ *
+ * This file provides the API needed for all other Tripal and Tripal dependent
+ * modules.
+ */
+ 
+/**
+ * @defgroup tripal_api Tripal API
+ * @{
+ * Provides an application programming interface (API) for the tripal package
+ *
+ * The Tripal API currently provides generic insert/update/select functions for all chado content as 
+ * well as some module specific functions that insert/update/delete/select specific chado content. 
+ *
+ * This API is currently in it's infancy so some necessary functions might be missing. If you come 
+ * across a missing function that you think should be included go to the sourceforge feature request * page and request it's inclusion in the API. Such feature requests with a working function * definition will be given priority.
+ * @}
+ */
+ 
 require_once "tripal_core.schema.api.inc";
 
 // just a temporary function for debugging
@@ -102,6 +115,8 @@ function tripal_core_chado_insert_test(){
 * key constraint by specifying the genus and species.  The cvterm is also
 * specified using its foreign key and the cv_id for the cvterm is nested as
 * well.
+*
+* @ingroup tripal_api
 */
 function tripal_core_chado_insert($table,$values){
    $insert_values = array();
@@ -246,6 +261,8 @@ function tripal_core_chado_insert($table,$values){
 * organism_id. The same nested struture is also used for specifying the 
 * values to update.  The function will find the record that matches the 
 * columns specified and update the record with the avlues in the $uvalues array.
+*
+* @ingroup tripal_api
 */
 function tripal_core_chado_update($table,$match,$values){
    $update_values = array();   // contains the values to be updated
@@ -369,6 +386,8 @@ function tripal_core_chado_update($table,$match,$values){
 * way of the organism_id foreign key constraint by specifying the genus and 
 * species.  The cvterm is also specified using its foreign key and the cv_id 
 * for the cvterm is nested as well.
+*
+* @ingroup tripal_api
 */
 function tripal_core_chado_select($table,$columns,$values,$has_record = 0){
 
@@ -451,20 +470,15 @@ function tripal_core_chado_select($table,$columns,$values,$has_record = 0){
 * documentation for any of those functions for further information.
 *
 * @param $table_desc
-*  A table description in Drupal Schema API format for the table with the
-*  foreign key relationship that needs to be identified. This field is generated
-*  by hook_chado_<table name>_schema(). If more than one module implements a hook
-*  the two arrays will be merged. (ie: if the same foreign key is defined in two modules
-*  then $table_desc['foreign keys'][<table>]['table'] will be an array as will 
-*  $table_desc['foreign keys'][<table>]['columns'] -use the one with the highest index)
+*  A table description for the table with the foreign key relationship to be identified generated by 
+*  hook_chado_<table name>_schema()
 * @param $field
 *  The field in the table that is the foreign key.
 * @param $values
 *  An associative array containing the values 
 * 
 * @return
-*  A string containg the results of the foreign key lookup, or FALSE if 
-*  failed.
+*  A string containg the results of the foreign key lookup, or FALSE if failed.
 *
 * Example usage:
 * @code
@@ -482,8 +496,9 @@ function tripal_core_chado_select($table,$columns,$values,$has_record = 0){
 * way of the organism_id foreign key constraint by specifying the genus and 
 * species.  The cvterm is also specified using its foreign key and the cv_id 
 * for the cvterm is nested as well.
+*
+* @ingroup tripal_api
 */
-
 function tripal_core_chado_get_foreign_key($table_desc,$field,$values){
 
    // get the list of foreign keys for this table description and

+ 84 - 41
tripal_core/tripal_core.module

@@ -8,9 +8,18 @@ require_once "bulk_loader.php";
 
 require_once "tripal_core.api.inc";
 
-/*************************************************************************
-*
-*/
+/**
+ * @defgroup tripal_core Core Tripal Module
+ * @{
+ * Provides basic functions for interacting with chado
+ * @}
+ */
+ 
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_core_init(){
    // the two lines below are necessary to ensure that the search_path
    // variable is always set.  In the case where a view needs to query the
@@ -36,9 +45,12 @@ function tripal_core_init(){
       tripal_db_set_active($previous_db);  // now use drupal database
    }
 }
-/*************************************************************************
-*
-*/
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_create_moddir($module_name){
    // make the data directory for this module
    $data_dir = file_directory_path() . "/tripal/$module_name";
@@ -50,16 +62,22 @@ function tripal_create_moddir($module_name){
       watchdog('tripal_core',$message,array(),WATCHDOG_ERROR);
    }
 }
-/*************************************************************************
-*
-*/
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_get_moddir($module_name){
    $data_dir = file_directory_path() . "/tripal/$module_name";
    return $data_dir;
 }
-/*************************************************************************
-*
-*/
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_core_menu() {
    $items = array();
    
@@ -84,7 +102,7 @@ function tripal_core_menu() {
      'access arguments' => array('access administration pages'),
      'type' => MENU_NORMAL_ITEM,
    );
-*/
+ */
    $items['admin/tripal/tripal_jobs'] = array(
      'title' => 'Jobs',
      'description' => 'Jobs managed by Tripal',
@@ -174,15 +192,20 @@ function tripal_core_menu() {
 
   return $items;
 }
-/************************************************************************
-*  The typical display for information on feature, organism, library, etc
-*  pages is to use the Tripal expandable boxes.  However, some sites may
-*  prefer to use a menu system to keep the pages less cluttered.  This
-*  function provides a common interface for setting a Drupal variable
-*  that indicates whether or not the content is displayed in a box or as
-*  a menu item.  This function just reverses the setting each time it is
-*  called
-*/
+
+/**
+ * Provides the tripal box menu functionality
+ *
+ *  The typical display for information on feature, organism, library, etc
+ *  pages is to use the Tripal expandable boxes.  However, some sites may
+ *  prefer to use a menu system to keep the pages less cluttered.  This
+ *  function provides a common interface for setting a Drupal variable
+ *  that indicates whether or not the content is displayed in a box or as
+ *  a menu item.  This function just reverses the setting each time it is
+ *  called
+ *
+ * @ingroup tripal_core
+ */
 function tripal_toggle_box_menu($module,$box_name,$nid){
    // if the content is not in a menu then we wnat to turn on the
    // menu. If the content is in a menu item then we want to turn
@@ -194,9 +217,12 @@ function tripal_toggle_box_menu($module,$box_name,$nid){
    }
    drupal_goto("node/$nid");
 }
-/************************************************************************
-*
-*/
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_core_admin () {
 
 
@@ -210,12 +236,17 @@ function tripal_core_admin () {
    
    return system_settings_form($form);
 }
-/************************************************************************
-* The tripal_db_set_active function is used to prevent namespace collisions
-* when chado and drupal are installed in the same database but in different
-* schemas.  It is also used for backwards compatibility with older versions
-* of tripal or in cases where chado is located outside of the Drupal database.
-*/
+
+/**
+ * Set the Tripal Database
+ *
+ * The tripal_db_set_active function is used to prevent namespace collisions
+ * when chado and drupal are installed in the same database but in different
+ * schemas.  It is also used for backwards compatibility with older versions
+ * of tripal or in cases where chado is located outside of the Drupal database.
+ *
+ * @ingroup tripal_core
+ */
 function tripal_db_set_active($dbname){
    global $db_url, $db_type;
    $chado_exists = 0;
@@ -255,9 +286,12 @@ function tripal_db_set_active($dbname){
    }
    else return db_set_active($dbname);
 }
-/*************************************************************************
-*
-*/
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function tripal_core_is_chado_installed(){
    global $db_url, $db_type;
 
@@ -275,11 +309,15 @@ function tripal_core_is_chado_installed(){
    }
    return false;
 }
-/*************************************************************************
+
+/**
  * Implements hook_views_api()
+ *
  * Purpose: Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_core.views.inc where all the
  *  views integration code is
+ *
+ * @ingroup tripal_core
  */ 
 function tripal_core_views_api() {
    return array(
@@ -287,23 +325,28 @@ function tripal_core_views_api() {
    );
 }
 
-/*************************************************************************
+/**
  * Purpose: Get max rank for a given set of criteria
  *   This function was developed with the many property tables in chado in mind
  *
- * @params tablename: the name of the chado table you want to select the max rank from
- *    this table must contain a rank column of type integer
- * @params where_options: array(
+ * @param $tablename
+ *    The name of the chado table you want to select the max rank from this table must contain a 
+ *    rank column of type integer
+ * @param $where_options
+ *   where options should include the id and type for that table to correctly
+ *     group a set of records together where the only difference are the value and rank
+ * @code 
+ *  array(
  *													<column_name> => array(
  *														'type' => <type of column: INT/STRING>,
  *														'value' => <the value you want to filter on>,
  *														'exact' => <if TRUE use =; if FALSE use ~>,
  *													)
  *				)
- *     where options should include the id and type for that table to correctly
- *     group a set of records together where the only difference are the value and rank
+ * @endcode
  * @return the maximum rank
  *
+ * @ingroup tripal_core
  */
 function tripal_get_max_chado_rank ($tablename, $where_options) {
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 276 - 92
tripal_core/tripal_core.schema.api.inc


+ 47 - 5
tripal_core/tripal_core.views.inc

@@ -1,12 +1,44 @@
 <?php
 
-/*************************************************************************
+/**
+ * @defgroup views_field_handlers Views Field Handlers
+ * @{
+ * Provide rules for formatting and composition of fields
+ * @}
+ */
+
+/**
+ * @defgroup views_filter_handlers Views Filter Handlers
+ * @{
+ * Provide the ability to filter based on specified data
+ * @}
+ */
+
+/**
+ * @defgroup views_sort_handlers Views Sort Handlers
+ * @{
+ * Provide methods describing how specific data should be sorted
+ * @}
+ */
+
+/**
+ * @defgroup views_argument_handlers Views Sort Handlers
+ * @{
+ * Provide the ability to filter pased on arguments in the path of the view
+ * @}
+ */
+ 
+/**
  * Implements hook_views_handlers()
+ *
  * Purpose: Register all custom handlers with views
  *   where a handler describes either "the type of field", 
  *   "how a field should be filtered", "how a field should be sorted"
  *
- * @return: An array of handler definitions
+ * @return
+ *   An array of handler definitions
+ *
+ * @ingroup tripal_core
  */
 function tripal_core_views_handlers() {
  return array(
@@ -39,14 +71,17 @@ function tripal_core_views_handlers() {
  );
 }
     
-/*************************************************************************
+/**
  * Implements hook_views_pre_render
+ *
  * Purpose: Intercepts the view after the query has been executed
  *   All the results are stored in $view->result
  *   Looking up the NID here ensures the query is only executed once
  *   for all stocks in the table.
  *
  * @todo add if !<chado/drupal same db> around NID portion
+ *
+ * @ingroup tripal_core
  */
 function tripal_core_views_pre_render	(&$view) {
 		
@@ -56,15 +91,22 @@ function tripal_core_views_pre_render	(&$view) {
 		
 }
 
-/*************************************************************************
+/**
+ * Adds nid fields to all pertinent view results
+ *
  * Purpose: To add basetable_nid fields to all result arrays of a view
  *   only if the basetable_nid field is added. This function will only be
  *   called if chado/drupal are not in the same database (ie: only if 
  *   a join between the base and node table isn't possible.
+ *
  * Note: Supports adding Node IDs to analysis, feature, library, organism, stock
  *
- * @params the view object passed to hook_views_pre_render
+ * @param $view
+ *   the view object passed to hook_views_pre_render
+ *
  * @return the views object with nids added to the result array
+ *
+ * @ingroup tripal_core
  */
 function tripal_core_add_node_ids_to_view (&$view) {
 	

+ 5 - 3
tripal_core/tripal_launch_jobs.php

@@ -42,9 +42,11 @@ in order to pick up all necessary dependencies
 
   tripal_jobs_launch();
 
-/************************************************************************
-*
-*/
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function print_usage ($stdout){
   fwrite($stdout,"Usage:\n");
   fwrite($stdout,"  php ./sites/all/modules/tripal_core/tripal_launch_jobs <username> \n\n");

+ 5 - 1
tripal_core/tripal_launch_jobs_multi.php

@@ -78,7 +78,11 @@ if (sizeof($opts) > 0) {
 
 runjob($hostname, $username);
 
-
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
 function runjob($sitename, $username) {
 
     $_SERVER['SCRIPT_NAME'] = '/sites/all/modules/tripal_jobs/tripal_launch_jobs_multi.php';

+ 11 - 7
tripal_core/views/handlers/views_handler_field_chado_count.inc

@@ -1,11 +1,15 @@
 <?php
-
-// @file
-// Purpose: Provide a field that counts the number of records in the current table
-//   are connected to the base table. For example, this field could be used to count
-//   the number of features connected to a given organism -base table=organism, 
-//   current table=feature: for each record in the organism view count feature records where 
-//   feature.organism_id=organism_id of current organism record
+ 
+/**
+ * Purpose: Provide a field that counts the number of records in the current table
+ *   are connected to the base table. For example, this field could be used to count
+ *   the number of features connected to a given organism -base table=organism, 
+ *   current table=feature: for each record in the organism view count feature records where 
+ *   feature.organism_id=organism_id of current organism record
+ *
+ * @ingroup views_field_handlers
+ * @ingroup tripal_core
+ */
 class views_handler_field_chado_count extends views_handler_field {
 
   function init(&$view, $options) {

+ 1 - 0
tripal_core/views/handlers/views_handler_field_chado_tf_boolean.inc

@@ -15,6 +15,7 @@
  *      @endcode
  *
  * @ingroup views_field_handlers
+ * @ingroup tripal_core
  */
 class views_handler_field_chado_tf_boolean extends views_handler_field_boolean {
 

+ 5 - 0
tripal_core/views/handlers/views_handler_field_cvterm_name.inc

@@ -1,6 +1,11 @@
 <?php 
 // $Id$
 
+/**
+ *
+ * @ingroup views_field_handlers
+ * @ingroup tripal_core
+ */
 class views_handler_field_cvterm_name extends views_handler_field {
 
   /**

+ 5 - 0
tripal_core/views/handlers/views_handler_field_dbxref_accession_link.inc

@@ -1,5 +1,10 @@
 <?php
 
+/**
+ *
+ * @ingroup views_field_handlers
+ * @ingroup tripal_core
+ */
 class views_handler_field_dbxref_accession_link extends views_handler_field {
  function construct() {
    parent::construct();

+ 3 - 5
tripal_core/views/handlers/views_handler_field_node_optional.inc

@@ -1,12 +1,10 @@
 <?php
-// $Id: views_handler_field_node.inc,v 1.7.2.2 2010/03/16 23:09:05 merlinofchaos Exp $
-/**
- * @file
- * Contains the basic 'node' field handler.
- */
 
 /**
  * Field handler to provide simple renderer that allows linking to a node.
+ *
+ * @ingroup views_field_handlers
+ * @ingroup tripal_core
  */
 class views_handler_field_node_optional extends views_handler_field_node {
 

+ 2 - 1
tripal_core/views/handlers/views_handler_field_readable_date.inc

@@ -1,9 +1,10 @@
 <?php
-// $Id: views_handler_field_date.inc,v 1.3 2009/06/02 18:20:18 merlinofchaos Exp $
+
 /**
  * A handler to provide proper displays for dates.
  *
  * @ingroup views_field_handlers
+ * @ingroup tripal_core
  */
 class views_handler_field_readable_date extends views_handler_field {
   function option_definition() {

+ 5 - 0
tripal_core/views/handlers/views_handler_field_type_name.inc

@@ -1,5 +1,10 @@
 <?php
 
+/**
+ *
+ * @ingroup views_field_handlers
+ * @ingroup tripal_core
+ */
 class views_handler_field_type_name extends views_handler_field {
  function construct() {
    parent::construct();

+ 4 - 1
tripal_core/views/handlers/views_handler_filter_chado_boolean.inc

@@ -1,8 +1,11 @@
 <?php
 
-/* @file
+/**
  * Purpose: This handler provides a TRUE/FALSE or YES/NO select for chado fields
  *  of type boolean (includes both 0/1 and t/f booleans)
+ *
+ * @ingroup views_filter_handlers
+ * @ingroup tripal_core
  */
 class views_handler_filter_chado_boolean extends views_handler_filter_boolean_operator {
  /**

+ 5 - 1
tripal_core/views/handlers/views_handler_filter_chado_select_cvterm_name.inc

@@ -1,9 +1,13 @@
 <?php
 
-/* @file
+/**
  * Purpose: This Handler provides a select list for the type field
+ *
  *  NOTE: This handler only works when applied to the type_id field in the base_table of
  *  this view.
+ *
+ * @ingroup views_filter_handlers
+ * @ingroup tripal_core
  */
 class views_handler_filter_chado_select_cvterm_name extends views_handler_filter_string {
 

+ 5 - 2
tripal_core/views/handlers/views_handler_filter_chado_select_string.inc

@@ -1,8 +1,11 @@
 <?php
 
-/* @file
+/**
  * Purpose: This Handler provides a generic select list for any chado field that is a string
- *  The select list includes all distinct values for that field
+ *  The select list includes all distinct values for that field.
+ *
+ * @ingroup views_filter_handlers
+ * @ingroup tripal_core
  */
 class views_handler_filter_chado_select_string extends views_handler_filter_string {
 

+ 27 - 8
tripal_stock/tripal_stock-administration.inc

@@ -1,10 +1,13 @@
 <?php
 // $Id$
 
-/*************************************************************************
+/**
  * Purpose: Provide Guidance to new Tripal Admin
  *
- * @return HTML Formatted text
+ * @return
+ *   HTML Formatted text
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_module_description_page() {
   $text = '';
@@ -70,10 +73,13 @@ function tripal_stock_module_description_page() {
   return $text;
 }
 
-/*************************************************************************
+/**
  * Purpose: Provide administration options for chado_stocks
  *
- * @return form array (as described by the drupal form api)
+ * @return
+ *   Form array (as described by the drupal form api)
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_admin() {
   $form = array();
@@ -181,9 +187,14 @@ function tripal_stock_admin() {
 }
 
 /**
- * Implements hook_form_submit()
+ * Implements hook_form_validate(): Validates user input
  *
- * Handles Submit actions of all subforms
+ * @param $form
+ *   An array describing the form that was rendered
+ * @param $form_state
+ *   An array describing the current state of the form including user input
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_admin_validate($form, &$form_state) {
    global $user;  // we need access to the user info
@@ -213,12 +224,20 @@ function tripal_stock_admin_validate($form, &$form_state) {
     }
 }
 
-/**************************************************************************************************************/
 /** 
  * Syncs all Stocks associated with an organism
+ *
  * Note: Handling of multiple organisms is done in tripal_stock_admin_validate()
  *
- * @params $organisms
+ * @param $organism_id
+ *   The chado primary key of the organism for which stocks should be sync'd
+ * @param $job_id
+ *   The tripal job ID
+ *
+ * @return
+ *   TRUE if successful; FALSE otherwise
+ *
+ * @ingroup tripal_stock
  */
  function tripal_stock_sync_stock_set($organism_id, $job_id) {
 	global $user;

+ 126 - 17
tripal_stock/tripal_stock-db_references.inc

@@ -1,10 +1,19 @@
 <?php
 
-/*************************************************************************************************************
- * @section 
- * Deals with Adding DB references
- */
 
+/**
+ * Display the ADD Database References to Stock Page
+ *
+ * This page is displayed after the stock is created as part of a simulated multi-part form
+ *
+ * @param $node
+ *   The stock node to add the database references to
+ *
+ * @return
+ *   HTML formatted output
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ALL_dbreferences_page($node) {
   $output = '';
 
@@ -21,8 +30,17 @@ function tripal_stock_add_ALL_dbreferences_page($node) {
 
 
 /**
- * Implements Hook_form()
- * Handles adding of Database References to Stocks
+ * Implements Hook_form(): Handles adding of Database References to Stocks
+ *
+ * @param $form_state
+ *   An array describing the current state of the form
+ * @param $node
+ *   The stock node to add the database reference to
+ *
+ * @return
+ *   An array describing the form to be rendered
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_add_ONE_dbreference_form($form_state, $node) {
 
@@ -73,6 +91,16 @@ function tripal_stock_add_ONE_dbreference_form($form_state, $node) {
   return $form;
 }
 
+/**
+ * Implements hook_form_validate(): Validates the input from tripal_stock_add_ONE_dbreference_form()
+ *
+ * @param $form
+ *   An array describing the form that was rendered
+ * @param $form_state
+ *   An array describing the current state of the form including user input
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_dbreference_form_validate($form, &$form_state) {
 
   // Only ensure db reference valid if adding
@@ -108,6 +136,16 @@ function tripal_stock_add_ONE_dbreference_form_validate($form, &$form_state) {
 
 } 
 
+/**
+ * Implements hoook_form_submit(): Actually adds the db reference to the stock
+ *
+ * @param $form
+ *   An array describing the form that was rendered
+ * @param $form_state
+ *   An array describing the current state of the form including user input
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_dbreference_form_submit($form, &$form_state) {
 
   // FIX: Sometimes on programatic submission of form (drupal_execute) values in the form state get lost
@@ -147,11 +185,19 @@ function tripal_stock_add_ONE_dbreference_form_submit($form, &$form_state) {
 
 }
 
-/************************************************************************************************************* 
- * @section                                    
- * Deals with Editing and Deleting Properties  
+/**
+ * Display the EDIT Database References to Stock Page
+ *
+ * This page is displayed as a tab on each stock details page (by default)
+ *
+ * @param $node
+ *   The stock node to add the database references to
+ *
+ * @return
+ *   HTML formatted output
+ *
+ * @ingroup tripal_stock
  */                                            
-
 function tripal_stock_edit_ALL_dbreferences_page($node) {
   $output = '';
 
@@ -165,8 +211,19 @@ function tripal_stock_edit_ALL_dbreferences_page($node) {
 }
                                                
 /**                                            
- * Implements Hook_form()                      
- * Handles adding of Properties & Synonyms to Stocks
+ * Implements Hook_form(): Handles adding of Database References to Stocks
+ * 
+ * Specifically this adds dbxrefs to a current stock using the stock_dbxref table
+ *
+ * @param $form_state
+ *   An array describing the current state of the form
+ * @param $node
+ *   The stock node whose database references should be edited
+ *
+ * @return
+ *   An array describing the form to be rendered
+ *
+ * @ingroup tripal_stock
  */                                        
 function tripal_stock_edit_ALL_db_references_form($form_state, $node) {
   $form = array();
@@ -229,6 +286,16 @@ function tripal_stock_edit_ALL_db_references_form($form_state, $node) {
   return $form;
 }
 
+/**
+ * Implements hook_form_submit(): Actually edits the database references
+ *
+ * @param $form
+ *   An array representing the form
+ * @param $form_state
+ *   An array representing the current state of the form including user input
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_edit_ALL_db_references_form_submit($form, &$form_state) {
 
   if ($form_state['clicked_button']['#value'] == t('Update DB References') ) {
@@ -256,6 +323,20 @@ function tripal_stock_edit_ALL_db_references_form_submit($form, &$form_state) {
 
 }
 
+/**
+ * Updates a Database Reference
+ *
+ * @todo Make this function more generic ie: update all parts of the dbxref and db
+ *
+ * @param $dbxref_id
+ *   The unique chado identifier of the database reference to be updated
+ * @param $database_id
+ *   The new database ID
+ * @param $accession
+ *   The new accession
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_update_db_reference($dbxref_id, $database_id, $accession) {
 
   $previous_db = tripal_db_set_active('chado');
@@ -269,6 +350,17 @@ function tripal_stock_update_db_reference($dbxref_id, $database_id, $accession)
 
 }
 
+/**
+ * Deletes a given database reference
+ *
+ * @param $dbxref_id
+ *   The chado unique idenfier for the database reference to be deleted
+ *
+ * @return
+ *   TRUE on success; FALSE otherwise
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_delete_db_reference($dbxref_id) {
 
   $previous_db = tripal_db_set_active('chado');
@@ -285,6 +377,17 @@ function tripal_stock_delete_db_reference($dbxref_id) {
 
 }
 
+/**
+ * Themes the Edit All Database References for a stock form
+ *
+ * @param $form
+ *   An array describing the form to be themed
+ *
+ * @return 
+ *   An HTML rendering of the form
+ *
+ * @ingroup tripal_stock
+ */
 function theme_tripal_stock_edit_ALL_db_references_form ($form) {
   $output = '';
 
@@ -309,13 +412,19 @@ function theme_tripal_stock_edit_ALL_db_references_form ($form) {
   return $output;
 }
 
-/*************************************************************************************************************
- * @section
- * Supplimentary functions
- */
 
 /**
- * 
+ *  List all database references for a given node
+ *
+ * @todo Make this function a theme function
+ *
+ * @param $db_references
+ *   An array of database references to be listed
+ *
+ * @return
+ *   HTML representation of the list
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_list_dbreferences_for_node($db_references) {
 

+ 47 - 18
tripal_stock/tripal_stock-properties.inc

@@ -1,13 +1,9 @@
 <?php
 
-/*************************************************************************************************************
- * @section
- * Deals with Adding Properties
- */
-
 /**
- * Implements Hook_form()
- * Handles adding of Properties & Synonyms to Stocks
+ * 
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_add_ALL_property_page($node) {
   $output = '';
@@ -23,6 +19,11 @@ function tripal_stock_add_ALL_property_page($node) {
   return $output;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_property_form($form_state, $node) {
   $form = array();
   $stock_id = $node->stock_id;
@@ -73,6 +74,11 @@ function tripal_stock_add_ONE_property_form($form_state, $node) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_property_form_validate($form, &$form_state) {
 
   // Only Require if Adding Property
@@ -108,6 +114,11 @@ function tripal_stock_add_ONE_property_form_validate($form, &$form_state) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_property_form_submit($form, &$form_state) {
 	
   // if there is a property add it (only won't be a property if clicked next step w/ no property)
@@ -151,11 +162,11 @@ function tripal_stock_add_ONE_property_form_submit($form, &$form_state) {
   } //end of if property to add
 }
 
-/*************************************************************************************************************
- * @section
- * Deals with Editing and Deleting Properties
+/**
+ * 
+ *
+ * @ingroup tripal_stock
  */
-
 function tripal_stock_edit_ALL_properties_page($node) {
   $output = '';
 
@@ -169,8 +180,9 @@ function tripal_stock_edit_ALL_properties_page($node) {
 }
 
 /**
- * Implements Hook_form()
- * Handles adding of Properties & Synonyms to Stocks
+ * Implements Hook_form(): Handles adding of Properties & Synonyms to Stocks
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_edit_ALL_properties_form($form_state, $node) {
   $form = array();
@@ -247,6 +259,11 @@ function tripal_stock_edit_ALL_properties_form($form_state, $node) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_edit_ALL_properties_form_submit($form, &$form_state) {
 
   if ($form_state['clicked_button']['#value'] == t('Update Properties') ) {
@@ -267,6 +284,11 @@ function tripal_stock_edit_ALL_properties_form_submit($form, &$form_state) {
   
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_update_property($stockprop_id, $cvterm_id, $value, $preferred, $nid) {
 
 	$previous_db = tripal_db_set_active('chado');
@@ -318,6 +340,11 @@ function tripal_stock_update_property($stockprop_id, $cvterm_id, $value, $prefer
   }
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_delete_property($stockprop_id) {
 
   $previous_db = tripal_db_set_active('chado');
@@ -329,6 +356,11 @@ function tripal_stock_delete_property($stockprop_id) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function theme_tripal_stock_edit_ALL_properties_form ($form) {
   $output = '';
 
@@ -352,13 +384,10 @@ function theme_tripal_stock_edit_ALL_properties_form ($form) {
   return $output;
 }
 
-/*************************************************************************************************************
- * @section
- * Supplimentary functions
- */
-
 /**
  * 
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_list_properties_for_node($properties, $synonyms) {
 

+ 50 - 15
tripal_stock/tripal_stock-relationships.inc

@@ -1,10 +1,10 @@
 <?php
 
-/*************************************************************************************************************
- * @section
- * Deals with Adding Relationships
+/**
+ * 
+ *
+ * @ingroup tripal_stock
  */
-
 function tripal_stock_add_ALL_relationships_page($node) {
   $output = '';
 
@@ -20,8 +20,9 @@ function tripal_stock_add_ALL_relationships_page($node) {
 }
 
 /**
- * Implements Hook_form()
- * Handles adding of Relationships to Stocks
+ * Implements Hook_form(): Handles adding of Relationships to Stocks
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_add_ONE_relationship_form($form_state, $node) {
 
@@ -94,6 +95,11 @@ function tripal_stock_add_ONE_relationship_form($form_state, $node) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_relationship_form_validate($form, &$form_state) {
 
   //Require Validation if adding
@@ -152,6 +158,11 @@ function tripal_stock_add_ONE_relationship_form_validate($form, &$form_state) {
   } //end of require validation if adding relationship
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_ONE_relationship_form_submit($form, &$form_state) {
 
   if ($form_state['values']['subject_id'] > 0) {
@@ -170,11 +181,11 @@ function tripal_stock_add_ONE_relationship_form_submit($form, &$form_state) {
 
 }
 
-/************************************************************************************************************* 
- * @section                                           
- * Deals with Editing and Deleting Properties         
+/**
+ * 
+ *
+ * @ingroup tripal_stock
  */
-
 function tripal_stock_edit_ALL_relationships_page($node) {
   $output = '';
 	
@@ -189,7 +200,8 @@ function tripal_stock_edit_ALL_relationships_page($node) {
                                                       
 /**                                                   
  * Implements Hook_form()                             
- * Handles adding of Properties & Synonyms to Stocks  
+ *
+ * @ingroup tripal_stock
  */                                                   
 function tripal_stock_edit_ALL_relationships_form($form_state, $node) {
   $form = array();
@@ -277,6 +289,11 @@ function tripal_stock_edit_ALL_relationships_form($form_state, $node) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_edit_ALL_relationships_form_validate($form, &$form_state) {
 
   // Only Require if Updating Relationships
@@ -341,6 +358,11 @@ function tripal_stock_edit_ALL_relationships_form_validate($form, &$form_state)
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_edit_ALL_relationships_form_submit($form, &$form_state) {
 
   if ($form_state['clicked_button']['#value'] == t('Update Relationships') ) {
@@ -372,6 +394,11 @@ function tripal_stock_edit_ALL_relationships_form_submit($form, &$form_state) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_update_relationship ($stock_relationship_id, $subject_id, $cvterm_id, $object_id) {
 
   $previous_db = tripal_db_set_active('chado');
@@ -386,6 +413,11 @@ function tripal_stock_update_relationship ($stock_relationship_id, $subject_id,
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_delete_relationship ($stock_relationship_id) {
 
   $previous_db = tripal_db_set_active('chado');
@@ -397,6 +429,11 @@ function tripal_stock_delete_relationship ($stock_relationship_id) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function theme_tripal_stock_edit_ALL_relationships_form ($form) {
   $output = '';
   
@@ -423,13 +460,11 @@ function theme_tripal_stock_edit_ALL_relationships_form ($form) {
   return $output;
 }
 
-/*************************************************************************************************************
- * @section
- * Supplementary Functions
- */
 
 /**
  *
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_list_relationships_for_node($stock_name, $subject_relationships, $object_relationships) {
 

+ 34 - 3
tripal_stock/tripal_stock-secondary_tables.inc

@@ -1,6 +1,11 @@
 <?php
 // $Id$
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_back_to_stock_button($form_state, $nid) {
   $form = array();
 
@@ -17,10 +22,20 @@ function tripal_stock_back_to_stock_button($form_state, $nid) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_back_to_stock_button_submit($form, $form_state) {
   drupal_goto('node/'.$form_state['values']['nid']);
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_chado_properties_progress($current) {
 
     $value = '<div class="form_progress"><div class="form_progress-text">'; 
@@ -49,6 +64,11 @@ function tripal_stock_add_chado_properties_progress($current) {
 
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_chado_properties_navigate($form_state, $step, $nid) {
   $form = array();
 
@@ -110,6 +130,11 @@ function tripal_stock_add_chado_properties_navigate($form_state, $step, $nid) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_add_chado_properties_navigate_submit($form, $form_state) {
 
   $raw_steps = preg_split('/::/', $form_state['values']['steps']); 
@@ -157,9 +182,10 @@ function tripal_stock_add_chado_properties_navigate_submit($form, $form_state) {
 
 }
 
-/*************************************************************************************************************
- * Implements Hook_form()
- * Handles setting the is_obsolete property of stocks
+/**
+ * 
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_is_obsolete_form($node, $stock_id) {
 
@@ -177,6 +203,11 @@ function tripal_stock_is_obsolete_form($node, $stock_id) {
   return $form;
 }
 
+/**
+ * 
+ *
+ * @ingroup tripal_stock
+ */
 function tripal_stock_is_obsolete_form_submit($form, &$form_state) {
 
   $previous_db = tripal_db_set_active('chado');

+ 87 - 47
tripal_stock/tripal_stock.api.inc

@@ -1,13 +1,15 @@
 <?php
  
-/*************************************************************************
- * @section: Return a Single Stock
- *************************************************************************/
-
-/*************************************************************************
- * Purpose: Return a given stock object using the nid
+/**
+ * Purpose: Return a given stock node using the nid
+ *
+ * @param $nid
+ *   The node ID of the stock you want to load
+ *
+ * @return
+ *   stock node with the passed in node ID
  *
- * @return stock object created by node load
+ * @ingroup tripal_api
  */
 function triapl_stock_get_stock_by_nid ($nid) {
 	
@@ -15,10 +17,13 @@ function triapl_stock_get_stock_by_nid ($nid) {
 	
 }
 
-/*************************************************************************
+/**
  * Purpose: Return a given stock object using the stock id
  *
- * @return stock object created by node load
+ * @return 
+ *   Stock object created by node load
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_get_stock_by_stock_id ($stock_id) {
 
@@ -34,15 +39,12 @@ function tripal_stock_get_stock_by_stock_id ($stock_id) {
 	
 }
 
-/*************************************************************************
- * @section: Get Additional Data Associated with a stock
- *************************************************************************/
-
-/*************************************************************************
+/**
  * Purpose:
  *
- * @params $stock_id
+ * @param $stock_id
  *   the unique identifier for the stock to load properties of
+ *
  * @return
  *   an array of properties where each element is a property object with
  *   the following fields:
@@ -66,6 +68,8 @@ function tripal_stock_get_stock_by_stock_id ($stock_id) {
  *     - type_db_reference_db_description (db):
  *     - type_db_reference_db_url (db):
  *     - type_db_reference_db_urlprefix (db):
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_load_properties($stock_id) {
 
@@ -79,15 +83,13 @@ function tripal_stock_load_properties($stock_id) {
   return $properties;  
 }
 
-/*************************************************************************
- * @section: Return Multiple Stocks
- *************************************************************************/
- 
-/*************************************************************************
+/**
  * Purpose: Returns all stocks currently sync'd with drupal
  *
  * @return 
-     An array of node objects keyed by stock_id
+ *   An array of node objects keyed by stock_id
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_get_all_stocks() {
 	$sql = "SELECT stock_id, nid from {chado_stock}";
@@ -102,11 +104,12 @@ function tripal_stock_get_all_stocks() {
 	return $stocks;
 }
 
-/*************************************************************************
+/**
  * Purpose: Return all stocks that match a given criteria
  *
- * @params $values
+ * @param $values
  *   An associative array containing the values for filtering the results.
+ *
  * @return 
  *   An array of matching stock objects (produced using node_load)
  *   matching the given criteria
@@ -134,6 +137,8 @@ function tripal_stock_get_all_stocks() {
  * exists. The $values array is nested such that the organism is identified by way of the 
  * organism_id foreign key constraint by specifying the genus and species.  The cvterm is also 
  * specified using its foreign key and the cv_id for the cvterm is nested as well.
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_get_stocks($values) {
 
@@ -154,17 +159,18 @@ function tripal_stock_get_stocks($values) {
   return $stocks;
 }
 
-/*************************************************************************
+/**
  * Purpose: Retrieve stocks based on associated stock properties
  *
- * @params $stockprop_values
+ * @param $stockprop_values
  *   An array of column_name => value where column_name is any column in the stockprop table
  *   and value is the value you want that column to be. This is used as a tripal_core_chado_select
  *   values array so nesting is allowed.
- * @params $stock_values
+ * @param $stock_values
  *   An array of column_name => value where column_name is any column in the stock table
  *   and value is the value you want that column to be. This is used as a tripal_core_chado_select
  *   values array so nesting is allowed. 
+ *
  * @return
  *   An array of stock node objects
  *
@@ -190,6 +196,8 @@ function tripal_stock_get_stocks($values) {
  * @endcode
  * The above code selects all Lens culinaris stocks with the synonym (stock property) CDC Redberry.
  * The nodes for each stock selected are loaded and returned in an array.
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_get_stocks_by_stockprop($stockprop_values, $stock_values) {
 
@@ -216,17 +224,20 @@ function tripal_stock_get_stocks_by_stockprop($stockprop_values, $stock_values)
   return $stocks;
 }
 
-/*************************************************************************
+/**
  * Purpose: Return all stocks with a given name identifier
  *  which might match stock.name, stock.uniquename, dbxref.accession, 
  *  stockprop.value where stockprop.type='synonym'
  *
  * @param $name
  *   The name identfier to be used
- * @params $organism_id
+ * @param $organism_id
  *   The stock.organism_id of the stock to be selected
+ *
  * @return
  *   An array of stock node objects
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
   $stock_ids = array();
@@ -314,21 +325,17 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
   
   return $stocks;
 }
-
-/****************************************************************************
- * @section Chado Table Descriptions
- * Please Add Descriptions to the fields ($description['fields'][<field name>]['description]) 
- * and table ($description['description']). Also add any foreign key relelationships that
- * arn't already added.
- ****************************************************************************/
  
-/****************************************************************************
+/**
  * Implements hook_chado_stock_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_schema() {
   $description = array();
@@ -359,13 +366,16 @@ function tripal_stock_chado_stock_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stockprop_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stockprop table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stockprop_schema() {
   $description = array();
@@ -387,13 +397,16 @@ function tripal_stock_chado_stockprop_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stockprop_pub_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stockprop_pub table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stockprop_pub_schema() {
   $description = array();
@@ -415,13 +428,16 @@ function tripal_stock_chado_stockprop_pub_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_cvterm_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_cvterm table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_cvterm_schema() {
   $description = array();
@@ -450,13 +466,16 @@ function tripal_stock_chado_stock_cvterm_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_dbxref_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_dbxref table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_dbxref_schema() {
   $description = array();
@@ -478,13 +497,16 @@ function tripal_stock_chado_stock_dbxref_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_genotype_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_genotype table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_genotype_schema() {
   $description = array();
@@ -506,13 +528,16 @@ function tripal_stock_chado_stock_genotype_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_pub_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_pub table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_pub_schema() {
   $description = array();
@@ -534,13 +559,16 @@ function tripal_stock_chado_stock_pub_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_relationship_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_relationship table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_relationship_schema() {
   $description = array();
@@ -563,13 +591,16 @@ function tripal_stock_chado_stock_relationship_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stock_relationship_pub_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stock_relationship_pub table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stock_relationship_pub_schema() {
   $description = array();
@@ -591,13 +622,16 @@ function tripal_stock_chado_stock_relationship_pub_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stockcollection_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stockcollection table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stockcollection_schema() {
   $description = array();
@@ -619,13 +653,16 @@ function tripal_stock_chado_stockcollection_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stockcollection_stock_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stockcollection_stock table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stockcollection_stock_schema() {
   $description = array();
@@ -647,13 +684,16 @@ function tripal_stock_chado_stockcollection_stock_schema() {
   return $description;
 }
 
-/****************************************************************************
+/**
  * Implements hook_chado_stockcollectionprop_schema()
+ *
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
  *
  * @return
  *    Array describing the stockcollectionprop table
+ *
+ * @ingroup tripal_api
  */
 function tripal_stock_chado_stockcollectionprop_schema() {
   $description = array();

+ 179 - 54
tripal_stock/tripal_stock.module

@@ -1,6 +1,26 @@
 <?php
 // $Id$
 
+/**
+ * @file
+ * Implements Tripal Stock Module hooks
+ */
+
+/**
+ * @defgroup tripal_stock Stock Module
+ * @{
+ * Provides functions for managing chado stocks including creating details pages for each stock
+ *
+ * The Tripal Stock Module provides functionality for adding, editing, deleting and accessing chado 
+ * stocks. The stock module was designed to store information about stock collections in a 
+ * laboratory. What is called a stock could also be called a strain or an accession. There is a lot 
+ * in common between a Drosophila stock and a Saccharomyces strain and an Arabidopsis line. They all 
+ * come from some taxon, have genotypes, physical locations in the lab, some conceivable 
+ * relationship with a publication, some conceivable relationship with a sequence feature (such as a 
+ * transgene), and could be described by some ontology term. For more information about the chado 
+ * Stock Module see the GMOD Wiki Page (http://gmod.org/wiki/Chado_Stock_Module)
+ * @}
+ */
 require("tripal_stock-administration.inc");
 
 require("tripal_stock.api.inc");
@@ -11,13 +31,13 @@ require("tripal_stock-properties.inc");
 require("tripal_stock-relationships.inc");
 require("tripal_stock-db_references.inc");
 
-/*************************************************************************
- * Implementation of hook_menu()
- * Purpose: Add menu items for this module
- * Note: A Menu item for the Create chado_stock form is automatically
- *   added to the 'Create Content' Navigation menu
+/**
+ * Implements hook_menu(): Adds menu items for the tripal_stock
  *
- * @return and array for menu descriptions
+ * @return
+ *   Menu definitions for the tripal_stock
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_menu() {
   $items = array();
@@ -110,11 +130,21 @@ function tripal_stock_menu() {
   return $items;
 }
 
-/*************************************************************************
+/**
  * Implements Menu wildcard_load hook
+ *
  * Purpose: Allows the node ID of a chado stock to be dynamically 
  *   pulled from the path. The node is loaded from this node ID
- *   and supplied to the page as an arguement
+ *   and supplied to the page as an arguement. This is an example 
+ *   of dynamic argument replacement using wildcards in the path.
+ *
+ * @param $nid
+ *   The node ID passed in from the path
+ *
+ * @return
+ *   The node object with the passed in nid
+ *
+ * @ingroup tripal_stock
  */
 function cs_node_load($nid) {
   if (is_numeric($nid)) {
@@ -127,11 +157,15 @@ function cs_node_load($nid) {
   return FALSE;
 }
 
-/*************************************************************************
+/**
  * Implementation of hook_perm()
+ *
  * Purpose: Set the permission types that the chado stock module uses
  *
- * @return an array listing the possible permission catagories
+ * @return
+ *   Listing of the possible permission catagories
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_perm() {
   return array(
@@ -142,10 +176,20 @@ function tripal_stock_perm() {
   );
 }
 
-/*************************************************************************
- * Implements hook_access()
- * Purpose: Maps permission catagories to actions; 
+/**
+ * Implements hook_access(): Maps permission catagories to actions
+ *
+ * @param $op
+ *   The operation current operation: one of create, update, delete
+ * @param $node
+ *   The node object the current operation is being performed on
+ * @param $account
+ *   A user object representing the user for whom the operation is to be performed
+ *
+ * @return
  *   TRUE grants access; FALSE denies it
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_access($op, $node, $account) {
    if ($op == 'create') {
@@ -170,11 +214,17 @@ function chado_stock_access($op, $node, $account) {
    return FALSE;
 }
 
-/*************************************************************************
+/**
  * Implements hook_views_api()
+ *
  * Purpose: Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_stock.views.inc where all the
  *  views integration code is
+ *
+ * @return
+ *   An array with fields important for views integration
+ *
+ * @ingroup tripal_stock
  */ 
 function tripal_stock_views_api() {
    return array(
@@ -182,11 +232,13 @@ function tripal_stock_views_api() {
    );
 }
 
-/*************************************************************************
- * Implements hook_theme()
- * Purpose: Register themeing functions for this module
+/**
+ * Implements hook_theme(): Register themeing functions for this module
+ *
+ * @return
+ *   An array of themeing functions to register
  *
- * @return an array of themeing functions to register
+ * @ingroup tripal_stock
  */
 function tripal_stock_theme() {
 	return array(
@@ -234,8 +286,17 @@ function tripal_stock_theme() {
 	);
 }
 
-/*************************************************************************
+/**
  * Purpose: show stocks stored in drupals chado_stock table
+ *
+ * This function provides the default html representation of the stock table. This
+ * representation can be overridden using Drupal Views2 to create more flexible tables
+ * listing stocks.
+ *
+ * @return
+ *   HTML representation of a table of stocks
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_show_stocks () {
 	$sql = "SELECT COUNT(stock_id) FROM {chado_stock}";
@@ -252,6 +313,17 @@ function tripal_stock_show_stocks () {
    }
 }
 
+/**
+ * A themeing funtion for the default tripal stock table
+ *
+ * @param $stocks
+ *   An array of all stock nodes
+ *
+ * @return
+ *   HTML representation of a table of stocks
+ *
+ * @ingroup tripal_stock
+ */
 function theme_tripal_stock_stock_table (&$stocks) {
 
 	// cycle through the stocks and build the stocks page
@@ -278,13 +350,13 @@ function theme_tripal_stock_stock_table (&$stocks) {
    return $output;
 }
 
-/*************************************************************************
- * @section Implementation of stock Node
- * including node_load, form, insert, update, delete(by nid and vid)
- *************************************************************************/
-
-/*************************************************************************
- * Implements hook_node_info() 
+/**
+ * Implements hook_node_info(): registers a stock node type
+ *
+ * @return
+ *   An array describing various details of the node
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_node_info() {
   return array(
@@ -298,9 +370,16 @@ function tripal_stock_node_info() {
   );
 }
 
-/*************************************************************************
- * Implements hook_load()
- * Everytime a chado_stock node is viewed or manipulated this hook is called first to prepare the data
+/**
+ * Implements hook_load(): Prepares the chado_stock node
+ *
+ * @param $node
+ *   The basic node containing all variables common to all nodes
+ *
+ * @return
+ *   A stock node containing all the variables from the basic node and all stock specific variables
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_load($node) {
 
@@ -493,9 +572,8 @@ function chado_stock_load($node) {
 }
 
 
-/*************************************************************************
- * Implements hook_form()	
- * Creates the main Add/Edit/Delete Form for chado stocks
+/**
+ * Implements hook_form(): Creates the main Add/Edit/Delete Form for chado stocks
  *
  * Parts to be added by this form
  *     name, 
@@ -504,6 +582,16 @@ function chado_stock_load($node) {
  *     type => select from cvterm with key cvterm_id,
  *     organism => select from available with key organism_id
  *     main_db_reference => accession, version, description, db_name(select from dropdown) 
+ *
+ * @param $node
+ *   An empty node object on insert OR the current stock node object on update
+ * @param $form_state
+ *   The current state of the form
+ *
+ * @return
+ *   A description of the form to be rendered by drupal_get_form()
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_form($node, $form_state) {
   $type = node_get_types('type', $node);
@@ -619,8 +707,15 @@ function chado_stock_form($node, $form_state) {
   return $form;
 }
 
-/*************************************************************************
- * Implements hook_validate()
+/**
+ * Implements hook_validate(): Validate the input from the chado_stock node form
+ *
+ * @param $node
+ *   The current node including fields with the form element names and submitted values
+ * @param $form
+ *   A description of the form to be rendered by drupal_get_form()
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_validate($node, &$form) {
 
@@ -699,9 +794,16 @@ function chado_stock_validate($node, &$form) {
 
 }
 
-/*************************************************************************
- * Implements hook_insert()
- * Inserts data from chado_stock_form() into drupal and chado
+/**
+ * Implements hook_insert(): Inserts data from chado_stock_form() into drupal and chado
+ *
+ * @param $node
+ *   The current node including fields with the form element names and submitted values
+ *
+ * @return
+ *   TRUE if the node was successfully inserted into drupal/chado; FALSE otherwise
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_insert($node) {
 
@@ -796,10 +898,18 @@ function chado_stock_insert($node) {
 
 }
 
-/*************************************************************************
- * Implements hook_update()
- * Handles Editing/Updating of main stock info (that in the chado stock table)
- * Currently just writes over all old data
+/**
+ * Implements hook_update(): Handles Editing/Updating of main stock info
+ *
+ * NOTE: Currently just writes over all old data
+ *
+ * @param $node
+ *   The current node including fields with the form element names and submitted values
+ *
+ * @return
+ *   TRUE if the node was successfully updated in drupal/chado; FALSE otherwise
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_update($node) {
 
@@ -900,9 +1010,18 @@ function chado_stock_update($node) {
 
 }
 
-/*************************************************************************
- * Implements hook_delete()
- * Handles deleting of chado_stocks
+/**
+ * Implements hook_delete(): Handles deleting of chado_stocks
+ *
+ * NOTE: Currently deletes data -no undo or record-keeping functionality
+ *
+ * @param $node
+ *   The current node including fields with the form element names and submitted values
+ *
+ * @return
+ *   TRUE if the node was successfully deleted from drupal/chado; FALSE otherwise
+ *
+ * @ingroup tripal_stock
  */
 function chado_stock_delete($node) {
 
@@ -921,12 +1040,23 @@ function chado_stock_delete($node) {
   tripal_db_set_active($previous_db);
 }
 
-/**************************************************************************
- * @section Tripal Stock Blocks and Template Preprocessor Functions
- **************************************************************************/
-
-/*************************************************************************
+/**
  * Purpose: Implement Blocks relating to stock content
+ *
+ * @param $op
+ *   What kind of information to retrieve about the block or blocks. 
+ *   Possible values include list, configure, save, view.
+ * @param $delta
+ *   Which block to return (not applicable if $op is 'list').
+ * @param $edit
+ *   If $op is 'save', the submitted form data from the configuration form.
+ *
+ * @return
+ *   One of the following depending on $op: An array of block descriptions (list), the configuration 
+ *   form (configure), nothing (save), an array defining subject and content for the block indexed 
+ *   by $delta (view)
+ *
+ * @ingroup tripal_stock
  */
 function tripal_stock_block ($op = 'list', $delta = 0, $edit=array()) {
   switch($op) {
@@ -992,9 +1122,4 @@ function tripal_stock_block ($op = 'list', $delta = 0, $edit=array()) {
 				return $block;
 			}
 	}
-}
-
-function tripal_stock_preprocess_node_chado_stock (&$variables) {
-	$variables['testing1'] = 'test';
-	drupal_set_message('here');
 }

+ 7 - 4
tripal_stock/tripal_stock.views.inc

@@ -11,10 +11,10 @@
  */
  
 /*************************************************************************
- * Implements hook_views_data()
- * Purpose: Describe chado/tripal tables & fields to views
+ * Implements hook_views_data(): Describe chado/tripal tables & fields to views
  *
- * @return: a data array which follows the structure outlined in the
+ * @return array
+ *   A data array which follows the structure outlined in the
  *   views2 documentation for this hook. Essentially, it's an array of table
  *   definitions keyed by chado/tripal table name. Each table definition 
  *   includes basic details about the table, fields in that table and
@@ -35,11 +35,13 @@ function tripal_stock_views_data()  {
 
 /*************************************************************************
  * Implements hook_views_handlers()
+ *
  * Purpose: Register all custom handlers with views
  *   where a handler describes either "the type of field", 
  *   "how a field should be filtered", "how a field should be sorted"
  *
- * @return: An array of handler definitions
+ * @return array
+ *   An array of handler definitions
  */
 function tripal_stock_views_handlers() {
  return array(
@@ -83,6 +85,7 @@ function tripal_stock_views_handlers() {
 
 /*************************************************************************
  * Implements hook_views_pre_render
+ *
  * Purpose: Intercepts the view after the query has been executed
  *   All the results are stored in $view->result
  *   Looking up the NID here ensures the query is only executed once

+ 5 - 3
tripal_stock/views/chado_stock.views.inc

@@ -1,12 +1,14 @@
 <?php
 
 /**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_stock drupal table, it's fields and any joins between it and other tables
- * @see tripal_stock_views_data() --in tripal_stock.views.inc
+ * Purpose: this function returns the portion of the data array which describes the chado_stock 
+ * drupal table, it's fields and any joins between it and other tables
  *
  * The main need for description of this table to views is to join chado data with drupal nodes
  *
+ * @see tripal_stock_views_data() --in tripal_stock.views.inc
+ *
+ * @ingroup tripal_stock
  */
 function retrieve_chado_stock_views_data () {
 	global $db_url;

+ 6 - 0
tripal_stock/views/handlers/views_handler_argument_stockprop_id.inc

@@ -1,5 +1,11 @@
 <?php
 
+/**
+ * Allows a stock property in the path to be used to filter a view
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_argument_handlers
+ */
 class views_handler_argument_stockprop_id extends views_handler_argument_string {
 
 	function options_form(&$form, &$form_state) {

+ 9 - 0
tripal_stock/views/handlers/views_handler_field_computed_stock_nid.inc

@@ -1,5 +1,14 @@
 <?php
 
+/**
+ * Adds the Node ID to for the current stock 
+ *
+ * This handler is only needed if chado is in a separate database and, therefore, the node tables 
+ * cannot be joined to the stock tables
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
+ */
 class views_handler_field_computed_stock_nid extends views_handler_field_numeric {
 	function construct() {
 		parent::construct();

+ 7 - 2
tripal_stock/views/handlers/views_handler_field_stock_dbxref_all.inc

@@ -1,8 +1,13 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all database references for a given stock to be displayed in a single cell
+ *
+ * This handler only deals with database references joined to the stock through stock_dbxref. For 
+ * the database reference joined to the stock by stock.dbxref_id simply join to the dbxref table.
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stock_dbxref_all extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 8 - 2
tripal_stock/views/handlers/views_handler_field_stock_dbxref_by_type.inc

@@ -1,8 +1,14 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all database references of a specified db for a given stock to be 
+ * displayed in a single cell.
+ *
+ * This handler only deals with database references joined to the stock through stock_dbxref. For 
+ * the database reference joined to the stock by stock.dbxref_id simply join to the dbxref table.
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stock_dbxref_by_type extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 4 - 2
tripal_stock/views/handlers/views_handler_field_stockprop_all.inc

@@ -1,8 +1,10 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all properties for a given stock to be displayed in a single cell
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stockprop_all extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 5 - 2
tripal_stock/views/handlers/views_handler_field_stockprop_by_type.inc

@@ -1,8 +1,11 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all properties of a specified type for a given stock to be displayed in a 
+ * single cell
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stockprop_by_type extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 4 - 2
tripal_stock/views/handlers/views_handler_field_stockrel_all.inc

@@ -1,8 +1,10 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all relationships for a given stock to be displayed in a single cell
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stockrel_all extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 5 - 2
tripal_stock/views/handlers/views_handler_field_stockrel_by_type.inc

@@ -1,8 +1,11 @@
 <?php
-// $Id: views_handler_field_term_node_tid.inc,v 1.4 2009/07/01 23:07:14 merlinofchaos Exp $
 
 /**
- * Field handler for terms.
+ * Field handler allowing all relationships of a specified type for a given stock to be displayed in 
+ * a single cell
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_field_handlers
  */
 class views_handler_field_stockrel_by_type extends views_handler_field_prerender_list {
   function init(&$view, $options) {

+ 6 - 2
tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc

@@ -1,7 +1,11 @@
 <?php
-// $Id$
-
 
+/**
+ * Allows stocks to be filtered by associated database reference accession
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_filter_handlers
+ */
 class views_handler_filter_stock_dbxref_id extends views_handler_filter {
 
   function init(&$view, $options) {

+ 4 - 1
tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc

@@ -1,7 +1,10 @@
 <?php
 
 /**
- * Filter by stockprop type id
+ * Allows stocks to be filtered by proeprty values
+ *
+ * @ingroup tripal_stock
+ * @ingroup views_filter_handlers
  */
 class views_handler_filter_stockprop_id extends views_handler_filter {
 

+ 2 - 0
tripal_stock/views/misc_tables.views.inc

@@ -15,6 +15,8 @@
         ),
       ); 
  *   @endcode
+ *
+ * @ingroup tripal_stock
  */
 function retrieve_stock_misc_tables_views_data() {
   $data = array();

+ 17 - 15
tripal_stock/views/stock.views.inc

@@ -11,22 +11,24 @@
  *
  * BASE TABLE: stock
  * @code
- *     create table stock (
- *             stock_id serial not null,
- *             primary key (stock_id),
- *     R       dbxref_id int,
- *             foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
- *     R       organism_id int,
- *             foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
- *     F       name varchar(255),
- *     F       uniquename text not null,
- *     F       description text,
- *     R       type_id int not null,
- *             foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
- *     F       is_obsolete boolean not null default 'false',
- *             constraint stock_c1 unique (organism_id,uniquename,type_id)
- *     );
+      create table stock (
+        stock_id serial not null,
+        primary key (stock_id),
+        dbxref_id int,
+        foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
+        organism_id int,
+        foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
+        name varchar(255),
+        uniquename text not null,
+        description text,
+        type_id int not null,
+        foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
+        is_obsolete boolean not null default 'false',
+        constraint stock_c1 unique (organism_id,uniquename,type_id)
+      );
  * @endcode
+ *
+ * @ingroup tripal_stock
  */
 function retrieve_stock_views_data() {
   global $db_url;

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно