Explorar el Código

Merge pull request #17 from tripal/fix-menu

Add mgmt module under tripal extensions
Abdullah Almsaeed hace 6 años
padre
commit
69bfbbdd18

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

@@ -14,7 +14,7 @@ function tripal_jbrowse_mgmt_add_form($form, &$form_state) {
       '#suffix' => '</div>',
     ];
 
-    return;
+    return $form;
   }
 
   $organisms = tripal_jbrowse_mgmt_get_organisms_list();
@@ -183,7 +183,7 @@ function tripal_jbrowse_mgmt_add_form_submit($form, &$form_state) {
       [$instance_id],
       $user->uid
     );
-    drupal_goto("admin/tripal_jbrowse_mgmt/instances/$instance_id");
+    drupal_goto("admin/tripal/extension/tripal_jbrowse/management/instances/$instance_id");
     return $form;
   }
 

+ 2 - 2
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_delete_instance.form.inc

@@ -35,7 +35,7 @@ function tripal_jbrowse_mgmt_delete_instance_form(
     '#type' => 'markup',
     '#markup' => l(
       'Cancel',
-      'admin/tripal_jbrowse_mgmt/instances'
+      'admin/tripal/extension/tripal_jbrowse/management/instances'
     ),
   ];
 
@@ -79,5 +79,5 @@ function tripal_jbrowse_mgmt_delete_instance_form_submit($form, &$form_state) {
     'warning'
   );
 
-  drupal_goto('admin/tripal_jbrowse_mgmt/instance/' . $instance_id);
+  drupal_goto('admin/tripal/extension/tripal_jbrowse/management/instance/' . $instance_id);
 }

+ 2 - 2
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_instance.page.inc

@@ -69,10 +69,10 @@ function tripal_jbrowse_mgmt_instance_page($instance_id) {
           $track->file_type,
           $track->user->name,
           date('m/d/Y', $track->created_at),
-          l('Manage Track', 'admin/tripal_jbrowse_mgmt/tracks/' . $track->id),
+          l('Manage Track', 'admin/tripal/extension/tripal_jbrowse/management/tracks/' . $track->id),
           l(
             'Delete Track',
-            'admin/tripal_jbrowse_mgmt/tracks/' . $track->id . '/delete'
+            'admin/tripal/extension/tripal_jbrowse/management/tracks/' . $track->id . '/delete'
           ),
         ];
       },

+ 3 - 3
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_list.page.inc

@@ -33,17 +33,17 @@ function tripal_jbrowse_mgmt_instances_page() {
     $rows[] = [
       l(
         $instance->title,
-        'admin/tripal_jbrowse_mgmt/instances/' . $instance->id
+        'admin/tripal/extension/tripal_jbrowse/management/instances/' . $instance->id
       ),
       $instance->user->name,
       $instance->description ?: 'Not provided',
-      l('Manage Tracks', 'admin/tripal_jbrowse_mgmt/instances/' . $instance->id),
+      l('Manage Tracks', 'admin/tripal/extension/tripal_jbrowse/management/instances/' . $instance->id),
       l(
         'Launch',
         $settings['link'],
         ['query' => tripal_jbrowse_mgmt_build_http_query($instance)]
       ),
-      l('Delete Instance', 'admin/tripal_jbrowse_mgmt/instances/'.$instance->id.'/delete'),
+      l('Delete Instance', 'admin/tripal/extension/tripal_jbrowse/management/instances/'.$instance->id.'/delete'),
 
     ];
   }

+ 3 - 3
tripal_jbrowse_mgmt/includes/tripal_jbrowse_mgmt_tracks.form.inc

@@ -269,7 +269,7 @@ function tripal_jbrowse_mgmt_add_track_form_submit($form, &$form_state) {
     'tripal_jbrowse_mgmt', 'tripal_jbrowse_mgmt_add_track_to_instance', [$track_id],
     $user->uid);
 
