-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnodequeue.install
284 lines (273 loc) · 8.11 KB
/
nodequeue.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php
/**
* @file
* Install, update and uninstall functions for the nodequeue module.
*/
/**
* Implements hook_schema().
*/
function nodequeue_schema() {
$schema['nodequeue_queue'] = array(
'description' => 'Base table for queues, storing global information for each queue',
'fields' => array(
'qid' => array(
'description' => 'The primary identifier for a queue.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'name' => array(
'description' => 'The machine name for the queue.',
'type' => 'varchar',
'length' => 128,
),
'title' => array(
'description' => 'Title of a queue.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'subqueue_title' => array(
'description' => 'Title of a subqueue.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'size' => array(
'description' => 'How many nodes this queue will hold',
'type' => 'int',
'default' => 0,
),
'link' => array(
'description' => 'The link text to show under a node to add it to the queue.',
'type' => 'varchar',
'length' => 40,
),
'link_remove' => array(
'description' => 'The link text to show under a node to remove it from the queue.',
'type' => 'varchar',
'length' => 40,
),
'owner' => array(
'description' => '',
'type' => 'varchar',
'length' => 255,
),
'show_in_ui' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 1,
),
'show_in_tab' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 1,
),
'show_in_links' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 1,
),
'reference' => array(
'description' => '',
'type' => 'varchar',
'length' => 255,
'default' => '0',
),
'reverse' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 0,
),
'insert_at_front' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 0,
),
'i18n' => array(
'description' => '',
'type' => 'int',
'size' => 'tiny',
'default' => 1,
),
), // fields
'primary key' => array('qid'),
'unique keys' => array(
'name' => array('name'),
),
); // nodequeue_queue.
$schema['nodequeue_roles'] = array(
'description' => 'Defines the roles which are allowed to use a particular nodequeue.',
'fields' => array(
'qid' => array(
'description' => 'Primary key for {nodequeue_queue}',
'type' => 'int',
'size' => 'big',
'unsigned' => TRUE,
'not null' => TRUE,
),
'role' => array(
'description' => 'Primary key for roles',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
), // fields
'indexes' => array(
'qid' => array('qid'),
'role' => array('role'),
), // indexes
); // nodequeue_roles
$schema['nodequeue_types'] = array(
'description' => 'Defines the node types which are allowed in each queue',
'fields' => array(
'qid' => array(
'description' => 'Primary key for {nodequeue_queue}',
'type' => 'int',
'size' => 'big',
'unsigned' => TRUE,
'not null' => TRUE
),
'type' => array(
'description' => 'Node Type',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE
),
), // fields
'indexes' => array(
'qid' => array('qid'),
'type' => array('type'),
), // indexes
); // nodequeue_types
// Subqueues are minor queues that inherit all of the properties of
// the parent queue. A parent queue must have at least 1 subqueue
// to do anything. Reference is for the use of whatever is creating
// the subqueues in order to link it to some other ID easily.
$schema['nodequeue_subqueue'] = array(
'description' => 'Subqueues are minor queues that inherit all of the properties of the parent queue. A parent queue must have at least 1 subqueue to do anything. Reference is for the use of whatever is creating the subqueues in order to link it to some other ID easily.',
'fields' => array(
'sqid' => array(
'description' => 'Subqueue identifier',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'qid' => array(
'description' => 'Queue identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'reference' => array(
'description' => '',
'type' => 'varchar',
'length' => 255,
'default' => '0',
'not null' => FALSE
),
'title' => array(
'description' => '',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE
),
), // fields
'primary key' => array('sqid'),
'indexes' => array(
'qid' => array('qid'),
'reference' => array('reference'),
'title' => array('title'),
), // indexes
); // nodequeue_subqueue
$schema['nodequeue_nodes'] = array(
'description' => 'Indicates which nodes are in which queues/subqueues.',
'fields' => array(
'qid' => array(
'description' => 'Queue id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'sqid' => array(
'description' => 'Subqueue this node is in',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'Node id in this subqueue',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE
),
'position' => array(
'description' => 'The position of the node in this subqueue.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE
),
'timestamp' => array(
'description' => "The time that the item's position in the subqueue was updated.",
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
), // fields
'indexes' => array(
'sqid' => array('sqid', 'position'),
'nid' => array('nid'),
'qid_nid' => array('qid', 'nid'),
), // indexes
); // nodequeue_nodes
return $schema;
}
/**
* Converts variables to config.
*/
function nodequeue_update_1000() {
// Convert variables to config.
$config = config('nodequeue.settings');
$config->set('use_tab', update_variable_get('nodequeue_use_tab', 1));
$config->set('tab_name', update_variable_get('nodequeue_tab_name', 'Queue'));
$config->set('autocomplete_limit', update_variable_get('nodequeue_autocomplete_limit', 10));
$config->set('view_per_queue', update_variable_get('nodequeue_view_per_queue', 1));
$config->set('show_contextual_links', update_variable_get('nodequeue_show_contextual_links', 0));
$config->save();
// Delete old variables.
variable_del('nodequeue_use_tab');
variable_del('nodequeue_tab_name');
variable_del('nodequeue_autocomplete_limit');
variable_del('nodequeue_view_per_queue');
variable_del('nodequeue_show_contextual_links');
}
/**
* Adds a column for Role Name.
*/
function nodequeue_update_1001() {
db_drop_primary_key('nodequeue_roles');
db_change_field('nodequeue_roles', 'rid', 'role',
array(
'description' => 'Primary key for roles',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
array('primary key' => array('qid', 'role')));
}
/**
* Converts the node links setting from varaible to config.
*/
function nodequeue_update_1002() {
// Convert this variable we missed.
config_set('nodequeue.settings', 'node_links', update_variable_get('nodequeue_links', FALSE));
// Delete old variables.
variable_del('nodequeue_links');
}