Browse Source

Added vertical tabs for the Tripal v2 content migration UI. However, still can't get ajax to work correctly after this change.

ccheng 9 years ago
parent
commit
0fd17bc354
2 changed files with 36 additions and 11 deletions
  1. 36 11
      tripal_chado/includes/tripal_chado.migrate.inc
  2. 0 0
      tripal_panes/tripal_panes.module

+ 36 - 11
tripal_chado/includes/tripal_chado.migrate.inc

@@ -10,13 +10,37 @@
  */
  */
 function tripal_chado_migrate_form($form, &$form_state) {
 function tripal_chado_migrate_form($form, &$form_state) {
 
 
+  $form['overview_vert_tabs'] = array(
+    '#type' => 'vertical_tabs'
+  );
+  $form['modes']['#group'] = 'overview_vert_tabs';
+  $form['modes']['#weight'] = 1000;
+  
+  $form['step1'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Step1',
+    '#description' => 'Enable Legacy Support',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#group' => 'overview_vert_tabs'
+  );
+  
+  $form['step2'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Step2',
+    '#description' => 'Migrate Content',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#group' => 'overview_vert_tabs'
+  );
+  
   $tv2_content_type = 'all';
   $tv2_content_type = 'all';
   if (array_key_exists('values', $form_state)) {
   if (array_key_exists('values', $form_state)) {
     $tv2_content_type = $form_state['values']['tv2_content_type'];
     $tv2_content_type = $form_state['values']['tv2_content_type'];
   }
   }
 
 
   $options = tripal_chado_get_tripal_v2_content_type_options(TRUE);
   $options = tripal_chado_get_tripal_v2_content_type_options(TRUE);
-  $form['tv2_content_type'] = array(
+  $form['step2']['tv2_content_type'] = array(
     '#type' => 'select',
     '#type' => 'select',
     '#title' => 'Tripal v2 Content Type',
     '#title' => 'Tripal v2 Content Type',
     '#description' => t('Select the Tripal v2 content type to migrate.'),
     '#description' => t('Select the Tripal v2 content type to migrate.'),
@@ -38,7 +62,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
     $pkey = $schema['primary key'][0];
     $pkey = $schema['primary key'][0];
     $fkeys = $schema['foreign keys'];
     $fkeys = $schema['foreign keys'];
 
 
-    $form['tv3_content_type'] = array(
+    $form['step2']['tv3_content_type'] = array(
       '#type' => 'fieldset',
       '#type' => 'fieldset',
       '#title' => 'Tripal v3 Content Type',
       '#title' => 'Tripal v3 Content Type',
       '#description' => "Click the 'Get Tripal v3 Types' button to retrieve a list of Tripal v3
       '#description' => "Click the 'Get Tripal v3 Types' button to retrieve a list of Tripal v3
@@ -46,7 +70,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
         depending on the size of your database.  The number of items to be converted is
         depending on the size of your database.  The number of items to be converted is
         shown beside the type."
         shown beside the type."
     );
     );
-    $form['tv3_content_type']['get_v3_type_btn'] = array(
+    $form['step2']['tv3_content_type']['get_v3_type_btn'] = array(
       '#type' => 'button',
       '#type' => 'button',
       '#name' => 'get_v3_type_btn',
       '#name' => 'get_v3_type_btn',
       '#value' => "Get Tripal v3 Types",
       '#value' => "Get Tripal v3 Types",
@@ -62,7 +86,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
     if ($form_state['clicked_button']['#name'] == 'get_v3_type_btn') {
     if ($form_state['clicked_button']['#name'] == 'get_v3_type_btn') {
 
 
       // Migrate all      
       // Migrate all      
-      $form['tv3_content_type']['tv3_migrate_all'] = array(
+      $form['step2']['tv3_content_type']['tv3_migrate_all'] = array(
         '#type' => 'checkbox',
         '#type' => 'checkbox',
         '#title' => 'Migrate All'
         '#title' => 'Migrate All'
       );
       );
@@ -89,7 +113,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
             $tv3_content_type->namespace . '--' . 
             $tv3_content_type->namespace . '--' . 
             $tv3_content_type->accession . '--' . 
             $tv3_content_type->accession . '--' . 
             $tv3_content_type->type);
             $tv3_content_type->type);
-          $form['tv3_content_type'][$key] = array(
+          $form['step2']['tv3_content_type'][$key] = array(
             '#type' => 'checkbox',
             '#type' => 'checkbox',
             '#title' => $tv3_content_type->type . ' (' . $tv3_content_type->num . ')',
             '#title' => $tv3_content_type->type . ' (' . $tv3_content_type->num . ')',
           );
           );
@@ -107,7 +131,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
         $org_count = chado_query($sql)->fetchField();
         $org_count = chado_query($sql)->fetchField();
         if ($org_count > 0) {
         if ($org_count > 0) {
           $key = urldecode('tv3_content_type--local--organism--organism');
           $key = urldecode('tv3_content_type--local--organism--organism');
-          $form['tv3_content_type'][$key] = array(
+          $form['step2']['tv3_content_type'][$key] = array(
             '#type' => 'checkbox',
             '#type' => 'checkbox',
             '#title' => 'Organism (' . $org_count . ')',
             '#title' => 'Organism (' . $org_count . ')',
           );
           );
@@ -125,7 +149,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
         $ana_count = chado_query($sql)->fetchField();
         $ana_count = chado_query($sql)->fetchField();
         if ($ana_count > 0) {
         if ($ana_count > 0) {
           $key = urlencode('tv3_content_type--local--analysis--analysis');
           $key = urlencode('tv3_content_type--local--analysis--analysis');
-          $form['tv3_content_type'][$key] = array(
+          $form['step2']['tv3_content_type'][$key] = array(
             '#type' => 'checkbox',
             '#type' => 'checkbox',
             '#title' => 'Analysis (' . $ana_count . ')',
             '#title' => 'Analysis (' . $ana_count . ')',
           );
           );
@@ -133,15 +157,15 @@ function tripal_chado_migrate_form($form, &$form_state) {
         }
         }
       }
       }
       if ($no_data) {
       if ($no_data) {
-        unset($form['tv3_content_type']['tv3_migrate_all']);
+        unset($form['step2']['tv3_content_type']['tv3_migrate_all']);
         drupal_set_message('No data for migration or all have been migrated.', 'warning');
         drupal_set_message('No data for migration or all have been migrated.', 'warning');
       }
       }
     }
     }
   }
   }
 
 
   // Submit button
   // Submit button
-  if ($tv2_content_type == 'all' || key_exists('tv3_migrate_all', $form['tv3_content_type'])) {
-    $form['migrate_btn'] = array(
+  if ($tv2_content_type == 'all' || key_exists('tv3_migrate_all', $form['step2']['tv3_content_type'])) {
+    $form['step2']['migrate_btn'] = array(
       '#type' => 'submit',
       '#type' => 'submit',
       '#name' => 'migrate_btn',
       '#name' => 'migrate_btn',
       '#value' => "Migrate $options[$tv2_content_type]",
       '#value' => "Migrate $options[$tv2_content_type]",
@@ -225,7 +249,8 @@ function tripal_chado_migrate_form_submit($form, &$form_state) {
  * @param $form_state
  * @param $form_state
  * @return $form
  * @return $form
  */
  */
-function tripal_chado_migrate_form_ajax_callback($form, $form_state) {
+function tripal_chado_migrate_form_ajax_callback(&$form, &$form_state) {
+  $active_tab = $form_state['values']['overview_vert_tabs__active_tab'];
   return $form;
   return $form;
 }
 }
 
 

+ 0 - 0
tripal_panes/tripal_panes.module