瀏覽代碼

Option to redirect to full JBrowse.

Lacey Sanderson 5 年之前
父節點
當前提交
7b21ace9f4

+ 11 - 0
tripal_jbrowse_page/includes/tripal_jbrowse_page.admin.inc

@@ -23,6 +23,13 @@ function tripal_jbrowse_page_settings_form($form, $form_state) {
     '#default_value' => variable_get('trpjbrowse_page_create_menu_items', 1),
   ];
 
+  $form['general']['embed'] = [
+    '#type' => 'checkbox',
+    '#title' => 'Embed JBrowse in your Tripal Site',
+    '#description' => 'Check this box if you would like to embed the JBrowse in your Tripal site. Conversely, uncheck it for links to go directly to the full-screen JBrowse.',
+  '#default_value' => variable_get('trpjbrowse_page_embed', 1),
+  ];
+
   $form['exclude_fieldset'] = [
     '#type' => 'fieldset',
     '#title' => 'Exclude JBrowse Instances from Page Integration',
@@ -75,6 +82,10 @@ function tripal_jbrowse_page_settings_form_submit($form, $form_state) {
     'trpjbrowse_page_create_menu_items',
     $values['create_menu_items']
   );
+  variable_set(
+    'trpjbrowse_page_embed',
+    $values['embed']
+  );
 
   // Exclude Instances.
   variable_set(

+ 4 - 6
tripal_jbrowse_page/includes/tripal_jbrowse_page.page.inc

@@ -20,13 +20,11 @@ function tripal_jbrowse_page_page($genus, $species) {
 
   $url = url($settings['link'],['query' => $query_params]);
 
-  if (FALSE) {
-    drupal_goto($url, array('external' => TRUE));
-  }
-  else {
+  if (variable_get('trpjbrowse_page_embed', 1)) {
     drupal_add_css(drupal_get_path('module', 'tripal_jbrowse_page') . '/theme/tripal_jbrowse_page.css');
     return theme('jbrowse_instance_embedded_page', ['url' => $url]);
   }
-
-  return '';
+  else {
+    drupal_goto($url, array('external' => TRUE));
+  }
 }