Project

General

Profile

« Previous | Next » 

Revision 4e698c80

Added by Wouter Addink over 11 years ago

  • ID 4e698c80b8d423e6f70fa10edabc0aa7b2ba3ef5
  • Parent 3e3a571c

Migrated D7 install profile, not yet working!

View differences:

.gitattributes
1321 1321
7.x/modules/cdm_dataportal/js/thickbox/thickbox.js -text
1322 1322
7.x/modules/cdm_dataportal/node_types.php -text
1323 1323
7.x/modules/cdm_dataportal/pom.xml -text
1324
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.info -text
1325
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.install -text
1324 1326
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.profile -text
1325 1327
7.x/modules/cdm_dataportal/profile/CDM_DataPortal_Testing/CDM_DataPortal_Testing.profile -text
1326 1328
7.x/modules/cdm_dataportal/settings.php -text
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.info
1
name = CDM DataPortal
2
description = CDM DataPortal installation profile.
3
version = 7.x-3.0
4
core = 7.x
5

  
6
;Core modules.
7
dependencies[] = block
8
dependencies[] = color
9
dependencies[] = comment
10
dependencies[] = contextual
11
dependencies[] = help
12
dependencies[] = image
13
dependencies[] = list
14
dependencies[] = menu
15
dependencies[] = number
16
dependencies[] = options
17
dependencies[] = path
18
dependencies[] = taxonomy
19
dependencies[] = dblog
20
dependencies[] = search
21
dependencies[] = shortcut
22
dependencies[] = toolbar
23
dependencies[] = overlay
24
dependencies[] = field_ui
25
dependencies[] = file
26
dependencies[] = rdf
27

  
28
;Contributed modules.
29
dependencies[] = admin_menu
30

  
31
;Custom CDM modules.
32
;dependencies[] = cdm_api
33
;dependencies[] = cdm_taxontree
34
;dependencies[] = cdm_dataportal
35
;dependencies[] = ext_links
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.install
1
<?php
2
/**
3
 * @file
4
 * Install, update and uninstall functions for CDM_DataPortal install profile.
5
 */
6

  
7
/**
8
 * Implements hook_install().
9
 *
10
 * Perform actions to set up the site for this profile.
11
 *
12
 * @see system_install()
13
 */
