View source
<?php
function better_messages_install() {
db_query("UPDATE {system} SET weight = 9999 WHERE name = 'better_messages'");
_better_messages_insert_default_settings();
}
function better_messages_schema() {
$schema['better_messages'] = array(
'description' => 'Better Messages settings table.',
'fields' => array(
'name' => array(
'description' => 'Better Messages skin machine name.',
'type' => 'varchar',
'length' => 128,
),
'data' => array(
'description' => 'The settings of the Better Messages skin.',
'type' => 'blob',
'size' => 'normal',
),
),
'unique keys' => array(
'name' => array(
'name',
),
),
'primary key' => array(
'name',
),
);
return $schema;
}
function better_messages_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'better_messages%'");
db_query("DELETE FROM {system} WHERE name = 'better_messages'");
}
function _better_messages_insert_default_settings() {
$default_settings = _better_messages_default_settings();
$fb_settings = $default_settings;
$fb_settings['admin']['title'] = t('Facebook style');
$fb_settings['admin']['css'] = drupal_get_path('module', 'better_messages') . '/skins/facebook_style/skin.css';
$fb_style = array(
'name' => 'facebook_style',
'data' => serialize($fb_settings),
);
drupal_write_record('better_messages', $fb_style);
$so_settings = $default_settings;
$so_settings['admin']['title'] = t('Stackoverflow style');
$so_settings['admin']['css'] = drupal_get_path('module', 'better_messages') . '/skins/stackoverflow_style/skin.css';
$so_settings['placement']['pos_x'] = 'l';
$so_settings['placement']['pos_y'] = 't';
$so_settings['placement']['width'] = '100%';
$so_settings['animation']['popin']['effect'] = 'slideDown';
$so_settings['animation']['popout']['effect'] = 'slideUp';
$so_style = array(
'name' => 'stackoverflow_style',
'data' => serialize($so_settings),
);
drupal_write_record('better_messages', $so_style);
$growl_settings = $default_settings;
$growl_settings['admin']['title'] = t('Growl style');
$growl_settings['admin']['css'] = drupal_get_path('module', 'better_messages') . '/skins/growl_style/skin.css';
$growl_settings['placement']['pos_x'] = 'r';
$growl_settings['placement']['pos_y'] = 't';
$growl_settings['placement']['space_x'] = '20';
$growl_settings['placement']['space_y'] = '20';
$growl_settings['placement']['width'] = '300px';
$growl_style = array(
'name' => 'growl_style',
'data' => serialize($growl_settings),
);
drupal_write_record('better_messages', $growl_style);
variable_set('better_messages_default', 'facebook_style');
}
function _better_messages_default_settings() {
return array(
'placement' => array(
'pos_x' => 'center',
'pos_y' => 'center',
'space_x' => 0,
'space_y' => 0,
'width' => '400px',
'fixed' => 1,
),
'animation' => array(
'popin' => array(
'effect' => 'fadeIn',
'easing' => 'easeOutExpo',
'duration' => 'slow',
'opendelay' => 0.3,
),
'popout' => array(
'effect' => 'fadeOut',
'easing' => 'easeOutExpo',
'duration' => 'slow',
'autoclose' => array(
'seconds' => 8,
'show_countdown' => 1,
'disable_autoclose_error' => 1,
'disable_autoclose_hover' => 1,
),
),
),
'jquery_ui' => array(
'draggable' => 0,
),
'admin' => array(
'visibility' => array(
'visibility' => 0,
'pages' => '',
),
'title' => '',
'css' => '',
'storage' => 'system',
),
);
}