123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <?php
- /**
- * @file
- * Create and manage JBrowse instances.
- */
- require_once 'includes/tripal_jbrowse_mgmt.api.inc';
- require_once 'includes/tripal_jbrowse_mgmt.jobs.inc';
- require_once 'includes/tripal_jbrowse_mgmt_commands.inc';
- /**
- * Implements hook_menu().
- */
- function tripal_jbrowse_mgmt_menu() {
- $items = [];
- // Admin forms.
- $items['admin/tripal/extension/tripal_jbrowse/management'] = [
- 'title' => 'Tripal JBrowse Management',
- 'description' => 'List JBrowse settings',
- 'page callback' => 'tripal_jbrowse_mgmt_instances_page',
- 'page arguments' => ['tripal_jbrowse_mgmt_configure_form'],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_list.page.inc',
- 'type' => MENU_NORMAL_ITEM,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances'] = [
- 'title' => 'List Instances',
- 'description' => 'List JBrowse settings',
- 'page callback' => 'tripal_jbrowse_mgmt_instances_page',
- 'page arguments' => ['tripal_jbrowse_mgmt_configure_form'],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_list.page.inc',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/configure'] = [
- 'title' => 'Settings',
- 'description' => 'List and create JBrowse instances.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_configure_form'],
- 'access arguments' => ['configure tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_configure.form.inc',
- 'type' => MENU_LOCAL_TASK,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/register'] = [
- 'title' => 'Register Existing Instance',
- 'description' => 'Adds an existing JBrowse to the list of instances managed within Tripal.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_register_form'],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_register.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/add'] = [
- 'title' => 'Create New Instance',
- 'description' => 'List and create JBrowse instances.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_add_form'],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_add.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/%'] = [
- 'title' => 'Manage Instance',
- 'description' => 'View an instance and manage its tracks.',
- 'page callback' => 'tripal_jbrowse_mgmt_instance_page',
- 'page arguments' => [6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_instance.page.inc',
- 'type' => MENU_CALLBACK,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/%/edit'] = [
- 'title' => 'Edit Instance',
- 'description' => 'Edit metadata for existing JBrowse instances.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_edit_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_edit.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/%/delete'] = [
- 'title' => 'Delete Instance',
- 'description' => 'Confirm deleting an instance.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_delete_instance_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_delete_instance.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/%/add_track'] = [
- 'title' => 'Add New Track',
- 'description' => 'Add new track to a jbrowse instance.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_add_track_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_tracks.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/tracks/%'] = [
- 'title' => 'Edit Track',
- 'description' => 'Edit tracks.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_json_editor_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_json_editor.form.inc',
- 'type' => MENU_CALLBACK,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/tracks/%/delete'] = [
- 'title' => 'Delete Track',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_delete_track_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_tracks.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/tracks/%/edit_json'] = [
- 'title' => 'Edit Json',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => ['tripal_jbrowse_mgmt_json_editor_advance_form', 6],
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'file' => 'includes/tripal_jbrowse_mgmt_tracks.form.inc',
- 'type' => MENU_LOCAL_ACTION,
- ];
- $items['admin/tripal/extension/tripal_jbrowse/management/instances/analysis/autocomplete'] = [
- 'title' => 'autocomplete for JBrowse instance analysis',
- 'page callback' => '_mgmt_add_analysis_autocomplete',
- 'access arguments' => ['administer tripal_jbrowse_mgmt'],
- 'type' => MENU_CALLBACK,
- ];
- return $items;
- }
- /**
- * Implements hook_permission().
- */
- function tripal_jbrowse_mgmt_permission() {
- $items = [];
- $items['configure tripal_jbrowse_mgmt'] = [
- 'title' => t('Configure Tripal JBrowse Management'),
- ];
- $items['administer tripal_jbrowse_mgmt'] = [
- 'title' => t('Create, edit and delete JBrowse instances'),
- ];
- return $items;
- }
- /**
- * autocomplete helper
- * $string = string for autocomplete search
- * to provide analysis names for form in tripal_jbrowse_mgmt_add.form.inc
- */
- function _mgmt_add_analysis_autocomplete($string){
- $analysis_4match =array();
- $analysis = db_select('chado.analysis', 'CA')
- ->fields('CA', ['analysis_id', 'name'])
- ->condition('name','%'.db_like($string).'%','LIKE')
- ->execute();
- foreach($analysis as $one_analysis){
- $key = $one_analysis->name . ' (' . $one_analysis->analysis_id . ')';
- $analysis_4match[$key] = $one_analysis->name;
- }
- drupal_json_output($analysis_4match);
- }
|