Browse Source

Coding Standards: Final cleanup for tripal_views; added @coder-ignore for errors to be ignored

Lacey Sanderson 12 years ago
parent
commit
08681d4faa

+ 9 - 16
tripal_views/tripal_views.coder_ignores.txt

@@ -2,25 +2,18 @@
 ; file:line:warning-type
 ; where warning-type is one of security, style, sql, i18n, comment, etc.
 
-; All <?php should be closed with a ?> in theme template files
-tripal_views_integration_fields_form.tpl.php:48:style
-tripal_views_data_export_download_form.tpl.php:8:style
-
-; All variables are set through the code and thus don't need to be filtered
-tripal_views_integration.inc:809:security
+; All variables are filtered
+tripal_views_integration.inc:814:security
 
 ; SQL queries the chado database which does not use the drupal prefixing functionality
 ; therefore, curly brackets ({}) are not appropriate.
-views/handlers/views_handler_filter_chado_select_cvterm_name.inc:53:sql
-views/handlers/views_handler_filter_chado_select_cvterm_name.inc:61:sql
-views/handlers/views_handler_field_dbxref_accession_link.inc:31:sql
-views/handlers/views_handler_filter_stockprop_id.inc:78:sql
-views/handlers/views_handler_filter_stockprop_id.inc:104:sql
-views/handlers/views_handler_filter_stock_relationship_id.inc:23:sql
-views/handlers/views_handler_filter_stock_relationship_id.inc:72:sql
-views/handlers/views_handler_filter_stock_relationship_id.inc:79:sql
-views/handlers/views_handler_filter_stock_relationship_id.inc:160:sql
-views/handlers/views_handler_argument_stockprop_id.inc:21:sql
+views/handlers/views_handler_filter_chado_select_cvterm_name.inc:62:sql
+views/handlers/views_handler_field_dbxref_accession_link.inc:32:sql
+views/handlers/views_handler_filter_stockprop_id.inc:105:sql
+views/handlers/views_handler_filter_stock_relationship_id.inc:24:sql
+views/handlers/views_handler_filter_stock_relationship_id.inc:74:sql
+views/handlers/views_handler_filter_stock_relationship_id.inc:82:sql
+views/handlers/views_handler_argument_stockprop_id.inc:22:sql
 
 ; SQL queries the pg_tables table to check if a table exists in chado; drupal
 ; prefixing is not appropriate

+ 9 - 9
tripal_views/tripal_views_integration.inc

@@ -368,9 +368,9 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
   // we need a div block where the table fields will get put when the
   // AHAH callback is made
   $form['view_setup_table'] = array(
-     '#type' => 'item',
-       '#prefix' => '<div id="table-rows-div">',
-       '#suffix' => '</div>',
+    '#type' => 'item',
+    '#prefix' => '<div id="table-rows-div">',
+    '#suffix' => '</div>',
   );
 
 
@@ -381,10 +381,10 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
     $mview_id = $form_state['storage']['mview_id'];
     $table_name = $form_state['storage']['table_name'];
     $form['view_setup_table'] = array(
-     '#type' => 'fieldset',
-     '#title' => 'Join Selection',
-     '#prefix' => '<div id="fieldset-table-rows-wrapper">',
-     '#suffix' => '</div>',
+      '#type' => 'fieldset',
+      '#title' => 'Join Selection',
+      '#prefix' => '<div id="fieldset-table-rows-wrapper">',
+      '#suffix' => '</div>',
     );
 
     // get the columns in this materialized view.  They are separated by commas
@@ -486,8 +486,8 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
       $form['view_setup_table']["$table_id-$i"]["fields_name_$table_id-$i"] = array(
         '#type' => 'markup',
         '#prefix' => "<div class=\"column-one\">",
-        '#value' => "<span class=\"column-name\">$column_name</span>".
-                    "<br /><span class=\"column-type\">$column_type</span>",
+        '#value' => "<span class=\"column-name\">" . filter_xss($column_name) . "</span>".
+                    "<br /><span class=\"column-type\">" . filter_xss($column_type) . "</span>",
         '#suffix' => "</div>",
       );
       $data['field_types'][$column_name] = $column_type;

+ 4 - 3
tripal_views/views/chado_linking.TMP.inc

