Browse Source

Library: cleaned up doc

Lacey Sanderson 11 years ago
parent
commit
1e024d9bd0

+ 6 - 0
tripal_library/api/tripal_library.api.inc

@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ * Provides an application programming interface (API) to manage libraries
+ */
+
 /**
  * @defgroup tripal_library_api Library API
  * @ingroup tripal_api
@@ -68,6 +73,7 @@ function tripal_library_insert_property($library_id, $property, $value, $update_
 function tripal_library_update_property($library_id, $property, $value, $insert_if_missing = 0) {
   return chado_update_property('library', $library_id, $property, 'library_property', $value, $insert_if_missing);
 }
+
 /**
  * Delete a given property
  *

+ 9 - 11
tripal_library/includes/tripal_library.admin.inc

@@ -1,5 +1,14 @@
 <?php
+/**
+ * @file
+ * Admin launchpad
+ */
 
+/**
+ * Admin launchpad
+ *
+ * @ingroup tripal_library
+ */
 function tripal_library_admin_libraries_listing() {
   $output = '';
 
@@ -44,14 +53,3 @@ function tripal_library_admin() {
 
   return system_settings_form($form);
 }
-
-
-
-/**
- *
- * @ingroup tripal_library
- */
-function tripal_library_admin_validate($form, &$form_state) {
-  
-}
-

+ 33 - 8
tripal_library/includes/tripal_library.chado_node.inc

@@ -1,6 +1,12 @@
 <?php
+/**
+ * @file
+ * Implements the library node content type
+ */
 
 /**
+ * Implements hook_node_info().
+ *
  * Provide information to drupal about the node types that we're creating
  * in this module
  *
@@ -33,7 +39,9 @@ function tripal_library_node_info() {
 }
 
 /**
- *  When editing or creating a new node of type 'chado_library' we need
+ *  Implements hook_form().
+ *
+ * When editing or creating a new node of type 'chado_library' we need
  *  a form.  This function creates the form that will be used for this.
  *
  * @ingroup tripal_library
@@ -196,8 +204,11 @@ function chado_library_form($node, &$form_state) {
 
   return $form;
 }
+
 /**
- *  validates submission of form when adding or updating a library node
+ * Implements hook_validate().
+ *
+ * Validates submission of form when adding or updating a library node
  *
  * @ingroup tripal_library
  */
@@ -226,7 +237,10 @@ function chado_library_validate($node, $form, &$form_state) {
     form_set_error('uniquename', t('The unique library name already exists. Please choose another'));
   }
 }
+
 /**
+ *  Implements hook_insert().
+ *
  *  When a new chado_library node is created we also need to add information
  *  to our chado_library table.  This function is called on insert of a new node
  *  of type 'chado_library' and inserts the necessary information.
@@ -296,8 +310,9 @@ function chado_library_insert($node) {
     drupal_write_record('chado_library', $record);
   }
 }
+
 /**
- * Update nodes
+ * Implements hook_update().
  *
  * @ingroup tripal_library
  */
