-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdfbulletin.install
198 lines (191 loc) · 5.29 KB
/
pdfbulletin.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
<?php
/**
* @file
* Install, and un-install functions.
*/
/**
* Implementation of hook_schema().
*/
function pdfbulletin_schema() {
$schema = array();
$schema['pdfbulletin_view'] = array(
'description' => 'Views to email with settings',
'fields' => array(
'nid' => array(
'description' => '{node}.nid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => '{node}.vid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0
),
'view_name' => array(
'type' => 'varchar',
'length' => '32',
'default' => '',
'not null' => TRUE,
'description' => 'Unique {views}.name',
),
'display_id' => array(
'type' => 'varchar',
'length' => '64',
'default' => '',
'not null' => TRUE,
'description' => 'Views {views_display}.display_id',
),
'args' => array(
'type' => 'text',
'description' => 'Serialized array of views arguments.',
'serialize' => TRUE,
),
'filters' => array(
'type' => 'text',
'description' => 'Serialized array of views filters.',
'serialize' => TRUE,
),
'header' => array(
'type' => 'text',
'description' => 'Header HTML for the bulletin.',
'not null' => TRUE,
),
'header_format' => array(
'type' => 'int',
'description' => 'The input format used by the header.',
'not null' => TRUE,
'default' => 0
),
'footer' => array(
'type' => 'text',
'description' => 'Footer HTML for the bulletin.',
'not null' => TRUE,
),
'footer_format' => array(
'type' => 'int',
'description' => 'The input format used by the footer.',
'not null' => TRUE,
'default' => 0
),
'email' => array(
'type' => 'text',
'description' => 'Footer HTML for the bulletin.',
'not null' => TRUE,
),
'email_format' => array(
'type' => 'int',
'description' => 'The input format used by the email text.',
'not null' => TRUE,
'default' => 0
),
'empty_text' => array(
'type' => 'text',
'description' => 'Footer HTML for the bulletin.',
'not null' => TRUE,
),
'empty_text_format' => array(
'type' => 'int',
'description' => 'The input format used by the empty text.',
'not null' => TRUE,
'default' => 0
),
'paper_size' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'The name of the paper format for the pdf.',
'not null' => TRUE,
'default' => '',
),
'css_file' => array(
'type' => 'varchar',
'length' => 255,
'description' => 'The filename of the css for the pdf.',
'not null' => TRUE,
'default' => 'basic',
),
),
'primary key' => array('nid'),
'unique keys' => array(
'vid' => array('vid'),
),
'indexes' => array(
'views' => array('view_name', 'display_id')
),
);
$schema['pdfbulletin_schedule'] = array(
'description' => 'Schedule for PDF bulletins',
'fields' => array(
'nid' => array(
'description' => '{pdfbulletin_view}.nid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
// for the moment the frequency is only seconds
'frequency' => array(
'description' => 'Number of seconds between sending bulletins.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 604800,
),
'date' => array(
'description' => 'Unix timestamp for the date time of first bulletin to be sent.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
'send_empty' => array(
'description' => 'Bool if the bulletin should be sent if empty.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'default' => 1,
),
'scheduled' => array(
'description' => 'If the bulletin is or should be scheduled.',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'default' => 1,
),
),
'indexes' => array('nid' => array('nid'), 'scheduled' => array('scheduled')),
);
$schema['pdfbulletin_subs'] = array(
'description' => 'Subscriptions to PDF bulletins',
'fields' => array(
'nid' => array(
'type' => 'int',
'description' => 'Reference {pdfbulletin_view}.nid',
'unsigned' => TRUE,
'not null' => TRUE,
),
'email' => array(
'type' => 'varchar',
'length' => '255',
'default' => '',
'description' => 'Email address of subscriber',
),
),
'indexes' => array('nid' => array('nid'), 'email' => array('email')),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function pdfbulletin_install() {
drupal_install_schema('pdfbulletin');
}
/**
* Implentation of hook_uninstall().
*/
function pdfbulletin_uninstall() {
drupal_uninstall_schema('pdfbulletin');
variable_del('pdfbulletin_pending');
}