Browse Source

Fixed merge conflict

Stephen Ficklin 11 years ago
parent
commit
c5a0ad9b98

+ 20 - 0
tripal_cv/api/tripal_cv.schema.api.inc

@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Implements hook_chado_schema_v1_2_tripal_obo_temp()
+ * Purpose: To describe the structure of 'tripal_obo_temp' to tripal
+ * @see tripal_core_chado_insert()
+ * @see tripal_core_chado_update()
+ * @see tripal_core_chado_select()
+ *
+ * @return
+ *    An array describing the 'tripal_obo_temp' table
+ *
+ * @ingroup tripal_chado_v1.2_schema_api
+ *
+ */
+function tripal_cv_chado_schema_v1_2_tripal_obo_temp() {
+  $schema = tripal_cv_get_custom_tables('tripal_obo_temp');
+  $description = $schema['tripal_obo_temp'];
+  return $description;
+}

+ 2 - 0
tripal_cv/tripal_cv.module

@@ -11,6 +11,8 @@ require_once "includes/cvtermpath_form.inc";
 
 require_once "includes/tripal_cv_admin.inc";
 
+require_once "api/tripal_cv.schema.api.inc";
+
 /**
  * @defgroup tripal_cv CV Module
  * @ingroup tripal_modules

+ 1 - 0
tripal_library/tripal_library.views_default.inc

@@ -178,6 +178,7 @@ function tripal_library_admin_defaultviews_library() {
   $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
   $handler->display->display_options['filters']['type_id']['table'] = 'library';
   $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['value'] = 'All';
   $handler->display->display_options['filters']['type_id']['group'] = '0';
   $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
   $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';

+ 8 - 8
tripal_organism/tripal_organism.module

@@ -217,14 +217,14 @@ function tripal_organism_node_presave($node) {
  */
 function tripal_organism_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-    case 'chado_organism':
