tripal_chado.mviews.inc

Contains functions for viewing and editing of Materialized Views on a Tripal website.

File

tripal_chado/includes/tripal_chado.mviews.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains functions for viewing and editing of Materialized Views
  5. * on a Tripal website.
  6. */
  7. /**
  8. * Provides a landing page for tripal jobs admin
  9. */
  10. function tripal_mview_admin_view() {
  11. $output = '';
  12. // set the breadcrumb
  13. $breadcrumb = array();
  14. $breadcrumb[] = l('Home', '<front>');
  15. $breadcrumb[] = l('Administration', 'admin');
  16. $breadcrumb[] = l('Tripal', 'admin/tripal');
  17. $breadcrumb[] = l('Chado Schema', 'admin/tripal/storage/chado');
  18. $breadcrumb[] = l('Materialized Views', 'admin/tripal/storage/chado/mviews');
  19. drupal_set_breadcrumb($breadcrumb);
  20. // Add the view
  21. $view = views_embed_view('tripal_admin_mviews', 'default');
  22. if (isset($view)) {
  23. $output .= $view;
  24. }
  25. else {
  26. $output .= '<p>The Tripal Materalized View management system uses Drupal Views to provide an '
  27. . 'administrative interface. Currently one or more views needed for this '
  28. . 'administrative interface are disabled. <strong>Click each of the following links to '
  29. . 'enable the pertinent views</strong>:</p>';
  30. $output .= '<ul>';
  31. $output .= '<li>'.l('MViews View', 'admin/tripal/storage/chado/mviews/views/mviews/enable').'</li>';
  32. $output .= '</ul>';
  33. }
  34. return $output;
  35. }
  36. /**
  37. * A template function which returns markup to display details for the current materialized view
  38. *
  39. * @param $mview_id
  40. * The unique ID of the materialized view to render
  41. */
  42. function tripal_mview_report($mview_id) {
  43. // set the breadcrumb
  44. $breadcrumb = array();
  45. $breadcrumb[] = l('Home', '<front>');
  46. $breadcrumb[] = l('Administration', 'admin');
  47. $breadcrumb[] = l('Tripal', 'admin/tripal');
  48. $breadcrumb[] = l('Chado Schema', 'admin/tripal/storage/chado');
  49. $breadcrumb[] = l('Materialied Views', 'admin/tripal/storage/chado/mviews');
  50. drupal_set_breadcrumb($breadcrumb);
  51. // get this mview details
  52. $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id";
  53. $results = db_query($sql, array(':mview_id' => $mview_id));
  54. $mview = $results->fetchObject();
  55. $rows = array();
  56. // create a table with each row containig stats for
  57. // an individual job in the results set.
  58. $output = "<p>Details for <b>$mview->name</b>:</p>";
  59. // build the URLs using the url function so we can handle installations where
  60. // clean URLs are or are not used
  61. $update_url = url("admin/tripal/storage/chado/mviews/action/update/$mview->mview_id");
  62. $delete_url = url("admin/tripal/storage/chado/mviews/action/delete/$mview->mview_id");
  63. $edit_url = url("admin/tripal/storage/chado/mviews/edit/$mview->mview_id");
  64. $export_url = url("admin/tripal/storage/chado/mviews/export/$mview->mview_id");
  65. $rows[] = array('Actions', "<a href='$update_url'>Populate</a>, <a href='$edit_url'>Edit</a>, <a href='$delete_url'>Delete</a>");
  66. if ($mview->last_update > 0) {
  67. $update = format_date($mview->last_update);
  68. }
  69. else {
  70. $update = 'Not yet populated';
  71. }
  72. $rows[] = array('Last Update', $update);
  73. if ($mview->name) {
  74. $rows[] = array('View Name', $mview->name);
  75. }
  76. if ($mview->modulename) {
  77. $rows[] = array('Module Name', $mview->modulename);
  78. }
  79. if ($mview->mv_table) {
  80. $rows[] = array('Table Name', $mview->mv_table);
  81. }
  82. if ($mview->mv_specs) {
  83. $rows[] = array('Table Field Definitions', $mview->mv_specs);
  84. }
  85. if ($mview->query) {
  86. $rows[] = array('Query', "<textarea rows=\"15\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">" . $mview->query . "</textarea>");
  87. }
  88. if ($mview->indexed) {
  89. $rows[] = array('Indexed Fields', $mview->indexed);
  90. }
  91. if ($mview->special_index) {
  92. $rows[] = array('Special Indexed Fields', $mview->special_index);
  93. }
  94. if ($mview->mv_schema) {
  95. $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>");
  96. }
  97. $header = array('Detail', 'Value');
  98. $table = array(
  99. 'header' => $header,
  100. 'rows' => $rows,
  101. 'attributes' => array('class' => 'tripal-data-table'),
  102. 'sticky' => FALSE,
  103. 'caption' => '',
  104. 'colgroups' => array(),
  105. 'empty' => 'There are no materialized views',
  106. );
  107. $table = theme_table($table);
  108. $output .= $table;
  109. return $output;
  110. }
  111. /**
  112. * A Form to Create/Edit a Materialized View
  113. *
  114. * @param $form_state
  115. * The current state of the form (Form API)
  116. * @param $mview_id
  117. * The unique ID of the Materialized View to Edit or NULL if creating a new materialized view
  118. *
  119. * @return
  120. * A form array (Form API)
  121. */
  122. function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
  123. // set the breadcrumb
  124. $breadcrumb = array();
  125. $breadcrumb[] = l('Home', '<front>');
  126. $breadcrumb[] = l('Administration', 'admin');
  127. $breadcrumb[] = l('Tripal', 'admin/tripal');
  128. $breadcrumb[] = l('Chado Schema', 'admin/tripal/storage/chado');
  129. $breadcrumb[] = l('Materialied Views', 'admin/tripal/storage/chado/mviews');
  130. drupal_set_breadcrumb($breadcrumb);
  131. if (!$mview_id) {
  132. $action = 'Add';
  133. }
  134. else {
  135. $action = 'Edit';
  136. }
  137. // set defaults for collapsed fieldsets
  138. $schema_collapsed = 0;
  139. $traditional_collapsed = 1;
  140. $default_name = '';
  141. $default_mv_table = '';
  142. $default_mv_specs = '';
  143. $default_indexed = '';
  144. $default_mvquery = '';
  145. $default_special_index = '';
  146. $default_comment = '';
  147. $default_modulename = '';
  148. $default_schema = '';
  149. // if the view is the older style legacy view then this value get's set to 1
  150. $is_legacy = 0;
  151. // get this requested view
  152. if (strcmp($action, 'Edit') == 0 ) {
  153. $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
  154. $mview = db_query($sql, array(':mview_id' => $mview_id))->fetchObject();
  155. // set the default values. If there is a value set in the
  156. // form_state then let's use that, otherwise, we'll pull
  157. // the values from the database
  158. if (array_key_exists('values', $form_state)) {
  159. $default_name = $form_state['values']['name'];
  160. $default_mv_table = $form_state['values']['mv_table'];
  161. $default_mv_specs = $form_state['values']['mv_specs'];
  162. $default_indexed = $form_state['values']['indexed'];
  163. $default_mvquery = $form_state['values']['mvquery'];
  164. $default_special_index = $form_state['values']['special_index'];
  165. $default_comment = $form_state['values']['comment'];
  166. $default_modulename = $form_state['values']['modulename'];
  167. }
  168. if (!$default_name) {
  169. $default_name = $mview->name;
  170. }
  171. if (!$default_mv_table) {
  172. $default_mv_table = $mview->mv_table;
  173. }
  174. if (!$default_mv_specs) {
  175. $default_mv_specs = $mview->mv_specs;
  176. }
  177. if (!$default_indexed) {
  178. $default_indexed = $mview->indexed;
  179. }
  180. if (!$default_mvquery) {
  181. $default_mvquery = $mview->query;
  182. }
  183. if (!$default_special_index) {
  184. $default_special_index = $mview->special_index;
  185. }
  186. if (!$default_comment) {
  187. $default_comment = $mview->comment;
  188. }
  189. if (!$default_schema) {
  190. $default_schema = $mview->mv_schema;
  191. }
  192. if (!$default_modulename) {
  193. $default_modulename = $mview->modulename ? $mview->modulename : 'tripal_chado';
  194. }
  195. if ($mview->mv_specs) {
  196. $is_legacy = 1;
  197. }
  198. // the mv_table column of the tripal_mviews table always has the table
  199. // name even if it is a custom table. However, for the sake of the form,
  200. // we do not want this to show up as the mv_table is needed for the
  201. // traditional style input. We'll blank it out if we have a custom
  202. // table and it will get reset in the submit function using the
  203. // 'table' value from the schema array
  204. if ($default_schema) {
  205. $default_mv_table = '';
  206. }
  207. // set which fieldset is collapsed
  208. if (!$default_schema) {
  209. $schema_collapsed = 1;
  210. $traditional_collapsed = 0;
  211. }
  212. }
  213. // Build the form
  214. $form['action'] = array(
  215. '#type' => 'value',
  216. '#value' => $action
  217. );
  218. $form['is_legacy'] = array(
  219. '#type' => 'value',
  220. '#value' => $is_legacy
  221. );
  222. $form['mview_id'] = array(
  223. '#type' => 'value',
  224. '#value' => $mview_id
  225. );
  226. $form['modulename'] = array(
  227. '#type' => 'value',
  228. '#value' => $default_modulename,
  229. );
  230. $form['instructions'] = array(
  231. '#type' => 'fieldset',
  232. '#title' => 'Instructions',
  233. '#collapsible' => TRUE,
  234. '#collapsed' => TRUE,
  235. );
  236. $form['instructions']['text'] = array(
  237. '#type' => 'item',
  238. '#markup' => t('Materialized views are used to help speed data
  239. querying, particularly for searching. A materialized view is essentially
  240. a database table that is pre-populated with the desired data to search on.
  241. Rows in the materialized view are typically a combination of data from
  242. multiple tables with indexes on searchable columns. The table structure
  243. for materialized views is defined using the ' .
  244. l('Drupal Schema API', 'https://api.drupal.org/api/drupal/includes!database!schema.inc/group/schemaapi/7',
  245. array('attributes' => array('target' => '_blank'))) . '. '. t('Additionally,
  246. an SQL statement is provided that populates the table with data. ' .
  247. 'Please note that table names should be all lower-case.')
  248. ),
  249. );
  250. $form['instructions']['example_schema']= array(
  251. '#type' => 'item',
  252. '#markup' => "An example Schema API definition for a materialized view: <pre>
  253. array (
  254. 'description' => 'Stores the type and number of features per organism',
  255. 'table' => 'organism_feature_count',
  256. 'fields' => array (
  257. 'organism_id' => array (
  258. 'type' => 'int',
  259. 'not null' => true,
  260. ),
  261. 'genus' => array (
  262. 'type' => 'varchar',
  263. 'length' => '255',
  264. 'not null' => true,
  265. ),
  266. 'species' => array (
  267. 'type' => 'varchar',
  268. 'length' => '255',
  269. 'not null' => true,
  270. ),
  271. 'common_name' => array (
  272. 'type' => 'varchar',
  273. 'length' => '255',
  274. 'not null' => false,
  275. ),
  276. 'num_features' => array (
  277. 'type' => 'int',
  278. 'not null' => true,
  279. ),
  280. 'cvterm_id' => array (
  281. 'type' => 'int',
  282. 'not null' => true,
  283. ),
  284. 'feature_type' => array (
  285. 'type' => 'varchar',
  286. 'length' => '255',
  287. 'not null' => true,
  288. ),
  289. ),
  290. 'indexes' => array (
  291. 'organism_id_idx' => array ('organism_id'),
  292. 'cvterm_id_idx' => array ('cvterm_id'),
  293. 'feature_type_idx' => array ('feature_type'),
  294. ),
  295. )
  296. </pre>"
  297. );
  298. $form['instructions']['example_sql'] = array(
  299. '#type' => 'item',
  300. '#markup' => "An example SQL statement to populate the table: <pre>
  301. SELECT
  302. O.organism_id, O.genus, O.species, O.common_name,
  303. count(F.feature_id) as num_features,
  304. CVT.cvterm_id, CVT.name as feature_type
  305. FROM organism O
  306. INNER JOIN feature F ON O.Organism_id = F.organism_id
  307. INNER JOIN cvterm CVT ON F.type_id = CVT.cvterm_id
  308. GROUP BY
  309. O.Organism_id, O.genus, O.species, O.common_name, CVT.cvterm_id, CVT.name
  310. </pre>"
  311. );
  312. $form['name']= array(
  313. '#type' => 'textfield',
  314. '#title' => t('View Name'),
  315. '#description' => t('Please enter the name for this materialized view.'),
  316. '#required' => TRUE,
  317. '#default_value' => $default_name,
  318. );
  319. $form['comment']= array(
  320. '#type' => 'textarea',
  321. '#title' => t('MView Description'),
  322. '#description' => t('Optional. Please provide a description of the purpose for this materialized vieww.'),
  323. '#required' => FALSE,
  324. '#default_value' => $default_comment,
  325. );
  326. // add a fieldset for the Drupal Schema API
  327. $form['schema'] = array(
  328. '#type' => 'fieldset',
  329. '#title' => 'Table Schema',
  330. '#description' => t('Use a ' . l("Drupal Schema API", "https://api.drupal.org/api/drupal/includes!database!schema.inc/group/schemaapi/7", array('attributes' => array('target' => '_blank'))) .
  331. ' array to describe the table. See the bottom of this page for an example.'),
  332. '#collapsible' => 1,
  333. '#collapsed' => $schema_collapsed ,
  334. );
  335. $form['schema']['schema']= array(
  336. '#type' => 'textarea',
  337. '#title' => t('Schema Array'),
  338. '#description' => t('Please enter the ' . l("Drupal Schema API", "https://api.drupal.org/api/drupal/includes!database!schema.inc/group/schemaapi/7", array('attributes' => array('target' => '_blank'))) .
  339. ' compatible array that defines the table. There must also be a "table" key with the name of the table as the value. See the example at the bottom of this page.'),
  340. '#required' => FALSE,
  341. '#default_value' => $default_schema,
  342. '#rows' => 25,
  343. '#attributes' => array(
  344. 'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",
  345. ),
  346. );
  347. // only let folks edit legacy MViews, not create new ones
  348. if ($is_legacy) {
  349. // add a fieldset for the Original Table Description fields
  350. $form['traditional'] = array(
  351. '#type' => 'fieldset',
  352. '#title' => 'Legacy MViews Setup',
  353. '#description' => t('<font color="red">Tripal no longer supports editing of legacy style materialized views. </font> This view will continue to function and you can populate it, however, to update you must convert this view to the newer Drupal Schema API format using the "Table Schema" section above. Unfortunately, after converting this view to the Schema API and saving, the materialized view be recreated and emptied. You will need to re-populate it. Therefore, you may want to schedule update of this or any other legacy materialized during your next site maintenance.'),
  354. '#collapsible' => 1,
  355. '#collapsed' => $traditional_collapsed,
  356. );
  357. $form['traditional']['mv_table']= array(
  358. '#type' => 'textfield',
  359. '#title' => t('Table Name'),
  360. '#description' => t('Please enter the table name that this view will generate in the database. You can use the schema and table name for querying the view'),
  361. '#required' => FALSE,
  362. '#default_value' => $default_mv_table,
  363. '#attributes' => array('disabled' => 'disabled'),
  364. );
  365. $form['traditional']['mv_specs']= array(
  366. '#type' => 'textarea',
  367. '#title' => t('Table Definition'),
  368. '#description' => t('Please enter the field definitions for this view. Each field should be separated by a comma or enter each field definition on each line.'),
  369. '#required' => FALSE,
  370. '#default_value' => $default_mv_specs,
  371. '#attributes' => array('disabled' => 'disabled'),
  372. );
  373. $form['traditional']['indexed']= array(
  374. '#type' => 'textarea',
  375. '#title' => t('Indexed Fields'),
  376. '#description' => t('Please enter the field names (as provided in the table definition above) that will be indexed for this view. Separate by a comma or enter each field on a new line.'),
  377. '#required' => FALSE,
  378. '#default_value' => $default_indexed,
  379. '#attributes' => array('disabled' => 'disabled'),
  380. );
  381. /**
  382. $form['traditional']['special_index']= array(
  383. '#type' => 'textarea',
  384. '#title' => t('View Name'),
  385. '#description' => t('Please enter the name for this materialized view.'),
  386. '#required' => TRUE,
  387. '#default_value' => $default_special_index,
  388. );
  389. */
  390. }
  391. $form['mvquery']= array(
  392. '#type' => 'textarea',
  393. '#title' => t('Query'),
  394. '#description' => t('Please enter the SQL statement used to populate the table.'),
  395. '#required' => TRUE,
  396. '#default_value' => $default_mvquery,
  397. '#rows' => 25,
  398. '#attributes' => array(
  399. 'style' => "font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;",
  400. ),
  401. );
  402. if ($action == 'Edit') {
  403. $value = 'Save';
  404. }
  405. if ($action == 'Add') {
  406. $value = 'Add';
  407. }
  408. $form['submit'] = array(
  409. '#type' => 'submit',
  410. '#value' => t($value),
  411. '#executes_submit_callback' => TRUE,
  412. );
  413. $form['cancel'] = array(
  414. '#type' => 'markup',
  415. '#markup' => l('Cancel', 'admin/tripal/storage/chado/mviews'),
  416. );
  417. return $form;
  418. }
  419. /**
  420. * Validate the Create/Edit Materialized View Form
  421. * Implements hook_form_validate().
  422. */
  423. function tripal_mviews_form_validate($form, &$form_state) {
  424. $action = $form_state['values']['action'];
  425. $mview_id = $form_state['values']['mview_id'];
  426. $name = trim($form_state['values']['name']);
  427. $is_legacy = $form_state['values']['is_legacy'];
  428. $query = $form_state['values']['mvquery'];
  429. // if this is a legacy materialized view (no longer supported in Tripal v2.0
  430. // but code left just in case)
  431. if ($is_legacy) {
  432. $mv_table = trim($form_state['values']['mv_table']);
  433. $mv_specs = $form_state['values']['mv_specs'];
  434. $indexed = $form_state['values']['indexed'];
  435. $special_index = '';//$form_state['values']['special_index'];
  436. }
  437. else {
  438. $mv_table = '';
  439. $mv_specs = '';
  440. $indexed = '';
  441. $special_index = '';
  442. }
  443. $comment = trim($form_state['values']['comment']);
  444. $schema = $form_state['values']['schema'];
  445. // validate the contents of the array
  446. $schema_array = array();
  447. $success = eval("\$schema_array = $schema;");
  448. $error = chado_validate_custom_table_schema($schema_array);
  449. if ($error) {
  450. form_set_error('schema', $error);
  451. }
  452. // if both the schema and the older fields for the legacy view are populated then
  453. // this is an error and we need to let the user know.
  454. if ($schema and ($mv_table or $mv_specs or $indexed or $special_index)) {
  455. form_set_error($form_state['values']['schema'],
  456. t('You can create an MView using the Drupal Schema API method or the ' .
  457. 'traditional method but not both.'));
  458. }
  459. // if we don't have a schema and are missing fields for the legacy views then
  460. // inform the user.
  461. if (!$schema) {
  462. if (!$mv_specs) {
  463. form_set_error($form_state['values']['mv_specs'],
  464. t('The Table Definition field is required.'));
  465. }
  466. if (!$mv_table) {
  467. form_set_error($form_state['values']['mv_table'],
  468. t('The Table Name field is required.'));
  469. }
  470. }
  471. // make sure the array is valid
  472. if ($schema) {
  473. $success = eval("\$schema_array = $schema;");
  474. if ($success === FALSE) {
  475. $error = error_get_last();
  476. form_set_error($form_state['values']['schema'],
  477. t("The schema array is improperly formatted. Parse Error : " . $error["message"]));
  478. }
  479. if (!array_key_exists('table', $schema_array)) {
  480. form_set_error($form_state['values']['schema'],
  481. t("The schema array must have key named 'table'"));
  482. }
  483. // TODO: add in more validation checks of the array to help the user
  484. }
  485. }
  486. /**
  487. * Submit the Create/Edit Materialized View Form
  488. * Implements hook_form_submit().
  489. */
  490. function tripal_mviews_form_submit($form, &$form_state) {
  491. $ret = array();
  492. $action = $form_state['values']['action'];
  493. $mview_id = $form_state['values']['mview_id'];
  494. $name = trim($form_state['values']['name']);
  495. $is_legacy = $form_state['values']['is_legacy'];
  496. $query = $form_state['values']['mvquery'];
  497. $comment = trim($form_state['values']['comment']);
  498. $schema = $form_state['values']['schema'];
  499. $modulename = trim($form_state['values']['modulename']);
  500. $mv_table = '';
  501. $mv_specs = '';
  502. $indexed = '';
  503. $special_index = '';
  504. // if this is a legacy materialized view (no longer supported in Tripal v2.0
  505. // but code left just in case)
  506. if ($is_legacy) {
  507. $mv_table = $form_state['values']['mv_table'];
  508. $mv_specs = $form_state['values']['mv_specs'];
  509. $indexed = $form_state['values']['indexed'];
  510. $special_index = '';//$form_state['values']['special_index'];
  511. }
  512. if (!$modulename) {
  513. $modulename = 'tripal_chado';
  514. }
  515. // if this is an edit action
  516. if (strcmp($action, 'Edit') == 0) {
  517. chado_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
  518. $indexed, $query, $special_index, $comment, $schema);
  519. }
  520. // else an add action
  521. elseif (strcmp($action, 'Add') == 0) {
  522. // convert the schema into a PHP array
  523. $schema_arr = array();
  524. eval("\$schema_arr = $schema;");
  525. tripal_add_mview($name, $modulename, $schema_arr, $query, $comment);
  526. drupal_goto("admin/tripal/storage/chado/mviews");
  527. }
  528. else {
  529. drupal_set_message(t("No action performed."));
  530. }
  531. return '';
  532. }
  533. /**
  534. * Just a simple form for confirming deletion of a custom table
  535. */
  536. function tripal_mviews_delete_form($form, &$form_state, $mview_id) {
  537. // get details about this table entry
  538. $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id";
  539. $results = db_query($sql, array(':mview_id' => $mview_id));
  540. $entry = $results->fetchObject();
  541. $form = array();
  542. $form['mview_id'] = array(
  543. '#type' => 'value',
  544. '#value' => $mview_id
  545. );
  546. $form['sure'] = array(
  547. '#type' => 'markup',
  548. '#markup' => '<p>Are you sure you want to delete the "' . $entry->name . '" materialized view?</p>'
  549. );
  550. $form['submit'] = array(
  551. '#type' => 'submit',
  552. '#value' => 'Delete',
  553. );
  554. $form['cancel'] = array(
  555. '#type' => 'submit',
  556. '#value' => 'Cancel',
  557. );
  558. return $form;
  559. }
  560. /**
  561. * form submit hook for the tripal_custom_tables_delete_form form.
  562. *
  563. * @param $form
  564. * @param $form_state
  565. */
  566. function tripal_mviews_delete_form_submit($form, &$form_state) {
  567. $action = $form_state['clicked_button']['#value'];
  568. $mview_id = $form_state['values']['mview_id'];
  569. if (strcmp($action, 'Delete') == 0) {
  570. chado_delete_mview($mview_id);
  571. }
  572. else {
  573. drupal_set_message(t("No action performed."));
  574. }
  575. drupal_goto("admin/tripal/storage/chado/mviews");
  576. }
  577. /**
  578. * A wrapper for the chado_refresh_mview() API function, which
  579. * then redirects back to the admin page for mviews.
  580. *
  581. * @param $mview_id
  582. */
  583. function tripal_mviews_add_populate_job($mview_id) {
  584. chado_refresh_mview($mview_id);
  585. drupal_goto("admin/tripal/storage/chado/mviews");
  586. }