Browse Source

Analysis: Added default admin view

Lacey Sanderson 11 years ago
parent
commit
cdf5f88a10

+ 33 - 1
tripal_analysis/includes/tripal_analysis.admin.inc

@@ -5,6 +5,38 @@
  * Contains functions displaying administrative pages and forms
  */
 
+/**
+ *
+ */
+function tripal_analysis_admin_analysis_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado', 'admin/tripal/chado');
+  $breadcrumb[] = l('Analysis', 'admin/tripal/chado/tripal_analysis');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_analysis_admin_analyses','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Analysis module uses primarily views to provide an '
+      . 'administrative interface. Currently one or more views needed for this '
+      . 'administrative interface are disabled. <strong>Click each of the following links to '
+      . 'enable the pertinent views</strong>:</p>';
+    $output .= '<ul>';
+      $output .= '<li>'.l('Analysis View', 'admin/tripal/chado/tripal_analysis/views/analyses/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
 
 /**
  * Administration page callbacks for the Tripal Analysis module
@@ -53,7 +85,7 @@ function tripal_analysis_admin() {
     }
     $counter++;
   }
-  
+
   if($counter == 0) {
     $form['nothing'] = array(
       '#markup' => t('There are currently no settings to configure. However, analysis extension modules may add items here when they are installed.')

+ 19 - 15
tripal_analysis/tripal_analysis.module

@@ -56,11 +56,12 @@ function tripal_analysis_node_info() {
  * @ingroup tripal_analysis
  */
 function tripal_analysis_menu() {
-  
+
   // Tripal Analysis administrative settings
   $items['admin/tripal/chado/tripal_analysis'] = array(
     'title' => 'Analyses',
     'description' => 'A bioinformatics analysis producing features.',
+    'page callback' => 'tripal_analysis_admin_analysis_view',
     'access arguments' => array('administer tripal analyses'),
     'type' => MENU_NORMAL_ITEM,
   );
@@ -71,25 +72,28 @@ function tripal_analysis_menu() {
     'page callback' => 'theme',
     'page arguments' => array('tripal_analysis_help'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10,
   );
 
   $items['admin/tripal/chado/tripal_analysis/configuration'] = array(
-    'title' => 'Configuration',
+    'title' => 'Settings',
     'description' => 'Settings for the displays of analysis results.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_analysis_admin'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 5
   );
-  
+
   $items['admin/tripal/chado/tripal_analysis/sync'] = array(
-    'title' => 'Sync Analyses',
+    'title' => 'Sync',
     'description' => 'Sync Chado analyses with Drupal.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_analysis_sync_form'),
     'access arguments' => array('administer tripal analyses'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 0
   );
 
   return $items;
@@ -177,7 +181,7 @@ function tripal_analysis_theme($existing, $type, $theme, $path) {
     'chado_analysis_form' => array(
       'render element' => 'form',
     )
-    
+
   );
 
   return $items;
@@ -284,19 +288,19 @@ function chado_analysis_insert($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
-  
+
   // if there is an analysis_id in the $node object then this must be a sync so
   // we can skip adding the analysis as it is already there, although
   // we do need to proceed with the rest of the insert
   if (!property_exists($node,'analysis_id')) {
-    
+
     // Create a timestamp so we can insert it into the chado database
     $time  = $node->timeexecuted;
     $month = $time['month'];
     $day   = $time['day'];
     $year  = $time['year'];
     $timestamp = $month . '/' . $day . '/' . $year;
-    
+
     // insert and then get the newly inserted analysis record
     $values = array(
       'name'           => $node->analysisname,
@@ -321,10 +325,10 @@ function chado_analysis_insert($node) {
   else {
     $analysis_id = $node->analysis_id;
   }
-  
+
   // Make sure the entry for this analysis doesn't already exist in the
   // chado_analysis table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('analysis', $node->nid);  
+  $check_org_id = chado_get_id_for_node('analysis', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -435,7 +439,7 @@ function chado_analysis_update($node) {
   $node->sourcename = trim($node->sourcename);
   $node->sourceversion = trim($node->sourceversion);
   $node->sourceuri = trim($node->sourceuri);
-    
+
   if ($node->revision) {
     // TODO -- decide what to do about revisions
   }
@@ -586,7 +590,7 @@ function chado_analysis_load($nodes) {
     // build the analysis variable
     $values = array('analysis_id' => $analysis_id);
     $analysis = tripal_core_generate_chado_var('analysis', $values);
-    
+
 
     // add in the description field
     $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');

+ 0 - 19
tripal_analysis/tripal_analysis.views_default.inc

@@ -123,13 +123,6 @@ function tripal_analysis_defaultvalue_admin_analysis() {
   $handler->display->display_options['fields']['sourcename']['table'] = 'analysis';
   $handler->display->display_options['fields']['sourcename']['field'] = 'sourcename';
   $handler->display->display_options['fields']['sourcename']['label'] = 'Source';
-  /* Field: Chado Analysis: Timeexecuted */
-  $handler->display->display_options['fields']['timeexecuted']['id'] = 'timeexecuted';
-  $handler->display->display_options['fields']['timeexecuted']['table'] = 'analysis';
-  $handler->display->display_options['fields']['timeexecuted']['field'] = 'timeexecuted';
-  $handler->display->display_options['fields']['timeexecuted']['label'] = 'Time Executed';
-  $handler->display->display_options['fields']['timeexecuted']['date_format'] = 'custom';
-  $handler->display->display_options['fields']['timeexecuted']['custom_date_format'] = 'F j, Y';
   /* Field: Content: Delete link */
   $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
   $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
@@ -187,18 +180,6 @@ function tripal_analysis_defaultvalue_admin_analysis() {
   $handler->display->display_options['filters']['sourcename']['expose']['label'] = 'Source Contains';
   $handler->display->display_options['filters']['sourcename']['expose']['operator'] = 'sourcename_op';
   $handler->display->display_options['filters']['sourcename']['expose']['identifier'] = 'sourcename';
-  /* Filter criterion: Chado Analysis: Timeexecuted */
-  $handler->display->display_options['filters']['timeexecuted']['id'] = 'timeexecuted';
-  $handler->display->display_options['filters']['timeexecuted']['table'] = 'analysis';
-  $handler->display->display_options['filters']['timeexecuted']['field'] = 'timeexecuted';
-  $handler->display->display_options['filters']['timeexecuted']['operator'] = '>';
-  $handler->display->display_options['filters']['timeexecuted']['group'] = 1;
-  $handler->display->display_options['filters']['timeexecuted']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['timeexecuted']['expose']['operator_id'] = 'timeexecuted_op';
-  $handler->display->display_options['filters']['timeexecuted']['expose']['label'] = 'Time Executed';
-  $handler->display->display_options['filters']['timeexecuted']['expose']['use_operator'] = TRUE;
-  $handler->display->display_options['filters']['timeexecuted']['expose']['operator'] = 'timeexecuted_op';
-  $handler->display->display_options['filters']['timeexecuted']['expose']['identifier'] = 'timeexecuted';
 
   /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');