14
function CDM_DataPortal_install() {
15
  // Add text formats.
16
  $filtered_html_format = array(
17
    'format' => 'filtered_html',
18
    'name' => 'Filtered HTML',
19
    'weight' => 0,
20
    'filters' => array(
21
      // URL filter.
22
      'filter_url' => array(
23
        'weight' => 0,
24
        'status' => 1,
25
      ),
26
      // HTML filter.
27
      'filter_html' => array(
28
        'weight' => 1,
29
        'status' => 1,
30
      ),
31
      // Line break filter.
32
      'filter_autop' => array(
33
        'weight' => 2,
34
        'status' => 1,
35
      ),
36
      // HTML corrector filter.
37
      'filter_htmlcorrector' => array(
38
        'weight' => 10,
39
        'status' => 1,
40
      ),
41
    ),
42
  );
43
  $filtered_html_format = (object) $filtered_html_format;
44
  filter_format_save($filtered_html_format);
45

  
46
  $full_html_format = array(
47
    'format' => 'full_html',
48
    'name' => 'Full HTML',
49
    'weight' => 1,
50
    'filters' => array(
51
      // URL filter.
52
      'filter_url' => array(
53
        'weight' => 0,
54
        'status' => 1,
55
      ),
56
      // Line break filter.
57
      'filter_autop' => array(
58
        'weight' => 1,
59
        'status' => 1,
60
      ),
61
      // HTML corrector filter.
62
      'filter_htmlcorrector' => array(
63
        'weight' => 10,
64
        'status' => 1,
65
      ),
66
    ),
67
  );
68
  $full_html_format = (object) $full_html_format;
69
  filter_format_save($full_html_format);
70

  
71
  // Enable some standard blocks.
72
  $default_theme = variable_get('theme_default', 'bartik');
73
  $admin_theme = 'seven';
74
  $blocks = array(
75
    array(
76
      'module' => 'system',
77
      'delta' => 'main',
78
      'theme' => $default_theme,
79
      'status' => 1,
80
      'weight' => 0,
81
      'region' => 'content',
82
      'pages' => '',
83
      'cache' => -1,
84
    ),
85
    array(
86
      'module' => 'search',
87
      'delta' => 'form',
88
      'theme' => $default_theme,
89
      'status' => 1,
90
      'weight' => -1,
91
      'region' => 'sidebar_first',
92
      'pages' => '',
93
      'cache' => -1,
94
    ),
95
    array(
96
      'module' => 'node',
97
      'delta' => 'recent',
98
      'theme' => $admin_theme,
99
      'status' => 1,
100
      'weight' => 10,
101
      'region' => 'dashboard_main',
102
      'pages' => '',
103
      'cache' => -1,
104
    ),
105
    array(
106
      'module' => 'user',
107
      'delta' => 'login',
108
      'theme' => $default_theme,
109
      'status' => 1,
110
      'weight' => 0,
111
      'region' => 'sidebar_first',
112
      'pages' => '',
113
      'cache' => -1,
114
    ),
115
    array(
116
      'module' => 'system',
117
      'delta' => 'navigation',
118
      'theme' => $default_theme,
119
      'status' => 1,
120
      'weight' => 0,
121
      'region' => 'sidebar_first',
122
      'pages' => '',
123
      'cache' => -1,
124
    ),
125
    array(
126
      'module' => 'system',
127
      'delta' => 'powered-by',
128
      'theme' => $default_theme,
129
      'status' => 1,
130
      'weight' => 10,
131
      'region' => 'footer',
132
      'pages' => '',
133
      'cache' => -1,
134
    ),
135
    array(
136
      'module' => 'system',
137
      'delta' => 'help',
138
      'theme' => $default_theme,
139
      'status' => 1,
140
      'weight' => 0,
141
      'region' => 'help',
142
      'pages' => '',
143
      'cache' => -1,
144
    ),
145
    array(
146
      'module' => 'system',
147
      'delta' => 'main',
148
      'theme' => $admin_theme,
149
      'status' => 1,
150
      'weight' => 0,
151
      'region' => 'content',
152
      'pages' => '',
153
      'cache' => -1,
154
    ),
155
    array(
156
      'module' => 'system',
157
      'delta' => 'help',
158
      'theme' => $admin_theme,
159
      'status' => 1,
160
      'weight' => 0,
161
      'region' => 'help',
162
      'pages' => '',
163
      'cache' => -1,
164
    ),
165
    array(
166
      'module' => 'user',
167
      'delta' => 'login',
168
      'theme' => $admin_theme,
169
      'status' => 1,
170
      'weight' => 10,
171
      'region' => 'content',
172
      'pages' => '',
173
      'cache' => -1,
174
    ),
175
    array(
176
      'module' => 'user',
177
      'delta' => 'new',
178
      'theme' => $admin_theme,
179
      'status' => 1,
180
      'weight' => 0,
181
      'region' => 'dashboard_sidebar',
182
      'pages' => '',
183
      'cache' => -1,
184
    ),
185
    array(
186
      'module' => 'search',
187
      'delta' => 'form',
188
      'theme' => $admin_theme,
189
      'status' => 1,
190
      'weight' => -10,
191
      'region' => 'dashboard_sidebar',
192
      'pages' => '',
193
      'cache' => -1,
194
    ),
195
  );
196
  $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
197
  foreach ($blocks as $block) {
198
    $query->values($block);
199
  }
200
  $query->execute();
201

  
202
  // Insert default pre-defined node types into the database. For a complete
203
  // list of available node type attributes, refer to the node type API
204
  // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
205
  $types = array(
206
    array(
207
      'type' => 'page',
208
      'name' => st('Basic page'),
209
      'base' => 'node_content',
210
      'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
211
      'custom' => 1,
212
      'modified' => 1,
213
      'locked' => 0,
214
    ),
215
    array(
216
      'type' => 'article',
217
      'name' => st('Article'),
218
      'base' => 'node_content',
219
      'description' => st('Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'),
220
      'custom' => 1,
221
      'modified' => 1,
222
      'locked' => 0,
223
    ),
224
  );
225

  
226
  foreach ($types as $type) {
227
    $type = node_type_set_defaults($type);
228
    node_type_save($type);
229
    node_add_body_field($type);
230
  }
231

  
232
  // Insert default pre-defined RDF mapping into the database.
233
  $rdf_mappings = array(
234
    array(
235
      'type' => 'node',
236
      'bundle' => 'page',
237
      'mapping' => array(
238
        'rdftype' => array('foaf:Document'),
239
      ),
240
    ),
241
    array(
242
      'type' => 'node',
243
      'bundle' => 'article',
244
      'mapping' => array(
245
        'field_image' => array(
246
          'predicates' => array('og:image', 'rdfs:seeAlso'),
247
          'type' => 'rel',
248
        ),
249
        'field_tags' => array(
250
          'predicates' => array('dc:subject'),
251
          'type' => 'rel',
252
        ),
253
      ),
254
    ),
255
  );
256
  foreach ($rdf_mappings as $rdf_mapping) {
257
    rdf_mapping_save($rdf_mapping);
258
  }
259

  
260
  // Default "Basic page" to not be promoted and have comments disabled.
261
  variable_set('node_options_page', array('status'));
262
  variable_set('comment_page', COMMENT_NODE_HIDDEN);
263

  
264
  // Don't display date and author information for "Basic page" nodes by default.
265
  variable_set('node_submitted_page', FALSE);
266

  
267
  // Enable user picture support and set the default to a square thumbnail option.
268
  variable_set('user_pictures', '1');
269
  variable_set('user_picture_dimensions', '1024x1024');
270
  variable_set('user_picture_file_size', '800');
271
  variable_set('user_picture_style', 'thumbnail');
272

  
273
  // Allow visitor account creation with administrative approval.
274
  variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
275
  
276
  // CDM Portal specific settings.
277
  variable_set('anonymous', 'Anonymous');
278
  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
279
    variable_set('file_temporary_path', 'c:\\windows\\temp');
280
  }
