function tripal_feature_gff3_load_form_validate

2.x tripal_feature.gff_loader.inc tripal_feature_gff3_load_form_validate($form, &$form_state)
1.x gff_loader.inc tripal_feature_gff3_load_form_validate($form, &$form_state)

Related topics

File

tripal_feature/includes/gff_loader.inc, line 210
@todo Add file header description

Code

function tripal_feature_gff3_load_form_validate($form, &$form_state) {

  $gff_file = trim($form_state['values']['gff_file']);
  $organism_id = $form_state['values']['organism_id'];
  $target_organism_id = $form_state['values']['target_organism_id'];
  $target_type = trim($form_state['values']['target_type']);
  $create_target = $form_state['values']['create_target'];
  $create_organism = $form_state['values']['create_organism'];
  $add_only = $form_state['values']['add_only'];
  $update = $form_state['values']['update'];
  $refresh = $form_state['values']['refresh'];
  $remove = $form_state['values']['remove'];
  $use_transaction = $form_state['values']['use_transaction'];
  $line_number = trim($form_state['values']['line_number']);
  $landmark_type = trim($form_state['values']['landmark_type']);
  $alt_id_attr = trim($form_state['values']['alt_id_attr']);



  // check to see if the file is located local to Drupal
  $gff_file = trim($gff_file);
  $dfile = $_SERVER['DOCUMENT_ROOT'] . base_path() . $gff_file;
  if (!file_exists($dfile)) {
    // if not local to Drupal, the file must be someplace else, just use
    // the full path provided
    $dfile = $gff_file;
  }
  if (!file_exists($dfile)) {
    form_set_error('gff_file', t("Cannot find the file on the system. Check that the file exists or that the web server has permissions to read the file."));
  }

  // @coder-ignore: there are no functions being called here
  if (($add_only AND ($update OR $refresh OR $remove)) OR 
    ($update AND ($add_only OR $refresh OR $remove)) OR 
    ($refresh AND ($update OR $add_only OR $remove)) OR 
    ($remove AND ($update OR $refresh OR $add_only))) {
    form_set_error('add_only', t("Please select only one checkbox from the import options section"));
  }

  if ($line_number and !is_numeric($line_number) or $line_number < 0) {
    form_set_error('line_number', t("Please provide an integer line number greater than zero."));
  }
}