-  drupal_goto('admin/tripal_jbrowse_mgmt/instances/' . $instance->id);
+  drupal_goto('admin/tripal/extension/tripal_jbrowse/management/instances/' . $instance->id);
 }
 
 /**
@@ -311,7 +311,7 @@ function tripal_jbrowse_mgmt_delete_track_form($form, &$form_state, $track_id) {
   $form['cancel'] = [
     '#type' => 'markup',
     '#markup' => l('Cancel',
-      'admin/tripal_jbrowse_mgmt/instances/' . $track->instance_id),
+      'admin/tripal/extension/tripal_jbrowse/management/instances/' . $track->instance_id),
   ];
 
   return $form;
@@ -335,5 +335,5 @@ function tripal_jbrowse_mgmt_delete_track_form_submit($form, &$form_state) {
 
   tripal_jbrowse_mgmt_update_track($track, ['is_deleted' => 1]);
 
-  drupal_goto('admin/tripal_jbrowse_mgmt/instances/' . $track->instance_id);
+  drupal_goto('admin/tripal/extension/tripal_jbrowse/management/instances/' . $track->instance_id);
 }

+ 22 - 26
tripal_jbrowse_mgmt/tripal_jbrowse_mgmt.module

@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Create and manage JBrowse instances.
@@ -14,9 +15,9 @@ require_once 'includes/tripal_jbrowse_mgmt_commands.inc';
 function tripal_jbrowse_mgmt_menu() {
   $items = [];
 
-  // Admin forms
-  $items['admin/tripal_jbrowse_mgmt'] = [
-    'title' => 'JBrowse',
+  // 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'],
@@ -25,12 +26,7 @@ function tripal_jbrowse_mgmt_menu() {
     'type' => MENU_NORMAL_ITEM,
   ];
 
-  $items['admin/tripal_jbrowse_mgmt/list'] = [
-    'title' => 'List Instances',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-  ];
-
-  $items['admin/tripal_jbrowse_mgmt/configure'] = [
+  $items['admin/tripal/extension/tripal_jbrowse/management/configure'] = [
     'title' => 'Settings',
     'description' => 'List and create JBrowse instances.',
     'page callback' => 'drupal_get_form',
@@ -40,7 +36,7 @@ function tripal_jbrowse_mgmt_menu() {
     'type' => MENU_LOCAL_TASK,
   ];
 
-  $items['admin/tripal_jbrowse_mgmt/instances/add'] = [
+  $items['admin/tripal/extension/tripal_jbrowse/management/instances/add'] = [
     'title' => 'Add New Instance',
     'description' => 'List and create JBrowse instances.',
     'page callback' => 'drupal_get_form',
@@ -50,54 +46,54 @@ function tripal_jbrowse_mgmt_menu() {
     'type' => MENU_LOCAL_ACTION,
   ];
 
-  $items['admin/tripal_jbrowse_mgmt/instances/%'] = [
+  $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' => [3],
+    'page arguments' => [6],
     'access arguments' => ['administer tripal_jbrowse_mgmt'],
     'file' => 'includes/tripal_jbrowse_mgmt_instance.page.inc',
     'type' => MENU_CALLBACK,
   ];
 
-  $items['admin/tripal_jbrowse_mgmt/instances/%/delete'] = [
+  $items['admin/tripal/extension/tripal_jbrowse/management/instances/%/delete'] = [
     'title' => 'Delete an instance',
     'description' => 'Confirm deleting an instance.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => ['tripal_jbrowse_mgmt_delete_instance_form', 3],
+    '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_jbrowse_mgmt/instances/%/add_track'] = [
+  $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', 3],
+    '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_jbrowse_mgmt/tracks/%'] = [
+  $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', 3],
+    '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_jbrowse_mgmt/tracks/%/delete'] = [
-      'title' => 'Delete Track',
-      'page callback' => 'drupal_get_form',
-      'page arguments' => ['tripal_jbrowse_mgmt_delete_track_form', 3],
-      '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/%/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,
+  ];
 
   return $items;
 }