281
  else {
282
    variable_set('file_temporary_path', '/tmp');
283
  }
284
  // variable_set('filter_html_1', 1);
285
  // variable_set('menu_primary_menu', 2);
286
  // variable_set('menu_secondary_menu', 2);
287
  variable_set('node_options_forum', array (0 => 'status'));
288
  variable_set('node_options_page', array (0 => 'status'));
289
  // variable_set('site_footer', '');
290
  variable_set('site_frontpage', 'node/1');
291
  variable_set('site_mail', '');
292
  // variable_set('site_mission', '');
293
  variable_set('site_name', 'CDM Dataportal');
294
  variable_set('site_slogan', '');
295
  variable_set('cdm_dataportal_geoservice_display_width', '600');
296
  // Enable the SUB_THEME_TEMPLATE theme as default theme.
297
  // @comment WA: was garland in D5 portals.
298
  db_update('system')
299
  ->fields(array('status' => 1))
300
  ->condition('type', 'theme')
301
  ->condition('name', 'garland')
302
  ->execute();
303
  db_update('system')
304
  ->fields(array('status' => 1))
305
  ->condition('type', 'theme')
306
  ->condition('name', 'garland_cichorieae')
307
  ->execute();  
308
  db_update('system')
309
  ->fields(array('status' => 1))
310
  ->condition('type', 'theme')
311
  ->condition('name', 'SUB_THEME_TEMPLATE')
312
  ->execute();
313
  variable_set('theme_default', 'SUB_THEME_TEMPLATE');