@@ -1,6 +1,7 @@
 <?php
 
 /**
+ * @file
  * This is a temporary function holding all the old-style views integration
  * needed to link the base tables to their node. This will remain to keep things working
  * until it has been best determined how to do this via the new tripal_views integration
@@ -13,9 +14,9 @@ function tripal_views_TEMPORARY_chado_linking_data($data) {
   // if the chado database is not local to the drupal database
   // then we need to set the database name.  This should always
   // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
-     // return empty data array b/c if chado is external then no join to the nodetable can be made
-     return $data;
+  if (is_array($db_url) and array_key_exists('chado', $db_url)) {
+    // return empty data array b/c if chado is external then no join to the nodetable can be made
+    return $data;
   }
 
   // FEATURE ====================================

+ 1 - 0
tripal_views/views/handlers/views_handler_argument_stockprop_id.inc

@@ -18,6 +18,7 @@ class views_handler_argument_stockprop_id extends views_handler_argument_string
 
     //get options & display as options
     $previous_db = tripal_db_set_active('chado');
+    // @coder-ignore: non-drupal schema therefore table prefixing does not apply
     $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM cvterm cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM stockprop)");
     tripal_db_set_active($previous_db);
     $types = array();

+ 2 - 0
tripal_views/views/handlers/views_handler_field_chado_rel_by_type.inc

@@ -84,6 +84,7 @@ class views_handler_field_chado_rel_by_type extends views_handler_field_prerende
       );
 
       $options = array();
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       $sql = 'SELECT rel.type_id, cvt.name FROM %s_relationship rel LEFT JOIN cvterm cvt ON cvt.cvterm_id=rel.type_id GROUP BY rel.type_id,cvt.name';
       $previous_db = tripal_db_set_active('chado');
       $resource = db_query($sql, $this->table);
@@ -124,6 +125,7 @@ class views_handler_field_chado_rel_by_type extends views_handler_field_prerende
       }
 
       // Add relationships to the view results
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       $sql = "SELECT rel.*, cvterm.name as type_name, "
         ."subject.name as subject_name, object.name as object_name "
         ."FROM " . $this->table . "_relationship rel "

+ 1 - 0
tripal_views/views/handlers/views_handler_field_dbxref_accession_link.inc

@@ -28,6 +28,7 @@ class views_handler_field_dbxref_accession_link extends views_handler_field {
 
     if (!empty($db_id) AND !empty($accession)) {
       $previous_db = tripal_db_set_active('chado');
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       $result = db_fetch_object(db_query('SELECT urlprefix FROM db WHERE db_id=%d', $db_id));
       tripal_db_set_active($previous_db);
       $urlprefix = $result->urlprefix;

+ 1 - 0
tripal_views/views/handlers/views_handler_filter_chado_select_cvterm_name.inc

@@ -58,6 +58,7 @@ class views_handler_filter_chado_select_cvterm_name extends views_handler_filter
 
     }
     else {
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       $sql = "SELECT cvterm_id, name FROM cvterm WHERE cvterm_id IN (SELECT distinct(type_id) FROM %s)";
       $previous_db = tripal_db_set_active('chado');
       $resource = db_query($sql, $this->view->base_table);

+ 3 - 0
tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc

@@ -19,6 +19,7 @@ class views_handler_filter_stock_relationship_id extends views_handler_filter {
 
       // determine if just checking presence
       if (preg_match('/NULL/', $this->operator)) {
+          // @coder-ignore: non-drupal schema therefore table prefixing does not apply
           $where = 'stock.stock_id IN ('
             .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
             .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' AND type_id = ' . $this->options['type']
@@ -68,6 +69,7 @@ class views_handler_filter_stock_relationship_id extends views_handler_filter {
 
         //generate where
         if (sizeof($fixed_stock_ids) == 1) {
+          // @coder-ignore: non-drupal schema therefore table prefixing does not apply
           $where = 'stock.stock_id IN ('
             .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
             .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' ' . $fixed_stock_ids[0] . ' AND type_id = ' . $this->options['type']
@@ -75,6 +77,7 @@ class views_handler_filter_stock_relationship_id extends views_handler_filter {
           $this->query->add_where($this->options['group'], $where);
         }
         elseif (sizeof($fixed_stock_ids) > 1) {
+          // @coder-ignore: non-drupal schema therefore table prefixing does not apply
           $where = 'stock.stock_id IN ('
             .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
             .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' (' . implode(', ', $fixed_stock_ids) . ') AND type_id = ' . $this->options['type']

+ 1 - 0
tripal_views/views/handlers/views_handler_filter_stockprop_id.inc

@@ -101,6 +101,7 @@ class views_handler_filter_stockprop_id extends views_handler_filter {
 
       // Get options
       $previous_db = tripal_db_set_active('chado');
+      // @coder-ignore: non-drupal schema therefore table prefixing does not apply
       $resource = db_query("SELECT value FROM stockprop WHERE type_id=" . $this->type . " ORDER BY value");
       tripal_db_set_active($previous_db);
       while ($r = db_fetch_object($resource)) {