Quellcode durchsuchen

Pub: Added default admin View for new UI

Lacey Sanderson vor 11 Jahren
Ursprung
Commit
22a7afc520

+ 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


+ 82 - 56
tripal_pub/tripal_pub.module

@@ -75,39 +75,50 @@ 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' => 0
   );
 
 
-  $items['admin/tripal/tripal_pub/import_list'] = array(
+  $items['admin/tripal/chado/tripal_pub/import_list'] = array(
     'title' => t('Importers List'),
     'description' => t('List all publication importers'),
     'page callback' => 'tripal_pub_importers_list',
@@ -115,7 +126,7 @@ function tripal_pub_menu() {
     'type ' => MENU_CALLBACK,
   );
 
-  $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',
@@ -124,64 +135,64 @@ function tripal_pub_menu() {
     '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,
   );
@@ -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;
 }