314
  /*
315
  variable_set('theme_settings', array (
316
    'toggle_node_info_page' => FALSE,
317
    'toggle_node_info_cdm_media' => FALSE,
318
    'toggle_node_info_cdm_name' => FALSE,
319
    'toggle_node_info_cdm_taxon' => FALSE,
320
    'toggle_node_info_cdm_reference' => FALSE,
321
  ));
322
  */
323
 // a:16:{s:11:"toggle_logo";i:1;s:11:"toggle_name";i:1;s:13:"toggle_slogan";i:0;s:14:"toggle_mission";i:0;s:24:"toggle_node_user_picture";i:0;s:27:"toggle_comment_user_picture";i:0;s:13:"toggle_search";i:1;s:14:"toggle_favicon";i:1;s:12:"default_logo";i:1;s:9:"logo_path";s:0:"";s:11:"logo_upload";s:0:"";s:15:"default_favicon";i:1;s:12:"favicon_path";s:0:"";s:14:"favicon_upload";s:0:"";s:2:"op";s:18:"Save configuration";s:10:"form_token";s:32:"3e11e7c40e73cf4b3e70ae5703d87d72";}
324

  
325
  variable_set('cdm_webservice_debug', 0);
326
  variable_set('cdm_webservice_cache', 0);
327
  variable_set('distribution_sort', 'HIDE_TDWG2');
328

  
329
  variable_set('user_register', '0');
330

  
331
  // Create a default vocabulary named "Tags", enabled for the 'article' content type.
332
  $description = st('Use tags to group articles on similar topics into categories.');
333
  $help = st('Enter a comma-separated list of words to describe your content.');
334
  $vocabulary = (object) array(
335
    'name' => st('Tags'),
336
    'description' => $description,
337
    'machine_name' => 'tags',
338
    'help' => $help,
339

  
340
  );
341
  taxonomy_vocabulary_save($vocabulary);
342

  
343
  $field = array(
344
    'field_name' => 'field_' . $vocabulary->machine_name,
345
    'type' => 'taxonomy_term_reference',
346
    // Set cardinality to unlimited for tagging.
347
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
348
    'settings' => array(
349
      'allowed_values' => array(
350
        array(
351
          'vocabulary' => $vocabulary->machine_name,
352
          'parent' => 0,
353
        ),
354
      ),
355
    ),
356
  );
357
  field_create_field($field);
358

  
359
  $instance = array(
360
    'field_name' => 'field_' . $vocabulary->machine_name,
361
    'entity_type' => 'node',
362
    'label' => 'Tags',
363
    'bundle' => 'article',
364
    'description' => $vocabulary->help,
365
    'widget' => array(
366
      'type' => 'taxonomy_autocomplete',
367
      'weight' => -4,
368
    ),
369
    'display' => array(
370
      'default' => array(
371
        'type' => 'taxonomy_term_reference_link',
372
        'weight' => 10,
373
      ),
374
      'teaser' => array(
375
        'type' => 'taxonomy_term_reference_link',
376
        'weight' => 10,
377
      ),
378
    ),
379
  );
380
  field_create_instance($instance);
381

  
382

  
383
  // Create an image field named "Image", enabled for the 'article' content type.
384
  // See http://api.drupal.org/api/function/field_create_field/7
385
  $field = array(
386
    'field_name' => 'field_image',
387
    'type' => 'image',
388
    'cardinality' => 1,
389
    'locked' => FALSE,
390
    'indexes' => array('fid' => array('fid')),
391
    'settings' => array(
392
      'uri_scheme' => 'public',
393
      'default_image' => FALSE,
394
    ),
395
    'storage' => array(
396
      'type' => 'field_sql_storage',
397
      'settings' => array(),
398
    ),
399
  );
400
  field_create_field($field);
401

  
402
  // See http://api.drupal.org/api/function/field_create_instance/7