@@ -312,7 +327,7 @@ function chado_library_update($node) {
   $match = array(
     'library_id' => $library_id,
   );
-  
+
   $values = array(
     'name'        => $node->libraryname,
     'uniquename'  => $node->uniquename,
@@ -349,7 +364,10 @@ function chado_library_update($node) {
   chado_update_node_form_dbxrefs($node, $details);
 
 }
+
 /**
+ *  Implements hook_load().
+ *
  *  When a node is requested by the user this function is called to allow us
  *  to add auxiliary data to the node object.
  *
@@ -372,7 +390,10 @@ function chado_library_load($nodes) {
 }
 
 /**
+ * Implements hook_delete().
+ *
  * Delete data from drupal and chado databases when a node is deleted
+ *
  * @ingroup tripal_library
  */
 function chado_library_delete(&$node) {
@@ -400,7 +421,7 @@ function chado_library_delete(&$node) {
 }
 
 /**
- * Implement hook_access().
+ * Implement hook_node_access().
  *
  * This hook allows node modules to limit access to the node types they define.
  *
@@ -446,7 +467,10 @@ function chado_library_node_access($node, $op, $account) {
   }
   return NULL;
 }
+
 /**
+ * Implements hook_node_view(). Acts on all content types
+ *
  * @ingroup tripal_library
  */
 function tripal_library_node_view($node, $view_mode, $langcode) {
@@ -514,11 +538,12 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
 }
 
 /**
+ * Implements hook_node_presave(). Acts on all node content types.
  *
- * @param $node
+ * @ingroup tripal_library
  */
 function tripal_library_node_presave($node) {
-  
+
   switch ($node->type) {
     case 'chado_library':
       // for a form submission the 'libraryname' field will be set,
@@ -532,4 +557,4 @@ function tripal_library_node_presave($node) {
       }
       break;
   }
-}
+}

+ 26 - 11
tripal_library/tripal_library.install

@@ -1,11 +1,14 @@
 <?php
 /**
  * @file
- * @todo Add file header description
+ * Installation of the library module
  */
 
 /**
+ * Implements hook_disable().
  * Disable default views when module is disabled
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_disable() {
 
@@ -20,6 +23,8 @@ function tripal_library_disable() {
 
 /**
  * Implementation of hook_requirements().
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_requirements($phase) {
   $requirements = array();
@@ -35,6 +40,7 @@ function tripal_library_requirements($phase) {
   }
   return $requirements;
 }
+
 /**
  * Implementation of hook_install().
  *
@@ -101,6 +107,8 @@ function tripal_library_schema() {
 }
 
 /**
+ * Adds a materialized view keeping track of the type of features associated with each library
+ *
  * @ingroup tripal_library
  */
 function tripal_library_add_mview_library_feature_count(){
@@ -152,18 +160,23 @@ function tripal_library_add_mview_library_feature_count(){
 
 /**
  * Adds new CV's used by this module
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_add_cvs(){
   tripal_cv_add_cv(
-    'library_property', 
+    'library_property',
     'Contains properties for libraries'
   );
   tripal_cv_add_cv(
-    'library_type', 
+    'library_type',
     'Contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
   );
 }
+
 /**
+ * Adds cvterms needed for the library module
+ *
  * @ingroup tripal_library
  */
 function tripal_library_add_cvterms() {
@@ -173,7 +186,7 @@ function tripal_library_add_cvterms() {
   // description in the libraryprop table.
   tripal_cv_add_cvterm(
      array(
-       'name' => 'Library Description', 
+       'name' => 'Library Description',
        'def' => 'Description of a library'
      ),
     'library_property', 0, 1, 'tripal'
@@ -224,10 +237,12 @@ function tripal_library_add_cvterms() {
 }
 
 /**
- * This is the required update for tripal_library when upgrading from Drupal core API 6.x. 
+ * This is the required update for tripal_library when upgrading from Drupal core API 6.x.
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_update_7000() {
-  
+
   // the library types were formerly in a vocabulary named 'tripal_library_types'.
   // rename that to just be 'library_type'
   $cv = tripal_cv_get_cv_by_name('tripal_library_types');
@@ -241,11 +256,11 @@ function tripal_library_update_7000() {
   if (!$success) {
     throw new DrupalUpdateException('Failed to rename tripal_library_types CV.');
   }
-  
-  
-  // For Tripal in Drupal 6 the library_description cvterm was stored in the 
+
+
+  // For Tripal in Drupal 6 the library_description cvterm was stored in the
   // 'tripal' CV.  It should be stored in the new library_property CV that
-  // is added by this module for Tripal 2.0 and Drupal 7.  So, we need to 
+  // is added by this module for Tripal 2.0 and Drupal 7.  So, we need to
   // reset the CV ID for that term and rename the term to 'Library Description'
   tripal_library_add_cvs();
   $cv = tripal_cv_get_cv_by_name('library_property');
@@ -261,4 +276,4 @@ function tripal_library_update_7000() {
   if (!$success) {
     throw new DrupalUpdateException('Failed to move library properties to new library_property CV.');
   }
-}
+}

+ 33 - 23
tripal_library/tripal_library.module

@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * Integrates the Chado Library module with Drupal Nodes & Views
+ */
 
 /**
  * @defgroup tripal_library Library Module
@@ -8,22 +12,23 @@
  * @}
  */
 
-require('api/tripal_library.api.inc');
-require('theme/tripal_library.theme.inc');
-require('includes/tripal_library.admin.inc');
-require('includes/tripal_library.chado_node.inc');
-
+require 'api/tripal_library.api.inc';
 
+require 'theme/tripal_library.theme.inc';
 
+require 'includes/tripal_library.admin.inc';
+require 'includes/tripal_library.chado_node.inc';
 
 /**
+ * Implements hook_permission().
+ *
  * 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_library
  */
-function tripal_library_permisssions() {
+function tripal_library_permisssion() {
   return array(
     'access chado_library content' => array(
       'title' => t('View Libraries'),
@@ -49,6 +54,8 @@ function tripal_library_permisssions() {
 }
 
 /**
+ * Implements hook_menu().
+ *
  * Menu items are automatically added for the new node types created
  * by this module to the 'Create Content' Navigation menu item.  This function
  * adds more menu items needed for this module.
@@ -107,8 +114,9 @@ function tripal_library_menu() {
 }
 
 /**
- * Implements hook_views_api()
- * Purpose: Essentially this hook tells drupal that there is views support for
+ * Implements hook_views_api().
+ *
+ * Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_db.views.inc where all the
  *  views integration code is
  *
@@ -116,13 +124,14 @@ function tripal_library_menu() {
  */
 function tripal_library_views_api() {
   return array(
-    'api' => 2.0,
+    'api' => 3.0,
   );
 }
 
-
 /**
- *  We need to let drupal know about our theme functions and their arguments.
+ *  Implements hook_theme().
+ *
+ * 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
  *
@@ -202,15 +211,20 @@ function tripal_library_theme($existing, $type, $theme, $path) {
 }
 
 /**
- * Implements hook_help()
- * Purpose: Adds a help page to the module list
+ * Implements hook_help().
+ * Adds a help page to the module list
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_help ($path, $arg) {
   if ($path == 'admin/help#tripal_library') {
     return theme('tripal_library_help', array());
   }
 }
+
 /**
+ * Implements hook_block_info().
+ *
  * @ingroup tripal_library
  */
 function tripal_library_block_info() {
@@ -238,7 +252,10 @@ function tripal_library_block_info() {
 
   return $blocks;
 }
+
 /**
+ * Implements hook_block_view().
+ *
  * @ingroup tripal_library
  */
 function tripal_library_block_view($delta = '') {
@@ -284,20 +301,13 @@ function tripal_library_block_view($delta = '') {
 }
 
 /**
- *
- * @ingroup tripal_library
- */
-function tripal_library_cron() {
-
-}
-
-
-/**
- * Implementation of hook_form_alter()
+ * Implementation of hook_form_alter().
  *
  * @param $form
  * @param $form_state
  * @param $form_id
+ *
+ * @ingroup tripal_library
  */
 function tripal_library_form_alter(&$form, &$form_state, $form_id) {
   // turn of preview button for insert/updates

+ 12 - 2
tripal_library/tripal_library.views_default.inc

@@ -1,8 +1,13 @@
 <?php
+/**
+ * @file
+ * Describes library default views
+ */
 
 /**
+ * Implements hook_views_default_views().
  *
- *
+ * @ingroup tripal_library
  */
 function tripal_library_views_default_views() {
   $views = array();
@@ -13,6 +18,11 @@ function tripal_library_views_default_views() {
   return $views;
 }
 
+/**
+ * Default administration library view
+ *
+ * @ingroup tripal_library
+ */
 function tripal_library_admin_defaultviews_library() {
 
   $view = new view();
@@ -220,4 +230,4 @@ function tripal_library_admin_defaultviews_library() {
   */
 
   return $view;
-}
+}