/[drupal]/contributions/modules/pageear/pageear.install
ViewVC logotype

Contents of /contributions/modules/pageear/pageear.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (show annotations) (download) (as text)
Thu Nov 5 16:04:02 2009 UTC (2 weeks, 5 days ago) by manfer
Branch: MAIN
Changes since 1.14: +13 -1 lines
File MIME type: text/x-php
Changed by manfer: Dropped current pageear persistent variables.
Changed by manfer: No more use of hook_footer, all done on init.
1 <?php
2 // $Id: pageear.install,v 1.14 2009/11/02 14:06:19 manfer Exp $
3
4 /**
5 * @file
6 * Install file.
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function pageear_install() {
13
14 $result = drupal_install_schema('pageear');
15
16 if ($result[0]['success']) {
17 // Insert an example pageear
18 $sql = "INSERT INTO {pageears} (status, name, peelPosition, smallURL, bigURL, mirror, inTransition, transitionDuration, peelColor, redValue, greenValue, blueValue, linkTarget, link, loadSoundURL, openSoundURL, closeSoundURL, flagSpeed, peelSpeed, automaticOpen, automaticClose, close_button_enable, text_on_close_button, close_redValue, close_greenValue, close_blueValue, languages, roles, visibility, pages, flagWidth, flagHeight, peelWidth, peelHeight, flagStyle, peelStyle, peelColorStyle, weight, linkEnabled, peelPositionModel, waitEnable, waitURL, waitWidth, waitHeight)";
19 $sql .= " VALUES ('%d', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d')";
20 $result = db_query($sql,
21 array(
22 ':status' => 0,
23 ':name' => 'drupal',
24 ':peelPosition' => 'topright',
25 ':smallURL' => drupal_get_path('module', 'pageear') .'/pageturn/small.jpg',
26 ':bigURL' => drupal_get_path('module', 'pageear') .'/pageturn/big.jpg',
27 ':mirror' => 1,
28 ':inTransition' => 'Squeeze',
29 ':transitionDuration' => 4,
30 ':peelColor' => 'custom',
31 ':redValue' => 255,
32 ':greenValue' => 255,
33 ':blueValue' => 255,
34 ':linkTarget' => '_blank',
35 ':link' => 'http://www.drupal.org/',
36 ':loadSoundURL' => '',
37 ':openSoundURL' => '',
38 ':closeSoundURL' => '',
39 ':flagSpeed' => 4,
40 ':peelSpeed' => 4,
41 ':automaticOpen' => 0,
42 ':automaticClose' => 0,
43 ':close_button_enable' => 0,
44 ':text_on_close_button' => 'close',
45 ':close_redValue' => 100,
46 ':close_greenValue' => 100,
47 ':close_blueValue' => 100,
48 ':languages' => '',
49 ':roles' => '',
50 ':visibility' => 0,
51 ':pages' => '',
52 ':flagWidth' => 100,
53 ':flagHeight' => 100,
54 ':peelWidth' => 500,
55 ':peelHeight' => 500,
56 ':flagStyle' => 'style1',
57 ':peelStyle' => 'style1',
58 ':peelColorStyle' => 'gradient',
59 ':weight' => 0,
60 ':linkEnabled' => 1,
61 ':peelPositionModel' => 'absolute',
62 ':waitEnable' => 0,
63 ':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif',
64 ':waitWidth' => 42,
65 ':waitHeight' => 42
66 ));
67
68 }
69 }
70
71
72 /**
73 * Implementation of hook_enable().
74 */
75 function pageear_enable() {
76 // Update the persistent variable numEnabledPageears that tracks number of pageears enabled
77 variable_set('numEnabledPageears', 0);
78 }
79
80 /**
81 * Implementation of hook_disable().
82 */
83 function pageear_disable() {
84 // Disable all enabled pageears if the module is disabled.
85 db_query("UPDATE {pageears} SET status = 0 WHERE status = 1");
86
87 // Update the persistent variable numEnabledPageears that tracks number of pageears enabled
88 variable_set('numEnabledPageears', 0);
89 }
90
91 /**
92 * Deletes images and sounds used by pageears.
93 */
94 function delete_all_images_sounds() {
95
96 $directory_path = file_directory_path() .'/'. PAGEEAR_PATH_IMAGES;
97 // if the directory where files reside does not exists nothing to do
98 if (!file_check_directory($directory_path)) {
99 return;
100 }
101
102 $result = db_query("SELECT p.peid FROM {pageears} p");
103 while ($row = db_fetch_object($result)) {
104
105 foreach (array('waitURL', 'smallURL', 'bigURL', 'loadSoundURL', 'openSoundURL', 'closeSoundURL') as $image_sound) {
106
107 if ($image_sound == 'waitURL' || $image_sound == 'smallURL' || $image_sound == 'bigURL') {
108 $extensions = array('.jpg', '.jpeg', '.gif', '.png', '.swf');
109 }
110 else {
111 $extensions = array('.mp3');
112 }
113
114 foreach ($extensions as $extension) {
115
116 $filename = $directory_path .'/'. $image_sound .'_'. $row->peid;
117 $filepath = $filename . $extension;
118 file_delete($filepath);
119
120 $i = 0;
121 $filepath = $filename .'_'. $i . $extension;
122 while (file_delete($filepath)) {
123 $i += 1;
124 $filepath = $filename .'_'. $i . $extension;
125 }
126
127 }
128
129 }
130
131 }
132
133 }
134
135 /**
136 * Implementation of hook_uninstall().
137 */
138 function pageear_uninstall() {
139 // Delete all images and sounds used by pageear
140 delete_all_images_sounds();
141 // Delete persistent variables.
142 variable_del('numEnabledPageears');
143 variable_del('current_pageear');
144 variable_del('current_topleft_pageear');
145 variable_del('current_topright_pageear');
146 // Drop the associated schema(s).
147 drupal_uninstall_schema('pageear');
148 }
149
150 /**
151 * Implementation of hook_schema().
152 */
153 function pageear_schema() {
154 $schema['pageears'] = array(
155 'description' => 'Stores pageear settings.',
156 'fields' => array(
157 'peid' => array(
158 'type' => 'serial',
159 'not null' => TRUE,
160 'description' => 'Primary Key: Unique pageear ID.',
161 ),
162 'weight' => array(
163 'type' => 'int',
164 'not null' => TRUE,
165 'default' => 0,
166 'size' => 'tiny',
167 ),
168 'status' => array(
169 'type' => 'int',
170 'not null' => TRUE,
171 'default' => 0,
172 'size' => 'tiny',
173 'description' => 'Pageear enabled status. (1 = enabled, 0 = disabled).',
174 ),
175 'name' => array(
176 'type' => 'varchar',
177 'length' => 64,
178 'not null' => TRUE,
179 'default' => 'Sample Pageear',
180 'description' => 'Name of the pageear. The name will be added to the pageear class to enable custom theming.',
181 ),
182 'flagStyle' => array(
183 'type' => 'varchar',
184 'length' => 7,
185 'not null' => TRUE,
186 'default' => 'style1',
187 'description' => 'Style of flag.',
188 ),
189 'peelStyle' => array(
190 'type' => 'varchar',
191 'length' => 7,
192 'not null' => TRUE,
193 'default' => 'style1',
194 'description' => 'Style of peel.',
195 ),
196 'peelPosition' => array(
197 'type' => 'varchar',
198 'length' => 9,
199 'not null' => TRUE,
200 'default' => 'topright',
201 'description' => 'Position of pageear. In left or right top browser corner (topleft: left, topright: right).',
202 ),
203 'peelPositionModel' => array(
204 'type' => 'varchar',
205 'length' => 9,
206 'not null' => TRUE,
207 'default' => 'absolute',
208 'description' => 'Position Model of pageear. (absolute or fixed).',
209 ),
210 'waitEnable' => array(
211 'type' => 'int',
212 'not null' => TRUE,
213 'default' => 0,
214 'size' => 'tiny',
215 'description' => 'Wait icon enabled status. (1 = enabled, 0 = disabled).',
216 ),
217 'waitURL' => array(
218 'type' => 'varchar',
219 'length' => 255,
220 'not null' => TRUE,
221 'default' => '',
222 'description' => 'URL of the image to show while the ad is loading.',
223 ),
224 'waitWidth' => array(
225 'type' => 'int',
226 'unsigned' => TRUE,
227 'not null' => TRUE,
228 'default' => 42,
229 'size' => 'normal',
230 'description' => 'Width of wait icon.',
231 ),
232 'waitHeight' => array(
233 'type' => 'int',
234 'unsigned' => TRUE,
235 'not null' => TRUE,
236 'default' => 42,
237 'size' => 'normal',
238 'description' => 'Height of wait icon.',
239 ),
240 'flagWidth' => array(
241 'type' => 'int',
242 'unsigned' => TRUE,
243 'not null' => TRUE,
244 'default' => 100,
245 'size' => 'normal',
246 'description' => 'Width of flag.',
247 ),
248 'flagHeight' => array(
249 'type' => 'int',
250 'unsigned' => TRUE,
251 'not null' => TRUE,
252 'default' => 100,
253 'size' => 'normal',
254 'description' => 'Height of flag.',
255 ),
256 'peelWidth' => array(
257 'type' => 'int',
258 'unsigned' => TRUE,
259 'not null' => TRUE,
260 'default' => 500,
261 'size' => 'normal',
262 'description' => 'Width of peel.',
263 ),
264 'peelHeight' => array(
265 'type' => 'int',
266 'unsigned' => TRUE,
267 'not null' => TRUE,
268 'default' => 500,
269 'size' => 'normal',
270 'description' => 'Height of peel.',
271 ),
272 'smallURL' => array(
273 'type' => 'varchar',
274 'length' => 255,
275 'not null' => TRUE,
276 'default' => '',
277 'description' => 'URL of the image to show when the ad is not peeled.',
278 ),
279 'bigURL' => array(
280 'type' => 'varchar',
281 'length' => 255,
282 'not null' => TRUE,
283 'default' => '',
284 'description' => 'URL of the image to show when the ad is peeled.',
285 ),
286 'mirror' => array(
287 'type' => 'int',
288 'not null' => TRUE,
289 'default' => 1,
290 'size' => 'tiny',
291 'description' => 'Mirror the ad on the back of the peeled page. (1 = enabled, 0 = disabled).',
292 ),
293 'inTransition' => array(
294 'type' => 'varchar',
295 'length' => 15,
296 'not null' => TRUE,
297 'default' => 'none',
298 'description' => 'In Transition when pageear is loaded.',
299 ),
300 'transitionDuration' => array(
301 'type' => 'int',
302 'unsigned' => TRUE,
303 'not null' => TRUE,
304 'default' => 4,
305 'size' => 'tiny',
306 'description' => 'Duration of in transition.',
307 ),
308 'peelColorStyle' => array(
309 'type' => 'varchar',
310 'length' => 9,
311 'not null' => TRUE,
312 'default' => 'gradient',
313 'description' => 'The color on peel can be a flat color or a gradient.',
314 ),
315 'peelColor' => array(
316 'type' => 'varchar',
317 'length' => 7,
318 'not null' => TRUE,
319 'default' => 'custom',
320 'description' => 'If the mirror effect is disabled, this color will be used on the back.',
321 ),
322 'redValue' => array(
323 'type' => 'int',
324 'unsigned' => TRUE,
325 'not null' => TRUE,
326 'default' => 255,
327 'size' => 'tiny',
328 'description' => 'Red value of Custom Color for the Peel (0 - 255).',
329 ),
330 'greenValue' => array(
331 'type' => 'int',
332 'unsigned' => TRUE,
333 'not null' => TRUE,
334 'default' => 255,
335 'size' => 'tiny',
336 'description' => 'Green value of Custom Color for the Peel (0 - 255).',
337 ),
338 'blueValue' => array(
339 'type' => 'int',
340 'unsigned' => TRUE,
341 'not null' => TRUE,
342 'default' => 255,
343 'size' => 'tiny',
344 'description' => 'Blue value of Custom Color for the Peel (0 - 255).',
345 ),
346 'linkEnabled' => array(
347 'type' => 'int',
348 'not null' => TRUE,
349 'default' => 1,
350 'size' => 'tiny',
351 'description' => 'Enabled or disabled link. (1 = enabled, 0 = disabled).',
352 ),
353 'linkTarget' => array(
354 'type' => 'varchar',
355 'length' => 7,
356 'not null' => TRUE,
357 'default' => '_blank',
358 'description' => 'Where to open the URL.',
359 ),
360 'link' => array(
361 'type' => 'varchar',
362 'length' => 255,
363 'not null' => TRUE,
364 'default' => 'http://www.drupal.org/',
365 'description' => 'URL to go when user click on the ad.',
366 ),
367 'loadSoundURL' => array(
368 'type' => 'varchar',
369 'length' => 255,
370 'not null' => TRUE,
371 'default' => '',
372 'description' => 'URL of mp3 file to play when the ad is loaded.',
373 ),
374 'openSoundURL' => array(
375 'type' => 'varchar',
376 'length' => 255,
377 'not null' => TRUE,
378 'default' => '',
379 'description' => 'URL of mp3 file to play when the peel is opened.',
380 ),
381 'closeSoundURL' => array(
382 'type' => 'varchar',
383 'length' => 255,
384 'not null' => TRUE,
385 'default' => '',
386 'description' => 'URL of mp3 file to play when the peel is closed.',
387 ),
388 'flagSpeed' => array(
389 'type' => 'int',
390 'unsigned' => TRUE,
391 'not null' => TRUE,
392 'default' => 4,
393 'size' => 'tiny',
394 'description' => 'Speed for the motion in the unpeeled state.',
395 ),
396 'peelSpeed' => array(
397 'type' => 'int',
398 'unsigned' => TRUE,
399 'not null' => TRUE,
400 'default' => 4,
401 'size' => 'tiny',
402 'description' => 'Speed for the motion in the peeled state.',
403 ),
404 'automaticOpen' => array(
405 'type' => 'int',
406 'unsigned' => TRUE,
407 'not null' => TRUE,
408 'default' => 0,
409 'size' => 'normal',
410 'description' => 'Millisecons to unpeel automatically after the pageear loads.',
411 ),
412 'automaticClose' => array(
413 'type' => 'int',
414 'unsigned' => TRUE,
415 'not null' => TRUE,
416 'default' => 0,
417 'size' => 'normal',
418 'description' => 'Millisecons to automatically close after unpeeling.',
419 ),
420 'close_button_enable' => array(
421 'type' => 'int',
422 'not null' => TRUE,
423 'default' => 0,
424 'size' => 'tiny',
425 'description' => 'Show a close button on open peel.',
426 ),
427 'text_on_close_button' => array(
428 'type' => 'varchar',
429 'length' => 20,
430 'not null' => TRUE,
431 'default' => 'close',
432 'description' => 'Text on clickable close button.',
433 ),
434 'close_redValue' => array(
435 'type' => 'int',
436 'unsigned' => TRUE,
437 'not null' => TRUE,
438 'default' => 255,
439 'size' => 'tiny',
440 'description' => 'Color red value of close button (0 - 255).',
441 ),
442 'close_greenValue' => array(
443 'type' => 'int',
444 'unsigned' => TRUE,
445 'not null' => TRUE,
446 'default' => 255,
447 'size' => 'tiny',
448 'description' => 'Color green value of close button (0 - 255).',
449 ),
450 'close_blueValue' => array(
451 'type' => 'int',
452 'unsigned' => TRUE,
453 'not null' => TRUE,
454 'default' => 255,
455 'size' => 'tiny',
456 'description' => 'Color blue value of close button (0 - 255).',
457 ),
458 'languages' => array(
459 'type' => 'varchar',
460 'length' => 255,
461 'not null' => TRUE,
462 'default' => '',
463 'description' => 'The language visibility of the pageear. Comma separated string of language names.',
464 ),
465 'roles' => array(
466 'type' => 'varchar',
467 'length' => 255,
468 'not null' => TRUE,
469 'default' => '',
470 'description' => 'The role visibility of the pageear. Comma separated string of role ids (rid).',
471 ),
472 'visibility' => array(
473 'type' => 'int',
474 'not null' => TRUE,
475 'default' => 0,
476 'size' => 'tiny',
477 'description' => 'Flag to indicate how to show pageears on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)',
478 ),
479 'pages' => array(
480 'type' => 'text',
481 'not null' => TRUE,
482 'description' => 'Contents of the "Pages" textarea; contains either a list of paths on which to include/exclude the pageear or PHP code, depending on "visibility" setting.',
483 ),
484 ),
485 'primary key' => array('peid'),
486 'indexes' => array(
487 'list' => array('status'),
488 ),
489 );
490
491 return $schema;
492 }
493
494 /**
495 * Creates pageears table and inserts sample pageear.
496 */
497 function pageear_update_6200() {
498
499 if (!db_table_exists('pageears')) {
500 $result = drupal_install_schema('pageear');
501
502 if ($result[0]['success']) {
503 // Insert an example pageear
504 $sql = "INSERT INTO {pageears} (status, name, peelPosition, smallURL, bigURL, mirror, inTransition, transitionDuration, peelColor, redValue, greenValue, blueValue, linkTarget, link, loadSoundURL, openSoundURL, closeSoundURL, flagSpeed, peelSpeed, automaticOpen, automaticClose, close_button_enable, text_on_close_button, close_redValue, close_greenValue, close_blueValue, languages, roles, visibility, pages, flagWidth, flagHeight, peelWidth, peelHeight, flagStyle, peelStyle, peelColorStyle, weight, linkEnabled, peelPositionModel, waitEnable, waitURL, waitWidth, waitHeight)";
505 $sql .= " VALUES ('%d', '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d')";
506 $insert_result = db_query($sql,
507 array(
508 ':status' => 0,
509 ':name' => 'drupal',
510 ':peelPosition' => 'topright',
511 ':smallURL' => drupal_get_path('module', 'pageear') .'/pageturn/small.jpg',
512 ':bigURL' => drupal_get_path('module', 'pageear') .'/pageturn/big.jpg',
513 ':mirror' => 1,
514 ':inTransition' => 'Squeeze',
515 ':transitionDuration' => 4,
516 ':peelColor' => 'custom',
517 ':redValue' => 255,
518 ':greenValue' => 255,
519 ':blueValue' => 255,
520 ':linkTarget' => '_blank',
521 ':link' => 'http://www.drupal.org/',
522 ':loadSoundURL' => '',
523 ':openSoundURL' => '',
524 ':closeSoundURL' => '',
525 ':flagSpeed' => 4,
526 ':peelSpeed' => 4,
527 ':automaticOpen' => 0,
528 ':automaticClose' => 0,
529 ':close_button_enable' => 0,
530 ':text_on_close_button' => 'close',
531 ':close_redValue' => 100,
532 ':close_greenValue' => 100,
533 ':close_blueValue' => 100,
534 ':languages' => '',
535 ':roles' => '',
536 ':visibility' => 0,
537 ':pages' => '',
538 ':flagWidth' => 100,
539 ':flagHeight' => 100,
540 ':peelWidth' => 500,
541 ':peelHeight' => 500,
542 ':flagStyle' => 'style1',
543 ':peelStyle' => 'style1',
544 ':peelColorStyle' => 'gradient',
545 ':weight' => 0,
546 ':linkEnabled' => 1,
547 ':peelPositionModel' => 'absolute',
548 ':waitEnable' => 0,
549 ':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif',
550 ':waitWidth' => 42,
551 ':waitHeight' => 42
552 ));
553
554 if ($insert_result) {
555 $ret['#success'] = array('success' => TRUE);
556 }
557 else {
558 $ret['#abort'] = array('success' => FALSE, 'query' => 'example pageear insertion failed');
559 }
560 }
561 else {
562 $ret['#abort'] = array('success' => FALSE, 'query' => 'pageears table installation failed');
563 }
564
565 return $ret;
566 }
567
568 $ret['#success'] = array('success' => TRUE);
569 return $ret;
570
571 }
572
573 /**
574 * Sets persistent variable numEnabledPageears.
575 */
576 function pageear_update_6201() {
577
578 $ret = array();
579 $num_active = db_result(db_query("SELECT COUNT(*) FROM {pageears} WHERE status = 1"));
580 variable_set('numEnabledPageears', (int)$num_active);
581 $ret['#success'] = array('success' => TRUE);
582 return $ret;
583
584 }
585
586 /**
587 * Adds flagWidth, flagHeight, peelWidth, peelHeight columns to pageears table.
588 */
589 function pageear_update_6210() {
590
591 $ret = array();
592 // This check is necesary because on an update from 6.x-1.x versions of module
593 // these columns are created on update_6200
594 if (!db_column_exists('pageears', 'flagWidth')) {
595 db_add_field($ret, 'pageears', 'flagWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 100, 'size' => 'normal', 'description' => 'Width of flag.'));
596 db_add_field($ret, 'pageears', 'flagHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 100, 'size' => 'normal', 'description' => 'Height of flag.'));
597 db_add_field($ret, 'pageears', 'peelWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 500, 'size' => 'normal', 'description' => 'Width of peel.'));
598 db_add_field($ret, 'pageears', 'peelHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 500, 'size' => 'normal', 'description' => 'Height of peel.'));
599 }
600 else {
601 $ret['#success'] = array('success' => TRUE);
602 }
603 return $ret;
604
605 }
606
607 /**
608 * Adds flagStyle, peelStyle, peelColorStyle columns to pageears table.
609 */
610 function pageear_update_6211() {
611
612 $ret = array();
613 // This check is necesary because on an update from 6.x-1.x versions of module
614 // these columns are created on update_6200
615 if (!db_column_exists('pageears', 'flagStyle')) {
616 db_add_field($ret, 'pageears', 'flagStyle', array('type' => 'varchar', 'length' => 7, 'not null' => TRUE, 'default' => 'style1', 'description' => 'Style of flag.'));
617 db_add_field($ret, 'pageears', 'peelStyle', array('type' => 'varchar', 'length' => 7, 'not null' => TRUE, 'default' => 'style1', 'description' => 'Style of peel.'));
618 db_add_field($ret, 'pageears', 'peelColorStyle', array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => 'gradient', 'description' => 'The color on peel can be a flat color or a gradient.'));
619 }
620 else {
621 $ret['#success'] = array('success' => TRUE);
622 }
623 return $ret;
624
625 }
626
627 /**
628 * Adds weight column to pageears table.
629 */
630 function pageear_update_6212() {
631
632 $ret = array();
633 // This check is necesary because on an update from 6.x-1.x versions of module
634 // these columns are created on update_6200
635 if (!db_column_exists('pageears', 'weight')) {
636 db_add_field($ret, 'pageears', 'weight', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0));
637 }
638 else {
639 $ret['#success'] = array('success' => TRUE);
640 }
641 return $ret;
642
643 }
644
645 /**
646 * Adds sites column to pageears table.
647 */
648 function pageear_update_6213() {
649
650 $ret = array();
651 // This check is necesary because on an update from 6.x-1.x versions of module
652 // these columns are created on update_6200
653 if (!db_column_exists('pageears', 'sites')) {
654 db_add_field($ret, 'pageears', 'sites', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'The sites visibility of the pageear. Comma separated string of site names.'));
655 }
656 else {
657 $ret['#success'] = array('success' => TRUE);
658 }
659 return $ret;
660
661 }
662
663 /**
664 * Adds linkEnabled column to pageears table.
665 */
666 function pageear_update_6214() {
667
668 $ret = array();
669 // This check is necesary because on an update from 6.x-1.x versions of module
670 // these columns are created on update_6200
671 if (!db_column_exists('pageears', 'linkEnabled')) {
672 db_add_field($ret, 'pageears', 'linkEnabled', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1, 'description' => 'Enabled or disabled link. (1 = enabled, 0 = disabled).'));
673 }
674 else {
675 $ret['#success'] = array('success' => TRUE);
676 }
677 return $ret;
678
679 }
680
681 /**
682 * Drops sites column from pageears table and deletes current_pageear persistent
683 * variable.
684 */
685 function pageear_update_6215() {
686
687 $ret = array();
688
689 db_drop_field($ret, 'pageears', 'sites');
690 variable_del('current_pageear');
691 $ret['#success'] = array('success' => TRUE);
692
693 return $ret;
694
695 }
696
697 /**
698 * Adds peelPositionModel column to pageears table.
699 */
700 function pageear_update_6216() {
701
702 $ret = array();
703 // This check is necesary because on an update from 6.x-1.x versions of module
704 // these columns are created on update_6200
705 if (!db_column_exists('pageears', 'peelPositionModel')) {
706 db_add_field($ret, 'pageears', 'peelPositionModel', array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => 'absolute', 'description' => 'Position Model of pageear. (absolute or fixed).'));
707 }
708 else {
709 $ret['#success'] = array('success' => TRUE);
710 }
711 return $ret;
712
713 }
714
715 /**
716 * Adds waitEnable, waitURL, waitWidth, waitHeight columns to pageears table.
717 */
718 function pageear_update_6217() {
719
720 $ret = array();
721 // This check is necesary because on an update from 6.x-1.x versions of module
722 // these columns are created on update_6200
723 if (!db_column_exists('pageears', 'waitEnable')) {
724 db_add_field($ret, 'pageears', 'waitEnable', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny', 'description' => 'Wait icon enabled status. (1 = enabled, 0 = disabled).'));
725 db_add_field($ret, 'pageears', 'waitURL', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'Height of flag.'));
726 db_add_field($ret, 'pageears', 'waitWidth', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 42, 'size' => 'normal', 'description' => 'URL of the image to show while the ad is loading.'));
727 db_add_field($ret, 'pageears', 'waitHeight', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 42, 'size' => 'normal', 'description' => 'Height of wait icon.'));
728 db_query("UPDATE {pageears} SET waitURL = '%s'", array(':waitURL' => drupal_get_path('module', 'pageear') .'/pageturn/wait.gif'));
729 }
730 else {
731 $ret['#success'] = array('success' => TRUE);
732 }
733 return $ret;
734
735 }
736
737 function pageear_update_6218() {
738
739 $ret = array();
740 variable_del('current_topleft_pageear');
741 variable_del('current_topright_pageear');
742 $ret['#success'] = array('success' => TRUE);
743 return $ret;
744
745 }

  ViewVC Help
Powered by ViewVC 1.1.2