403
  $instance = array(
404
    'field_name' => 'field_image',
405
    'entity_type' => 'node',
406
    'label' => 'Image',
407
    'bundle' => 'article',
408
    'description' => st('Upload an image to go with this article.'),
409
    'required' => FALSE,
410

  
411
    'settings' => array(
412
      'file_directory' => 'field/image',
413
      'file_extensions' => 'png gif jpg jpeg',
414
      'max_filesize' => '',
415
      'max_resolution' => '',
416
      'min_resolution' => '',
417
      'alt_field' => TRUE,
418
      'title_field' => '',
419
    ),
420

  
421
    'widget' => array(
422
      'type' => 'image_image',
423
      'settings' => array(
424
        'progress_indicator' => 'throbber',
425
        'preview_image_style' => 'thumbnail',
426
      ),
427
      'weight' => -1,
428
    ),
429

  
430
    'display' => array(
431
      'default' => array(
432
        'label' => 'hidden',
433
        'type' => 'image',
434
        'settings' => array('image_style' => 'large', 'image_link' => ''),
435
        'weight' => -1,
436
      ),
437
      'teaser' => array(
438
        'label' => 'hidden',
439
        'type' => 'image',
440
        'settings' => array('image_style' => 'medium', 'image_link' => 'content'),
441
        'weight' => -1,
442
      ),
443
    ),
444
  );
445
  field_create_instance($instance);
446

  
447
  // Enable default permissions for system roles.
448
  $filtered_html_permission = filter_permission_name($filtered_html_format);
449
  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', $filtered_html_permission));
450
  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_permission));
451

  
452
  // Create a default role for site administrators, with all available permissions assigned.
453
  $admin_role = new stdClass();
454
  $admin_role->name = 'admin';
455
  $admin_role->weight = 4;
456
  user_role_save($admin_role);
457
  user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
458
  // Set this as the administrator role.
459
  variable_set('user_admin_role', $admin_role->rid);
460

  
461
  // Assign user 1 the "administrator" role.
462
  db_insert('users_roles')
463
    ->fields(array('uid' => 1, 'rid' => $admin_role->rid))
464
    ->execute();
465

  
466
  // Create a role for CDM administrator.
467
  $admin_role->name = 'CDM admin';
468
  $admin_role->weight = 3;
469
  user_role_save($admin_role);
470
  $permissions = array(
471
    // Roles same as in D5 portals.
472
    'access administration menu',
473
    'administer blocks',
474
    'administer cdm_dataportal',
475
    'cdm_dataportal view notes',
476
    'access devel information',
477
    // @comment WA: IMCE module is not a required module in this profile.
478
    'access imce',
479
    'administer imce',
480
    'administer menu',
481
    'access content',
482
    'administer content types',
483
    'administer nodes',
484
    'create page content',
485
    'create story content',
486
    'edit own page content',
487
    'edit own story content',
488
    'view revisions',
489
    'access administration pages',
490
    'administer site configuration',
491
    'select different theme',
492
    'administer users',
493

  
494
    // Roles as in D5 but with different name.
495
    'edit any page content',
496
    'edit any story content',
497

  
498
    // New roles for D7.
499
    'access content overview',
500
    'access site in maintenance mode',
501
    'bypass node access',
502
    'select different theme',
503
    'view the administration theme',
504
    'use text format 3',
505
  );
506
  user_role_grant_permissions($admin_role->rid, $permissions);
507
  
508
  // Create a portal admin user (uid = 1).
509
  $user = user_save(new stdClass(), array(
510
    'name' => 'admin',
511
    'mail' => 'admin@dataportal.net',
512
    'status' => '1',
513
    'init' => 'wp5Admin@bgbm.org',
514
    'pass' => 'admin',
515
  ));
516
  
517
  // Assign user 1 the "CDM admin" role.
518
  db_insert('users_roles')
519
  ->fields(array('uid' => 1, 'rid' => $admin_role->rid))
520
  ->execute();
521

  
522
  // Create a Home link in the main menu.
