<?php
// $Id: gallery_assist_4cviewer.install,v 1.0 2009/11/10 11:46:00 jcmc Exp $

/**
 * @file
 * Make the needed changes in Gallery Assist to work with Cooliris.
 * The Cooliris assigment is for Gallery Assist or content types with gallery assigment.
 * You can assign it to each content type with Gallery Assist assigment and enabled on each node of this content type.
 */

/**
 * Implementation of hook_install().
 */
function gallery_assist_4cviewer_install() {

  $gallery_assist_4cviewer_default_data = array(
    't_cooliris_method'           => 'piclens',
    't_cooliris_float'            => 'left',
    't_cooliris_width'            => '300',
    't_cooliris_height'           => '',
    't_cooliris_backgroundColor'  => '#FFFFFF',
    't_cooliris_showSearch'       => FALSE,
    't_cooliris_showEmbed'        => FALSE,
    't_cooliris_numRows'          => 2,
    'p_cooliris_method'           => 'embed',
    'p_cooliris_float'            => 'none',
    'p_cooliris_width'            => '100%',
    'p_cooliris_height'           => '400',
    'p_cooliris_backgroundColor'  => '#FFFFFF',
    'p_cooliris_showSearch'       => FALSE,
    'p_cooliris_showEmbed'        => FALSE,
    'p_cooliris_numRows'          => 3,
  );

  variable_set('gallery_assist_4cviewer_default_data', $gallery_assist_4cviewer_default_data);
  
  $sql = "ALTER TABLE {gallery_assist} ADD `cooliris` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `data`, ADD `cooliris_conf` LONGTEXT NOT NULL AFTER `cooliris` ";
  
  db_query($sql);

}

/**
 * Implementation of hook_uninstall().
 */
function gallery_assist_4cviewer_uninstall() {
  // Delete the Cooliris columns.
  $sql = "ALTER TABLE {gallery_assist} IF EXISTS DROP `cooliris`, DROP `cooliris_conf`";
  @db_query($sql);
  
  // Delete the Cooliris columns.
  variable_del('gallery_assist_4cviewer_default_data');
  
  // Delete all Gallery Assist Cooliris settings variables.
  db_query("DELETE FROM {variable} WHERE name LIKE 'gallery_assist_4cviewer\_%'", $string);
  db_query("DELETE FROM {variable} WHERE name LIKE '%\_cooliris'", $string);
}
