blast_ui.node.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * @file
  4. * Contains all functions for creating the blastdb node type
  5. */
  6. function blast_ui_node_info() {
  7. return array(
  8. 'blastdb' => array(
  9. 'name' => t('Blast Database'),
  10. 'base' => 'blastdb',
  11. 'description' => t('Registers a BLAST Database for use with the BLAST UI.'),
  12. ),
  13. );
  14. }
  15. function blastdb_node_access($node, $op, $account) {
  16. $node_type = $node;
  17. if (is_object($node)) {
  18. $node_type = $node->type;
  19. }
  20. if($node_type == 'blastdb') {
  21. if ($op == 'create') {
  22. if (!user_access('create Blast Database', $account)) {
  23. return NODE_ACCESS_DENY;
  24. }
  25. return NODE_ACCESS_ALLOW;
  26. }
  27. if ($op == 'update') {
  28. if (!user_access('edit Blast Database', $account)) {
  29. return NODE_ACCESS_DENY;
  30. }
  31. }
  32. if ($op == 'delete') {
  33. if (!user_access('delete Blast Database', $account)) {
  34. return NODE_ACCESS_DENY;
  35. }
  36. }
  37. if ($op == 'view') {
  38. if (!user_access('access Blast Database', $account)) {
  39. return NODE_ACCESS_DENY;
  40. }
  41. }
  42. return NODE_ACCESS_IGNORE;
  43. }
  44. }
  45. function blastdb_form($node, &$form_state) {
  46. $form = array();
  47. $form['db_name']= array(
  48. '#type' => 'textfield',
  49. '#title' => t('File Name'),
  50. // Add a #description for each field
  51. '#required' => TRUE,
  52. '#default_value' => NULL,
  53. );
  54. $form['db_path']= array(
  55. '#type' => 'textfield',
  56. '#title' => t('File Address'),
  57. '#required' => TRUE,
  58. '#default_value' => NULL,
  59. );
  60. $form['db_common_name']= array(
  61. '#type' => 'textfield',
  62. // this is a description; you want something more succint for a title such as File Name
  63. '#title' => t('Pick a friendly name for your file'),
  64. '#required' => TRUE,
  65. '#default_value' => NULL,
  66. );
  67. return $form;
  68. }