523
  $item = array(
524
    'link_title' => st('Home'),
525
    'link_path' => '<front>',
526
    'menu_name' => 'main-menu',
527
  );
528
  menu_link_save($item);
529

  
530
  // Update the menu router information.
531
  menu_rebuild();
532

  
533
  // Enable the admin theme.
534
  db_update('system')
535
    ->fields(array('status' => 1))
536
    ->condition('type', 'theme')
537
    ->condition('name', 'seven')
538
    ->execute();
539
  variable_set('admin_theme', 'seven');
540
  variable_set('node_admin_theme', '1');
541
  
542
  // Create a first node page.
543
  $node = new stdClass();
544
  $node->uid = 1;
545
  $node->type = 'page';
546

  
547
  // Sets some defaults.
548
  node_object_prepare($node);
549

  
550
  $node->status = 1;
551
  $node->language = LANGUAGE_NONE;
552
  
553
  // Promoted to front page.
554
  $node->promote = 0;
555
  
556
  // Comments on.
557
  $node->comment = 1;
558
  $node->format = 'full_html';
559
  $node->title = 'CDM DataPortal';
560
  $node->body[$node->language][0]['value'] = printf(
561
    '<h3>Welcome to your CDM DataPortal. </h3>
562
    This data portal makes full use of the Common Data Model (CDM),
563
    a central component of the Internet Platform for Cybertaxonomy being
564
    developed by EDIT workpackage 5. All taxon pages are created as dynamic
565
    web pages from the underlying database.
566
    In order to finish the setup of your DataPortal please visit the !link1.
567
    The CDM Dataportal provides several Drupal Blocks (<i>taxon search</i>,
568
    <i>classification browser</i>, <i>external links</i>,
569
    <i>print this page</i>) which you may want to activate in the
570
    !link2>.', array(
571
      '!link1' => l('CDM Dataportal settings','admin/config/cdm_dataportal'),
572
      '!link2' => l('Blocks Settings', 'admin/structure/block'),
573
    ));
574
  node_save($node);
575
 }
7.x/modules/cdm_dataportal/profile/CDM_DataPortal/CDM_DataPortal.profile
1
<?php
2

  
3
// vim: filetype=php
4

  
5
/************************************************************
6
*                           MODULES                         *
7
************************************************************/
8
function CDM_DataPortal_profile_modules() {
9
    return array (
10
        // core modules
11
        'block', 'color', 'comment', 'filter', 'help', 'menu', 'node', 'system', 'taxonomy', 'user', 'watchdog', 'taxonomy',
12
        // admin
13
        'admin_menu',
14
        // requirement for cdm
15
       	'jquery_update',
16
        // CDM modules
17
        'cdm_api', 'cdm_taxontree',
18
        'cdm_dataportal',
19
        'ext_links',
20
       // additional:
21
       //profile_generator' // uncomment to enable
22
      );
23
}
24

  
25
/************************************************************
26
*                           DETAILS                         *
27
************************************************************/
28
function CDM_DataPortal_profile_details() {
29
    return array (
30
        'name' => 'CDM DataPortal',
31
        'description' => 'CDM DataPortal installation profile',
32
      );
33
}
34

  
35
function CDM_DataPortal_profile_final() {
36
/************************************************************
37
*                          VARIABLES                        *
38
************************************************************/
39
    variable_set('anonymous', 'Anonymous');
40
    variable_set('comment_page', 0); // = COMMENT_NODE_DISABLED
41
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
42
      variable_set('file_directory_temp', 'c:\\windows\\temp');
43
    } else {
44
      variable_set('file_directory_temp', '/tmp');
45
    }
46
    variable_set('filter_html_1', 1);
47
    variable_set('menu_primary_menu', 2);
48
    variable_set('menu_secondary_menu', 2);
49
    variable_set('node_options_forum', array (
50
      0 => 'status',
51
    ));
52
    variable_set('node_options_page', array (
53
      0 => 'status',
54
    ));
