| 1 |
<?php |
<?php |
| 2 |
// $Id: jcarousellite_node.install,v 1.1.2.1 2009/03/03 18:12:11 owahab Exp $ |
// $Id: jcarousellite_node.install,v 1.2 2009/03/07 20:41:00 owahab Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file jcarousellite_node.install |
* @file |
| 6 |
|
* jcarousellite_node.install |
| 7 |
* |
* |
| 8 |
* install and update hooks for jcarousellite_node module |
* schema and update hooks for jcarousellite_node module |
| 9 |
*/ |
*/ |
| 10 |
|
|
| 11 |
/** |
/** |
| 12 |
* Implementation of hook_install() |
* Implementation of hook_install(). |
| 13 |
*/ |
*/ |
| 14 |
function jcarousellite_node_install() { |
function jcarousellite_node_install() { |
| 15 |
switch ($GLOBALS['db_type']) { |
drupal_install_schema('jcarousellite_node'); |
| 16 |
case 'mysql': |
drupal_set_message(t('jCarousel Lite Node module has been successfully installed.')); |
|
case 'mysqli': |
|
|
db_query("CREATE TABLE {jcarousellite} ( |
|
|
nid int(10) unsigned NOT NULL default '0', |
|
|
vid int(10) unsigned NOT NULL default '0', |
|
|
jcarousellite_enabled INT(4) NOT NULL DEFAULT 0, |
|
|
jcarousellite_container_class VARCHAR(255) NOT NULL default '', |
|
|
jcarousellite_btnprev_class VARCHAR(255) NOT NULL default '', |
|
|
jcarousellite_btnnext_class VARCHAR(255) NOT NULL default '', |
|
|
jcarousellite_options LONGTEXT NOT NULL default '', |
|
|
PRIMARY KEY (vid) |
|
|
) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
|
|
$success = true; |
|
|
break; |
|
|
|
|
|
case 'pgsql': |
|
|
break; |
|
|
} |
|
|
if ($success) { |
|
|
drupal_set_message(t('jCarousel Lite Node module installed tables successfully.')); |
|
|
} |
|
|
else { |
|
|
drupal_set_message(t('Installation of the jCarousel Lite Node module database tables failed.'), 'error'); |
|
|
} |
|
| 17 |
} |
} |
| 18 |
|
|
| 19 |
/** |
/** |
| 20 |
* Implementation of hook_uninstall() |
* Implementation of hook_uninstall(). |
| 21 |
*/ |
*/ |
| 22 |
function jcarousellite_node_uninstall() { |
function jcarousellite_node_uninstall() { |
| 23 |
db_query('DROP TABLE {jcarousellite}'); |
drupal_uninstall_schema('jcarousellite_node'); |
| 24 |
foreach (node_get_types() as $type => $info) { |
drupal_set_message(t('jCarousel Lite Node module has been successfully uninstalled.')); |
|
variable_del('jcarousellite_'. $type); |
|
|
} |
|
|
drupal_set_message(t('jCarousel Lite Node module successfully uninstalled.')); |
|
| 25 |
} |
} |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
/** |
| 29 |
|
* Implementation of hook_schema(). |
| 30 |
|
*/ |
| 31 |
|
function jcarousellite_node_schema() { |
| 32 |
|
$schema['jcarousellite_node'] = array( |
| 33 |
|
'description' => t('Settings table for jCarousel Lite.'), |
| 34 |
|
'fields' => array( |
| 35 |
|
'nid' => array( |
| 36 |
|
'description' => t('The primary identifier for a node.'), |
| 37 |
|
'type' => 'int', |
| 38 |
|
'size' => 'normal', |
| 39 |
|
'unsigned' => TRUE, |
| 40 |
|
'not null' => TRUE, |
| 41 |
|
'default' => 0), |
| 42 |
|
'vid' => array( |
| 43 |
|
'description' => t('The revision ID for a node.'), |
| 44 |
|
'type' => 'int', |
| 45 |
|
'size' => 'normal', |
| 46 |
|
'unsigned' => TRUE, |
| 47 |
|
'not null' => TRUE, |
| 48 |
|
'default' => 0), |
| 49 |
|
'jcarousellite_enabled' => array( |
| 50 |
|
'description' => t('Stores jCarousel\'s state [enabled/disabled].'), |
| 51 |
|
'type' => 'int', |
| 52 |
|
'size' => 'small', |
| 53 |
|
'unsigned' => FALSE, |
| 54 |
|
'not null' => TRUE, |
| 55 |
|
'default' => 0), |
| 56 |
|
'jcarousellite_container_class' => array( |
| 57 |
|
'description' => t('Class name of the DIV container to be used with jCarousel.'), |
| 58 |
|
'type' => 'varchar', |
| 59 |
|
'length' => 255, |
| 60 |
|
'not null' => TRUE, |
| 61 |
|
'default' => ''), |
| 62 |
|
'jcarousellite_btnprev_class' => array( |
| 63 |
|
'description' => t('Class name of the PREV button to be used with jCarousel.'), |
| 64 |
|
'type' => 'varchar', |
| 65 |
|
'length' => 255, |
| 66 |
|
'not null' => TRUE, |
| 67 |
|
'default' => ''), |
| 68 |
|
'jcarousellite_btnnext_class' => array( |
| 69 |
|
'description' => t('Class name of the NEXT button to be used with jCarousel.'), |
| 70 |
|
'type' => 'varchar', |
| 71 |
|
'length' => 255, |
| 72 |
|
'not null' => TRUE, |
| 73 |
|
'default' => ''), |
| 74 |
|
'jcarousellite_options' => array( |
| 75 |
|
'description' => t('jCarousel specific options.'), |
| 76 |
|
'type' => 'text', |
| 77 |
|
'size' => 'big', |
| 78 |
|
'not null' => TRUE, |
| 79 |
|
'default' => ''), |
| 80 |
|
), |
| 81 |
|
'primary key' => array('vid'), |
| 82 |
|
); |
| 83 |
|
return $schema; |
| 84 |
|
} |
| 85 |
|
|