Преглед изворни кода

Bug fixes to instance manage tracks page.

Lacey Sanderson пре 5 година
родитељ
комит
f74597d6fc

+ 10 - 5
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt.api.inc

@@ -455,12 +455,17 @@ function tripal_jbrowse_mgmt_build_http_query($instance) {
 function tripal_jbrowse_mgmt_get_json($instance) {
   $path = tripal_jbrowse_mgmt_get_track_list_file_path($instance);
 
-  $contents = file_get_contents($path);
-  if (!$contents) {
-    throw new Exception('Unable to find ' . $path . ' file');
-  }
+  if (file_exists($path)) {
+    $contents = file_get_contents($path);
+    if (!$contents) {
+      throw new Exception('Unable to find ' . $path . ' file');
+    }
 
-  return json_decode($contents, TRUE);
+    return json_decode($contents, TRUE);
+  }
+  else {
+    return [];
+  }
 }
 
 /**

+ 1 - 1
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_add.form.inc

@@ -55,7 +55,7 @@ function tripal_jbrowse_mgmt_add_form($form, &$form_state) {
     '#type' => 'fieldset',
     '#title' => t('Reference Sequence File'),
     '#collabsible' => FALSE,
-    'weight' => 0
+    '#weight' => 0
   ];
 
   $form['data']['data_desc'] = [