diff options
author | Saketh1499 | 2022-01-03 22:19:08 +0530 |
---|---|---|
committer | Saketh1499 | 2022-01-03 22:19:08 +0530 |
commit | 53ce71ad7e2f0226c71993f28e2ebeab1a90d510 (patch) | |
tree | f183da8c04f98907368530a91d64d9ee90506178 | |
parent | 35bac1b5a4f1cc9fd667f9d49e9599d8f64f7a5b (diff) | |
download | cfd_case_study-53ce71ad7e2f0226c71993f28e2ebeab1a90d510.tar.gz cfd_case_study-53ce71ad7e2f0226c71993f28e2ebeab1a90d510.tar.bz2 cfd_case_study-53ce71ad7e2f0226c71993f28e2ebeab1a90d510.zip |
Updating project title and solvers sections in proposal form
-rwxr-xr-x | cfd_case_study.module | 4 | ||||
-rwxr-xr-x | manage_proposal.inc | 14 | ||||
-rwxr-xr-x | proposal.inc | 46 |
3 files changed, 38 insertions, 26 deletions
diff --git a/cfd_case_study.module b/cfd_case_study.module index 568d673..7669729 100755 --- a/cfd_case_study.module +++ b/cfd_case_study.module @@ -614,15 +614,13 @@ function _cs_list_of_simulation_types(){ return $simulation_types; } -function _cs_list_of_solvers($version_id, $simulation_id){ - $version_id = $version_id; +function _cs_list_of_solvers($simulation_id){ $simulation_id = $simulation_id; $solvers = array( 0 => '-Select-', ); $query = db_select('case_study_solvers'); $query->fields('case_study_solvers'); - $query->condition('version_id',$version_id); $query->condition('simulation_type_id',$simulation_id); $solvers_list = $query->execute(); while($solvers_data = $solvers_list->fetchObject()){ diff --git a/manage_proposal.inc b/manage_proposal.inc index 937b4aa..3564c75 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -1001,7 +1001,6 @@ function cfd_case_study_proposal_edit_form($form, &$form_state) 'callback' => 'ajax_solver_used_callback', ), ); - $version_id = isset($form_state['values']['version']) ? $form_state['values']['version'] : $proposal_data->version_id; $simulation_id = isset($form_state['values']['simulation_type']) ? $form_state['values']['simulation_type'] : $proposal_data->simulation_type_id; $form['solver_used'] = array( @@ -1013,7 +1012,7 @@ function cfd_case_study_proposal_edit_form($form, &$form_state) '#states' => array( 'invisible' => array( ':input[name="simulation_type"]' => array( - 'value' => 13 + 'value' => 19 ) ) ), @@ -1032,7 +1031,7 @@ function cfd_case_study_proposal_edit_form($form, &$form_state) '#states' => array( 'visible' => array( ':input[name="simulation_type"]' => array( - 'value' => 13 + 'value' => 19 ) ) ), @@ -1068,9 +1067,8 @@ function cfd_case_study_proposal_edit_form($form, &$form_state) } function ajax_solver_used_callback($form, $form_state){ - $version_id = isset($form_state['values']['version']) ? $form_state['values']['version'] : key($version_options); $simulation_id = isset($form_state['values']['simulation_type']) ? $form_state['values']['simulation_type'] : key($simulation_type_options); - if($simulation_id < 13){ + if($simulation_id < 19){ $form['solver_used']['#options'] = _cs_list_of_solvers($version_id, $simulation_id); $form['solver_used']['#required'] = TRUE; $form['solver_used']['#validated'] = TRUE; @@ -1089,12 +1087,12 @@ function ajax_solver_used_callback($form, $form_state){ ); } function cfd_case_study_proposal_edit_form_validate($form, $form_state){ - if ($form_state['values']['simulation_type'] < 13) { + if ($form_state['values']['simulation_type'] < 19) { if($form_state['values']['solver_used'] == '0'){ form_set_error('solver_used', t('Please select an option')); } } - else if ($form_state['values']['simulation_type'] == 13) { + else if ($form_state['values']['simulation_type'] == 19) { if ($form_state['values']['solver_used_text'] != '') { if (strlen($form_state['values']['solver_used_text']) > 100) @@ -1182,7 +1180,7 @@ function cfd_case_study_proposal_edit_form_submit($form, &$form_state) return; } $simulation_id = $v['simulation_type']; - if($simulation_id < 13){ + if($simulation_id < 19){ $solver = $v['solver_used']; } else{ diff --git a/proposal.inc b/proposal.inc index c13100a..06b4c6e 100755 --- a/proposal.inc +++ b/proposal.inc @@ -247,6 +247,10 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) '#type' => 'item', '#markup' => '<hr>' ); + + $list_case_study = _cs_list_of_case_studies(); + if(!empty($list_case_study)) + { $form['cfd_project_title_check'] = array( '#type' => 'radios', '#title' => t('Is the proposed CFD Case study from the list of available CFD Case studies?'), @@ -254,6 +258,7 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) '1' => 'Yes', '0' => 'No', ), + '#required' => TRUE, '#validated' => TRUE, ); $form['cfd_case_study_name_dropdown'] = array( @@ -271,7 +276,7 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) ), ); $form['project_title'] = array( - '#type' => 'textarea', + '#type' => 'textfield', '#title' => t('Project Title'), '#size' => 250, '#description' => t('Maximum character limit is 250'), @@ -285,6 +290,18 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) ) ), ); + } + else + { + $form['project_title'] = array( + '#type' => 'textfield', + '#title' => t('Project Title'), + '#size' => 250, + '#description' => t('Maximum character limit is 250'), + '#required' => TRUE, + '#validated' => TRUE, + ); + } $version_options = _cs_list_of_versions(); $form['version'] = array( '#type' => 'select', @@ -302,27 +319,27 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) 'callback' => 'ajax_solver_used_callback', ), ); - $version_id = isset($form_state['values']['version']) ? $form_state['values']['version'] : key($version_options); + $simulation_id = isset($form_state['values']['simulation_type']) ? $form_state['values']['simulation_type'] : key($simulation_type_options); - //if($simulation_id < 13){ + if($simulation_id < 19){ $form['solver_used'] = array( '#type' => 'select', '#title' => t('Select the Solver to be used'), - '#options' => _cs_list_of_solvers($version_id, $simulation_id), + '#options' => _cs_list_of_solvers($simulation_id), '#prefix' => '<div id="ajax-solver-replace">', '#suffix' => '</div>', '#states' => array( 'invisible' => array( ':input[name="simulation_type"]' => array( - 'value' => 13 + 'value' => 19 ) ) ), - //'#required' => TRUE + '#required' => TRUE ); - //} - //else if ($simulation_id == 13){ + } + //else if ($simulation_id == 19){ $form['solver_used_text'] = array( '#type' => 'textfield', '#title' => t('Enter the Solver to be used'), @@ -334,7 +351,7 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) '#states' => array( 'visible' => array( ':input[name="simulation_type"]' => array( - 'value' => 13 + 'value' => 19 ) ) ), @@ -387,10 +404,9 @@ function cfd_case_study_proposal_form($form, &$form_state, $no_js_use = FALSE) } function ajax_solver_used_callback($form, $form_state){ - $version_id = isset($form_state['values']['version']) ? $form_state['values']['version'] : key($version_options); $simulation_id = isset($form_state['values']['simulation_type']) ? $form_state['values']['simulation_type'] : key($simulation_type_options); - if($simulation_id < 13){ - $form['solver_used']['#options'] = _cs_list_of_solvers($version_id, $simulation_id); + if($simulation_id < 19){ + $form['solver_used']['#options'] = _cs_list_of_solvers($simulation_id); $form['solver_used']['#required'] = TRUE; $form['solver_used']['#validated'] = TRUE; $commands[] = ajax_command_replace('#ajax-solver-replace', drupal_render($form['solver_used'])); @@ -490,12 +506,12 @@ function cfd_case_study_proposal_form_validate($form, &$form_state) form_set_error('project_title', t('Project title shoud not be empty')); }*/ - if ($form_state['values']['simulation_type'] < 13) { + if ($form_state['values']['simulation_type'] < 19) { if($form_state['values']['solver_used'] == '0'){ form_set_error('solver_used', t('Please select an option')); } } - else if ($form_state['values']['simulation_type'] == 13) { + else if ($form_state['values']['simulation_type'] == 19) { if ($form_state['values']['solver_used_text'] != '') { if (strlen($form_state['values']['solver_used_text']) > 100) @@ -597,7 +613,7 @@ function cfd_case_study_proposal_form_submit($form, &$form_state) $university = $v['university']; $directory_name = _df_dir_name($project_title, $proposar_name); $simulation_id = $v['simulation_type']; - if($simulation_id < 13){ + if($simulation_id < 19){ $solver = $v['solver_used']; } else{ |