/[drupal]/contributions/modules/autolocale/localized.profile
ViewVC logotype

Contents of /contributions/modules/autolocale/localized.profile

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


Revision 1.6 - (show annotations) (download) (as text)
Fri May 11 07:40:53 2007 UTC (2 years, 6 months ago) by goba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +8 -21 lines
File MIME type: text/x-php
Update to latest Drupal 6.x-dev
1 <?php
2 // $Id: localized.profile,v 1.4 2007/05/09 09:14:43 goba Exp $
3
4 /**
5 * Return an array of the modules to be enabled when this profile is installed.
6 *
7 * @return
8 * An array of modules to be enabled.
9 */
10 function localized_profile_modules() {
11 return array('color', 'comment', 'help', 'taxonomy', 'dblog', 'autolocale');
12 }
13
14 /**
15 * Return a description of the profile for the initial installation screen.
16 *
17 * @return
18 * An array with keys 'name' and 'description' describing this profile.
19 */
20 function localized_profile_details() {
21 return array(
22 'name' => 'Drupal localized',
23 'description' => 'Localized interface (will be integrated to default profile).'
24 );
25 }
26
27 /**
28 * Return a list of tasks that this profile supports.
29 *
30 * @return
31 * A keyed array of tasks the profile will perform during the _final stage.
32 */
33 function localized_profile_task_list() {
34 global $install_locale;
35 if (!empty($install_locale) && ($install_locale != 'en')) {
36 return array('localeimport' => st('Import translation'));
37 }
38 return array();
39 }
40
41 /**
42 * Final tasks to import translation and create node types properly.
43 */
44 function localized_profile_final(&$task) {
45 global $profile, $install_locale, $base_url, $user;
46
47 // Insert default user-defined node types into the database. For a complete
48 // list of available node type attributes, refer to the node type API
49 // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
50 // Insert default user-defined node types into the database.
51 $common = array(
52 'module' => 'node',
53 'custom' => TRUE,
54 'modified' => TRUE,
55 'locked' => FALSE,
56 'has_body' => TRUE,
57 'body_label' => st('Body'),
58 'has_title' => TRUE,
59 'title_label' => st('Title'),
60 'help' => '',
61 'min_word_count' => '',
62 );
63 $types = array(
64 array_merge(
65 array(
66 'type' => 'page',
67 'name' => st('Page'),
68 'description' => st('If you want to add a static page, like a contact page or an about page, use a page.')
69 ),
70 $common
71 ),
72 array_merge(
73 array(
74 'type' => 'story',
75 'name' => st('Story'),
76 '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.')
77 ),
78 $common
79 ),
80 );
81
82 foreach ($types as $type) {
83 $type = (object) _node_type_set_defaults($type);
84 node_type_save($type);
85 }
86
87 // Default page to not be promoted and have comments disabled.
88 variable_set('node_options_page', array('status'));
89 variable_set('comment_page', COMMENT_NODE_DISABLED);
90
91 // Don't display date and author information for page nodes by default.
92 $theme_settings = variable_get('theme_settings', array());
93 $theme_settings['toggle_node_info_page'] = FALSE;
94 variable_set('theme_settings', $theme_settings);
95
96 // Determine if another language was enabled during installation.
97 // Enable it, import translations using a batch import.
98 if (!empty($install_locale) && ($install_locale != 'en') && $task == 'configure') {
99 include_once drupal_get_path('module', 'autolocale') .'/autolocale.module';
100 include_once drupal_get_path('module', 'autolocale') .'/autolocale.install';
101
102 // The user is logged in, but has no session ID yet, which
103 // would be required to be the same throughout the batch here.
104 $user->sid = session_id();
105
106 // Enable installation language as default site language.
107 _autolocale_install_language($install_locale);
108 // Create batch
109 $batch = autolocale_batch_import($install_locale);
110 if (!empty($batch)) {
111 // We need to ensure batch path exists
112 menu_rebuild();
113 // Start a batch, switch to localeimport state.
114 variable_set('install_task', 'localeimport');
115 batch_set($batch);
116 $path = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile;
117 batch_process($path, $path);
118 }
119 else {
120 // Installation done, because found nothing to import.
121 $task = 'finished';
122 return '';
123 }
124 }
125 // Localeimport task is about importing all files.
126 if ($task == 'localeimport'){
127 include_once 'includes/batch.inc';
128 return _batch_page();
129 }
130 }
131

  ViewVC Help
Powered by ViewVC 1.1.2