| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
//////////////////////////////////////////////////////////////////////////////
|
| 5 |
// Core API hooks
|
| 6 |
|
| 7 |
/**
|
| 8 |
* Implementation of hook_enable().
|
| 9 |
*/
|
| 10 |
function exhibit_enable() {
|
| 11 |
drupal_set_message(t('Exhibit successfully installed. Please review the available <a href="@settings">configuration settings</a>.', array('@settings' => url('admin/settings/exhibit'))));
|
| 12 |
}
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Implementation of hook_install().
|
| 16 |
*/
|
| 17 |
function exhibit_install() {
|
| 18 |
drupal_install_schema('exhibit');
|
| 19 |
|
| 20 |
// Default options: Promoted to front page = No
|
| 21 |
variable_set('node_options_exhibit', array('status'));
|
| 22 |
// Default comment setting: Disabled
|
| 23 |
variable_set('comment_exhibit', '0');
|
| 24 |
}
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Implementation of hook_uninstall().
|
| 28 |
*/
|
| 29 |
function exhibit_uninstall() {
|
| 30 |
drupal_uninstall_schema('exhibit');
|
| 31 |
}
|
| 32 |
|
| 33 |
//////////////////////////////////////////////////////////////////////////////
|
| 34 |
// Schema API hooks
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Implementation of hook_schema().
|
| 38 |
*/
|
| 39 |
function exhibit_schema() {
|
| 40 |
return array(
|
| 41 |
'exhibit_feeds' => array(
|
| 42 |
'description' => t('Stores exhibit data feed information.'),
|
| 43 |
'fields' => array(
|
| 44 |
'fid' => array(
|
| 45 |
'description' => t("The data feed's unique ID (primary key)."),
|
| 46 |
'type' => 'serial',
|
| 47 |
'unsigned' => TRUE,
|
| 48 |
'not null' => TRUE,
|
| 49 |
),
|
| 50 |
'module' => array(
|
| 51 |
'description' => t("The module providing the data feed."),
|
| 52 |
'type' => 'varchar',
|
| 53 |
'length' => 64,
|
| 54 |
'default' => '',
|
| 55 |
),
|
| 56 |
'title' => array(
|
| 57 |
'description' => t("The data feed's title."),
|
| 58 |
'type' => 'varchar',
|
| 59 |
'length' => 255,
|
| 60 |
'default' => '',
|
| 61 |
),
|
| 62 |
'enabled' => array(
|
| 63 |
'description' => t("The data feed's enabled status (1 = enabled, 0 = disabled)"),
|
| 64 |
'type' => 'int',
|
| 65 |
'not null' => TRUE,
|
| 66 |
'default' => 1,
|
| 67 |
'size' => 'tiny',
|
| 68 |
),
|
| 69 |
'cache' => array(
|
| 70 |
'description' => t("Binary flag to indicate the data feed's caching mode. (0 = Do not cache, 1 = Cache per role, 2 = Cache per user, 4 = Cache globally)"),
|
| 71 |
'type' => 'int',
|
| 72 |
'not null' => TRUE,
|
| 73 |
'default' => 0,
|
| 74 |
'size' => 'tiny',
|
| 75 |
),
|
| 76 |
'type' => array(
|
| 77 |
'description' => t("The data feed's MIME type."),
|
| 78 |
'type' => 'varchar',
|
| 79 |
'length' => 64,
|
| 80 |
'default' => '',
|
| 81 |
),
|
| 82 |
'url' => array(
|
| 83 |
'description' => t("The data feed's URL."),
|
| 84 |
'type' => 'text',
|
| 85 |
),
|
| 86 |
),
|
| 87 |
'primary key' => array('fid'),
|
| 88 |
),
|
| 89 |
'exhibit_nodes' => array(
|
| 90 |
'description' => t('Stores exhibit node data.'),
|
| 91 |
'fields' => array(
|
| 92 |
'nid' => array(
|
| 93 |
'description' => t("The node's ID from {node}.nid."),
|
| 94 |
'type' => 'int',
|
| 95 |
'unsigned' => TRUE,
|
| 96 |
'not null' => TRUE,
|
| 97 |
'default' => 0,
|
| 98 |
),
|
| 99 |
'vid' => array(
|
| 100 |
'description' => t("The node's version ID from {node}.vid."),
|
| 101 |
'type' => 'int',
|
| 102 |
'unsigned' => TRUE,
|
| 103 |
'not null' => TRUE,
|
| 104 |
'default' => 0,
|
| 105 |
),
|
| 106 |
'feeds' => array(
|
| 107 |
'description' => t("The exhibit's data feed IDs, as a comma-separated list."),
|
| 108 |
'type' => 'varchar',
|
| 109 |
'length' => 255,
|
| 110 |
'default' => '',
|
| 111 |
),
|
| 112 |
'definition' => array(
|
| 113 |
'description' => t("The exhibit's XHTML definition."),
|
| 114 |
'type' => 'text',
|
| 115 |
'size' => 'big',
|
| 116 |
),
|
| 117 |
'facet_definition' => array(
|
| 118 |
'description' => t("The exhibit's facet definition."),
|
| 119 |
'type' => 'text',
|
| 120 |
'size' => 'big',
|
| 121 |
),
|
| 122 |
),
|
| 123 |
'primary key' => array('nid', 'vid'),
|
| 124 |
),
|
| 125 |
);
|
| 126 |
}
|
| 127 |
|
| 128 |
/**
|
| 129 |
* Adds a facet definition field to the {exhibit_nodes} table.
|
| 130 |
*/
|
| 131 |
function exhibit_update_6001() {
|
| 132 |
db_add_field($ret, 'exhibit_nodes',
|
| 133 |
'facet_definition',
|
| 134 |
array(
|
| 135 |
'description' => t("The exhibit's facet definition."),
|
| 136 |
'type' => 'text',
|
| 137 |
'size' => 'big',
|
| 138 |
)
|
| 139 |
);
|
| 140 |
return array();
|
| 141 |
}
|