55
    variable_set('site_footer', '');
56
    variable_set('site_frontpage', 'node/1');
57
    variable_set('site_mail', '');
58
    variable_set('site_mission', '');
59
    variable_set('site_name', 'CDM Dataportal');
60
    variable_set('site_slogan', '');
61
    system_theme_data();
62
    db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", 'garland');
63
    variable_set('theme_default', 'garland');
64
    variable_set('theme_settings', array (
65
      'toggle_node_info_page' => false,
66
      'toggle_node_info_cdm_media' => false,
67
      'toggle_node_info_cdm_name' => false,
68
      'toggle_node_info_cdm_taxon' => false,
69
      'toggle_node_info_cdm_reference' => false
70
    ));
71
    variable_set('cdm_webservice_debug', 0);
72
    variable_set('cdm_webservice_cache', 0);
73
    variable_set('distribution_sort', 'HIDE_TDWG2');
74

  
75
    variable_set('user_register', '0');
76

  
77

  
78
/************************************************************
79
*                            ROLES                          *
80
************************************************************/
81

  
82
    $role_id['anonymous user'] = 1;
83
    $role_id['authenticated user'] = 2;
84
    $rid = 3;
85
    $role_id['CDM admin'] = $rid;
86
    db_query("INSERT INTO {role} (rid, name) VALUES (%d, '%s')", $rid, 'CDM admin');
87
    db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $rid, 'access administration menu, administer blocks, administer cdm_dataportal, cdm_dataportal view notes, access devel information, access imce, administer imce, administer menu, access content, administer content types, administer nodes, create page content, create story content, edit own page content, edit own story content, edit page content, edit story content, view revisions, access administration pages, administer site configuration, select different theme, administer users');
88
    $rid = 4;
89
    $role_id['admin'] = $rid;
90
    db_query("INSERT INTO {role} (rid, name) VALUES (%d, '%s')", $rid, 'admin');
91
    db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $rid, 'access administration menu, display drupal links, administer blocks, use PHP for block visibility, administer cdm_dataportal, cdm_dataportal view notes, access comments, administer comments, post comments, post comments without approval, access devel information, execute php code, switch users, administer filters, access imce, administer imce, administer menu, access content, administer content types, administer nodes, create page content, create story content, edit own page content, edit own story content, edit page content, edit story content, revert revisions, view revisions, access administration pages, administer site configuration, select different theme, administer taxonomy, access user profiles, administer access control, administer users, change own username');
92

  
93

  
94
/************************************************************
95
*                            USERS                          *
96
************************************************************/
97
    $user = user_save(new stdClass(), array (
98
        'name' => 'admin',
99
        'mail' => 'admin@dataportal.net',
100
        'mode' => '0',
101
        'sort' => '0',
102
        'threshold' => '0',
103
        'theme' => '',
104
        'signature' => '',
105
        'created' => '1285671981',
106
        'access' => '1285675547',
107
        'login' => '0',
108
        'status' => '1',
109
        'timezone' => '0',
110
        'language' => '',
111
        'picture' => '',
112
        'init' => 'wp5Admin@bgbm.org',
113
        'data' => 'a:0:{}',
114
      ));
115
    db_query("UPDATE {users} SET pass='%s' WHERE uid=%d", '21232f297a57a5a743894a0e4a801fc3', $user->uid);
116
    $user_id['admin'] = $user->uid;
117

  
118
/************************************************************
119
 *                   USERS <=> ROLES MAPPING                *
120
 ************************************************************/
121

  
122
/************************************************************
123
 *                   NODE TYPES                             *
124
 ************************************************************/
125

  
126

  
127
      // Insert default user-defined node types into the database.
