| webmaster@1 | 1 <?php | 
| webmaster@1 | 2 // $Id: contact.install,v 1.10 2007/12/18 12:59:21 dries Exp $ | 
| webmaster@1 | 3 | 
| webmaster@1 | 4 /** | 
| webmaster@1 | 5  * Implementation of hook_install(). | 
| webmaster@1 | 6  */ | 
| webmaster@1 | 7 function contact_install() { | 
| webmaster@1 | 8   // Create tables. | 
| webmaster@1 | 9   drupal_install_schema('contact'); | 
| webmaster@1 | 10 } | 
| webmaster@1 | 11 | 
| webmaster@1 | 12 /** | 
| webmaster@1 | 13  * Implementation of hook_uninstall(). | 
| webmaster@1 | 14  */ | 
| webmaster@1 | 15 function contact_uninstall() { | 
| webmaster@1 | 16   // Remove tables. | 
| webmaster@1 | 17   drupal_uninstall_schema('contact'); | 
| webmaster@1 | 18 | 
| webmaster@1 | 19   variable_del('contact_default_status'); | 
| webmaster@1 | 20   variable_del('contact_form_information'); | 
| webmaster@1 | 21   variable_del('contact_hourly_threshold'); | 
| webmaster@1 | 22 } | 
| webmaster@1 | 23 | 
| webmaster@1 | 24 /** | 
| webmaster@1 | 25  * Implementation of hook_schema(). | 
| webmaster@1 | 26  */ | 
| webmaster@1 | 27 function contact_schema() { | 
| webmaster@1 | 28   $schema['contact'] = array( | 
| webmaster@1 | 29     'description' => t('Contact form category settings.'), | 
| webmaster@1 | 30     'fields' => array( | 
| webmaster@1 | 31       'cid' => array( | 
| webmaster@1 | 32         'type' => 'serial', | 
| webmaster@1 | 33         'unsigned' => TRUE, | 
| webmaster@1 | 34         'not null' => TRUE, | 
| webmaster@1 | 35         'description' => t('Primary Key: Unique category ID.'), | 
| webmaster@1 | 36       ), | 
| webmaster@1 | 37       'category' => array( | 
| webmaster@1 | 38         'type' => 'varchar', | 
| webmaster@1 | 39         'length' => 255, | 
| webmaster@1 | 40         'not null' => TRUE, | 
| webmaster@1 | 41         'default' => '', | 
| webmaster@1 | 42         'description' => t('Category name.'), | 
| webmaster@1 | 43       ), | 
| webmaster@1 | 44       'recipients' => array( | 
| webmaster@1 | 45         'type' => 'text', | 
| webmaster@1 | 46         'not null' => TRUE, | 
| webmaster@1 | 47         'size' => 'big', | 
| webmaster@1 | 48         'description' => t('Comma-separated list of recipient e-mail addresses.'), | 
| webmaster@1 | 49       ), | 
| webmaster@1 | 50       'reply' => array( | 
| webmaster@1 | 51         'type' => 'text', | 
| webmaster@1 | 52         'not null' => TRUE, | 
| webmaster@1 | 53         'size' => 'big', | 
| webmaster@1 | 54         'description' => t('Text of the auto-reply message.'), | 
| webmaster@1 | 55       ), | 
| webmaster@1 | 56       'weight' => array( | 
| webmaster@1 | 57         'type' => 'int', | 
| webmaster@1 | 58         'not null' => TRUE, | 
| webmaster@1 | 59         'default' => 0, | 
| webmaster@1 | 60         'size' => 'tiny', | 
| webmaster@1 | 61         'description' => t("The category's weight."), | 
| webmaster@1 | 62       ), | 
| webmaster@1 | 63       'selected' => array( | 
| webmaster@1 | 64         'type' => 'int', | 
| webmaster@1 | 65         'not null' => TRUE, | 
| webmaster@1 | 66         'default' => 0, | 
| webmaster@1 | 67         'size' => 'tiny', | 
| webmaster@1 | 68         'description' => t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'), | 
| webmaster@1 | 69       ), | 
| webmaster@1 | 70     ), | 
| webmaster@1 | 71     'primary key' => array('cid'), | 
| webmaster@1 | 72     'unique keys' => array( | 
| webmaster@1 | 73       'category' => array('category'), | 
| webmaster@1 | 74     ), | 
| webmaster@1 | 75     'indexes' => array( | 
| webmaster@1 | 76       'list' => array('weight', 'category'), | 
| webmaster@1 | 77     ), | 
| webmaster@1 | 78   ); | 
| webmaster@1 | 79 | 
| webmaster@1 | 80   return $schema; | 
| webmaster@1 | 81 } |