|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
function tripal_views_setup_admin_form(){
|
|
|
|
|
@@ -53,7 +53,7 @@ function tripal_views_setup_admin_form(){
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
function tripal_views_setup_admin_form_submit($form, &$form_state){
|
|
|
$value = $form['existing_rows']['#options'][$form_state['values']['existing_rows']];
|
|
@@ -63,7 +63,7 @@ function tripal_views_setup_admin_form_submit($form, &$form_state){
|
|
|
}
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
function tripal_views_setup_new_search_form(&$form_state){
|
|
|
$form = array();
|
|
@@ -90,6 +90,7 @@ function tripal_views_setup_new_search_form(&$form_state){
|
|
|
|
|
|
$mview_query = db_query("SELECT mview_id,name FROM {tripal_mviews} ORDER BY name;");
|
|
|
$mview_options = array();
|
|
|
+ $mview_options['0'] = 'Select';
|
|
|
while ($mview_option = db_fetch_array($mview_query)){
|
|
|
$mview_options[$mview_option['mview_id']] = $mview_option['name'];
|
|
|
}
|
|
@@ -101,12 +102,12 @@ function tripal_views_setup_new_search_form(&$form_state){
|
|
|
'#options' => $mview_options,
|
|
|
'#description' => 'Which materialized view to use.',
|
|
|
'#required' => TRUE,
|
|
|
- '#ahah' => array(
|
|
|
- 'path' => 'admin/tripal/tripal_views_setup/ajax/mview_cols',
|
|
|
- 'wrapper' => 'table-rows-div',
|
|
|
- 'effect' => 'fade',
|
|
|
- 'event' => 'change',
|
|
|
- 'method' => 'replace',
|
|
|
+ '#ahah' => array(
|
|
|
+ 'path' => 'admin/tripal/tripal_views_setup/ajax/mview_cols',
|
|
|
+ 'wrapper' => 'table-rows-div',
|
|
|
+ 'effect' => 'fade',
|
|
|
+ 'event' => 'change',
|
|
|
+ 'method' => 'replace',
|
|
|
),
|
|
|
);
|
|
|
|
|
@@ -126,11 +127,12 @@ function tripal_views_setup_new_search_form(&$form_state){
|
|
|
'#suffix' => '</div>',
|
|
|
);
|
|
|
|
|
|
- dpm($form_state, 'formstate in mainform');
|
|
|
- if($form_state['values']['mview_id']){
|
|
|
- $mview_id = $form_state['values']['mview_id'];
|
|
|
- dpm($mview_id,'mviewidinif');
|
|
|
-
|
|
|
+ if($form_state['values']['mview_id'] || $form['mview_id']['#value']){
|
|
|
+ if (isset($form_state['values']['mview_id']))
|
|
|
+ $mview_id = $form_state['values']['mview_id'];
|
|
|
+ else
|
|
|
+ $mview_id = $form['mview_id']['#value'];
|
|
|
+
|
|
|
$form['view_setup_table'] = array(
|
|
|
'#type' => 'fieldset',
|
|
|
'#title' => 'New View Setup',
|
|
@@ -184,20 +186,21 @@ function tripal_views_setup_new_search_form(&$form_state){
|
|
|
'#options' => $chado_tables,
|
|
|
'#required' => FALSE,
|
|
|
'#ahah' => array(
|
|
|
-// 'path' => 'admin/tripal/tripal_views_setup/ajax/mview_cols',
|
|
|
-// 'wrapper' => 'table-rows-div',
|
|
|
-// 'effect' => 'fade',
|
|
|
-// 'event' => 'change',
|
|
|
-// 'method' => 'replace',
|
|
|
- ),
|
|
|
+ 'path' => 'admin/tripal/tripal_views_setup/ajax/field_col_join',
|
|
|
+ 'wrapper' => "fields-column-join-column-$i",
|
|
|
+ 'effect' => 'fade',
|
|
|
+ 'event' => 'change',
|
|
|
+ 'method' => 'replace',
|
|
|
+ ),
|
|
|
);
|
|
|
$column_join = array();
|
|
|
- if($form_state['values']['view_setup_table']["fields_column_join_$i"]){
|
|
|
+ if($form_state['values']["fields_column_join_$i"]){
|
|
|
$column_join = array('hello', 'world');
|
|
|
}
|
|
|
+ dpm($form_state,'formstate attopfieldcolumns');
|
|
|
$form['view_setup_table']["fields_column_join_column_$i"] = array(
|
|
|
'#type' => 'select',
|
|
|
- '#prefix' => "<div class=\"fields-column-join-column\">",
|
|
|
+ '#prefix' => "<div id=\"fields-column-join-column-$i\" class=\"fields-column-join-column\">",
|
|
|
'#suffix' => "</div>",
|
|
|
'#options' => $column_join,
|
|
|
'#required' => FALSE,
|
|
@@ -216,48 +219,57 @@ function tripal_views_setup_new_search_form(&$form_state){
|
|
|
$i++;
|
|
|
}
|
|
|
|
|
|
+ $form['row_counter'] = array(
|
|
|
+ '#type' => 'hidden',
|
|
|
+ '#value' => $i,
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
- $form['row_counter'] = array(
|
|
|
- '#type' => 'hidden',
|
|
|
- '#value' => $i,
|
|
|
- );
|
|
|
|
|
|
$form['submit'] = array(
|
|
|
'#type' => 'submit',
|
|
|
'#value' => 'Create',
|
|
|
);
|
|
|
-
|
|
|
- dpm($form, 'form');
|
|
|
+
|
|
|
+ dpm($form, 'form final');
|
|
|
|
|
|
return $form;
|
|
|
}
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
-function tripal_view_search_ajax_mview_cols(){
|
|
|
- dpm($_POST, 'post');
|
|
|
-
|
|
|
+function tripal_view_setup_ajax_mview_cols(){
|
|
|
+
|
|
|
+ $form = tripal_views_setup_ajax_getform($form_state, $args, $_POST);
|
|
|
+
|
|
|
+ unset($form['view_setup_table']['#prefix'], $form['view_setup_table']['#suffix']);
|
|
|
+ $output = theme('status_message') . drupal_render($form['view_setup_table']);
|
|
|
+
|
|
|
+ // Final rendering callback.
|
|
|
+ drupal_json(array('status' => TRUE, 'data' => $output));
|
|
|
+}
|
|
|
+
|
|
|
+function tripal_views_setup_ajax_getform(&$form_state, &$args, &$_POST){
|
|
|
+
|
|
|
// Retrieve the form from the cache
|
|
|
$form_state = array('storage' => NULL);
|
|
|
$form_build_id = $_POST['form_build_id'];
|
|
|
$form = form_get_cache($form_build_id, $form_state);
|
|
|
-
|
|
|
+
|
|
|
// Preparing to process the form
|
|
|
$args = $form['#parameters'];
|
|
|
$form_id = array_shift($args);
|
|
|
$form_state['post'] = $form['#post'] = $_POST;
|
|
|
$form['#programmed'] = $form['#redirect'] = FALSE;
|
|
|
-
|
|
|
+
|
|
|
// Sets the form_state so that the validate and submit handlers can tell
|
|
|
// when the form is submitted via AHAH
|
|
|
$form_state['ahah_submission'] = TRUE;
|
|
|
-
|
|
|
+
|
|
|
// Process the form with drupal_process_form. This function calls the submit
|
|
|
// handlers, which put whatever was worthy of keeping into $form_state.
|
|
|
drupal_process_form($form_id, $form, $form_state);
|
|
|
-
|
|
|
+
|
|
|
// You call drupal_rebuild_form which destroys $_POST.
|
|
|
// The form generator function is called and creates the form again but since
|
|
|
// it knows to use $form_state, the form will be different.
|
|
@@ -265,17 +277,31 @@ function tripal_view_search_ajax_mview_cols(){
|
|
|
// destroyed, the submit handlers will not be called again.
|
|
|
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
|
|
|
|
|
|
-
|
|
|
- // $form = drupal_get_form('tripal_views_setup_fields_form',$mview_id);
|
|
|
+ return $form;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
+ */
|
|
|
+function tripal_view_setup_ajax_field_col_join(){
|
|
|
+ dpm($_POST,'post tripal_view_setup_ajax_field_col_join');
|
|
|
+
|
|
|
+ dpm($form_state,'formstate tripal_view_setup_ajax_field_col_join');
|
|
|
+
|
|
|
+ $form = tripal_views_setup_ajax_getform($form_state, $args, $_POST);
|
|
|
+
|
|
|
unset($form['view_setup_table']['#prefix'], $form['view_setup_table']['#suffix']);
|
|
|
$output = theme('status_message') . drupal_render($form['view_setup_table']);
|
|
|
-
|
|
|
+
|
|
|
// Final rendering callback.
|
|
|
- drupal_json(array('status' => TRUE, 'data' => $output));
|
|
|
+ drupal_json(array('status' => TRUE, 'data' => $output));
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
// function tripal_views_setup_fields(&$form_state=NULL, $mview_id = NULL){
|
|
|
|
|
@@ -370,27 +396,19 @@ function tripal_view_search_ajax_mview_cols(){
|
|
|
// return $form;
|
|
|
// }
|
|
|
|
|
|
-function tripal_views_setup_fields_form_submit($form, &$form_state){
|
|
|
- dpm($form,'formfield');
|
|
|
- dpm($form_state, 'formstatefield');
|
|
|
-}
|
|
|
+// function tripal_views_setup_fields_form_submit($form, &$form_state){
|
|
|
+// dpm($form,'formfield');
|
|
|
+// dpm($form_state, 'formstatefield');
|
|
|
+
|
|
|
+// }
|
|
|
|
|
|
-/**
|
|
|
- *
|
|
|
- * @ingroup tripal_view_search
|
|
|
- */
|
|
|
-function tripal_view_search_ajax_field_col_join(){
|
|
|
- dpm($_POST);
|
|
|
- dpm($_POST['row_counter'], 'rowcounter');
|
|
|
- drupal_json(array('status' => TRUE, 'data' => 'howdy'));
|
|
|
|
|
|
-}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
- * @ingroup tripal_view_search
|
|
|
+ * @ingroup tripal_view_setup
|
|
|
*/
|
|
|
function tripal_views_setup_new_search_form_submit($form, &$form_state){
|
|
|
- dpm($form,'form');
|
|
|
- dpm($form_state, 'formstate');
|
|
|
+ dpm($form,'form on submit');
|
|
|
+ dpm($form_state, 'formstate on submit');
|
|
|
}
|