Просмотр исходного кода

Tripal Library adheres to Drupal coding standads

Pubudu Basnayaka 12 лет назад
Родитель
Сommit
2640a022a1

+ 12 - 7
tripal_library/reindex.php

@@ -1,19 +1,24 @@
 <?php
+
+/**
+ * @file
+ * @todo Add file header description
+ */
+
+
 //
 // Copyright 2009 Clemson University
 //
 
 
-/* 
-
-This script must be run at the base directory level of the drupal installation 
-in order to pick up all necessary dependencies 
-
-*/
+/*
+ This script must be run at the base directory level of the drupal installation
+ in order to pick up all necessary dependencies
+ */
 
 require_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
 jlibrary_feature_reindex($argv[1]);
 
-?>
+

+ 11 - 7
tripal_library/taxonify.php

@@ -1,18 +1,22 @@
 <?php
+
+/**
+ * @file
+ * @todo Add file header description
+ */
+
 //
 // Copyright 2009 Clemson University
 //
 
-/* 
-
-This script must be run at the base directory level of the drupal installation 
-in order to pick up all necessary dependencies 
-
-*/
+/*
+ This script must be run at the base directory level of the drupal installation
+ in order to pick up all necessary dependencies
+ */
 
 require_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
 jlibrary_feature_set_taxonomy($argv[1]);
 
-?>
+

+ 4 - 4
tripal_library/tripal_library.api.inc