128
      $types = array(
129
        array(
130
            'type' => 'page',
131
            'name' => st('Page'),
132
            'module' => 'node',
133
            'description' => st('If you want to add a static page, like a contact page or an about page, use a page.'),
134
            'custom' => TRUE,
135
            'modified' => TRUE,
136
            'locked' => FALSE,
137
        ),
138
        array(
139
            'type' => 'story',
140
            'name' => st('Story'),
141
            'module' => 'node',
142
            'description' => st('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.'),
143
            'custom' => TRUE,
144
            'modified' => TRUE,
145
            'locked' => FALSE,
146
        ),
147
      );
148

  
149
      foreach ($types as $type) {
150
        $type = (object) _node_type_set_defaults($type);
151
        node_type_save($type);
152
      }
153

  
154

  
155
/************************************************************
156
 *                       NODES                              *
157
 ************************************************************/
158
    // exporting nodes of type: Page
159
    db_query(
160
        "INSERT INTO {node} (nid,vid,type,title,uid,status,created,changed,comment,promote,moderate,sticky)
161
        VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
162
        '1','1','page','CDM DataPortal','1','1','1285672677','1285673272','0','0','0','0'
163
    );
164
    db_query(
165
        "INSERT INTO {node_revisions} (nid,vid,uid,title,body,teaser,log,timestamp,format)
166
        VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')",
167
        '1','1','1','CDM DataPortal','<h3>Welcome to your CDM DataPortal. </h3>
168

  
169
    This data portal makes full use of the Common Data Model  (CDM), a central component of the Internet Platform for Cybertaxonomy being developed by EDIT workpackage 5. All taxon pages are created as dynamic web pages from the underlying database.
170

  
171
    In order to finish the setup of your DataPortal please visit the <?php print(l(\'CDM Dataportal settings\', \'admin/settings/cdm_dataportal\')); ?>. The CDM Dataportal provides several Drupal Blocks (<i>taxon search</i>, <i>classification browser</i>, <i>external links</i>, <i>print this page</i>) which you may want to activate in the <?php print(l(\'Blocks Settings\', \'admin/build/block\')); ?>','<h3>Welcome to your CDM DataPortal. </h3>
172

  
173
    This data portal makes full use of the Common Data Model  (CDM), a central component of the Internet Platform for Cybertaxonomy being developed by EDIT workpackage 5. All taxon pages are created as dynamic web pages from the underlying database.
174

  
175
    In order to finish the setup of your DataPortal please visit the <?php print(l(\'CDM Dataportal settings\', \'admin/settings/cdm_dataportal\')); ?>. The CDM Dataportal provides several Drupal Blocks (<i>taxon search</i>, <i>classification browser</i>, <i>external links</i>, <i>print this page</i>) which you may want to activate in the <?php print(l(\'Blocks Settings\', \'admin/build/block\')); ?>','','1285673272','2'
176
    );
177

  
178
    system_initialize_theme_blocks('garland');
179

  
180
    // set site info
181
    //  * site name
182
    //  * start page
183
    db_query(
184
        "REPLACE INTO {variable} (name, value) VALUES
185
          ('cdm_dataportal_geoservice_display_width', 's:3:\"600\";'),
186
          ('site_frontpage', 's:6:\"node/1\";'),
187
          ('site_name', 's:19:\"EDIT CDM DataPortal\";')
188
        ");
189

  
190
   // FIX node sequences !!!!!
191

  
192
    db_query(
193
        "REPLACE INTO {sequences} (name, id) VALUES
194
        ('{node_nid}', 1),
195
        ('{node_revisions_vid}', 1);
196
        ");
197

  
198
    return;
199
}
1
<?php
2
/**
3
 * @file
4
 * Enables modules and site configuration for a CDM portal installation.
5
 */
6

  
7
/**
8
 * Implements hook_form_FORM_ID_alter() for install_configure_form().
9
 *
10
 * Allows the profile to alter the site configuration form.
11
 */
12
function CDM_DataPortal_form_install_configure_form_alter(&$form, $form_state) {
13
  // Pre-populate the site name.
14
  $form['site_information']['site_name']['#default_value'] = st('EDIT CDM DataPortal');
15
}

Also available in: Unified diff