View source
<?php
function image_hotspots_schema() {
$schema['image_hotspot'] = array(
'description' => 'Stores data for image hotspots.',
'fields' => array(
'hid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique hotspot ID.',
),
'fid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: File ID that contains hotspots.',
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
),
'coordinates' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'The hotspots data (JSON).',
),
),
'primary key' => array(
'hid',
'fid',
),
);
return $schema;
}
function image_hotspots_update_7000() {
db_add_index('image_hotspot', 'hid', array(
'hid',
));
db_drop_primary_key('image_hotspot');
$spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
);
db_add_field('image_hotspot', 'language', $spec);
db_add_primary_key('image_hotspot', array(
'hid',
'fid',
'language',
));
db_drop_index('image_hotspot', 'hid');
}
function image_hotspots_install() {
$default_opacity = '0.3';
$default_colors = array(
'6666FF',
'66CCCC',
'FF3366',
'FF3300',
'FFFF66',
'33FF66',
'99FF66',
'FFCC99',
'9966FF',
'33CCFF',
);
$default_hotspots = array();
foreach ($default_colors as $color) {
$default_hotspots[] = array(
'background-color' => $color,
'opacity' => $default_opacity,
);
}
variable_set('image_hotspots_settings', $default_hotspots);
}
function image_hotspots_uninstall() {
variable_del('image_hotspot_fields');
variable_del('image_hotspots_settings');
}