@@ -128,7 +128,7 @@ function tripal_library_chado_libraryprop_schema() {
  * @ingroup tripal_library_api
  */
 function tripal_library_get_property($library_id, $property) {
-   return tripal_core_get_property('library', $library_id, $property, 'tripal');
+  return tripal_core_get_property('library', $library_id, $property, 'tripal');
 }
 
 /**
@@ -149,7 +149,7 @@ function tripal_library_get_property($library_id, $property) {
  * @ingroup tripal_library_api
  */
 function tripal_library_insert_property($library_id, $property, $value, $update_if_present = 0) {
-   return tripal_core_insert_property('library', $library_id, $property, 'tripal', $value, $update_if_present);
+  return tripal_core_insert_property('library', $library_id, $property, 'tripal', $value, $update_if_present);
 }
 
 /**
@@ -173,7 +173,7 @@ function tripal_library_insert_property($library_id, $property, $value, $update_
  * @ingroup tripal_library_api
  */
 function tripal_library_update_property($library_id, $property, $value, $insert_if_missing = 0) {
-   return tripal_core_update_property('library', $library_id, $property, 'tripal', $value, $insert_if_missing);
+  return tripal_core_update_property('library', $library_id, $property, 'tripal', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -192,5 +192,5 @@ function tripal_library_update_property($library_id, $property, $value, $insert_
  * @ingroup tripal_library_api
  */
 function tripal_library_delete_property($library_id, $property) {
-   return tripal_core_delete_property('library', $library_id, $property, 'tripal');
+  return tripal_core_delete_property('library', $library_id, $property, 'tripal');
 }

+ 101 - 101
tripal_library/tripal_library.install

@@ -5,56 +5,56 @@
  */
 
 /**
-*  Implementation of hook_install();
-*
-* @ingroup tripal_library
-*/
+ * Implementation of hook_install().
+ *
+ * @ingroup tripal_library
+ */
 function tripal_library_install() {
-   // create the module's data directory
-   tripal_create_moddir('tripal_library');
+  // create the module's data directory
+  tripal_create_moddir('tripal_library');
 
-   // create the tables that correlate drupal nodes with chado
-   // features, librarys, etc....
-   drupal_install_schema('tripal_library');
+  // create the tables that correlate drupal nodes with chado
+  // features, librarys, etc....
+  drupal_install_schema('tripal_library');
 
-   // Insert cvterm 'library_description' into cvterm table of chado
-   // database. This CV term is used to keep track of the library
-   // description in the libraryprop table.
-   tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 'tripal', 0, 1, 'tripal');
+  // Insert cvterm 'library_description' into cvterm table of chado
+  // database. This CV term is used to keep track of the library
+  // description in the libraryprop table.
+  tripal_cv_add_cvterm(array('name' => 'library_description', 'def' => 'Description of a library'), 'tripal', 0, 1, 'tripal');
 
-   // Add CVTerms for the library types
-   tripal_cv_add_cvterm(array('name' => 'cdna_library', 'def' => 'cDNA Library'), 'tripal', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'bac_library', 'def' => 'BAC Library'), 'tripal', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'fosmid_library', 'def' => 'FOSMID Library'), 'tripal', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'cosmid_library', 'def' => 'COSMID Library'), 'tripal', 0, 1, 'tripal');
-   tripal_cv_add_cvterm(array('name' => 'yac_library', 'def' => 'YAC Library'), 'tripal', 0, 1, 'tripal');
+  // Add CVTerms for the library types
+  tripal_cv_add_cvterm(array('name' => 'cdna_library', 'def' => 'cDNA Library'), 'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'bac_library', 'def' => 'BAC Library'), 'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'fosmid_library', 'def' => 'FOSMID Library'), 'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'cosmid_library', 'def' => 'COSMID Library'), 'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm(array('name' => 'yac_library', 'def' => 'YAC Library'), 'tripal', 0, 1, 'tripal');
 
-   // Add the materialized view needed to count the features for the library
-   // Drop the MView table if it exists
-   $previous_db = tripal_db_set_active('chado');
-   if (db_table_exists('library_feature_count')) {
-      $sql = "DROP TABLE library_feature_count";
-      db_query($sql);
-   }
-   tripal_db_set_active($previous_db);
-   // Create the MView
-   tripal_add_mview('library_feature_count', 'tripal_library',
-      'library_feature_count',
-      'library_id integer, name character varying(255), '.
-    '  num_features integer, feature_type character varying(255)',
-     'library_id',
-     'SELECT '.
-      '   L.library_id, '.
-      '   L.name, '.
-      '    count(F.feature_id) as num_features, '.
-      '    CVT.name as feature_type '.
-      'FROM {Library} L '.
-      '    INNER JOIN Library_Feature LF  ON LF.library_id = L.library_id '.
-      '    INNER JOIN Feature F           ON LF.feature_id = F.feature_id '.
-      '    INNER JOIN Cvterm CVT          ON F.type_id = CVT.cvterm_id '.
-      'GROUP BY L.library_id, L.name, CVT.name',
-     ''
-   );
+  // Add the materialized view needed to count the features for the library
+  // Drop the MView table if it exists
+  $previous_db = tripal_db_set_active('chado');
+  if (db_table_exists('library_feature_count')) {
+    $sql = "DROP TABLE library_feature_count";
+    db_query($sql);
+  }
+  tripal_db_set_active($previous_db);
+  // Create the MView
+  tripal_add_mview('library_feature_count', 'tripal_library',
+    'library_feature_count',
+    'library_id integer, name character varying(255), '.
+  '  num_features integer, feature_type character varying(255)',
+   'library_id',
+   'SELECT '.
+    '   L.library_id, '.
+    '   L.name, '.
+    '    count(F.feature_id) as num_features, '.
+    '    CVT.name as feature_type '.
+    'FROM {Library} L '.
+    '    INNER JOIN Library_Feature LF  ON LF.library_id = L.library_id '.
+    '    INNER JOIN Feature F           ON LF.feature_id = F.feature_id '.
+    '    INNER JOIN Cvterm CVT          ON F.type_id = CVT.cvterm_id '.
+    'GROUP BY L.library_id, L.name, CVT.name',
+   ''
+  );
 
 }
 
