forked from nigelgbanks/cwrc_workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
islandora_workflow_rest.install
259 lines (251 loc) · 7.69 KB
/
islandora_workflow_rest.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
<?php
/**
* @file
* Hooks for installing/uninstalling this module.
*/
/**
* Implements hook_schema().
*/
function islandora_workflow_rest_schema() {
$schema['islandora_workflow_rest_stamps'] = array(
'description' => 'Table that stores lists of custom workflow stamps.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for a custom stamp.',
),
'stamp' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'The human readable name of the stamp.',
),
'descr' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The description of the current stamp.',
),
),
'primary key' => array('lid'),
);
$schema['islandora_workflow_rest_ds_logs'] = array(
'description' => 'Table that stores Datastream modification logs.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for a ds modification.',
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'Modified, added or deleted.',
),
'usr' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The userID who last touched the data stream.',
),
'dsid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The modified datastream ID.',
),
'delay' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The time, in seconds, where similar events will not be logged.',
),
'pid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The object pid that has been modified.',
),
'object_label' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The label of the modified object.',
),
'timestamp' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'time of modification.',
),
'state' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'State of log entry. Should be new, skipped, or tagged.',
),
'last_stamp' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'Last stamp at time of datastream update.',
),
),
'primary key' => array('lid'),
);
$schema['islandora_workflow_rest_ds_log_admin'] = array(
'description' => 'Table that stores Datastream admin configurations.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for a ds modification.',
),
'dsid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The modified datastream ID.',
),
'delay' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The time, in seconds, that similar events will not be logged.',
),
'pid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The content model pid.',
),
'label' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The content model label.',
),
),
'primary key' => array('lid'),
);
$schema['islandora_workflow_rest_reports'] = array(
'description' => 'Table that stores report queries.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The UID for the report.',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The name of the report.',
),
'project' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The name of the project this report belongs to.',
),
'createdby' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The user the report was created by.',
),
'editroles' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The roles allowed to edit the report.',
),
'viewroles' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'description' => 'The roles allowed to view the report.',
),
'query' => array(
'type' => 'varchar',
'length' => 2047,
'not null' => FALSE,
'description' => 'The solr query which produces the report.',
),
'terms' => array(
'type' => 'varchar',
'length' => 2047,
'not null' => FALSE,
'description' => 'The serialized terms array used to build the solr query.',
),
'solr_terms' => array(
'type' => 'varchar',
'length' => 4095,
'not null' => FALSE,
'description' => 'The serialized solr terms array used to build the display.',
),
),
'primary key' => array('lid'),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function islandora_workflow_rest_uninstall() {
variable_del('workflow_solr_field');
variable_del('islandora_workflow_rest_enable_namespace');
variable_del('islandora_workflow_rest_server_identifier');
}
/**
* Implements hook_install().
*/
function islandora_workflow_rest_install() {
module_load_include('inc', 'islandora_workflow_rest', 'includes/utilities');
module_load_include('inc', 'islandora', 'includes/utilities');
module_load_include('inc', 'islandora_basic_collection', 'includes/utilities');
// Add default stamp records.
$stamps = array(
"niso:AO" => "Author's Original",
"niso:SMUR" => "Manuscript Under Review",
"niso:AM" => "Accepted Manuscript",
"niso:P" => "Proof",
"niso:VoR" => "Version of Record",
"niso:CVoR" => "Corrected Version",
"niso:EVoR" => "Enhanced Version",
"orl:SUB" => "Submitted",
"orl:RWT" => "Researched / Written / Tagged",
"orl:REV" => "Revised",
"orl:RBV" => "Reviewed by Volume Author",
"orl:CAS" => "Checked Against Sources",
"orl:CFT" => "Checked for Tagging",
"orl:CFB" => "Checked for Bibliographic Practices",
"orl:PUB" => "Published",
"orl:ENH" => "Enhanced",
"orl:TC" => "Tag Cleanup",
"orl:PUBR" => "Publication Readthrough",
"cwrc:cre" => "repository item created",
"cwrc:dep" => "repository item deposited",
"cwrc:cvr" => "content edited",
"cwrc:evr" => "content added",
"cwrc:ckd" => "Checked/Corrected",
"cwrc:tag" => "tagged by public",
"cwrc:rights_asg" => "Copyright/license",
"cwrc:pub" => "Undergoing Publishing",
"cwrc:rev" => "Peer-reviewed",
"cwrc:wdr" => "Removed from published state",
"cwrc:del" => "Deleted from the repository",
);
// This hook fires on install.
foreach ($stamps as $key => $value) {
$stamp = islandora_workflow_rest_get_stamp($key);
if (!isset($stamp) || $stamp == "") {
islandora_workflow_rest_set_stamp($key, $value);
}
}
}