-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathos2dagsorden.install
executable file
·207 lines (176 loc) · 5.81 KB
/
os2dagsorden.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
/**
* @file
* os2dagsorden.install
*/
/**
* Implements hook_install_tasks().
*/
function os2dagsorden_install_tasks($install_state) {
$os2dagsorden_configure = variable_get('os2dagsorden_configure', FALSE);
$tasks = array();
$tasks['revert_features'] = array(
'display_name' => st('Revert all features'),
'display' => TRUE,
'type' => 'normal',
'run' => INSTALL_TASK_RUN_IF_REACHED,
'function' => 'os2dagsorden_revert_all_features',
);
$tasks['os2dagsorden_configure_choose'] = array(
'display_name' => st('OS2Dagsorden'),
'type' => 'form',
);
$tasks['os2dagsorden_configure_settings'] = array(
'display_name' => st('Konfigurer ESDH'),
'type' => 'form',
'display' => $os2dagsorden_configure,
'run' => $os2dagsorden_configure ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
);
$tasks['os2dagsorden_settings_settings'] = array(
'display_name' => st('Konfigurer OS2dagsorden'),
'type' => 'form',
'display' => $os2dagsorden_configure,
'run' => $os2dagsorden_configure ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
);
return $tasks;
}
/**
* Task to revert all features.
*/
function os2dagsorden_revert_all_features() {
features_revert();
}
/**
* Form callback for configuring ESDH plugin.
*/
function os2dagsorden_configure_choose($form, &$form_state) {
$avaiable_plugins = array(
0 => t('None'),
'os2web_acadre_esdh' => 'Acadre',
'os2web_edoc_esdh' => 'eDoc',
'os2web_sbsys_esdh' => 'SBSYS',
);
$form['plugin'] = array(
'#type' => 'select',
'#title' => st('Choose ESDH plugin'),
'#options' => $avaiable_plugins,
);
$form['configure'] = array(
'#type' => 'checkbox',
'#title' => t('Configure os2dagsorden now?'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => st('Continue'),
);
return $form;
}
/**
* Submithandler for configuring ESDH plugin.
*/
function os2dagsorden_configure_choose_submit(&$form, &$form_state) {
if ($form_state['values']['plugin']) {
module_enable(array($form_state['values']['plugin']));
}
variable_set('os2dagsorden_configure', (bool) $form_state['values']['configure']);
}
/**
* Configure settings callback.
*/
function os2dagsorden_configure_settings($form, &$form_state) {
require_once drupal_get_path('module', 'os2web_settings') . '/os2web_settings.admin.inc';
$form = drupal_retrieve_form('os2web_settings_settings_form', $form_state);
drupal_prepare_form('os2web_settings_settings_form', $form, $form_state);
return $form;
}
/**
* Configure form callback.
*/
function os2dagsorden_settings_settings($form, &$form_state) {
$dir = 'public://os2convert';
file_prepare_directory($dir, FILE_CREATE_DIRECTORY);
require_once drupal_get_path('module', 'os2dagsorden_settings') . '/os2dagsorden_settings.admin.inc';
$form = drupal_retrieve_form('os2dagsorden_settings_settings_form', $form_state);
drupal_prepare_form('os2dagsorden_settings_settings_form', $form, $form_state);
return $form;
}
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function os2dagsorden_install() {
include_once DRUPAL_ROOT . '/profiles/minimal/minimal.install';
// Allow visitor account creation, but with administrative approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
// Enable default permissions for system roles.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
// Add text formats.
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
'filters' => array(
// URL filter.
'filter_url' => array('weight' => 0, 'status' => 1),
// HTML filter.
'filter_html' => array('weight' => 1, 'status' => 1),
// Line break filter.
'filter_autop' => array('weight' => 2, 'status' => 1),
// HTML corrector filter.
'filter_htmlcorrector' => array('weight' => 10, 'status' => 1),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
$full_html_format = array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
'filters' => array(
// URL filter.
'filter_url' => array('weight' => 0, 'status' => 1),
// Line break filter.
'filter_autop' => array('weight' => 1, 'status' => 1),
// HTML corrector filter.
'filter_htmlcorrector' => array('weight' => 10, 'status' => 1),
),
);
$full_html_format = (object) $full_html_format;
filter_format_save($full_html_format);
theme_enable(array('os2dagsorden_theme'));
theme_disable(array('bartik'));
// Turn off notification error messages.
variable_set('error_level', ERROR_REPORTING_DISPLAY_SOME);
// Set current theme.
variable_set('theme_default', 'os2dagsorden_theme');
// Set admin theme to Seven.
variable_set('admin_theme', 'seven');
// Set admin theme on node/edit and node/add
variable_set('node_admin_theme', '0');
module_disable(array('update'));
// Set default TZ.
variable_set('date_default_timezone', "Europe/Berlin");
variable_set('date_first_day', "1");
variable_set('configurable_timezones', "0");
$role = user_role_load_by_name('authenticated user');
if ($role != FALSE) {
$roles = array(
'create os2web_meetings_spaper content',
'delete own os2web_meetings_spaper content',
'edit own os2web_meetings_spaper content',
);
foreach ($roles as $name) {
db_merge('role_permission')->key(array(
'rid' => $role->rid,
'permission' => $name,
))->fields(array(
'module' => 'node',
))->execute();
}
}
else {
drupal_set_message('"authenticated user" role was not found.', 'error');
}
}