/[drupal]/contributions/modules/admin_message/admin_message.install
ViewVC logotype

Contents of /contributions/modules/admin_message/admin_message.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Fri Mar 6 03:02:41 2009 UTC (8 months, 3 weeks ago) by ultimateboy
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +74 -24 lines
File MIME type: text/x-php
#289299 by ultimateboy: initial port to d6
1 <?php
2 // $Id$
3 /**
4 * @file
5 * Database Schema for admin_menu.module
6 */
7
8 /**
9 * Implementation of hook_schema().
10 */
11 function admin_message_schema() {
12 $schema['admin_message'] = array(
13 'description' => t('TODO'),
14 'fields' => array(
15 'nid' => array(
16 'description' => t('TODO'),
17 'type' => 'int',
18 'size' => 'small',
19 'not null' => TRUE,
20 'default' => 0,
21 ),
22 'keep_new' => array(
23 'description' => t('TODO'),
24 'type' => 'int',
25 'size' => 'tiny',
26 'not null' => TRUE,
27 'default' => 0,
28 ),
29 'php_visibility' => array(
30 'description' => t('TODO'),
31 'type' => 'text',
32 'size' => 'small',
33 'not null' => TRUE,
34 'default' => '',
35 ),
36 ),
37 'primary key' => array('nid'),
38 );
39 $schema['admin_message_close'] = array(
40 'description' => t('TODO'),
41 'fields' => array(
42 'nid' => array(
43 'description' => t('TODO'),
44 'type' => 'int',
45 'size' => 'small',
46 'not null' => TRUE,
47 'default' => 0,
48 ),
49 'uid' => array(
50 'description' => t('TODO'),
51 'type' => 'int',
52 'size' => 'small',
53 'not null' => TRUE,
54 'default' => 0,
55 ),
56 ),
57 'primary key' => array('nid, uid'),
58 );
59 return $schema;
60 }
61
62 function admin_message_install() {
63
64 drupal_install_schema('admin_message');
65
66
67 // Create default content type
68 $type = array(
69 'type' => 'admin_message',
70 'name' => t('Admin message'),
71 'module' => 'node',
72 'description' => t('Use admin messages to display messages, usually status messages or similar to logged in users.'),
73 'body_label' => t('Message'),
74 'custom' => TRUE,
75 'modified' => TRUE,
76 'locked' => FALSE,
77 );
78 $type = (object) _node_type_set_defaults($type);
79 $status = node_type_save($type);
80 // Set to published and sticky as default for content type.
81 variable_set('node_options_'. $type->type , array('status', 'sticky'));
82 // Disable comments for this content type.
83 variable_set('comment_'. $type->type, '0');
84
85 drupal_set_message(t('<em>Admin message</em> was installed. Enable the block "Admin messages" to display messages to users.'));
86
87 if ($status == SAVED_UPDATED) {
88 drupal_set_message(t('The content type %name has been updated.', array('%name' => $type->name)));
89 }
90 elseif ($status == SAVED_NEW) {
91 drupal_set_message(t('The content type %name has been added - use it to create messages.', array('%name' => $type->name)));
92 }
93
94 }
95
96 /**
97 * Implementation of hook_uninstall().
98 */
99 function admin_message_uninstall() {
100 drupal_uninstall_schema('admin_message');
101
102 }

  ViewVC Help
Powered by ViewVC 1.1.2