Browse Source

Tripal Views Upgrade: fixed all coder upgrade warnings. Still can't enable without whitescreen

Lacey Sanderson 11 years ago
parent
commit
6a42758808

+ 10 - 6
tripal_views/includes/tripal_views_integration.inc

@@ -235,8 +235,9 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
     '#options' => $chado_tables,
     '#description' => t('Tables from Chado, custom tables and materialized view tables (non-legacy MViews) can be selected for integration.'),
     '#default_value' => (!$setup_obj->mview_id) ? $setup_obj->table_name : '',
-    '#ahah' => array(
-       'path' => 'tripal/views/integration/ajax/view_setup_table',
+    '#ajax' => array(
+       //D6: 'path' => 'tripal/views/integration/ajax/view_setup_table',
+       'callback' => 'tripal_views_integration_ajax_view_setup_table',
        'wrapper' => 'table-rows-div',
        'effect' => 'fade',
        'event' => 'change',
@@ -258,8 +259,9 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
     '#options' => $mview_tables,
     '#description' => 'Which materialized view to use.',
     '#default_value' => $setup_obj->mview_id,
-    '#ahah' => array(
-       'path' => 'tripal/views/integration/ajax/view_setup_table',
+    '#ajax' => array(
+       //D6: 'path' => 'tripal/views/integration/ajax/view_setup_table',
+       'callback' => 'tripal_views_integration_ajax_view_setup_table',
        'wrapper' => 'table-rows-div',
        'effect' => 'fade',
        'event' => 'change',
@@ -524,8 +526,10 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
         '#options' => $chado_join_tables,
         '#required' => FALSE,
         '#default_value' => $default_join_table,
-        '#ahah' => array(
-           'path' => "tripal/views/integration/ajax/join_field/$table_id-$i/fields_join_column_$table_id-$i",
+        '#ajax' => array(
+           //D6: 'path' => "tripal/views/integration/ajax/join_field/$table_id-$i/fields_join_column_$table_id-$i",
+           //D7 TODO: Add back in arguments!!
+           'callback' => 'tripal_views_integration_ajax_join_field',
            'wrapper' => "fields-column-join-column-$table_id-$i",
            'effect' => 'fade',
            'event' => 'change',

+ 41 - 2
tripal_views/tripal_views.info

@@ -3,8 +3,47 @@ description = This module provides integration with Drupal Views. Other Tripal m
 core = 6.x
 project = tripal_core
 package = Tripal
-version = 6.x-1.1
+version = 7.x-2.0beta
+
+files[] = views/handlers/chado_views_handler_relationship.inc
+files[] = views/handlers/views_handler_join_chado_through_linking.inc
+files[] = views/handlers/views_handler_join_chado_through_linking.inc
+files[] = views/handlers/chado_views_handler_filter_string.inc
+files[] = views/handlers/chado_views_handler_filter_date.inc
+files[] = views/handlers/tripal_views_handler_filter_textarea.inc
+files[] = views/handlers/chado_views_handler_field_date.inc
+files[] = views/handlers/chado_views_handler_field_boolean.inc
+files[] = views/handlers/chado_views_handler_relationship_to_node.inc
+files[] = views/handlers/chado_views_handler_sort.inc
+files[] = views/handlers/tripal_views_handler_filter_file_upload.inc
+files[] = views/handlers/chado_views_handler_field_counter.inc
+files[] = views/handlers/chado_views_handler_field_custom.inc
+files[] = views/handlers/chado_views_handler_field_math.inc
+files[] = views/handlers/tripal_views_handler_field_sequence.inc
+files[] = views/handlers/tripal_views_handler_filter_no_results.inc
+files[] = views/handlers/chado_views_handler_field_numeric.inc
+files[] = views/handlers/chado_views_handler_filter_numeric.inc
+files[] = views/handlers/tripal_views_handler_filter_sequence.inc
+files[] = views/handlers/chado_views_handler_field.inc
+files[] = views/handlers/chado_views_handler_filter_float.inc
+files[] = views/handlers/views_handler_join_chado_aggregator.inc
+files[] = views/handlers/views_handler_join_chado_aggregator.inc
+files[] = views/handlers/tripal_views_handler_filter_select_cvterm.inc
+files[] = views/handlers/deprecated/views_handler_field_chado_count.inc
+files[] = views/handlers/deprecated/views_handler_field_readable_date.inc
+files[] = views/handlers/deprecated/views_handler_field_dbxref_accession_link.inc
+files[] = views/handlers/deprecated/views_handler_filter_chado_boolean.inc
+files[] = views/handlers/deprecated/views_handler_filter_chado_select_string.inc
+files[] = views/handlers/deprecated/views_handler_filter_chado_select_cvterm_name.inc
+files[] = views/handlers/deprecated/views_handler_field_node_optional.inc
+files[] = views/handlers/chado_views_handler_field_markup.inc
+files[] = views/handlers/chado_views_handler_filter_boolean_operator.inc
+files[] = views/handlers/tripal_views_handler_filter_select_string.inc
+files[] = views/handlers/chado_views_handler_filter_equality.inc
+files[] = views/handlers/tripal_views_handler_field_aggregate.inc
+
+files[] = views_data_export/plugins/tripal_views_plugin_style_export_fasta.inc
+
 dependencies[] = views
 dependencies[] = views_data_export
 dependencies[] = tripal_core
-

+ 29 - 22
tripal_views/tripal_views.install

@@ -15,9 +15,6 @@ function tripal_views_install() {
   // create the module's data directory
   tripal_create_moddir('tripal_views');
 
-  // create the tables that manage materialized views and jobs
-  drupal_install_schema('tripal_views');
-
   // we want views to pick up our changes
   views_invalidate_cache();
 
@@ -32,14 +29,6 @@ function tripal_views_schema() {
   $schema = tripal_views_get_schemas();
   return $schema;
 }
-/**
- * Implementation of hook_uninstall().
- *
- * @ingroup tripal_views
- */
-function tripal_views_uninstall() {
-  drupal_uninstall_schema('tripal_views');
-}
 
 /**
  * This function simply defines all tables needed for the module to work
@@ -67,27 +56,45 @@ function tripal_views_get_schemas() {
  *   - Add tripal_views_field table to keep track of fields for views integration
  */
 function tripal_views_update_6040() {
-  $ret = array();
 
   // Add Priority to tripal_views
-  db_add_field($ret, 'tripal_views', 'priority', array('type' => 'int'));
-  db_add_unique_key($ret, 'tripal_views', 'priority', array('table_name', 'priority'));
-  db_add_index($ret, 'tripal_views', 'priority', array('table_name', 'priority'));
+  db_add_field(
+    'tripal_views',
+    'priority',
+    array('type' => 'int')
+  );
+  db_add_unique_key('tripal_views', 'priority', array('table_name', 'priority'));
+  db_add_index('tripal_views', 'priority', array('table_name', 'priority'));
 
   // Add handler to tripal_views_join
-  db_add_field($ret, 'tripal_views_join', 'handler', array('type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => ''));
+  db_add_field(
+    'tripal_views_join',
+    'handler',
+    array(
+      'type' => 'varchar',
+      'length' => '255',
+      'not null' => TRUE,
+      'default' => ''
+    )
+  );
 
   // Add tripal_views_field to keep track of fields for views integration
   $schema = tripal_views_views_schema();
-  db_create_table($ret, 'tripal_views_field', $schema['tripal_views_field']);
+  db_create_table('tripal_views_field', $schema['tripal_views_field']);
 
   // Add base_table TRUE/FALSE to tripal_views
-  db_add_field($ret, 'tripal_views', 'base_table', array('type' => 'int', 'not null ' => TRUE,
-      'default' => 1));
+  db_add_field(
+    'tripal_views',
+    'base_table',
+    array(
+      'type' => 'int',
+      'not null ' => TRUE,
+      'default' => 1
+    )
+  );
 
   // Add arguments to joins
   db_add_field(
-    $ret,
     'tripal_views_join',
     'arguments',
     array(
@@ -97,7 +104,7 @@ function tripal_views_update_6040() {
     )
   );
 
-  return $ret;
+  return t('Updated Tripal Views to handle multiple Integrations and keep track of fields.');
 }
 
 /**
@@ -322,7 +329,7 @@ function tripal_views_views_schema() {
   return $schema;
 }
 /**
- * Implementation of hook_requirements(). 
+ * Implementation of hook_requirements().
  *
  */
 function tripal_views_requirements($phase) {

+ 32 - 30
tripal_views/tripal_views.module

@@ -46,7 +46,7 @@ function tripal_views_menu() {
     'title' => 'Integrate A Table',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_views_integration_form'),
-    'access arguments' => array('manage tripal_views_integration'), 
+    'access arguments' => array('manage tripal_views_integration'),
     'type' => MENU_NORMAL_ITEM,
   );
 
@@ -54,7 +54,7 @@ function tripal_views_menu() {
     'title' => 'Edit Views Integration',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_views_integration_form', 5),
-    'access arguments' => array('manage tripal_views_integration'), 
+    'access arguments' => array('manage tripal_views_integration'),
     'type' => MENU_CALLBACK,
   );
 
@@ -62,7 +62,7 @@ function tripal_views_menu() {
     'title' => 'Delete Views Integration',
     'page callback' => 'tripal_views_integration_delete',
     'page arguments' => array(5),
-    'access arguments' => array('manage tripal_views_integration'), 
+    'access arguments' => array('manage tripal_views_integration'),
     'type' => MENU_CALLBACK,
   );
 
@@ -70,7 +70,7 @@ function tripal_views_menu() {
     'title' => 'Import Views Integration',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_views_integration_import_form'),
-    'access arguments' => array('manage tripal_views_integration'), 
+    'access arguments' => array('manage tripal_views_integration'),
     'type' => MENU_NORMAL_ITEM,
   );
 
@@ -81,27 +81,29 @@ function tripal_views_menu() {
     'access arguments' => array('manage tripal_views_integration'),
     'type' => MENU_CALLBACK,
   );
-  
-  // Menu item for the AJAX callback function that retrieves the 
+
+  // D6:
+  // Menu item for the AJAX callback function that retrieves the
   // portion of the form that contains all of the fields for the table being integrated
-  $items['tripal/views/integration/ajax/view_setup_table'] = array(
-    'title' => 'Import Views Integration',
-    'page callback' => 'tripal_views_integration_ajax_view_setup_table',
-    'page arguments' => array(),
-    'access arguments' => array('manage tripal_views_integration'), 
-    'type' => MENU_CALLBACK,
-  );
-  
-  // Menu item for the AJAX callback function that retrieves the list of 
-  // column names for the table that is selected to be joined. 
-  $items['tripal/views/integration/ajax/join_field/%/%'] = array(
-    'title' => 'Import Views Integration',
-    'page callback' => 'tripal_views_integration_ajax_join_field',
-    'page arguments' => array(5, 6),
-    'access arguments' => array('manage tripal_views_integration'), 
-    'type' => MENU_CALLBACK,
-  );
-  
+  //$items['tripal/views/integration/ajax/view_setup_table'] = array(
+  //  'title' => 'Import Views Integration',
+  //  'page callback' => 'tripal_views_integration_ajax_view_setup_table',
+  //  'page arguments' => array(),
+  //  'access arguments' => array('manage tripal_views_integration'),
+  //  'type' => MENU_CALLBACK,
+  //);
+
+  // D6:
+  // Menu item for the AJAX callback function that retrieves the list of
+  // column names for the table that is selected to be joined.
+  //$items['tripal/views/integration/ajax/join_field/%/%'] = array(
+  //  'title' => 'Import Views Integration',
+  //  'page callback' => 'tripal_views_integration_ajax_join_field',
+  //  'page arguments' => array(5, 6),
+  //  'access arguments' => array('manage tripal_views_integration'),
+  //  'type' => MENU_CALLBACK,
+  //);
+
   return $items;
 }
 
@@ -127,7 +129,7 @@ function tripal_views_init() {
  *
  * @ingroup tripal_views
  */
-function tripal_views_perm() {
+function tripal_views_permission() {
   return array(
     'manage tripal_views_integration',
   );
@@ -174,9 +176,9 @@ function tripal_views_theme() {
     ),
     // instructions page for the pub module
     'tripal_views_admin' => array(
-      'template' => 'tripal_views_admin',  
-      'arguments' =>  array(NULL),  
-      'path' => drupal_get_path('module', 'tripal_views') . '/theme' 
+      'template' => 'tripal_views_admin',
+      'arguments' =>  array(NULL),
+      'path' => drupal_get_path('module', 'tripal_views') . '/theme'
     ),
   );
 }
@@ -213,10 +215,10 @@ function tripal_views_biological_data_page() {
 }
 
 /*
- * 
+ *
  */
 function tripal_views_form_alter(&$form, &$form_state, $form_id) {
-  if ($form_id == "tripal_views_integration_form") {    
+  if ($form_id == "tripal_views_integration_form") {
     // updating the form through the ahah callback sets the action of
     // the form to the ahah callback URL. We need to set it back
     // to the normal form URL

+ 2 - 2
tripal_views/views/handlers/deprecated/views_handler_field_readable_date.inc

@@ -19,7 +19,7 @@ class views_handler_field_readable_date extends views_handler_field {
 
   function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
-    $time = time();
+    $time = $REQUEST_TIME;
 
     $form['date_format'] = array(
       '#type' => 'select',
@@ -62,7 +62,7 @@ class views_handler_field_readable_date extends views_handler_field {
       return theme('views_nodate');
     }
     else {
-      $time_diff = time() - $value; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
+      $time_diff = $REQUEST_TIME - $value; // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
       switch ($format) {
         case 'raw time ago':
           return format_interval($time_diff, is_numeric($custom_format) ? $custom_format : 2);

+ 4 - 4
tripal_views/views/handlers/tripal_views_handler_filter_no_results.inc

@@ -70,7 +70,7 @@ class tripal_views_handler_filter_no_results extends views_handler_filter {
       // If set, change the no_results text
       if (!empty($this->options['apply_button'])) {
         if (!$jquery_loaded) {
-          drupal_set_html_head('<script type="text/javascript" src="' . $base_url . '/misc/jquery.js"></script>');
+          drupal_add_html_head('<script type="text/javascript" src="' . $base_url . '/misc/jquery.js"></script>');
           $jquery_loaded = TRUE;
         }
         $javascript = '<script type="text/javascript">'."\n"
@@ -78,14 +78,14 @@ class tripal_views_handler_filter_no_results extends views_handler_filter {
           ."  $('div.view-empty').html('" . addslashes($this->options['no_results_text']) . "');\n"
           ."});\n"
           .'</script>'."\n";
-        drupal_set_html_head($javascript);
+        drupal_add_html_head($javascript);
       }
     }
 
     // Set the Apply button text
     if (!empty($this->options['apply_button'])) {
       if (!$jquery_loaded) {
-        drupal_set_html_head('<script type="text/javascript" src="' . $base_url . '/misc/jquery.js"></script>');
+        drupal_add_html_head('<script type="text/javascript" src="' . $base_url . '/misc/jquery.js"></script>');
         $jquery_loaded = TRUE;
       }
       $javascript = '<script type="text/javascript">'."\n"
@@ -93,7 +93,7 @@ class tripal_views_handler_filter_no_results extends views_handler_filter {
         ."  $('div.views-submit-button').html(" . '"' . "<input type='submit' id='edit-submit-all-analysis' value='" . $this->options['apply_button'] . "' class='form-submit'>" . '"' . ");\n"
         ."});\n"
         .'</script>' . "\n";
-      drupal_set_html_head($javascript);
+      drupal_add_html_head($javascript);
     }
   }