| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
function simplelist_schema() {
|
| 5 |
$schema = array();
|
| 6 |
|
| 7 |
$schema['simplelist'] = array(
|
| 8 |
'description' => t('The base table to hold simplelist information'),
|
| 9 |
'fields' => array(
|
| 10 |
'slid' => array(
|
| 11 |
'description' => t('The primary identifier for a simplelist.'),
|
| 12 |
'type' => 'serial',
|
| 13 |
'unsigned' => TRUE,
|
| 14 |
'not null' => TRUE),
|
| 15 |
'name' => array(
|
| 16 |
'description' => t('Technical name for the simplelist.'),
|
| 17 |
'type' => 'varchar',
|
| 18 |
'length' => 128,
|
| 19 |
'not null' => TRUE,
|
| 20 |
'default' => ''),
|
| 21 |
'description' => array(
|
| 22 |
'description' => t('Description of the simplelist, for admin use'),
|
| 23 |
'type' => 'text',
|
| 24 |
'default' => ''),
|
| 25 |
'access' => array(
|
| 26 |
'description' => t('Which roles can access this node.'),
|
| 27 |
'type' => 'varchar',
|
| 28 |
'length' => 255),
|
| 29 |
'filter_name' => array(
|
| 30 |
'description' => t('Which filter class to load for this simplelist'),
|
| 31 |
'type' => 'varchar',
|
| 32 |
'length' => 255),
|
| 33 |
'filter_data' => array(
|
| 34 |
'description' => t('Filter-specific data store'),
|
| 35 |
'type' => 'varchar',
|
| 36 |
'length' => 511),
|
| 37 |
'sort_name' => array(
|
| 38 |
'description' => t('Sort field data'),
|
| 39 |
'type' => 'varchar',
|
| 40 |
'length' => 255),
|
| 41 |
'sort_data' => array(
|
| 42 |
'description' => t('dunno yet'),
|
| 43 |
'type' => 'varchar',
|
| 44 |
'length' => 255),
|
| 45 |
'cache' => array(
|
| 46 |
'description' => t('Indicates if block is cached and how'),
|
| 47 |
'type' => 'int',
|
| 48 |
'default' => BLOCK_CACHE_PER_PAGE,
|
| 49 |
'not null' => TRUE),
|
| 50 |
'published' => array(
|
| 51 |
'description' => t('Indicates if this list will show all nodes, only published ones, or only unpublished ones.'),
|
| 52 |
'type' => 'int',
|
| 53 |
'default' => 1, // Only published is default.
|
| 54 |
'not null' => TRUE),
|
| 55 |
),
|
| 56 |
'primary key' => array('slid'),
|
| 57 |
'unique keys' => array(
|
| 58 |
'name' => array('name'),
|
| 59 |
),
|
| 60 |
);
|
| 61 |
|
| 62 |
$schema['simplelist_types'] = array(
|
| 63 |
'description' => t('This table holds simplelist node type information'),
|
| 64 |
'fields' => array(
|
| 65 |
'slid' => array(
|
| 66 |
'description' => t('The primary identifier for a simplelist.'),
|
| 67 |
'type' => 'int',
|
| 68 |
'unsigned' => TRUE,
|
| 69 |
'not null' => TRUE),
|
| 70 |
'node_type' => array(
|
| 71 |
'description' => t('Node type to be included in list.'),
|
| 72 |
'type' => 'varchar',
|
| 73 |
'length' => 32,
|
| 74 |
'not null' => TRUE),
|
| 75 |
),
|
| 76 |
'primary key' => array('slid', 'node_type'),
|
| 77 |
);
|
| 78 |
|
| 79 |
$schema['simplelist_terms'] = array(
|
| 80 |
'description' => t('This table holds simplelist node type information'),
|
| 81 |
'fields' => array(
|
| 82 |
'slid' => array(
|
| 83 |
'description' => t('The primary identifier for a simplelist.'),
|
| 84 |
'type' => 'int',
|
| 85 |
'unsigned' => TRUE,
|
| 86 |
'not null' => TRUE),
|
| 87 |
'tid' => array(
|
| 88 |
'description' => t('Taxonomy terms to be included in list.'),
|
| 89 |
'type' => 'int',
|
| 90 |
'not null' => TRUE),
|
| 91 |
),
|
| 92 |
'primary key' => array('slid', 'tid'),
|
| 93 |
);
|
| 94 |
|
| 95 |
$schema['simplelist_display'] = array(
|
| 96 |
'description' => t('This table holds data describing how a simplelist is displayed in different contexts'),
|
| 97 |
'fields' => array(
|
| 98 |
'sldid' => array(
|
| 99 |
'description' => t('Primary key for the table'),
|
| 100 |
'type' => 'serial',
|
| 101 |
'unsigned' => TRUE,
|
| 102 |
'not null' => TRUE),
|
| 103 |
'slid' => array(
|
| 104 |
'description' => t('Link back to parent simplelist'),
|
| 105 |
'type' => 'int',
|
| 106 |
'not null' => TRUE),
|
| 107 |
'display_name' => array(
|
| 108 |
'description' => t('Class of Display code to use'),
|
| 109 |
'type' => 'varchar',
|
| 110 |
'length' => 255),
|
| 111 |
'display_context' => array(
|
| 112 |
'description' => t('Type of display - page, block, etc.'),
|
| 113 |
'type' => 'varchar',
|
| 114 |
'length' => 255),
|
| 115 |
'display_title' => array(
|
| 116 |
'description' => t('Title to display'),
|
| 117 |
'type' => 'varchar',
|
| 118 |
'length' => 255,
|
| 119 |
'default' => '',
|
| 120 |
'not null' => TRUE),
|
| 121 |
'display_count' => array(
|
| 122 |
'description' => t('Number of items to display'),
|
| 123 |
'type' => 'int',
|
| 124 |
'default' => 10,
|
| 125 |
'not null' => TRUE),
|
| 126 |
'display_pager' => array(
|
| 127 |
'description' => t('Indicates if pager is displayed'),
|
| 128 |
'type' => 'int',
|
| 129 |
'size' => 'tiny',
|
| 130 |
'default' => 1,
|
| 131 |
'not null' => TRUE),
|
| 132 |
'display_more' => array(
|
| 133 |
'description' => t('Indicates if \'more\' link is displayed'),
|
| 134 |
'type' => 'int',
|
| 135 |
'size' => 'tiny',
|
| 136 |
'default' => 1,
|
| 137 |
'not null' => TRUE),
|
| 138 |
'display_format' => array(
|
| 139 |
'description' => t('Format for displaying nodes'),
|
| 140 |
'type' => 'int',
|
| 141 |
'size' => 'tiny',
|
| 142 |
'default' => 0,
|
| 143 |
'not null' => TRUE),
|
| 144 |
'display_path' => array(
|
| 145 |
'description' => t('Path for display/arguments'),
|
| 146 |
'type' => 'varchar',
|
| 147 |
'length' => 255),
|
| 148 |
),
|
| 149 |
'primary key' => array('sldid'),
|
| 150 |
'unique keys' => array(
|
| 151 |
'context' => array('slid', 'display_context'),
|
| 152 |
),
|
| 153 |
'indexes' => array(
|
| 154 |
'slid' => array('slid'),
|
| 155 |
),
|
| 156 |
);
|
| 157 |
|
| 158 |
return $schema;
|
| 159 |
}
|
| 160 |
|
| 161 |
function simplelist_install() {
|
| 162 |
drupal_install_schema('simplelist');
|
| 163 |
drupal_set_message("Simplelist module is now installed. Define simplelists at !link",
|
| 164 |
array('!link' => l('Administer > Site building > Simplelist', 'admin/build/simplelist')));
|
| 165 |
}
|
| 166 |
|
| 167 |
function simplelist_uninstall() {
|
| 168 |
drupal_uninstall_schema('simplelist');
|
| 169 |
}
|