|
@@ -10,13 +10,37 @@
|
|
|
*/
|
|
|
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';
|
|
|
if (array_key_exists('values', $form_state)) {
|
|
|
$tv2_content_type = $form_state['values']['tv2_content_type'];
|
|
|
}
|
|
|
|
|
|
$options = tripal_chado_get_tripal_v2_content_type_options(TRUE);
|
|
|
- $form['tv2_content_type'] = array(
|
|
|
+ $form['step2']['tv2_content_type'] = array(
|
|
|
'#type' => 'select',
|
|
|
'#title' => 'Tripal v2 Content Type',
|
|
|
'#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];
|
|
|
$fkeys = $schema['foreign keys'];
|
|
|
|
|
|
- $form['tv3_content_type'] = array(
|
|
|
+ $form['step2']['tv3_content_type'] = array(
|
|
|
'#type' => 'fieldset',
|
|
|
'#title' => 'Tripal v3 Content Type',
|
|
|
'#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
|
|
|
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',
|
|
|
'#name' => 'get_v3_type_btn',
|
|
|
'#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') {
|
|
|
|
|
|
// Migrate all
|
|
|
- $form['tv3_content_type']['tv3_migrate_all'] = array(
|
|
|
+ $form['step2']['tv3_content_type']['tv3_migrate_all'] = array(
|
|
|
'#type' => 'checkbox',
|
|
|
'#title' => 'Migrate All'
|
|
|
);
|
|
@@ -89,7 +113,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
|
|
|
$tv3_content_type->namespace . '--' .
|
|
|
$tv3_content_type->accession . '--' .
|
|
|
$tv3_content_type->type);
|
|
|
- $form['tv3_content_type'][$key] = array(
|
|
|
+ $form['step2']['tv3_content_type'][$key] = array(
|
|
|
'#type' => 'checkbox',
|
|
|
'#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();
|
|
|
if ($org_count > 0) {
|
|
|
$key = urldecode('tv3_content_type--local--organism--organism');
|
|
|
- $form['tv3_content_type'][$key] = array(
|
|
|
+ $form['step2']['tv3_content_type'][$key] = array(
|
|
|
'#type' => 'checkbox',
|
|
|
'#title' => 'Organism (' . $org_count . ')',
|
|
|
);
|
|
@@ -125,7 +149,7 @@ function tripal_chado_migrate_form($form, &$form_state) {
|
|
|
$ana_count = chado_query($sql)->fetchField();
|
|
|
if ($ana_count > 0) {
|
|
|
$key = urlencode('tv3_content_type--local--analysis--analysis');
|
|
|
- $form['tv3_content_type'][$key] = array(
|
|
|
+ $form['step2']['tv3_content_type'][$key] = array(
|
|
|
'#type' => 'checkbox',
|
|
|
'#title' => 'Analysis (' . $ana_count . ')',
|
|
|
);
|
|
@@ -133,15 +157,15 @@ function tripal_chado_migrate_form($form, &$form_state) {
|
|
|
}
|
|
|
}
|
|
|
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');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 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',
|
|
|
'#name' => 'migrate_btn',
|
|
|
'#value' => "Migrate $options[$tv2_content_type]",
|
|
@@ -225,7 +249,8 @@ function tripal_chado_migrate_form_submit($form, &$form_state) {
|
|
|
* @param $form_state
|
|
|
* @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;
|
|
|
}
|
|
|
|