-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwysiwyg_imageupload.install
177 lines (164 loc) · 5.1 KB
/
wysiwyg_imageupload.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
<?php
// $Id$
// Copyright (c) 2010 KontextWork GbR
// Author: Eugen Mayer
/**
* Implementation of hook_install().
*/
function wysiwyg_imageupload_install() {
drupal_install_schema('wysiwyg_imageupload');
_wysiwyg_imageupload_install_styles_if_missing();
}
/**
* Implementation of hook_uninstall().
*/
function wysiwyg_imageupload_uninstall() {
// Remove tables.
drupal_uninstall_schema('wysiwyg_imageupload');
// Remove variables.
db_query("DELETE FROM {variable} WHERE name LIKE 'wysiwyg_imageupload_%%'");
}
function _wysiwyg_imageupload_install_styles_if_missing() {
$value = variable_get('wysiwyg_imageupload_imgstyles', FALSE);
if ($value == FALSE) {
variable_set('wysiwyg_imageupload_imgstyles', 'Spacing 20px Border=imgupl_styles_spacing_20_black_border\n\rBlack Border=imgupl_styles_black_border\n\rSpacing 5px=imgupl_styles_spacing_5\n\rSpacing 10px=imgupl_styles_spacing_10');
}
}
/**
* Implementation of hook_schema().
*/
function wysiwyg_imageupload_schema() {
$schema = array();
_wysiwyg_imageupload_inline_table($schema);
return $schema;
}
function _wysiwyg_imageupload_inline_table(&$schema) {
$schema['wysiwyg_imageupload_entity'] = array(
'description' => 'Stores the inline arguments for a specific image used inline',
'fields' => array(
'iid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The inline ID of the field, defined by the database.',
'no export' => TRUE,
),
'fid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {files}.fid.',
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {node}.nid associated with the uploaded file.',
),
'cid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {comment}.cid associated with the uploaded file.',
),
'temporary' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Is this file temporary.',
),
'imagecache' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Current selected imagecache preset',
),
'style' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Current selected style to show the image with.',
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Image title.',
),
'alignment' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Defines the alignment of the image',
),
),
'primary key' => array('iid')
);
$schema['wysiwyg_imageupload_entity_revision'] = array(
'description' => 'Stores the inline arguments for a specific image used inline',
'fields' => array(
'iid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The inline ID of the field, defined by the database.',
'no export' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {node}.vid associated with the uploaded file.',
),
),
'primary key' => array('vid', 'iid'),
'indexes' => array(
'iid' => array('iid'),
'vid' => array('vid'),
),
);
}
function wysiwyg_imageupload_update_6200() {
$schema = array();
_wysiwyg_imageupload_inline_table($schema);
$ret = array();
db_create_table($ret, 'wysiwyg_imageupload_entity', $schema['wysiwyg_imageupload_entity']);
db_create_table($ret, 'wysiwyg_imageupload_entity_revision', $schema['wysiwyg_imageupload_entity_revision']);
return $ret;
}
function wysiwyg_imageupload_update_6201() {
$value = variable_get('wysiwyg_imageupload_imgstyles', FALSE);
if ($value !== FALSE) {
variable_set('wysiwyg_imageupload_imgstyles', str_replace(';', "\r", $value));
}
return array();
}
/**
* Enable drupalwiki_imageselect_element.
*/
function wysiwyg_imageupload_update_6202() {
$ret = array();
if (!module_exists('drupalwiki_imageselect_element')) {
drupal_install_modules(array('drupalwiki_imageselect_element'));
if (!module_exists('drupalwiki_imageselect_element')) {
$ret['#abort'] = array('#success' => 'FALSE', 'query' => 'Can not enable drupalwiki_imageselect_element module.');
}
}
return $ret;
}
function wysiwyg_imageupload_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
require_once('wysiwyg_imageupload.module');
}
return $requirements;
}