@@ -64,37 +64,37 @@ function tripal_library_install() {
  * @ingroup tripal_library
  */
 function tripal_library_schema() {
-   $schema = tripal_library_get_schemas();
-   return $schema;
+  $schema = tripal_library_get_schemas();
+  return $schema;
 }
 
 /**
- * Implementation of hook_uninstall()
+ * Implementation of hook_uninstall().
  *
  * @ingroup tripal_library
  */
 function tripal_library_uninstall() {
-   drupal_uninstall_schema('tripal_library');
+  drupal_uninstall_schema('tripal_library');
 
-   // remove the materialized view
-   $sql = "SELECT * FROM {tripal_mviews} ".
-          "WHERE name = 'library_feature_count'";
+  // remove the materialized view
+  $sql = "SELECT * FROM {tripal_mviews} ".
+        "WHERE name = 'library_feature_count'";
 
-   if (db_table_exists('tripal_mviews')) {
-      $mview = db_fetch_object(db_query($sql));
-      if ($mview) {
-         tripal_mviews_action('delete', $mview->mview_id);
-      }
-   }
+  if (db_table_exists('tripal_mviews')) {
+    $mview = db_fetch_object(db_query($sql));
+    if ($mview) {
+      tripal_mviews_action('delete', $mview->mview_id);
+    }
+  }
 
-   // Get the list of nodes to remove
-   $sql_lib_id = "SELECT nid, vid ".
-                 "FROM {node} ".
-                 "WHERE type='chado_library'";
-   $result = db_query($sql_lib_id);
-   while ($node = db_fetch_object($result)) {
-      node_delete($node->nid);
-   }
+  // Get the list of nodes to remove
+  $sql_lib_id = "SELECT nid, vid ".
+               "FROM {node} ".
+               "WHERE type='chado_library'";
+  $result = db_query($sql_lib_id);
+  while ($node = db_fetch_object($result)) {
+    node_delete($node->nid);
+  }
 }
 
 /**
@@ -108,33 +108,33 @@ function tripal_library_uninstall() {
 function tripal_library_get_schemas() {
   $schema = array();
   $schema['chado_library'] = array(
-      'fields' => array(
-         'vid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-         ),
-         'nid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-         ),
-         'library_id' => array(
-            'type' => 'int',
-            'not null' => TRUE,
-            'default' => 0
-         )
+    'fields' => array(
+      'vid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+    'nid' => array(
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0
+      ),
+    'library_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'default' => 0
+      )
       ),
-      'indexes' => array(
-         'library_id' => array('library_id')
+    'indexes' => array(
+      'library_id' => array('library_id')
       ),
-      'unique keys' => array(
-         'nid_vid' => array('nid', 'vid'),
-         'vid' => array('vid')
+    'unique keys' => array(
+      'nid_vid' => array('nid', 'vid'),
+      'vid' => array('vid')
       ),
-      'primary key' => array('nid'),
+    'primary key' => array('nid'),
   );
   return $schema;
 }
@@ -146,15 +146,15 @@ function tripal_library_get_schemas() {
  * @ingroup tripal_library
  */
 function tripal_library_requirements($phase) {
-   $requirements = array();
-   if ($phase == 'install') {
-      if (!function_exists('tripal_create_moddir')) {
-         $requirements ['tripal_library'] = array(
-            'title' => "tripal_library",
-            'value' => "error. Some required modules are just being installed. Please try again.",
-            'severity' => REQUIREMENT_ERROR,
-         );
-      }
-   }
-   return $requirements;
+  $requirements = array();
+  if ($phase == 'install') {
+    if (!function_exists('tripal_create_moddir')) {
+      $requirements ['tripal_library'] = array(
+        'title' => "tripal_library",
+        'value' => "error. Some required modules are just being installed. Please try again.",
+        'severity' => REQUIREMENT_ERROR,
+        );
+    }
+  }
+  return $requirements;
 }

+ 7 - 7
tripal_library/tripal_library.views.inc

@@ -36,7 +36,7 @@ function tripal_library_views_data()  {
     );
     foreach ($tables as $tablename) {
       if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -50,7 +50,7 @@ function tripal_library_views_data()  {
     );
     foreach ($tables as $tablename) {
       if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -69,16 +69,16 @@ function tripal_library_views_data()  {
  * @ingroup tripal_library_views
  */
 function tripal_library_views_handlers() {
- return array(
+  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'tripal_library') . '/views/handlers',
-   ),
+      ),
    'handlers' => array(
      'views_handler_field_computed_library_nid' => array(
        'parent' => 'views_handler_field_numeric',
-     ),
-   ),
- );
+      ),
+    ),
+  );
 }
 
 /**