-      // Show feature browser and counts
-      if ($view_mode == 'full') {
-        $node->content['tripal_organism_base'] = array(
-          '#value' => theme('tripal_organism_base', array('node' => $node)),
-        );
-      }
-      if ($view_mode == 'teaser') {
+  	case 'chado_organism':
+  	  // Show feature browser and counts
+  	  if ($view_mode == 'full') {
+  	    $node->content['tripal_organism_base'] = array(
+  	      '#value' => theme('tripal_organism_base', array('node' => $node)),
+  	    );
+  	  }
+  	  if ($view_mode == 'teaser') {
         $node->content['tripal_organism_teaser'] = array(
           '#value' => theme('tripal_organism_teaser', array('node' => $node)),
         );

+ 36 - 32
tripal_pub/includes/pub_importers.inc

@@ -25,24 +25,28 @@ function tripal_pub_importers_list() {
     }
 
     $rows[] = array(
-      l(t('Edit/Test'), "admin/tripal/tripal_pub/import/edit/$importer->pub_import_id"),
+      l(t('Edit/Test'), "admin/tripal/chado/tripal_pub/import/edit/$importer->pub_import_id"),
       $importer->name,
       $criteria['remote_db'],
       $criteria_str,
       $importer->disabled ? 'Yes' : 'No',
       $importer->do_contact ? 'Yes' : 'No',
-      l(t('Delete'), "admin/tripal/tripal_pub/import/delete/$importer->pub_import_id"),
+      l(t('Delete'), "admin/tripal/chado/tripal_pub/import/delete/$importer->pub_import_id"),
     );
   }
 
   $rows[] = array(
     'data' => array(
-     array('data' => l(t('Create a new publication importer.'), "admin/tripal/tripal_pub/import/new"),
+     array('data' => l(t('Create a new publication importer.'), "admin/tripal/chado/tripal_pub/import/new"),
         'colspan' => 7),
      )
   );
 
-  $page = theme('table', $header, $rows);
+  $page = "<ul class='action-links'>";
+  $page .= '<li>' . l('New Importer', 'admin/tripal/chado/tripal_pub/import/new') . '</li>';
+  $page .= '</ul>';
+
+  $page .= theme('table', array('header' => $header, 'rows' => $rows));
   return $page;
 }
 
@@ -54,7 +58,7 @@ function tripal_pub_importer_setup($action = 'new', $pub_import_id = NULL) {
 
   $pager_id = 0;
   $limit = 20;
-  
+
   // make sure the tripal_pub and tripal_contact ontologies are loaded
   $values = array('name' => 'tripal_pub');
   $tpub_cv = tripal_core_chado_select('cv', array('cv_id'), $values);
@@ -70,7 +74,7 @@ function tripal_pub_importer_setup($action = 'new', $pub_import_id = NULL) {
   // generate the search form
   $form = drupal_get_form('tripal_pub_importer_setup_form',  $pub_import_id, $action);
 
-  $output = l("Return to publication importers list", "admin/tripal/tripal_pub/import_list");
+  $output = l("Return to publication importers list", "admin/tripal/chado/tripal_pub/import_list");
   $output .= $form;
 
   // retrieve any results
@@ -109,7 +113,7 @@ function tripal_pub_importer_setup($action = 'new', $pub_import_id = NULL) {
         $citation = htmlspecialchars($pub['Citation']);
         $raw_link = '';
         if($pub['Publication Dbxref']) {
-          $raw_link = l('raw', 'admin/tripal/tripal_pub/import/raw/' . $pub['Publication Dbxref'], array('attributes' => array('target' => '_blank')));
+          $raw_link = l('raw', 'admin/tripal/chado/tripal_pub/import/raw/' . $pub['Publication Dbxref'], array('attributes' => array('target' => '_blank')));
         }
         $rows[] = array(
         number_format($i),
@@ -120,12 +124,12 @@ function tripal_pub_importer_setup($action = 'new', $pub_import_id = NULL) {
       }
     }
     $headers = array('', 'Publication', '');
-    $table = theme('table', $headers, $rows);
+    $table = theme('table', array('header' => $headers, 'rows' => $rows));
 
     // join all to form the results
     $output .= "<br><p><b>Found " . number_format($total_items) .
       ". Page " . ($page + 1) . " of $total_pages. " .
-      " Results</b></br>" . $table . '</p>' . $pager;    
+      " Results</b></br>" . $table . '</p>' . $pager;
   }
   return $output;
 }
@@ -155,7 +159,7 @@ function theme_tripal_pub_importer_setup_form($form) {
   $markup .= '</div>';
   $markup .= '<div id="pub-search-form-row2">' . drupal_render($form['disabled']) . '</div>';
   $markup .= '<div id="pub-search-form-row3">' . drupal_render($form['do_contact']) . '</div>';
-  $markup .= theme('table', $headers, $rows, array('id' => 'tripal-pub-importer-table'));
+  $markup .= theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => 'tripal-pub-importer-table')));
 
   $form['criteria'] = array(
     '#type' => 'markup',
@@ -171,7 +175,7 @@ function theme_tripal_pub_importer_setup_form($form) {
  */
 function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NULL, $action = 'new') {
   tripal_core_ahah_init_form();
-   
+
   // Set the default values. If the pub_import_id isn't already defined by the form values
   // and one is provided then look it up in the database
   $criteria = NULL;
@@ -214,7 +218,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
     unset($_SESSION['tripal_pub_import']);
   }
 
-   
+
   // change the number of criteria based on form_state post data.
   if (!$num_criteria) {
     $num_criteria = 1;
@@ -264,7 +268,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
     '#options' => $remote_dbs,
     '#default_value' => $remote_db,
     '#ahah' => array(
-      'path'    => "admin/tripal/tripal_pub/import/changedb",
+      'path'    => "admin/tripal/chado/tripal_pub/import/changedb",
       'wrapper' => 'tripal-pub-importer-setup-form',
       'event'   => 'click',
       'method'  => 'replace',
@@ -296,7 +300,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
   $form['do_contact'] = array(
     '#type'          => 'checkbox',
     '#title'         => t('Create Contact'),
-    '#description'   => t('Check to create an entry in the contact table for each author of a matching publication during import. This allows storage of 
+    '#description'   => t('Check to create an entry in the contact table for each author of a matching publication during import. This allows storage of
        additional information such as affilation, etc. Otherwise, only authors names are retrieved.'),
     '#default_value' => $do_contact,
   );
@@ -304,7 +308,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
   // choices array
   $scope_choices = array(
     'any'      => 'Any Field',
-    'abstract' => 'Abstract',  
+    'abstract' => 'Abstract',
     'author'   => 'Author',
     'id'       => 'Accession',
     'title'    => 'Title',
@@ -335,7 +339,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
       $scope        = isset($_SESSION['tripal_pub_import']['criteria'][$i]['scope'])        ? $_SESSION['tripal_pub_import']['criteria'][$i]['scope']        : $scope;
       $is_phrase    = isset($_SESSION['tripal_pub_import']['criteria'][$i]['is_phrase'])    ? $_SESSION['tripal_pub_import']['criteria'][$i]['is_phrase']    : $is_phrase;
       $operation    = isset($_SESSION['tripal_pub_import']['criteria'][$i]['operation'])    ? $_SESSION['tripal_pub_import']['criteria'][$i]['operation']    : $operation;
-      
+
       // If the form_state has variables then use those.  This happens when an error occurs on the form or the
       // form is resbumitted using AJAX
       if ($form_state['values']) {
@@ -347,8 +351,8 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
 
       $form['criteria'][$i]["search_terms-$i"] = array(
         '#type'          => 'textfield',
-        '#description'   => t('Please provide a list of words for searching. You may use 
-          conjunctions such as "AND" or "OR" to separate words if they are expected in 
+        '#description'   => t('Please provide a list of words for searching. You may use
+          conjunctions such as "AND" or "OR" to separate words if they are expected in
           the same scope, but do not mix ANDs and ORs.  Uncheck the "Is Phrase" checkbox to use conjunctions'),
         '#default_value' => $search_terms,
         '#required'      => TRUE,
@@ -362,7 +366,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
       );
       $form['criteria'][$i]["is_phrase-$i"] = array(
         '#type'    => 'checkbox',
-        '#title'   => t('Is Phrase?'),    
+        '#title'   => t('Is Phrase?'),
         '#default_value' => $is_phrase,
       );
 
@@ -388,7 +392,7 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
           '#value'        => t('Remove'),
           '#src'          => drupal_get_path('theme', 'tripal') . '/images/minus.png',
           '#ahah' => array(
-            'path'    => "admin/tripal/tripal_pub/import/criteria/minus/$i",
+            'path'    => "admin/tripal/chado/tripal_pub/import/criteria/minus/$i",
             'wrapper' => 'tripal-pub-importer-setup-form',
             'event'   => 'click',
             'method'  => 'replace',
@@ -397,14 +401,14 @@ function tripal_pub_importer_setup_form(&$form_state = NULL, $pub_import_id = NU
           );
         }
         $form['criteria'][$i]["add-$i"] = array(
-        '#type'         => 'image_button',      
+        '#type'         => 'image_button',
         '#value'        => t('Add'),
         '#src'          => drupal_get_path('theme', 'tripal') . '/images/add.png',
         '#ahah' => array(
-          'path'    => "admin/tripal/tripal_pub/import/criteria/add/$i",
+          'path'    => "admin/tripal/chado/tripal_pub/import/criteria/add/$i",
           'wrapper' => 'tripal-pub-importer-setup-form',
           'event'   => 'click',
-          'method'  => 'replace',          
+          'method'  => 'replace',
         ),
         '#attributes' => array('onClick' => 'return false;'),
         );
@@ -452,11 +456,11 @@ function tripal_pub_importer_setup_form_validate($form, &$form_state) {
     $scope =  $form_state['values']["scope-$i"];
     $is_phrase =  $form_state['values']["is_phrase-$i"];
     $operation =  $form_state['values']["operation-$i"];
-    
+
     if (!$is_phrase) {
     	if (preg_match('/and/i', $search_terms) and preg_match('/or/i', $search_terms)) {
     	  form_set_error("search_terms-$i", "You may use 'AND' or 'OR' but cannot use both. Add a new entry below with the same scope for the other conunction.");
-    	  $_SESSION['tripal_pub_import']['perform_search'] = 0;	
+    	  $_SESSION['tripal_pub_import']['perform_search'] = 0;
     	}
     }
   }
@@ -474,7 +478,7 @@ function tripal_pub_importer_setup_form_validate($form, &$form_state) {
  *
  */
 function tripal_pub_importer_setup_form_submit($form, &$form_state) {
-   
+
   $pub_import_id = $form_state['values']['pub_import_id'];
   $num_criteria = $form_state['values']['num_criteria'];
   $remote_db =  $form_state['values']["remote_db"];
@@ -528,7 +532,7 @@ function tripal_pub_importer_setup_form_submit($form, &$form_state) {
       if(drupal_write_record('tripal_pub_import', $record, 'pub_import_id')){
         unset($_SESSION['tripal_pub_import']);
         drupal_set_message('Publication import settings updated.');
-        drupal_goto('admin/tripal/tripal_pub/import_list');
+        drupal_goto('admin/tripal/chado/tripal_pub/import_list');
       }
       else {
         drupal_set_message('Could not update publication import settings.', 'error');
@@ -544,7 +548,7 @@ function tripal_pub_importer_setup_form_submit($form, &$form_state) {
         if ($form_state['values']['op'] == 'Save & Import Now') {
           tripal_pub_import_publications($record['pub_import_id']);
         }
-        drupal_goto('admin/tripal/tripal_pub/import_list');
+        drupal_goto('admin/tripal/chado/tripal_pub/import_list');
       }
       else {
         drupal_set_message('Could not save publication import settings.', 'error');
@@ -556,7 +560,7 @@ function tripal_pub_importer_setup_form_submit($form, &$form_state) {
     $success = db_query($sql, array(':pub_import_id' => $pub_import_id));
     if ($success) {
       drupal_set_message('Publication importer deleted.');
-      drupal_goto('admin/tripal/tripal_pub/import_list');
+      drupal_goto('admin/tripal/chado/tripal_pub/import_list');
     }
     else {
       drupal_set_message('Could not delete publication importer.', 'error');
@@ -572,7 +576,7 @@ function tripal_pub_importer_delete($pub_import_id) {
   $success = db_query($sql, array(':pub_import_id' => $pub_import_id));
   if ($success) {
     drupal_set_message('Publication importer deleted.');
-    drupal_goto('admin/tripal/tripal_pub/import_list');
+    drupal_goto('admin/tripal/chado/tripal_pub/import_list');
   }
   else {
     drupal_set_message('Could not delete publication importer.', 'error');
@@ -595,7 +599,7 @@ function tripal_pub_importer_setup_page_update_remotedb() {
   // return the updated JSON
   drupal_json(
   array(
-      'status'   => $status, 
+      'status'   => $status,
       'data'     => $data,
       'settings' => $settings,
   )
@@ -618,7 +622,7 @@ function tripal_pub_importer_setup_page_update_criteria($action, $i) {
   // return the updated JSON
   drupal_json(
   array(
-      'status'   => $status, 
+      'status'   => $status,
       'data'     => $data,
       'settings' => $settings,
   )

+ 49 - 15
tripal_pub/includes/tripal_pub.admin.inc

@@ -1,5 +1,39 @@
 <?php
 
+/**
+ *
+ */
+function tripal_pub_admin_pub_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('Publications', 'admin/tripal/chado/tripal_pub');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_pub_admin_publications','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Publications 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('Publications View', 'admin/tripal/chado/tripal_pub/views/pubs/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+
 /**
  * Administrative settings form
  *
@@ -37,7 +71,7 @@ function tripal_pub_admin() {
 }
 
 /**
- * 
+ *
  * @param $form
  */
 function get_tripal_pub_admin_form_default_type(&$form) {
@@ -46,15 +80,15 @@ function get_tripal_pub_admin_form_default_type(&$form) {
   // ontologies these are all grouped under the term 'Publication Type'
   // we want the default to be 'Journal Article'
   $sql = "
-    SELECT 
+    SELECT
       CVTS.cvterm_id, CVTS.name
     FROM {cvtermpath} CVTP
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id  = CVTO.cvterm_id
       INNER JOIN {cv}          ON CVTO.cv_id      = CV.cv_id
-    WHERE CV.name = 'tripal_pub' AND CVTO.name = 'Publication Type' AND 
+    WHERE CV.name = 'tripal_pub' AND CVTO.name = 'Publication Type' AND
       NOT CVTS.is_obsolete = 1
-    ORDER BY CVTS.name ASC 
+    ORDER BY CVTS.name ASC
   ";
   $results = chado_query($sql);
   $pub_types = array();
@@ -64,10 +98,10 @@ function get_tripal_pub_admin_form_default_type(&$form) {
       $d_type_id = $pub_type->cvterm_id;
     }
   }
-  
+
   // override the default by using the stored variable
   $d_type_id = variable_get('tripal_pub_default_type', $d_type_id);
-  
+
   $form['default_type'] = array(
     '#type' => 'fieldset',
     '#title' => t('Default Publication Type'),
@@ -92,14 +126,14 @@ function get_tripal_pub_admin_form_importing_set(&$form) {
     '#title' => t('Import Settings')
   );
   $form['import']['import_duplicate_check'] = array(
-    '#type' => 'radios', 
-    '#title' => t('Unique Constraint'),     
+    '#type' => 'radios',
+    '#title' => t('Unique Constraint'),
     '#options' => array(
-      'title_year' => t('Title and Year'), 
-      'title_year_media' => t('Title, Year, Media name (e.g. Journal Name, etc.)'), 
+      'title_year' => t('Title and Year'),
+      'title_year_media' => t('Title, Year, Media name (e.g. Journal Name, etc.)'),
       'title_year_type' => t('Title, Year, Media type (e.g. Journal, Conference Proceedings, etc.'),
     ),
-    '#description' => t('During import, Tripal will attempt to find duplicate publications. 
+    '#description' => t('During import, Tripal will attempt to find duplicate publications.
        There are several options for how to find a duplicate publication.  Choose the
        option that best suits your needs.'),
     '#default_value' => variable_get('tripal_pub_import_duplicate_check', 'title_year_media'),
@@ -151,10 +185,10 @@ function get_tripal_pub_admin_form_select_search_list(&$form) {
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and 
-      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
+    WHERE CV.name = 'tripal_pub' and
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and
       NOT CVTS.is_obsolete = 1
-    ORDER BY CVTS.name ASC 
+    ORDER BY CVTS.name ASC
   ";
   $prop_types = chado_query($sql);
   while ($prop = $prop_types->fetchObject()) {
@@ -189,7 +223,7 @@ function tripal_pub_admin_validate($form, &$form_state) {
 
   $import_duplicate_check = $form_state['values']['import_duplicate_check'];
   variable_set('tripal_pub_import_duplicate_check', $import_duplicate_check);
-  
+
   $default_type = $form_state['values']['type_id'];
   variable_set('tripal_pub_default_type', $default_type);
 

+ 0 - 0
tripal_pub/theme/tripal_pub_admin.tpl.php → tripal_pub/theme/tripal_pub_help.tpl.php


+ 88 - 62
tripal_pub/tripal_pub.module

@@ -75,113 +75,124 @@ function tripal_pub_menu() {
   $items['find/publications/criteria/%/%'] = array(
     'page callback' => 'tripal_pub_search_page_update_criteria',
     'page arguments' => array(5, 6),
-    'access arguments' => array('access chado_pub content'),    
+    'access arguments' => array('access chado_pub content'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub']= array(
+  $items['admin/tripal/chado/tripal_pub']= array(
     'title' => 'Publications',
+    'description' => ('A documented provenance artefact - publications, documents, personal communication.'),
+    'page callback' => 'tripal_pub_admin_pub_view',
+    'access arguments' => array('administer tripal pubs'),
+    'type' => MENU_NORMAL_ITEM
+  );
+
+  $items['admin/tripal/chado/tripal_pub/help']= array(
+    'title' => 'Help',
     'description' => ('A module for interfacing the GMOD chado database with Drupal, providing viewing of publications'),
     'page callback' => 'theme',
     'page arguments' => array('tripal_pub_help'),
     'access arguments' => array('administer tripal pubs'),
-    'type' => MENU_NORMAL_ITEM
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10
   );
 
-  $items['admin/tripal/tripal_pub/configuration'] = array(
-    'title' => 'Configuration',
+  $items['admin/tripal/chado/tripal_pub/configuration'] = array(
+    'title' => 'Settings',
     'description' => 'Configure the Tripal publication module.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_pub_help'),
+    'page arguments' => array('tripal_pub_admin'),
     'access arguments' => array('administer tripal pubs'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 5
   );
 
-  $items['admin/tripal/tripal_pub/sync'] = array(
-    'title' => ' Sync Publications',
+  $items['admin/tripal/chado/tripal_pub/sync'] = array(
+    'title' => ' Sync',
     'description' => 'Sync publications in Chado with Drupal',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_pub_sync_form'),
     'access arguments' => array('administer tripal pubs'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2
   );
 
-
-  $items['admin/tripal/tripal_pub/import_list'] = array(
-    'title' => t('Importers List'),
+  $items['admin/tripal/chado/tripal_pub/import_list'] = array(
+    'title' => t('Importers'),
     'description' => t('List all publication importers'),
     'page callback' => 'tripal_pub_importers_list',
     'access arguments' => array('administer tripal pubs'),
-    'type ' => MENU_CALLBACK,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 0
   );
 
-  $items['admin/tripal/tripal_pub/import/new'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/new'] = array(
     'title' => t('Add an Importer'),
     'description' => t('Add a new publication importer.'),
     'page callback' => 'tripal_pub_importer_setup',
-    'page arguments' => array(4, NULL),
+    'page arguments' => array(5, NULL),
     'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub/import/raw/%'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/raw/%'] = array(
     'page callback' => 'tripal_pub_get_raw_data',
     'page arguments' => array(5),
     'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub/import/edit/%'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/edit/%'] = array(
     'page callback' => 'tripal_pub_importer_setup',
     'page arguments' => array(4, 5),
     'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub/import/delete/%'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/delete/%'] = array(
     'page callback' => 'tripal_pub_importer_delete',
     'page arguments' => array(5),
     'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
-  $items['admin/tripal/tripal_pub/import/changedb'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/changedb'] = array(
     'page callback' => 'tripal_pub_importer_setup_page_update_remotedb',
     'page arguments' => array(),
-    'access arguments' => array('administer tripal pubs'),    
+    'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub/import/criteria/%/%'] = array(
+  $items['admin/tripal/chado/tripal_pub/import/criteria/%/%'] = array(
     'page callback' => 'tripal_pub_importer_setup_page_update_criteria',
     'page arguments' => array(5, 6),
-    'access arguments' => array('administer tripal pubs'),    
+    'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['tripal_pub/properties/add'] = array(
+  $items['tripal_pub/chado/properties/add'] = array(
     'page callback' => 'tripal_pub_property_add',
     'access arguments' => array('edit chado_pub content'),
     'type ' => MENU_CALLBACK,
   );
-  $items['tripal_pub/properties/description'] = array(
+  $items['tripal_pub/chado/properties/description'] = array(
     'page callback' => 'tripal_pub_property_get_description',
     'access arguments' => array('edit chado_pub content'),
     'type ' => MENU_CALLBACK,
   );
-  $items['tripal_pub/properties/minus/%/%'] = array(
+  $items['tripal_pub/chado/properties/minus/%/%'] = array(
     'page callback' => 'tripal_pub_property_delete',
     'page arguments' => array(3, 4),
     'access arguments' => array('edit chado_pub content'),
     'type ' => MENU_CALLBACK,
   );
 
-  $items['admin/tripal/tripal_pub/citation'] = array(
+  $items['admin/tripal/chado/tripal_pub/citation'] = array(
       'title' => ' Create Citations',
       'description' => 'Create citations in Chado with Drupal',
       'page callback' => 'drupal_get_form',
       'page arguments' => array('tripal_pub_citation_form'),
       'access arguments' => array('administer tripal pubs'),
-      'type' => MENU_NORMAL_ITEM,
+      'type' => MENU_CALLBACK,
   );
 
   return $items;
@@ -253,9 +264,9 @@ function tripal_pub_theme() {
 
     // instructions page for the pub module
     'tripal_pub_help' => array(
-      'template' => 'tripal_pub_help',  
-      'arguments' =>  array(NULL),  
-      'path' => $theme_path, 
+      'template' => 'tripal_pub_help',
+      'arguments' =>  array(NULL),
+      'path' => $theme_path,
     ),
 
     // themed forms
@@ -282,6 +293,21 @@ function tripal_pub_help ($path, $arg) {
     return theme('tripal_pub_help', array());
   }
 }
+
+/**
+ * Implements hook_views_api()
+ * Purpose: Essentially this hook tells drupal that there is views support for
+ *  for this module which then includes tripal_db.views.inc where all the
+ *  views integration code is
+ *
+ * @ingroup tripal_pub
+ */
+function tripal_pub_views_api() {
+  return array(
+    'api' => 3.0,
+  );
+}
+
 /**
  * Implement hook_permissions().
  */
@@ -315,7 +341,7 @@ function tripal_pub_permissions() {
  * Implement hook_access().
  *
  * This hook allows node modules to limit access to the node types they define.
- * 
+ *
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
@@ -329,7 +355,7 @@ function tripal_pub_permissions() {
  *  @return
  *  If the permission for the specified operation is not set then return FALSE. If the
  *  permission is set then return NULL as this allows other modules to disable
- *  access.  The only exception is when the $op == 'create'.  We will always 
+ *  access.  The only exception is when the $op == 'create'.  We will always
  *  return TRUE if the permission is set.
  *
  */
@@ -379,7 +405,7 @@ function chado_pub_insert($node) {
 	// we need an array suitable for the tripal_pub_create_citation() function
 	// to automatically generate a citation if a uniquename doesn't already exist
 	$pub_arr = array();
-	
+
   // if a pub_id already exists for this node then it already exists in Chado and
   // we get here because we are syncing the node.  Therefore, we can skip the insert
   // but we always want to set the URL path alias to be the Chado pub ID
@@ -398,9 +424,9 @@ function chado_pub_insert($node) {
         INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
         INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
         INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-      WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Details' and 
+      WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Details' and
         NOT CVTS.is_obsolete = 1
-      ORDER BY CVTS.name ASC 
+      ORDER BY CVTS.name ASC
     ";
     $prop_types = chado_query($sql);
     while ($prop = $prop_types->fetchObject()) {
@@ -434,12 +460,12 @@ function chado_pub_insert($node) {
 
     // iterate through all of the properties and remove those that really are
     // part of the pub table fields
-    foreach ($properties as $name => $element) {    	    
+    foreach ($properties as $name => $element) {
       $value = trim($element[0]);
-      
+
     	// populate our $pub_array for building a citation
     	$pub_arr[$name] = $value;
-    	
+
       // remove properties that are stored in the pub table
       if ($name == "Volume") {
         $volume = $value;
@@ -475,7 +501,7 @@ function chado_pub_insert($node) {
         $cross_refs[] = $value;
       }
     }
-    // generate a citation for this pub if one doesn't already exist 
+    // generate a citation for this pub if one doesn't already exist
     if (!$node->uniquename and array_key_exists('Citation', $properties)) {
     	$pub_type = tripal_cv_get_cvterm_by_id($node->type_id);
     	$pub_arr['Title'] = $node->pubtitle;
@@ -484,20 +510,20 @@ function chado_pub_insert($node) {
       $node->uniquename = tripal_pub_create_citation($pub_arr);
       $properties['Citation'][0] = $node->uniquename;
     }
-    
+
     // insert the pub record
     $values = array(
       'title'       => trim($node->pubtitle),
       'series_name' => substr(trim($node->series_name), 0, 255),
       'type_id'     => trim($node->type_id),
       'pyear'       => trim($node->pyear),
-      'is_obsolete' => $node->is_obsolete ? 'true' : 'false', 
+      'is_obsolete' => $node->is_obsolete ? 'true' : 'false',
       'uniquename'  => trim($node->uniquename),
       'volumetitle' => $volumetitle,
-      'volume'      => $volume,    
-      'issue'       => $issue,    
+      'volume'      => $volume,
+      'issue'       => $issue,
       'pages'       => $pages,
-      'miniref'     => substr($miniref, 0, 255),        
+      'miniref'     => substr($miniref, 0, 255),
       'publisher'   => substr($publisher, 0, 255),
       'pubplace'    => substr($pubplace, 0, 255),
     );
@@ -511,7 +537,7 @@ function chado_pub_insert($node) {
     // now add in the properties
     foreach ($properties as $property => $elements) {
       foreach ($elements as $rank => $value) {
-         
+
         $status = tripal_pub_insert_property($pub['pub_id'], $property, $value, FALSE);
         if (!$status) {
           drupal_set_message("Error cannot add property: $property", "error");
@@ -568,7 +594,7 @@ function chado_pub_update($node) {
     // there is no way to handle revisions in Chado but leave
     // this here just to make not we've addressed it.
   }
-  
+
   // we need an array suitable for the tripal_pub_create_citation() function
   // to automatically generate a citation if a uniquename doesn't already exist
   $pub_arr = array();
@@ -578,7 +604,7 @@ function chado_pub_update($node) {
 
   $properties = array(); // stores all of the properties we need to add
   $cross_refs = array(); // stores any cross references for this publication
-   
+
   // get the list of properties for easy lookup (without doing lots of database queries
   $properties_list = array();
   $sql = "
@@ -587,10 +613,10 @@ function chado_pub_update($node) {
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and 
-      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
+    WHERE CV.name = 'tripal_pub' and
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and
       NOT CVTS.is_obsolete = 1
-    ORDER BY CVTS.name ASC 
+    ORDER BY CVTS.name ASC
   ";
   $prop_types = chado_query($sql);
   while ($prop = $prop_types->fetchObject()) {
@@ -635,7 +661,7 @@ function chado_pub_update($node) {
     foreach ($element as $index => $value) {
     	// populate our $pub_array for building a citation
       $pub_arr[$name] = $value;
-      
+
       // remove properties that are stored in the pub table
       if ($name == "Volume") {
         $volume = $value;
@@ -672,7 +698,7 @@ function chado_pub_update($node) {
       }
     }
   }
-  // generate a citation for this pub if one doesn't already exist 
+  // generate a citation for this pub if one doesn't already exist
   if (!$node->uniquename) {
     $pub_type = tripal_cv_get_cvterm_by_id($node->type_id);
     $pub_arr['Title'] = $node->pubtitle;
@@ -690,14 +716,14 @@ function chado_pub_update($node) {
     'title'       => trim($node->pubtitle),
     'type_id'     => trim($node->type_id),
     'pyear'       => trim($node->pyear),
-    'is_obsolete' => $node->is_obsolete ? 'true' : 'false', 
+    'is_obsolete' => $node->is_obsolete ? 'true' : 'false',
     'uniquename'  => trim($node->uniquename),
     'series_name' => trim($node->series_name),
     'volumetitle' => $volumetitle,
-    'volume'      => $volume,    
-    'issue'       => $issue,    
+    'volume'      => $volume,
+    'issue'       => $issue,
     'pages'       => $pages,
-    'miniref'     => $miniref,        
+    'miniref'     => $miniref,
     'publisher'   => $publisher,
     'pubplace'    => $pubplace,
   );
@@ -815,10 +841,10 @@ function tripal_pub_form_alter(&$form, &$form_state, $form_id) {
     // the form to the ahah callback URL. We need to set it back
     // to the normal form URL
     if ($form_state['values']['action'] == 'edit') {
-      $form['#action'] = url("admin/tripal/tripal_pub/import/edit/" . $form_state['values']['pub_import_id']);
+      $form['#action'] = url("admin/tripal/chado/tripal_pub/import/edit/" . $form_state['values']['pub_import_id']);
     }
     if ($form_state['values']['action'] == 'new') {
-      $form['#action'] = url("admin/tripal/tripal_pub/import/new");
+      $form['#action'] = url("admin/tripal/chado/tripal_pub/import/new");
     }
   }
   if ($form_id == "tripal_pub_search_form") {
@@ -923,7 +949,7 @@ function tripal_pub_mail($key, &$message, $params) {
 }
 
 /**
- * 
+ *
  * @param $node
  */
 function tripal_pub_node_insert($node) {
@@ -939,7 +965,7 @@ function tripal_pub_node_insert($node) {
   }
 }
 /**
- * 
+ *
  * @param $node
  * @param $types
  */
@@ -968,7 +994,7 @@ function tripal_pub_node_update($node) {
   // node that will still work too (e.g. http://[base url]/node/[node id]
   // so the nodeapi function ensures that the URL path is set after insert or update
   // of the node and when the node is loaded if it hasn't yet been set.
-  if ($node->type == 'chado_pub') {  
+  if ($node->type == 'chado_pub') {
     $pub_id = chado_get_id_for_node('pub', $node->nid);
     tripal_pub_set_pub_url($node, $pub_id);
   }

+ 172 - 348
tripal_pub/tripal_pub.views_default.inc

@@ -7,368 +7,192 @@
 function tripal_pub_views_default_views() {
   $views = array();
 
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
-
   // Main default view
-  $view = new view;
-  $view->name = 'pub_listing';
-  $view->description = 'This view lists all pubs by default.';
-  $view->tag = 'chado default';
+  $view = tripal_pub_defaultview_admin_publications();
+  $views[$view->name] = $view;
+
+  return $views;
+}
+
+function tripal_pub_defaultview_admin_publications() {
+
+  $view = new view();
+  $view->name = 'tripal_pub_admin_publications';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
   $view->base_table = 'pub';
+  $view->human_name = 'Publication Admin';
   $view->core = 0;
-  $view->api_version = '2';
+  $view->api_version = '3.0';
   $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Defaults */
   $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->override_option('fields', array(
+  $handler->display->display_options['title'] = 'Publications';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'access chado_pub content';
+  $handler->display->display_options['cache']['type'] = 'none';
+  $handler->display->display_options['query']['type'] = 'views_query';
+  $handler->display->display_options['exposed_form']['type'] = 'basic';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['pager']['options']['offset'] = '0';
+  $handler->display->display_options['pager']['options']['id'] = '0';
+  $handler->display->display_options['pager']['options']['quantity'] = '9';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'title' => 'title',
+    'pyear' => 'pyear',
+    'type' => 'type',
+    'all_dbxref' => 'all_dbxref',
+    'all_properties' => 'all_properties',
+    'all_relationships' => 'all_relationships',
+  );
+  $handler->display->display_options['style_options']['default'] = '-1';
+  $handler->display->display_options['style_options']['info'] = array(
     'title' => array(
-      'label' => 'Title',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
-    ),
-    'pyear' => array(
-      'label' => 'Year',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'name',
-      'table' => 'pub',
-      'field' => 'pyear',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
     'type' => array(
-      'label' => 'Type',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'type',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
-  ));
-  $handler->override_option('sorts', array(
     'pyear' => array(
-      'order' => 'ASC',
-      'id' => 'year',
-      'table' => 'pub',
-      'field' => 'pyear',
-      'relationship' => 'none',
-    ),
-    'title' => array(
-      'order' => 'ASC',
-      'id' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
-    'type' => array(
-      'order' => 'ASC',
-      'id' => 'type',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'search_results' => array(
-      'operator' => '=',
-      'value' => '',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'search_results',
-      'table' => 'views',
-      'field' => 'search_results',
-      'relationship' => 'none',
-      'apply_button' => 'Show',
-      'no_results_text' => 'Click "Show" to see a list of all pubs matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all pubs will be listed.',
-    ),
-    'title' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'title_op',
-        'identifier' => 'pub_title',
-        'label' => 'Title',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'title',
-      'table' => 'pub',
-      'field' => 'title',
-      'relationship' => 'none',
-    ),
-    'type_id' => array(
-      'operator' => '=',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'type_id_op',
-        'identifier' => 'type_id',
-        'label' => 'Type',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'type_id',
-      'table' => 'pub',
-      'field' => 'type_id',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
-    ),
-    'year' => array(
-      'operator' => '=',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'name_op',
-        'identifier' => 'name',
-        'label' => 'Name Contains',
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'name',
-      'table' => 'pub',
-      'field' => 'name',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
+    'all_dbxref' => array(
+      'separator' => '',
     ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_pub content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Publications');
-  $handler->override_option('header', 'Click "Show" to see a list of all publications matching the entered criteria. If you leave a any of the criteria blank then the pubs will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all publications will be listed.');
-  $handler->override_option('header_format', '2');
-  $handler->override_option('header_empty', 0);
-  $handler->override_option('empty', 'No publications match the supplied criteria.');
-  $handler->override_option('empty_format', '1');
-  $handler->override_option('items_per_page', 50);
-  $handler->override_option('use_pager', '1');
-  $handler->override_option('style_plugin', 'table');
-  $handler->override_option('style_options', array(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'title' => 'title',
-      'pyear' => 'pyear',
-      'type' => 'type',
-      'all_dbxref' => 'all_dbxref',
-      'all_properties' => 'all_properties',
-      'all_relationships' => 'all_relationships',
+    'all_properties' => array(
+      'separator' => '',
     ),
-    'info' => array(
-      'title' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'type' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'pyear' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'all_dbxref' => array(
-        'separator' => '',
-      ),
-      'all_properties' => array(
-        'separator' => '',
-      ),
-      'all_relationships' => array(
-        'separator' => '',
-      ),
+    'all_relationships' => array(
+      'separator' => '',
     ),
-    'default' => '-1',
-  ));
-  $default_handler = $handler;
+  );
+  /* Header: Global: Action Links */
+  $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['table'] = 'views';
+  $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
+  $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
+  $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
+  $handler->display->display_options['header']['action_links_area']['link-1'] = array(
+    'label-1' => 'Add Publication',
+    'path-1' => 'node/add/tripal-pub',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => 'Add Citation',
+    'path-2' => 'admin/tripal/chado/tripal_pub/citation',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-3'] = array(
+    'label-3' => '',
+    'path-3' => '',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-4'] = array(
+    'label-4' => '',
+    'path-4' => '',
+  );
+  /* No results behavior: Global: Text area */
+  $handler->display->display_options['empty']['text']['id'] = 'area';
+  $handler->display->display_options['empty']['text']['table'] = 'views';
+  $handler->display->display_options['empty']['text']['field'] = 'area';
+  $handler->display->display_options['empty']['text']['content'] = 'No publications match the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '1';
+  /* Relationship: Pub: Pub => Node */
+  $handler->display->display_options['relationships']['pub_id']['id'] = 'pub_id';
+  $handler->display->display_options['relationships']['pub_id']['table'] = 'chado_pub';
+  $handler->display->display_options['relationships']['pub_id']['field'] = 'pub_id';
+  /* Field: Content: Nid */
+  $handler->display->display_options['fields']['nid']['id'] = 'nid';
+  $handler->display->display_options['fields']['nid']['table'] = 'node';
+  $handler->display->display_options['fields']['nid']['field'] = 'nid';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Pub: Title */
+  $handler->display->display_options['fields']['title']['id'] = 'title';
+  $handler->display->display_options['fields']['title']['table'] = 'pub';
+  $handler->display->display_options['fields']['title']['field'] = 'title';
+  /* Field: Chado Pub: Pyear */
+  $handler->display->display_options['fields']['pyear']['id'] = 'name';
+  $handler->display->display_options['fields']['pyear']['table'] = 'pub';
+  $handler->display->display_options['fields']['pyear']['field'] = 'pyear';
+  $handler->display->display_options['fields']['pyear']['label'] = 'Year';
+  /* Field: Chado Cvterm: Name */
+  $handler->display->display_options['fields']['type']['id'] = 'type';
+  $handler->display->display_options['fields']['type']['table'] = 'cvterm';
+  $handler->display->display_options['fields']['type']['field'] = 'name';
+  $handler->display->display_options['fields']['type']['label'] = 'Type';
+  /* Sort criterion: Chado Pub: Pyear */
+  $handler->display->display_options['sorts']['pyear']['id'] = 'year';
+  $handler->display->display_options['sorts']['pyear']['table'] = 'pub';
+  $handler->display->display_options['sorts']['pyear']['field'] = 'pyear';
+  /* Sort criterion: Chado Pub: Title */
+  $handler->display->display_options['sorts']['title']['id'] = 'title';
+  $handler->display->display_options['sorts']['title']['table'] = 'pub';
+  $handler->display->display_options['sorts']['title']['field'] = 'title';
+  /* Sort criterion: Chado Cvterm: Name */
+  $handler->display->display_options['sorts']['type']['id'] = 'type';
+  $handler->display->display_options['sorts']['type']['table'] = 'cvterm';
+  $handler->display->display_options['sorts']['type']['field'] = 'name';
+  /* Filter criterion: Chado Pub: Title */
+  $handler->display->display_options['filters']['title']['id'] = 'title';
+  $handler->display->display_options['filters']['title']['table'] = 'pub';
+  $handler->display->display_options['filters']['title']['field'] = 'title';
+  $handler->display->display_options['filters']['title']['operator'] = 'contains';
+  $handler->display->display_options['filters']['title']['group'] = '0';
+  $handler->display->display_options['filters']['title']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op';
+  $handler->display->display_options['filters']['title']['expose']['label'] = 'Title Contains';
+  $handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op';
+  $handler->display->display_options['filters']['title']['expose']['identifier'] = 'pub_title';
+  $handler->display->display_options['filters']['title']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Pub: Type Id */
+  $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['table'] = 'pub';
+  $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['value'] = 'All';
+  $handler->display->display_options['filters']['type_id']['group'] = '0';
+  $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
+  $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
+  $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
+  $handler->display->display_options['filters']['type_id']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+
+  /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/pubs');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Publications',
-    'description' => 'A published article, book, conference proceeding, etc.',
-    'weight' => '10',
-    'name' => 'navigation',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  // Add code specific to a local chado installation
-  // NOTE: Edit $handler above to $default_handler for the default display
-  if (tripal_core_chado_schema_exists()) {
-    // Add nid field
-    $fields = $view->get_items('field', 'default');
-    $new_fields = array(
-      'nid' => array(
-        'label' => 'Nid',
-        'alter' => array(
-          'alter_text' => 0,
-          'text' => '',
-          'make_link' => 0,
-          'path' => '',
-          'absolute' => 0,
-          'link_class' => '',
-          'alt' => '',
-          'rel' => '',
-          'prefix' => '',
-          'suffix' => '',
-          'target' => '',
-          'help' => '',
-          'trim' => 0,
-          'max_length' => '',
-          'word_boundary' => 1,
-          'ellipsis' => 1,
-          'html' => 0,
-          'strip_tags' => 0,
-        ),
-        'empty' => '',
-        'hide_empty' => 0,
-        'empty_zero' => 0,
-        'hide_alter_empty' => 1,
-        'link_to_node' => 0,
-        'exclude' => 1,
-        'id' => 'nid',
-        'table' => 'node',
-        'field' => 'nid',
-        'relationship' => 'none',
-      )
-    );
-    $fields = $new_fields + $fields;
-    // Change analysis.name to have a link to the node
-    $fields['name_2']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // Adds pub => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Publication to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_pub',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Only show records with published nodes
-    /**
-    $filters = $view->get_items('filter', 'default');
-    $filters['status'] = array(
-      'operator' => '=',
-      'value' => '1',
-      'group' => '0',
-      'exposed' => FALSE,
-      'expose' => array(
-        'operator' => FALSE,
-        'label' => '',
-      ),
-      'id' => 'status',
-      'table' => 'node',
-      'field' => 'status',
-      'relationship' => 'none',
-    );
-    $default_handler->override_option('filters', $filters);
-    */
-  }
-  $views[$view->name] = $view;
+  $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_pub/publications';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Publications';
+  $handler->display->display_options['menu']['description'] = 'A published article, book, conference proceeding, etc.';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $handler->display->display_options['menu']['context'] = 0;
+  $handler->display->display_options['menu']['context_only_inline'] = 0;
+  $handler->display->display_options['tab_options']['weight'] = '0';
 
-  return $views;
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
+  */
+
+  return $view;
 }