Переглянути джерело

Library: Created admin default view

Lacey Sanderson 11 роки тому
батько
коміт
0d861e7b62

+ 59 - 30
tripal_library/includes/tripal_library.admin.inc

@@ -1,5 +1,34 @@
-<?php 
+<?php
+
+function tripal_library_admin_libraries_listing() {
+  $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('Libraries', 'admin/tripal/chado/tripal_library');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_library_admin_libraries','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Tripal Library 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('Library Admin', 'admin/tripal/chado/tripal_library/views/libraries/enable').'</li>';
+    $output .= '</ul>';
+  }
 
+  return $output;
+}
 
 /**
  * Administrative settings form
@@ -311,14 +340,14 @@ function tripal_library_add_taxonomy($node, $library_id) {
   // do this because Drupal 6 fails to do this globally for us and
   // the drupal_execute function below won't work
   module_load_include('inc', 'taxonomy', 'taxonomy.admin');
-    
+
    // add the vocabulary
   $vocab_form['values']['name'] = 'DNA Libraries';
   $vocab_form['values']['description'] = 'Allows for associating/searching of library features by library name';
   $vocab_form['values']['help'] = '';
   $vocab_form['values']['module'] = 'taxonomy';
   drupal_form_submit('taxonomy_form_vocabulary', $vocab_form);
-  return;   
+  return;
 
    // make sure this term doesn't already exist.  If it doesn't then add it
   if ($vid) {
@@ -428,10 +457,10 @@ function tripal_library_feature_set_taxonomy($library_id = NULL) {
   if ($library_id) {
     print "Finding features for library with ID: $library_id\n";
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
-      WHERE L.library_id = :library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
     ";
     $features = chado_query($sql, array(':library_id' => $library_id));
@@ -439,18 +468,18 @@ function tripal_library_feature_set_taxonomy($library_id = NULL) {
   else {
     print "Finding features for all libraries\n";
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
     ";
     $features = chado_query($sql);
   }
 
   $node_sql = "
-    SELECT * 
-    FROM {chado_feature} CF 
-      INNER JOIN {node} N ON CF.nid = N.nid 
+    SELECT *
+    FROM {chado_feature} CF
+      INNER JOIN {node} N ON CF.nid = N.nid
     WHERE feature_id = :feature_id
   ";
   // iterate through the features and add the taxonomy
@@ -474,19 +503,19 @@ function tripal_library_reindex_features($library_id = NULL, $job_id = NULL) {
   // with all libraries.
   if ($library_id) {
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
         INNER JOIN {library} L ON LF.library_id = L.library_id
-      WHERE L.library_id = :library_id 
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
     ";
     $results = chado_query($sql, array(':library_id' => $library_id));
   }
   else {
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
     ";
     $results = chado_query($sql);
@@ -521,19 +550,19 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
   // with all libraries.
   if ($library_id) {
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
-      WHERE L.library_id = :library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
+      WHERE L.library_id = :library_id
       ORDER BY LF.feature_id
     ";
     $results = chado_query($sql, array(':library_id' => $library_id));
   }
   else {
     $sql = "
-      SELECT LF.feature_id, L.library_id, L.name as libname 
-      FROM {library_feature} LF 
-        INNER JOIN {library} L ON LF.library_id = L.library_id 
+      SELECT LF.feature_id, L.library_id, L.name as libname
+      FROM {library_feature} LF
+        INNER JOIN {library} L ON LF.library_id = L.library_id
       ORDER BY LF.feature_id
     ";
     $results = chado_query($sql);
@@ -552,9 +581,9 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
 
   // use this SQL for getting the nodes
   $nsql =  "
-    SELECT * 
-    FROM {chado_feature} CF 
-      INNER JOIN {node} N ON N.nid = CF.nid 
+    SELECT *
+    FROM {chado_feature} CF
+      INNER JOIN {node} N ON N.nid = CF.nid
     WHERE feature_id = :feature_id
   ";
    // iterate through the features and set the taxonomy
@@ -584,6 +613,6 @@ function tripal_library_taxonify_features($library_id = NULL, $job_id = NULL) {
 function tripal_library_cleanup($dummy = NULL, $job_id = NULL) {
 
   return tripal_core_clean_orphaned_nodes('library', $job_id);
-  
+
 }
 

+ 20 - 9
tripal_library/tripal_library.module

@@ -119,22 +119,33 @@ function chado_library_node_access($node, $op, $account) {
 function tripal_library_menu() {
   $items = array();
   // The administative settings menu
-  $items['admin/tripal/tripal_library'] = array(
+  $items['admin/tripal/chado/tripal_library'] = array(
     'title' => 'Libraries',
+    'description' => 'A grouping of genetic data',
+    'page callback' => 'tripal_library_admin_libraries_listing',
+    'access arguments' => array('administer tripal libraries'),
+    'type' => MENU_NORMAL_ITEM,
+    'weight' => 0
+  );
+
+  $items['admin/tripal/chado/tripal_library/help'] = array(
+    'title' => 'Help',
     'description' => 'Basic Description of Tripal Library Module Functionality',
     'page callback' => 'theme',
-    'page arguments' => array('tripal_library_help'),
+    'page arguments' => array('tripal_library_admin'),
     'access arguments' => array('administer tripal libraries'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 4
   );
 
-  $items['admin/tripal/tripal_library/configuration'] = array(
-    'title' => 'Configuration',
+  $items['admin/tripal/chado/tripal_library/configuration'] = array(
+    'title' => 'Settings',
     'description' => 'Configure the Tripal Library module',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('tripal_library_help'),
+    'page arguments' => array('tripal_library_admin'),
     'access arguments' => array('administer tripal libraries'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2
   );
 
   // Synchronizing libraries from Chado to Drupal
@@ -242,8 +253,8 @@ function tripal_library_theme() {
       'path' => "$theme_path/tripal_library",
     ),
     // help template
-    'tripal_library_help' => array(
-      'template' => 'tripal_library_help',
+    'tripal_library_admin' => array(
+      'template' => 'tripal_library_admin',
       'arguments' =>  array(NULL),
       'path' => $theme_path,
     ),

+ 191 - 357
tripal_library/tripal_library.views_default.inc

@@ -8,378 +8,212 @@
 function tripal_library_views_default_views() {
   $views = array();
 
-  if (!module_exists('tripal_views')) {
-    return $views;
-  }
+  $view = tripal_library_admin_defaultviews_library();
+  $views[$view->name] = $view;
+
+  return $views;
+}
 
-  // Main default view
-  $view = new view;
-  $view->name = 'library_listing';
-  $view->description = 'A listing of all libraries';
-  $view->tag = 'chado default';
+function tripal_library_admin_defaultviews_library() {
+
+  $view = new view();
+  $view->name = 'tripal_library_admin_libraries';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
   $view->base_table = 'library';
+  $view->human_name = 'Library 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'] = 'Libraries';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'perm';
+  $handler->display->display_options['access']['perm'] = 'access chado_library 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'] = 'none';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['grouping'] = '';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'uniquename' => 'uniquename',
+    'name_1' => 'name_1',
+    'common_name' => 'common_name',
+    'name' => 'name',
+    'is_obsolete' => 'is_obsolete',
+  );
+  $handler->display->display_options['style_options']['default'] = 'uniquename';
+  $handler->display->display_options['style_options']['info'] = array(
     'uniquename' => array(
-      'label' => 'Unique Name',
-      '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' => 'uniquename',
-      'table' => 'library',
-      'field' => 'uniquename',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
     'name_1' => array(
-      'label' => 'Name',
-      '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' => 'name_1',
-      'table' => 'library',
-      'field' => 'name',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
     'common_name' => array(
-      'label' => 'Organism',
-      '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' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
     'name' => 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' => 'name',
-      'table' => 'cvterm',
-      'field' => 'name',
-      'relationship' => 'none',
+      'sortable' => 1,
+      'separator' => '',
     ),
     'is_obsolete' => array(
-      'label' => 'Is Obsolete?',
-      '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,
-      'type' => 'yes-no',
-      'not' => 0,
-      'exclude' => 0,
-      'id' => 'is_obsolete',
-      'table' => 'library',
-      'field' => 'is_obsolete',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('sorts', array(
-    'name' => array(
-      'id' => 'name',
-      'table' => 'library',
-      'field' => 'name',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'common_name' => array(
-      'operator' => '=',
-      'value' => array(),
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'common_name_op',
-        'identifier' => 'organism_common_name',
-        'label' => 'Organism',
-        'remember' => 0,
-      ),
-      'case' => 1,
-      'id' => 'common_name',
-      'table' => 'organism',
-      'field' => 'common_name',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 1,
-      ),
+      'sortable' => 1,
+      'separator' => '',
     ),
-    'type_id' => array(
-      'operator' => '=',
-      'value' => array(),
-      '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' => 'library',
-      'field' => 'type_id',
-      'relationship' => 'none',
-      'values_form_type' => 'select',
-      'multiple' => 1,
-      'optional' => 0,
-      'show_all' => 0,
-      'agg' => array(
-        'records_with' => 1,
-        'aggregates_with' => 0,
-      ),
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_library content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Libraries');
-  $handler->override_option('header', 'Click "Show" to see a list of all libraries matching the entered criteria. If you leave a any of the criteria blank then the libraries will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all libraries will be listed.');
-  $handler->override_option('header_format', '2');
-  $handler->override_option('header_empty', 0);
-  $handler->override_option('empty', 'No libraries 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',
-    'summary' => '',
-    'columns' => array(
-      'uniquename' => 'uniquename',
-      'name_1' => 'name_1',
-      'common_name' => 'common_name',
-      'name' => 'name',
-      'is_obsolete' => 'is_obsolete',
-    ),
-    'info' => array(
-      'uniquename' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name_1' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'common_name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'is_obsolete' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-    ),
-    'default' => 'uniquename',
-  ));
-  $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 Library',
+    'path-1' => 'node/add/tripal-library',
+  );
+  $handler->display->display_options['header']['action_links_area']['link-2'] = array(
+    'label-2' => '',
+    'path-2' => '',
+  );
+  $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 libraries match the supplied criteria.';
+  $handler->display->display_options['empty']['text']['format'] = '1';
+  /* Relationship: Library: Library => Node */
+  $handler->display->display_options['relationships']['library_id']['id'] = 'library_id';
+  $handler->display->display_options['relationships']['library_id']['table'] = 'chado_library';
+  $handler->display->display_options['relationships']['library_id']['field'] = 'library_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']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
+  /* Field: Chado Library: Uniquename */
+  $handler->display->display_options['fields']['uniquename']['id'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['table'] = 'library';
+  $handler->display->display_options['fields']['uniquename']['field'] = 'uniquename';
+  $handler->display->display_options['fields']['uniquename']['label'] = 'Unique Name';
+  /* Field: Chado Library: Name */
+  $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
+  $handler->display->display_options['fields']['name_1']['table'] = 'library';
+  $handler->display->display_options['fields']['name_1']['field'] = 'name';
+  /* Field: Chado Organism: Common Name */
+  $handler->display->display_options['fields']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['table'] = 'organism';
+  $handler->display->display_options['fields']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['fields']['common_name']['label'] = 'Organism';
+  /* Field: Chado Cvterm: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'cvterm';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  $handler->display->display_options['fields']['name']['label'] = 'Type';
+  /* Field: Chado Library: Is Obsolete */
+  $handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['table'] = 'library';
+  $handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
+  $handler->display->display_options['fields']['is_obsolete']['label'] = 'Obsolete?';
+  $handler->display->display_options['fields']['is_obsolete']['alter']['alter_text'] = TRUE;
+  $handler->display->display_options['fields']['is_obsolete']['alter']['text'] = 'Yes';
+  $handler->display->display_options['fields']['is_obsolete']['empty'] = 'No';
+  $handler->display->display_options['fields']['is_obsolete']['empty_zero'] = TRUE;
+  $handler->display->display_options['fields']['is_obsolete']['separator'] = '';
+  /* Field: Content: Delete link */
+  $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
+  $handler->display->display_options['fields']['delete_node']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
+  /* Field: Content: Edit link */
+  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
+  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
+  $handler->display->display_options['fields']['edit_node']['relationship'] = 'library_id';
+  $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing']['label'] = '';
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node]   [delete_node]';
+  $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
+  /* Sort criterion: Chado Library: Name */
+  $handler->display->display_options['sorts']['name']['id'] = 'name';
+  $handler->display->display_options['sorts']['name']['table'] = 'library';
+  $handler->display->display_options['sorts']['name']['field'] = 'name';
+  /* Filter criterion: Chado Organism: Common Name */
+  $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['table'] = 'organism';
+  $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
+  $handler->display->display_options['filters']['common_name']['value'] = 'All';
+  $handler->display->display_options['filters']['common_name']['group'] = '0';
+  $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Organism';
+  $handler->display->display_options['filters']['common_name']['expose']['operator'] = 'common_name_op';
+  $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'organism_common_name';
+  $handler->display->display_options['filters']['common_name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Chado Library: Type Id */
+  $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']['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']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+
+  /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'chado/libraries');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Libraries',
-    'description' => 'A library is a collection of features of a given type. For example, a cDNA or BAC clone library.',
-    '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;
-    // Adds library => Node relationship
-    $default_handler->override_option('relationships', array(
-      'nid' => array(
-        'label' => 'Library to Node',
-        'required' => 0,
-        'id' => 'nid',
-        'table' => 'chado_library',
-        'field' => 'nid',
-        'relationship' => 'none',
-      ),
-    ));
-    // Change analysis.name to have a link to the node
-    $fields['name_1']['alter']['link_to_node'] = 1;
-    $default_handler->override_option('fields', $fields);
-    // 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_library/libraries';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Libraries';
+  $handler->display->display_options['menu']['description'] = 'A library is a collection of features of a given type. For example, a cDNA or BAC clone library.';
+  $handler->display->display_options['menu']['weight'] = '0';
+  $handler->display->display_options['menu']['name'] = 'management';
+  $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']['common_name']['expose']['values_form_type'] = 'select';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  */
+
+  return $view;
 }

+ 13 - 0
tripal_organism/tripal_organism.views_default.inc

@@ -180,6 +180,12 @@ function tripal_organism_admin_defaultview_organisms() {
     3 => 0,
   );
 
+  /** MANUALLY ADD since filter handler no exporting correctly */
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+
   /* Display: Page */
   $handler = $view->new_display('page', 'Page', 'page_1');
   $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_organism/organisms';
@@ -192,5 +198,12 @@ function tripal_organism_admin_defaultview_organisms() {
   $handler->display->display_options['menu']['context_only_inline'] = 0;
   $handler->display->display_options['tab_options']['weight'] = '0';
 
+  /** MANUALLY ADD since filter handler no exporting correctly
+  $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'textfield';
+  $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = FALSE;
+  $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
+  */
+
   return $view;
 }