|
@@ -3,38 +3,60 @@
|
|
|
// API.
|
|
|
require_once 'includes/tripal_jbrowse_page.api.inc';
|
|
|
|
|
|
-// Include files.
|
|
|
-require_once 'includes/tripal_jbrowse_page.listing.inc';
|
|
|
-require_once 'includes/tripal_jbrowse_page.page.inc';
|
|
|
-
|
|
|
/**
|
|
|
* Implements hook_menu().
|
|
|
*/
|
|
|
function tripal_jbrowse_page_menu() {
|
|
|
$items = [];
|
|
|
|
|
|
+ // Listing Page.
|
|
|
$items['jbrowse'] = [
|
|
|
'title' => 'JBrowse',
|
|
|
'description' => 'A listing of available JBrowse instances.',
|
|
|
'page callback' => 'tripal_jbrowse_page_listing_page',
|
|
|
'access arguments' => ['access content'],
|
|
|
+ 'file' => 'includes/tripal_jbrowse_page.listing.inc',
|
|
|
'type' => MENU_NORMAL_ITEM,
|
|
|
];
|
|
|
|
|
|
+ // Pages for each JBrowse Instance.
|
|
|
$instances = tripal_jbrowse_mgmt_get_instances();
|
|
|
foreach ($instances as $instance) {
|
|
|
|
|
|
- $path = 'jbrowse/'.$instance->organism->genus . '/' . $instance->organism->species;
|
|
|
- $items[$path] = [
|
|
|
- 'title' => $instance->title,
|
|
|
- 'description' => $instance->description,
|
|
|
- 'page callback' => 'tripal_jbrowse_page_page',
|
|
|
- 'page arguments' => [1, 2],
|
|
|
- 'access arguments' => ['access content'],
|
|
|
- 'type' => MENU_NORMAL_ITEM,
|
|
|
- ];
|
|
|
+ if (tripal_jbrowse_page_is_instance_public($instance->id)) {
|
|
|
+
|
|
|
+ // The type of menu needs to be determined.
|
|
|
+ $create_links = variable_get('trpjbrowse_page_create_menu_items', 1);
|
|
|
+ $menu_type = MENU_CALLBACK;
|
|
|
+ if ($create_links) {
|
|
|
+ $menu_type = MENU_NORMAL_ITEM;
|
|
|
+ }
|
|
|
+ // Create the menu item.
|
|
|
+ $path = 'jbrowse/'.$instance->organism->genus . '/' . $instance->organism->species;
|
|
|
+ $items[$path] = [
|
|
|
+ 'title' => $instance->title,
|
|
|
+ 'description' => $instance->description,
|
|
|
+ 'page callback' => 'tripal_jbrowse_page_page',
|
|
|
+ 'page arguments' => [1, 2],
|
|
|
+ 'access arguments' => ['access content'],
|
|
|
+ 'file' => 'includes/tripal_jbrowse_page.page.inc',
|
|
|
+ 'type' => $menu_type,
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ // Administration.
|
|
|
+ $admin_path = 'admin/tripal/extension/tripal_jbrowse/management';
|
|
|
+ $items[$admin_path.'/page-integration'] = [
|
|
|
+ 'title' => 'Page Integration',
|
|
|
+ 'description' => 'A listing of available JBrowse instances.',
|
|
|
+ 'page callback' => 'drupal_get_form',
|
|
|
+ 'page arguments' => ['tripal_jbrowse_page_settings_form'],
|
|
|
+ 'access arguments' => ['access content'],
|
|
|
+ 'file' => 'includes/tripal_jbrowse_page.admin.inc',
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ ];
|
|
|
+
|
|
|
return $items;
|
|
|
}
|
|
|
|