tripal_panes.install 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. /**
  3. * Implements hook_schema().
  4. */
  5. function tripal_panes_schema() {
  6. $schema = array();
  7. $schema['tripal_panes'] = array(
  8. 'description' => 'The list of panes into which fields can be placed.',
  9. 'fields' => array(
  10. 'pane_id' => array(
  11. 'description' => 'The primary identifier for this table.',
  12. 'type' => 'serial',
  13. 'unsigned' => TRUE,
  14. 'not null' => TRUE,
  15. ),
  16. 'bundle_id' => array(
  17. 'description' => 'A bundle ID from the tripal_bundle table.',
  18. 'type' => 'int',
  19. 'not null' => TRUE,
  20. ),
  21. 'name' => array(
  22. 'description' => 'The computer readable name for the pane. This name must only have alphanumerical characters and underscores and must not begin with a number. ',
  23. 'type' => 'varchar',
  24. 'length' => 128,
  25. 'not null' => TRUE,
  26. 'default' => '',
  27. ),
  28. 'label' => array(
  29. 'description' => 'A human readable name for pane. This name will be shown to users in the sidebar menu.',
  30. 'type' => 'varchar',
  31. 'length' => 128,
  32. 'not null' => TRUE,
  33. 'default' => '',
  34. ),
  35. 'settings' => array(
  36. 'description' => 'Contains a serialized array tripal_panesof settings for the pane.',
  37. 'type' => 'text',
  38. 'not null' => FALSE,
  39. ),
  40. 'weight' => array(
  41. 'type' => 'int',
  42. 'not null' => FALSE,
  43. 'default' => 0
  44. ),
  45. ),
  46. 'indexes' => array(
  47. 'bundle_id' => array('bundle_id'),
  48. ),
  49. 'unique keys' => array(
  50. 'bundle_pane' => array('bundle_id', 'name'),
  51. ),
  52. 'foreign keys' => array(
  53. 'tripal_bundle' => array(
  54. 'table' => 'tripal_bundle',
  55. 'columns' => array(
  56. 'bundle_id' => 'id',
  57. ),
  58. ),
  59. ),
  60. 'primary key' => array('pane_id'),
  61. );
  62. $schema['tripal_pane_fields'] = array(
  63. 'description' => 'The list of panes into which fields can be placed.',
  64. 'fields' => array(
  65. 'pane_field_id' => array(
  66. 'description' => 'The primary identifier for this table.',
  67. 'type' => 'serial',
  68. 'unsigned' => TRUE,
  69. 'not null' => TRUE,
  70. ),
  71. 'pane_id' => array(
  72. 'description' => 'The primary identifier for this table.',
  73. 'type' => 'int',
  74. 'not null' => TRUE,
  75. ),
  76. 'field_id' => array(
  77. 'description' => 'A bundle ID from the tripal_bundle table.',
  78. 'type' => 'int',
  79. 'not null' => TRUE,
  80. ),
  81. 'css_class' => array(
  82. 'description' => 'CSS classes assigned to this field. Class names are separated by a semi-colon',
  83. 'type' => 'text'
  84. )
  85. ),
  86. 'indexes' => array(
  87. 'pane_id' => array('pane_id'),
  88. 'field_id' => array('field_id'),
  89. ),
  90. 'unique keys' => array(
  91. 'pane_field' => array('pane_id', 'field_id'),
  92. ),
  93. 'foreign keys' => array(
  94. 'tripal_pane' => array(
  95. 'table' => 'tripal_pane',
  96. 'columns' => array(
  97. 'pane_id' => 'pane_id',
  98. ),
  99. ),
  100. 'field_config' => array(
  101. 'table' => 'field_config',
  102. 'columns' => array(
  103. 'field_id' => 'id',
  104. ),
  105. ),
  106. ),
  107. 'primary key' => array('pane_field_id'),
  108. );
  109. return $schema;
  110. }
  111. /**
  112. *
  113. */
  114. function tripal_add_tripal_bundle_panes_table(){
  115. $schema = array (
  116. 'table' => 'tripal_bundle_panes',
  117. 'fields' => array (
  118. 'pane_id' => array (
  119. 'type' => 'serial',
  120. 'not null' => TRUE
  121. ),
  122. 'bundle_id' => array(
  123. 'type' => 'int',
  124. 'not null' => TRUE
  125. ),
  126. 'name' => array (
  127. 'type' => 'varchar',
  128. 'length' => 128,
  129. 'not null' => TRUE
  130. ),
  131. 'weight' => array (
  132. 'type' => 'int',
  133. 'not null' => TRUE
  134. ),
  135. 'settings' => array(
  136. 'type' => 'text'
  137. ),
  138. ),
  139. 'primary key' => array (
  140. 0 => 'pane_id'
  141. ),
  142. 'foreign keys' => array (
  143. 'tripal_bundle' => array (
  144. 'table' => 'tripal_bundle',
  145. 'columns' => array (
  146. 'bundle_id' => 'bundle_id'
  147. ),
  148. ),
  149. ),
  150. 'unique keys' => array (
  151. 'tripal_bundle_panes_name' => array ('name'),
  152. ),
  153. 'indexes' => array(
  154. 'tripal_bundle_panes_bundle_id' => array('bundle_id'),
  155. ),
  156. );
  157. chado_create_custom_table('tripal_bundle_panes', $schema, TRUE);
  158. }
  159. function tripal_panes_update_7203() {
  160. module_load_include('module', 'tripal_ws', 'tripal_ws');
  161. tripal_ws_test();
  162. }
  163. /**
  164. * Implementation of hook_update_dependencies().
  165. *
  166. * It specifies a list of other modules whose updates must be run prior to
  167. * this one. It also ensures the the Tripal API is in scope for site
  168. * upgrades when tripal is disabled.
  169. */
  170. function tripal_panes_update_dependencies() {
  171. // Make sure we have the full API loaded this will help during a
  172. // site upgrade when the tripal_core module is disabled.
  173. //module_load_include('module', 'tripal', 'tripal');
  174. //tripal_import_api();
  175. print "HI!!!\n";
  176. module_load_include('module', 'tripal_ws', 'tripal_ws');
  177. $dependencies = array();
  178. return $dependencies;
  179. }