Explorar o código

Merge branch '7.x-2.x' of git.drupal.org:sandbox/spficklin/1337878 into 7.x-2.x

Stephen Ficklin %!s(int64=11) %!d(string=hai) anos
pai
achega
414bddb7ae

+ 57 - 24
tripal_core/includes/custom_tables.inc

@@ -9,12 +9,45 @@
  */
 
 /**
- * 
+ * Provides a landing page for tripal jobs admin
+ */
+function tripal_custom_table_admin_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado Schema', 'admin/tripal/schema');
+  $breadcrumb[] = l('Custom Tables', 'admin/tripal/schema/custom_tables');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_core_admin_custom_table','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Tripal Custom Table management system 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('Custom Tables View', 'admin/tripal/schema/custom_tables/views/tables/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+/**
+ *
  */
 function tripal_custom_table_new_page() {
   $output = drupal_render(drupal_get_form('tripal_custom_tables_form'));
-  return $output;     
-  
+  return $output;
+
 }
 /**
  * A template function which returns markup to display details for the custom table
@@ -76,7 +109,7 @@ function tripal_custom_tables_list() {
   $custom_tables = db_query("SELECT * FROM {tripal_custom_tables} ORDER BY table_name");
 
   foreach ($custom_tables as $custom_table) {
- 
+
     $rows[] = array(
       l(t('View'), "admin/tripal/custom_tables/view/$custom_table->table_id") . " | " .
       l(t('Edit'), "admin/tripal/custom_tables/edit/$custom_table->table_id") . " | " .
@@ -93,16 +126,16 @@ function tripal_custom_tables_list() {
     )
   );
   $table = array(
-    'header' => $header, 
-    'rows' => $rows, 
-    'attributes' => array(), 
+    'header' => $header,
+    'rows' => $rows,
+    'attributes' => array(),
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(), 
-    'empty' => 'No custom tables have been added', 
+    'colgroups' => array(),
+    'empty' => 'No custom tables have been added',
   );
 
-  $page = theme_table($table);  
+  $page = theme_table($table);
   return $page;
 }
 
@@ -161,11 +194,11 @@ function tripal_custom_tables_form($form, &$form_state = NULL, $table_id = NULL)
     '#type' => 'value',
     '#value' => $table_id
   );
-  
+
   $form['instructions']= array(
     '#type'          => 'item',
-    '#description'         => t('At times it is necessary to add a custom table to the Chado schema.  
-       These are not offically sanctioned tables but may be necessary for local data requirements.  
+    '#description'         => t('At times it is necessary to add a custom table to the Chado schema.
+       These are not offically sanctioned tables but may be necessary for local data requirements.
        Avoid creating custom tables when possible as other GMOD tools may not recognize these tables
        nor the data in them.  Linker tables or property tables are often a good candidate for
        a custom table. For example a table to link stocks and libraries (e.g. library_stock) would be
@@ -202,7 +235,7 @@ function tripal_custom_tables_form($form, &$form_state = NULL, $table_id = NULL)
     '#executes_submit_callback' => TRUE,
   );
   $form['#redirect'] = 'admin/tripal/custom_tables';
-  
+
   $form['example']= array(
     '#type'          => 'item',
     '#description'         => "<br>Example library_stock table: <pre>
@@ -216,7 +249,7 @@ array (
     'library_id' => array(
       'type' => 'int',
       'not null' => TRUE,
-    ),      
+    ),
     'stock_id' => array(
       'type' => 'int',
       'not null' => TRUE,
@@ -248,7 +281,7 @@ array (
 )
     </pre>",
   );
-  
+
 
   return $form;
 }
@@ -279,7 +312,7 @@ function tripal_custom_tables_form_validate($form, &$form_state) {
         t("The schema array should begin with the word 'array'."));
     }
     else {
-      $success = eval("\$schema_array = $schema;");    
+      $success = eval("\$schema_array = $schema;");
       if ($success === FALSE) {
         $error = error_get_last();
         form_set_error($form_state['values']['schema'],
@@ -299,10 +332,10 @@ function tripal_custom_tables_form_validate($form, &$form_state) {
           $exists = db_table_exists('chado.' . $schema_array['table']);
           if ($exists) {
             form_set_error($form_state['values']['schema'],
-              t("The table name already exists, please choose a different name."));  
+              t("The table name already exists, please choose a different name."));
           }
         }
-      }     
+      }
     }
   }
 }
@@ -320,7 +353,7 @@ function tripal_custom_tables_form_submit($form, &$form_state) {
   $table_id = $form_state['values']['table_id'];
   $schema = $form_state['values']['schema'];
   $force_drop = $form_state['values']['force_drop'];
-  
+
   $skip_creation = 1;
   if ($force_drop) {
      $skip_creation = 0;
@@ -329,9 +362,9 @@ function tripal_custom_tables_form_submit($form, &$form_state) {
   // conver the schema into a PHP array
   $schema_arr = array();
   eval("\$schema_arr = $schema;");
-  
 
-  if (strcmp($action, 'Edit') == 0) {    
+
+  if (strcmp($action, 'Edit') == 0) {
     tripal_core_edit_custom_table($table_id, $schema_arr['table'], $schema_arr, $skip_creation);
   }
   elseif (strcmp($action, 'Add') == 0) {
@@ -369,12 +402,12 @@ function tripal_custom_tables_action($op, $table_id, $redirect = FALSE) {
   $custom_table = $results->fetchObject();
 
   if ($op == 'delete') {
-  
+
     // remove the entry from the tripal_custom tables table
     $sql = "DELETE FROM {tripal_custom_tables} " .
            "WHERE table_id = $table_id";
     db_query($sql);
-    
+
     // drop the table from chado if it exists
     if (db_table_exists($custom_table->table_name)) {
       $success = chado_query("DROP TABLE %s", $custom_table->table_name);

+ 76 - 42
tripal_core/includes/mviews.inc

@@ -2,10 +2,44 @@
 
 /**
  * @file
- * Contains functions for viewing and editing of Materialized Views 
+ * Contains functions for viewing and editing of Materialized Views
  * on a Tripal website.
  */
 
+/**
+ * Provides a landing page for tripal jobs admin
+ */
+function tripal_mview_admin_view() {
+  $output = '';
+
+  // set the breadcrumb
+  $breadcrumb = array();
+  $breadcrumb[] = l('Home', '<front>');
+  $breadcrumb[] = l('Administration', 'admin');
+  $breadcrumb[] = l('Tripal', 'admin/tripal');
+  $breadcrumb[] = l('Chado Schema', 'admin/tripal/schema');
+  $breadcrumb[] = l('Materialized Views', 'admin/tripal/schema/mviews');
+  drupal_set_breadcrumb($breadcrumb);
+
+  // Add the view
+  $view = views_embed_view('tripal_core_admin_mviews','default');
+  if (isset($view)) {
+    $output .= $view;
+  }
+  else {
+    $output .= '<p>The Tripal Materalized View management system 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('MViews View', 'admin/tripal/schema/mviews/views/mviews/enable').'</li>';
+    $output .= '</ul>';
+  }
+
+  return $output;
+}
+
+
 /**
  * A template function which returns markup to display details for the current materialized view
  *
@@ -20,33 +54,33 @@ function tripal_mview_report($mview_id) {
   $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id";
   $results = db_query($sql, array(':mview_id' => $mview_id));
   $mview = $results->fetchObject();
-  
+
   $rows = array();
 
   // create a table with each row containig stats for
   // an individual job in the results set.
   $output  = "<p>" . l("Return to table of materialized views", "admin/tripal/schema/mviews/") . "</p>";
   $output .= "<p>Details for <b>$mview->name</b>:</p>";
-  
+
   // build the URLs using the url function so we can handle installations where
   // clean URLs are or are not used
   $update_url = url("admin/tripal/schema/mviews/action/update/$mview->mview_id");
   $delete_url = url("admin/tripal/schema/mviews/action/delete/$mview->mview_id");
   $edit_url = url("admin/tripal/schema/mviews/edit/$mview->mview_id");
   $rows[] = array('Actions', "<a href='$update_url'>Populate</a>, <a href='$edit_url'>Edit</a>,  <a href='$delete_url'>Delete</a>");
-  
-  if ($mview->last_update > 0) {    
+
+  if ($mview->last_update > 0) {
     $update = format_date($mview->last_update);
   }
   else {
     $update = 'Not yet populated';
   }
-  $rows[] = array('Last Update', $update);  
+  $rows[] = array('Last Update', $update);
   if ($mview->name) {
     $rows[] = array('View Name', $mview->name);
   }
   if ($mview->modulename) {
-    $rows[] = array('Module Name', $mview->modulename);    
+    $rows[] = array('Module Name', $mview->modulename);
   }
   if ($mview->mv_table) {
     $rows[] = array('Table Name', $mview->mv_table);
@@ -66,17 +100,17 @@ function tripal_mview_report($mview_id) {
   if ($mview->mv_schema) {
     $rows[] = array('Drupal Schema API Definition', "<textarea rows=\"20\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">" . $mview->mv_schema . "</textarea>");
   }
-  
+
   $header = array('Detail', 'Value');
   $table = array(
-    'header' => $header, 
-    'rows' => $rows, 
-    'attributes' => array(), 
+    'header' => $header,
+    'rows' => $rows,
+    'attributes' => array(),
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(), 
-    'empty' => 'There are no materialized views', 
-  ); 
+    'colgroups' => array(),
+    'empty' => 'There are no materialized views',
+  );
   $table = theme_table($table);
   $output .= $table;
 
@@ -119,8 +153,8 @@ function tripal_mviews_report() {
         'colspan' => 6),
     )
   );
-  $page = '</p>' . t("Materialized Views (MViews) are custom tables populated with a defined SQL statement.  
-    Because Chado is highly normalized and highly constrained it serves as a wonderful 
+  $page = '</p>' . t("Materialized Views (MViews) are custom tables populated with a defined SQL statement.
+    Because Chado is highly normalized and highly constrained it serves as a wonderful
     data storage platform, but unfortunately some queries may be slow.  MViews alleviate slowness by aggregating data
     into tables that are more easy to query.  Use MViews to create tables for custom search pages or custom Tripal
     module development.") . '</p>';
@@ -133,14 +167,14 @@ function tripal_mviews_report() {
            '</ul></p>';
   $page .= '<b>' . t("Existing MViews") . '</b>';
   $table = array(
-    'header' => $header, 
-    'rows' => $rows, 
-    'attributes' => array(), 
+    'header' => $header,
+    'rows' => $rows,
+    'attributes' => array(),
     'sticky' => FALSE,
     'caption' => '',
-    'colgroups' => array(), 
-    'empty' => 'There are no materialized views', 
-  ); 
+    'colgroups' => array(),
+    'empty' => 'There are no materialized views',
+  );
   $page .= theme_table($table);
   return $page;
 }
@@ -168,8 +202,8 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
 
   // set defaults for collapsed fieldsets
   $schema_collapsed = 0;
-  $traditional_collapsed = 1;  
-  
+  $traditional_collapsed = 1;
+
   $default_name = '';
   $default_mv_table = '';
   $default_mv_specs = '';
@@ -179,11 +213,11 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
   $default_comment = '';
   $default_modulename = '';
   $default_schema =  '';
-  
+
   // if the view is the older style legacy view then this value get's set to 1
   $is_legacy = 0;
-  
-  
+
+
   // get this requested view
   if (strcmp($action, 'Edit') == 0 ) {
     $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
@@ -228,10 +262,10 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     if (!$default_schema) {
       $default_schema = $mview->mv_schema;
     }
-    if (!$default_modulename) {      
+    if (!$default_modulename) {
       $default_modulename = $mview->modulename ? $mview->modulename : 'tripal_core';
     }
-    
+
     if ($mview->mv_specs) {
       $is_legacy = 1;
     }
@@ -262,22 +296,22 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     '#type' => 'value',
     '#value' => $is_legacy
   );
-  
+
   $form['mview_id'] = array(
     '#type' => 'value',
     '#value' => $mview_id
   );
-  
+
   $form['modulename'] = array(
     '#type' => 'value',
     '#value' => $default_modulename,
   );
-  
+
   $form['return_link'] = array(
     '#type' => 'item',
     '#description' => l("Return to table of materialized views", "admin/tripal/schema/mviews/"),
   );
-  
+
 
   $form['name']= array(
     '#type'          => 'textfield',
@@ -314,11 +348,11 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     '#default_value' => $default_schema,
     '#rows'          => 25,
     '#attributes' => array(
-      'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",      
+      'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",
     ),
   );
 
-  // only let folks edit legacy MViews, not create new ones 
+  // only let folks edit legacy MViews, not create new ones
   if ($is_legacy) {
     // add a fieldset for the Original Table Description fields
     $form['traditional'] = array(
@@ -331,7 +365,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
       '#collapsible' => 1,
       '#collapsed' => $traditional_collapsed,
     );
-  
+
     $form['traditional']['mv_table']= array(
       '#type'          => 'textfield',
       '#title'         => t('Table Name'),
@@ -339,7 +373,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
       '#required'      => FALSE,
       '#default_value' => $default_mv_table,
     );
-  
+
     $form['traditional']['mv_specs']= array(
       '#type'          => 'textarea',
       '#title'         => t('Table Definition'),
@@ -347,7 +381,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
       '#required'      => FALSE,
       '#default_value' => $default_mv_specs,
     );
-  
+
     $form['traditional']['indexed']= array(
       '#type'          => 'textarea',
       '#title'         => t('Indexed Fields'),
@@ -355,7 +389,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
       '#required'      => FALSE,
       '#default_value' => $default_indexed,
     );
-  
+
     /**
     $form['traditional']['special_index']= array(
       '#type'          => 'textarea',
@@ -375,7 +409,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     '#default_value' => $default_mvquery,
     '#rows'          => 25,
     '#attributes' => array(
-      'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",      
+      'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",
     ),
   );
 
@@ -411,7 +445,7 @@ function tripal_mviews_form_validate($form, &$form_state) {
   if ($is_legacy) {
     $mv_table = $form_state['values']['mv_table'];
     $mv_specs = $form_state['values']['mv_specs'];
-    $indexed = $form_state['values']['indexed'];    
+    $indexed = $form_state['values']['indexed'];
     $special_index = '';//$form_state['values']['special_index'];
   }
   else {
@@ -473,7 +507,7 @@ function tripal_mviews_form_submit($form, &$form_state) {
   if ($is_legacy) {
     $mv_table = $form_state['values']['mv_table'];
     $mv_specs = $form_state['values']['mv_specs'];
-    $indexed = $form_state['values']['indexed'];    
+    $indexed = $form_state['values']['indexed'];
     $special_index = '';//$form_state['values']['special_index'];
   }
   else {

+ 3 - 0
tripal_core/theme/tripal_core_customtables_help.tpl.php

@@ -0,0 +1,3 @@
+<p>The Tripal Jobs Management System provides a framework for Biological jobs to be run
+via the command-line in order to eliminate the problems associated with long running
+jobs in the web browser (ie: timeout errors).</p>

+ 3 - 0
tripal_core/theme/tripal_core_mviews_help.tpl.php

@@ -0,0 +1,3 @@
+<p>The Tripal Jobs Management System provides a framework for Biological jobs to be run
+via the command-line in order to eliminate the problems associated with long running
+jobs in the web browser (ie: timeout errors).</p>

+ 42 - 6
tripal_core/tripal_core.module

@@ -244,10 +244,21 @@ function tripal_core_menu() {
   $items['admin/tripal/schema/mviews'] = array(
     'title' => 'Materialized Views',
     'description' => 'Materialized views are used to improve speed of large or complex queries.',
+    'page callback' => 'tripal_mview_admin_view',
     'access arguments' => array('access administration pages'),
     'type' => MENU_NORMAL_ITEM,
     'weight' => -10
   );
+  $items['admin/tripal/schema/mviews/help'] = array(
+    'title' => 'Help',
+    'description' => 'Help for the materialized views management system',
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_core_mviews_help'),
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10
+  );
+  /**
   $items['admin/tripal/schema/mviews/list'] = array(
     'title' => 'List Materialized Views',
     'description' => 'A list of existing materialized views with the ability to edit & delete existing materialized views.',
@@ -256,13 +267,14 @@ function tripal_core_menu() {
     'type' => MENU_NORMAL_ITEM,
     'weight' => -10
   );
+  */
   $items['admin/tripal/schema/mviews/report/%'] = array(
     'title' => 'Materialized View',
     'description' => 'Materialized views are used to improve speed of large or complex queries. These are database views as compared to Drupal views.',
     'page callback' => 'tripal_mview_report',
     'page arguments' => array(5),
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/mviews/new'] = array(
     'title' => 'Create Materialized View',
@@ -270,14 +282,14 @@ function tripal_core_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_mviews_form'),
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/mviews/edit/%'] = array(
     'title' => 'Edit Materialized View',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_mviews_form', 5),
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/mviews/action/%/%'] = array(
     'title' => 'Create Materialized View',
@@ -292,10 +304,21 @@ function tripal_core_menu() {
   $items['admin/tripal/schema/custom_tables'] = array(
     'title' => 'Custom Tables',
     'description' => 'Creation of custom tables that are added to Chado database.',
+    'page callback' => 'tripal_custom_table_admin_view',
     'access arguments' => array('access administration pages'),
     'type' => MENU_NORMAL_ITEM,
     'weight' => -10
   );
+  $items['admin/tripal/schema/custom_tables/help'] = array(
+    'title' => 'Help',
+    'description' => 'Help for the tripal job management system',
+    'page callback' => 'theme',
+    'page arguments' => array('tripal_core_job_help'),
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10
+  );
+  /**
   $items['admin/tripal/schema/custom_tables/list'] = array(
     'title' => 'List of Custom Tables',
     'description' => 'Provides a list of all custom tables created by Tripal and allows for editing or removing existing custom tables.',
@@ -304,27 +327,28 @@ function tripal_core_menu() {
     'type' => MENU_NORMAL_ITEM,
     'weight' => -10
   );
+  */
   $items['admin/tripal/schema/custom_tables/view/%'] = array(
     'title' => 'Custom Tables',
     'description' => 'Custom tables are added to Chado.',
     'page callback' => 'tripal_custom_table_view',
     'page arguments' => array(4),
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/custom_tables/new'] = array(
     'title' => 'Create Custom Table',
     'description' => 'An interface for creating your own custom tables.',
     'page callback' => 'tripal_custom_table_new_page',
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/custom_tables/edit/%'] = array(
     'title' => 'Edit Custom Table',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_custom_tables_form', 4),
     'access arguments' => array('access administration pages'),
-    'type' => MENU_NORMAL_ITEM,
+    'type' => MENU_CALLBACK,
   );
   $items['admin/tripal/schema/custom_tables/action/%/%'] = array(
     'title' => 'Create Custom Table',
@@ -334,6 +358,13 @@ function tripal_core_menu() {
     'access arguments' => array('access administration pages'),
     'type' => MENU_CALLBACK,
   );
+  $items['admin/tripal/schema/custom_tables/views/tables/enable'] = array(
+    'title' => 'Enable Custom Tables Administrative View',
+    'page callback' => 'tripal_views_admin_enable_view',
+    'page arguments' => array('tripal_core_admin_custom_table', 'admin/tripal/schema/custom_tables'),
+    'access arguments' => array('access administration pages'),
+    'type' => MENU_CALLBACK,
+  );
 
   return $items;
 }
@@ -378,6 +409,11 @@ function tripal_core_theme() {
       'variables' =>  array(NULL),
       'path' => drupal_get_path('module', 'tripal_core') . '/theme'
     ),
+    'tripal_core_customtables_help' => array(
+      'template' => 'tripal_core_customtables_help',
+      'variables' =>  array(NULL),
+      'path' => drupal_get_path('module', 'tripal_core') . '/theme'
+    ),
   );
 }
 

+ 309 - 1
tripal_core/tripal_core.views.inc

@@ -13,6 +13,9 @@ function tripal_core_views_data() {
   // Custom Tables Management
   $data = tripal_core_views_data_custom_tables($data);
 
+  // Materialized Views Management
+  $data = tripal_core_views_data_mviews($data);
+
   return $data;
 }
 
@@ -31,7 +34,7 @@ function tripal_core_views_data_jobs($data) {
     'field' => 'job_id', // This is the identifier field for the view.
     'title' => t('Tripal Jobs'),
     'help' => t('The Job Management system for Tripal.'),
-    'weight' => -10,
+    'weight' => 10,
   );
 
   // Job ID
@@ -287,5 +290,310 @@ function tripal_core_views_data_jobs($data) {
  */
 function tripal_core_views_data_custom_tables($data) {
 
+  $data['tripal_custom_tables']['table']['group'] = t('Tripal Custom Tables');
+  $data['tripal_custom_tables']['table']['base'] = array(
+    'field' => 'table_id', // This is the identifier field for the view.
+    'title' => t('Tripal Custom Tables'),
+    'help' => t('Custom Tables in Chado created by this Tripal Installation.'),
+    'weight' => 10,
+  );
+
+  // Table ID
+  $data['tripal_custom_tables']['table_id'] = array(
+    'title' => t('Custom Table ID'),
+    'help' => t('Custom table primary key.'),
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  // Table Name
+  $data['tripal_custom_tables']['table_name'] = array(
+    'title' => t('Table Name'),
+    'help' => t('The name of the table in the database.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // Schema
+  $data['tripal_custom_tables']['schema'] = array(
+    'title' => t('Table Schema'),
+    'help' => t('The schema definition of the table.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  return $data;
+}
+
+/**
+ * Provides the data array for the tripal custom tables management
+ *
+ * @param $data
+ *   Previously generated tripal_core views data array
+ * return
+ *   $data array with custom tables management described
+ */
+function tripal_core_views_data_mviews($data) {
+
+  $data['tripal_mviews']['table']['group'] = t('Tripal Materialized Views');
+  $data['tripal_mviews']['table']['base'] = array(
+    'field' => 'mview_id', // This is the identifier field for the view.
+    'title' => t('Tripal Materialized Views'),
+    'help' => t('Materialized Views in Chado created by this Tripal Installation.'),
+    'weight' => 10,
+  );
+
+  // Mview ID
+  $data['tripal_mviews']['mview_id'] = array(
+    'title' => t('Materialized View ID'),
+    'help' => t('The primary key.'),
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+
+  // name
+  $data['tripal_mviews']['name'] = array(
+    'title' => t('Name'),
+    'help' => t('Human-readable name of the materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // modulename
+  $data['tripal_mviews']['modulename'] = array(
+    'title' => t('Module Name'),
+    'help' => t('The module that created the materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // mv_table
+  $data['tripal_mviews']['mv_table'] = array(
+    'title' => t('Table'),
+    'help' => t('The database table the materialized view is stored in.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // mv_specs
+  $data['tripal_mviews']['mv_specs'] = array(
+    'title' => t('Specification'),
+    'help' => t('Materialized View Specification.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // mv_schema
+  $data['tripal_mviews']['mv_schema'] = array(
+    'title' => t('Schema'),
+    'help' => t('Schema definition for the materialized view table.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // indexed
+  $data['tripal_mviews']['indexed'] = array(
+    'title' => t('Indices'),
+    'help' => t('Any indices for this materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // query
+  $data['tripal_mviews']['query'] = array(
+    'title' => t('Query'),
+    'help' => t('The query used to populate the materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // special_index
+  $data['tripal_mviews']['special_index'] = array(
+    'title' => t('Special Index'),
+    'help' => t('Any special indices for the materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // last_update
+  $data['tripal_mviews']['last_update'] = array(
+    'title' => t('Updated'),
+    'help' => t('Date Last Updated.'),
+    'field' => array(
+      'handler' => 'views_handler_field_date',
+      'click sortable' => TRUE,
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort_date',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_date',
+    ),
+  );
+
+  // status
+  $data['tripal_mviews']['status'] = array(
+    'title' => t('Status'),
+    'help' => t('The status of the materialized view.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
+  // comment
+  $data['tripal_mviews']['comment'] = array(
+    'title' => t('Description'),
+    'help' => t('Human-Readable Admin Description.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE, // This is use by the table display plugin.
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_string',
+    ),
+  );
+
   return $data;
 }

+ 385 - 0
tripal_core/tripal_core.views_default.inc

@@ -10,6 +10,12 @@ function tripal_core_views_default_views() {
   $view = tripal_core_admin_defaultview_jobs();
   $views[$view->name] = $view;
 
+  $view = tripal_core_admin_defaultview_custom_tables();
+  $views[$view->name] = $view;
+
+  $view = tripal_core_admin_defaultview_mviews();
+  $views[$view->name] = $view;
+
   return $views;
 }
 
@@ -282,5 +288,384 @@ function tripal_core_admin_defaultview_jobs() {
   $handler->display->display_options['menu']['context_only_inline'] = 0;
   $handler->display->display_options['tab_options']['weight'] = '0';
 
+  return $view;
+}
+
+function tripal_core_admin_defaultview_custom_tables() {
+
+  $view = new view();
+  $view->name = 'tripal_core_admin_custom_table';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'tripal_custom_tables';
+  $view->human_name = 'Tripal Custom Table Admin';
+  $view->core = 7;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Master */
+  $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['title'] = 'Custom Tables';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'none';
+  $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['exposed_form']['options']['submit_button'] = 'Filter';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['style_plugin'] = 'table';
+  /* 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 Custom Table',
+    'path-1' => 'admin/tripal/schema/custom_tables/new',
+  );
+  $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' => '',
+  );
+  /* Field: Tripal Custom Tables: Custom Table ID */
+  $handler->display->display_options['fields']['table_id']['id'] = 'table_id';
+  $handler->display->display_options['fields']['table_id']['table'] = 'tripal_custom_tables';
+  $handler->display->display_options['fields']['table_id']['field'] = 'table_id';
+  $handler->display->display_options['fields']['table_id']['label'] = '';
+  $handler->display->display_options['fields']['table_id']['element_class'] = 'extra-short-column';
+  $handler->display->display_options['fields']['table_id']['element_label_class'] = 'extra-short-column';
+  $handler->display->display_options['fields']['table_id']['element_label_colon'] = FALSE;
+  $handler->display->display_options['fields']['table_id']['separator'] = '';
+  /* Field: Tripal Custom Tables: Table Name */
+  $handler->display->display_options['fields']['table_name']['id'] = 'table_name';
+  $handler->display->display_options['fields']['table_name']['table'] = 'tripal_custom_tables';
+  $handler->display->display_options['fields']['table_name']['field'] = 'table_name';
+  $handler->display->display_options['fields']['table_name']['label'] = 'Name';
+  $handler->display->display_options['fields']['table_name']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['table_name']['alter']['path'] = 'admin/tripal/schema/custom_tables/view/[table_id]';
+  /* 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'] = 'Edit Link';
+  $handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = 'Edit';
+  $handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/schema/custom_tables/edit/[table_id]';
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
+  $handler->display->display_options['fields']['nothing_1']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing_1']['label'] = 'Delete Link';
+  $handler->display->display_options['fields']['nothing_1']['exclude'] = TRUE;
+  $handler->display->display_options['fields']['nothing_1']['alter']['text'] = 'Delete';
+  $handler->display->display_options['fields']['nothing_1']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['nothing_1']['alter']['path'] = 'admin/tripal/schema/custom_tables/action/delete/[table_id]';
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing_2']['id'] = 'nothing_2';
+  $handler->display->display_options['fields']['nothing_2']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing_2']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing_2']['label'] = '';
+  $handler->display->display_options['fields']['nothing_2']['alter']['text'] = '[nothing]   [nothing_1]';
+  $handler->display->display_options['fields']['nothing_2']['element_label_colon'] = FALSE;
+  /* Filter criterion: Tripal Custom Tables: Table Name */
+  $handler->display->display_options['filters']['table_name']['id'] = 'table_name';
+  $handler->display->display_options['filters']['table_name']['table'] = 'tripal_custom_tables';
+  $handler->display->display_options['filters']['table_name']['field'] = 'table_name';
+  $handler->display->display_options['filters']['table_name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['table_name']['expose']['operator_id'] = 'table_name_op';
+  $handler->display->display_options['filters']['table_name']['expose']['label'] = 'Table Name';
+  $handler->display->display_options['filters']['table_name']['expose']['operator'] = 'table_name_op';
+  $handler->display->display_options['filters']['table_name']['expose']['identifier'] = 'table_name';
+  $handler->display->display_options['filters']['table_name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page');
+  $handler->display->display_options['path'] = 'admin/tripal/schema/custom_tables/tables';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Custom Tables';
+  $handler->display->display_options['menu']['description'] = 'A list of existing custom tables';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $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 $view;
+}
+
+function tripal_core_admin_defaultview_mviews() {
+
+  $view = new view();
+  $view->name = 'tripal_core_admin_mviews';
+  $view->description = 'DO NOT DISABLE';
+  $view->tag = 'tripal admin';
+  $view->base_table = 'tripal_mviews';
+  $view->human_name = 'MView Admin';
+  $view->core = 7;
+  $view->api_version = '3.0';
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+  /* Display: Master */
+  $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['title'] = 'Materialized Views';
+  $handler->display->display_options['use_more_always'] = FALSE;
+  $handler->display->display_options['access']['type'] = 'none';
+  $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['exposed_form']['options']['submit_button'] = 'Filter';
+  $handler->display->display_options['pager']['type'] = 'full';
+  $handler->display->display_options['pager']['options']['items_per_page'] = '25';
+  $handler->display->display_options['style_plugin'] = 'table';
+  $handler->display->display_options['style_options']['columns'] = array(
+    'mview_id' => 'mview_id',
+    'name' => 'name',
+    'mv_table' => 'mv_table',
+    'comment' => 'comment',
+    'last_update' => 'last_update',
+    'status' => 'status',
+  );
+  $handler->display->display_options['style_options']['default'] = 'mview_id';
+  $handler->display->display_options['style_options']['info'] = array(
+    'mview_id' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'name' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'mv_table' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'comment' => array(
+      'sortable' => 0,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'last_update' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+    'status' => array(
+      'sortable' => 1,
+      'default_sort_order' => 'asc',
+      'align' => '',
+      'separator' => '',
+      'empty_column' => 0,
+    ),
+  );
+  /* Header: Global: Text area */
+  $handler->display->display_options['header']['area']['id'] = 'area';
+  $handler->display->display_options['header']['area']['table'] = 'views';
+  $handler->display->display_options['header']['area']['field'] = 'area';
+  $handler->display->display_options['header']['area']['label'] = 'Description';
+  $handler->display->display_options['header']['area']['empty'] = TRUE;
+  $handler->display->display_options['header']['area']['content'] = '<p>Materialized Views (MViews) are custom tables populated with a defined SQL statement. Because Chado is highly normalized and highly constrained it serves as a wonderful data storage platform, but unfortunately some queries may be slow. MViews alleviate slowness by aggregating data into tables that are more easy to query. Use MViews to create tables for custom search pages or custom Tripal module development.</p>
+  <p>MViews behaves in the following way:</p>
+  <ul>
+  <li>The SQL statement defined for an MVIEW will be used to populate the table</li>
+  <li>Altering the table structure of an MView will cause the MView table to be dropped and recreated. All records in the MView will be lost.</li>
+  <li>Altering the query of an existing view will not change the MView table. No records will be lost.</li>
+  <li>Repopulating an MView that is already populated will result in replacement of all records.</li>
+  <li>A database transaction will be used when populating MViews. Therefore replacement of records does not occur until the query completes. Any search forms or pages dependent on the MView will continue to function.</li>
+  </ul>';
+  $handler->display->display_options['header']['area']['format'] = 'full_html';
+  /* 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']['link-1'] = array(
+    'label-1' => 'Add Materialized View',
+    'path-1' => 'admin/tripal/schema/mviews/new',
+  );
+  $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' => '',
+  );
+  /* Field: Tripal Materialized Views: Materialized View ID */
+  $handler->display->display_options['fields']['mview_id']['id'] = 'mview_id';
+  $handler->display->display_options['fields']['mview_id']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['mview_id']['field'] = 'mview_id';
+  $handler->display->display_options['fields']['mview_id']['label'] = '';
+  $handler->display->display_options['fields']['mview_id']['element_class'] = 'extra-short-column';
+  $handler->display->display_options['fields']['mview_id']['element_label_class'] = 'extra-short-column';
+  $handler->display->display_options['fields']['mview_id']['element_label_colon'] = FALSE;
+  $handler->display->display_options['fields']['mview_id']['separator'] = '';
+  /* Field: Tripal Materialized Views: Name */
+  $handler->display->display_options['fields']['name']['id'] = 'name';
+  $handler->display->display_options['fields']['name']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['name']['field'] = 'name';
+  $handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['name']['alter']['path'] = 'admin/tripal/schema/mviews/report/[mview_id]';
+  /* Field: Tripal Materialized Views: Table */
+  $handler->display->display_options['fields']['mv_table']['id'] = 'mv_table';
+  $handler->display->display_options['fields']['mv_table']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['mv_table']['field'] = 'mv_table';
+  $handler->display->display_options['fields']['mv_table']['label'] = 'Table Name';
+  /* Field: Tripal Materialized Views: Description */
+  $handler->display->display_options['fields']['comment']['id'] = 'comment';
+  $handler->display->display_options['fields']['comment']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['comment']['field'] = 'comment';
+  /* Field: Tripal Materialized Views: Updated */
+  $handler->display->display_options['fields']['last_update']['id'] = 'last_update';
+  $handler->display->display_options['fields']['last_update']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['last_update']['field'] = 'last_update';
+  $handler->display->display_options['fields']['last_update']['label'] = 'Last Updated';
+  $handler->display->display_options['fields']['last_update']['date_format'] = 'long';
+  /* Field: Tripal Materialized Views: Status */
+  $handler->display->display_options['fields']['status']['id'] = 'status';
+  $handler->display->display_options['fields']['status']['table'] = 'tripal_mviews';
+  $handler->display->display_options['fields']['status']['field'] = 'status';
+  $handler->display->display_options['fields']['status']['empty'] = 'Not yet populated';
+  /* 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'] = 'Edit Link';
+  $handler->display->display_options['fields']['nothing']['exclude'] = TRUE;
+  $handler->display->display_options['fields']['nothing']['alter']['text'] = 'Edit';
+  $handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/tripal/schema/mviews/edit/[mview_id]';
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing_1']['id'] = 'nothing_1';
+  $handler->display->display_options['fields']['nothing_1']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing_1']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing_1']['label'] = 'Delete Link';
+  $handler->display->display_options['fields']['nothing_1']['exclude'] = TRUE;
+  $handler->display->display_options['fields']['nothing_1']['alter']['text'] = 'Delete';
+  $handler->display->display_options['fields']['nothing_1']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['nothing_1']['alter']['path'] = 'admin/tripal/schema/mviews/action/delete/[mview_id]';
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing_2']['id'] = 'nothing_2';
+  $handler->display->display_options['fields']['nothing_2']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing_2']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing_2']['label'] = 'Populate Link';
+  $handler->display->display_options['fields']['nothing_2']['exclude'] = TRUE;
+  $handler->display->display_options['fields']['nothing_2']['alter']['text'] = 'Populate';
+  $handler->display->display_options['fields']['nothing_2']['alter']['make_link'] = TRUE;
+  $handler->display->display_options['fields']['nothing_2']['alter']['path'] = 'admin/tripal/schema/mviews/action/update/[mview_id]';
+  /* Field: Global: Custom text */
+  $handler->display->display_options['fields']['nothing_3']['id'] = 'nothing_3';
+  $handler->display->display_options['fields']['nothing_3']['table'] = 'views';
+  $handler->display->display_options['fields']['nothing_3']['field'] = 'nothing';
+  $handler->display->display_options['fields']['nothing_3']['label'] = '';
+  $handler->display->display_options['fields']['nothing_3']['alter']['text'] = '[nothing]   [nothing_1]<br />
+  [nothing_2]';
+  $handler->display->display_options['fields']['nothing_3']['element_class'] = 'short-column';
+  $handler->display->display_options['fields']['nothing_3']['element_label_class'] = 'short-column';
+  $handler->display->display_options['fields']['nothing_3']['element_label_colon'] = FALSE;
+  /* Filter criterion: Tripal Materialized Views: Name */
+  $handler->display->display_options['filters']['name']['id'] = 'name';
+  $handler->display->display_options['filters']['name']['table'] = 'tripal_mviews';
+  $handler->display->display_options['filters']['name']['field'] = 'name';
+  $handler->display->display_options['filters']['name']['group'] = 1;
+  $handler->display->display_options['filters']['name']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['label'] = 'Name';
+  $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
+  $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
+  $handler->display->display_options['filters']['name']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Tripal Materialized Views: Table */
+  $handler->display->display_options['filters']['mv_table']['id'] = 'mv_table';
+  $handler->display->display_options['filters']['mv_table']['table'] = 'tripal_mviews';
+  $handler->display->display_options['filters']['mv_table']['field'] = 'mv_table';
+  $handler->display->display_options['filters']['mv_table']['group'] = 1;
+  $handler->display->display_options['filters']['mv_table']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['mv_table']['expose']['operator_id'] = 'mv_table_op';
+  $handler->display->display_options['filters']['mv_table']['expose']['label'] = 'Database Table';
+  $handler->display->display_options['filters']['mv_table']['expose']['operator'] = 'mv_table_op';
+  $handler->display->display_options['filters']['mv_table']['expose']['identifier'] = 'mv_table';
+  $handler->display->display_options['filters']['mv_table']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Tripal Materialized Views: Module Name */
+  $handler->display->display_options['filters']['modulename']['id'] = 'modulename';
+  $handler->display->display_options['filters']['modulename']['table'] = 'tripal_mviews';
+  $handler->display->display_options['filters']['modulename']['field'] = 'modulename';
+  $handler->display->display_options['filters']['modulename']['group'] = 1;
+  $handler->display->display_options['filters']['modulename']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['modulename']['expose']['operator_id'] = 'modulename_op';
+  $handler->display->display_options['filters']['modulename']['expose']['label'] = 'Module Created by';
+  $handler->display->display_options['filters']['modulename']['expose']['operator'] = 'modulename_op';
+  $handler->display->display_options['filters']['modulename']['expose']['identifier'] = 'modulename';
+  $handler->display->display_options['filters']['modulename']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+  /* Filter criterion: Tripal Materialized Views: Status */
+  $handler->display->display_options['filters']['status']['id'] = 'status';
+  $handler->display->display_options['filters']['status']['table'] = 'tripal_mviews';
+  $handler->display->display_options['filters']['status']['field'] = 'status';
+  $handler->display->display_options['filters']['status']['group'] = 1;
+  $handler->display->display_options['filters']['status']['exposed'] = TRUE;
+  $handler->display->display_options['filters']['status']['expose']['operator_id'] = 'status_op';
+  $handler->display->display_options['filters']['status']['expose']['label'] = 'Status';
+  $handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op';
+  $handler->display->display_options['filters']['status']['expose']['identifier'] = 'status';
+  $handler->display->display_options['filters']['status']['expose']['remember_roles'] = array(
+    2 => '2',
+    1 => 0,
+    3 => 0,
+  );
+
+  /* Display: Page */
+  $handler = $view->new_display('page', 'Page', 'page');
+  $handler->display->display_options['path'] = 'admin/tripal/schema/mviews/mviews';
+  $handler->display->display_options['menu']['type'] = 'default tab';
+  $handler->display->display_options['menu']['title'] = 'Materialized Views';
+  $handler->display->display_options['menu']['description'] = 'a list of mviews';
+  $handler->display->display_options['menu']['weight'] = '-10';
+  $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 $view;
 }